33 if (strstr(
$doc->usefor,
'W')) {
35 $checkCr = $checkW->verifyWorkflowComplete();
36 if (count($checkCr) > 0) {
37 $this->
addError(implode(
"\n", $checkCr));
44 $this->checkDefault();
45 $this->checkParameters();
49 private function getColumnCount()
52 $c = count($this->doc->fields) + count($this->doc->sup_fields);
53 $ancestor = $this->doc->getFathersDoc();
54 $ancestor[] = $this->doc->id;
56 $sql = sprintf(
"select count(*) from docattr where type != 'frame' and type != 'tab' and type != 'array' and %s",
GetSqlCond($ancestor,
"docid",
true));
68 $c = $this->getColumnCount();
69 if (
$c > self::maxSqlColumn) {
75 $this->doc->getAttributes();
76 $la = $this->doc->GetNormalAttributes();
77 foreach (
$la as & $oa) {
81 } elseif ((!is_a($foa,
"FieldSetAttribute")) && ($foa->type !=
'array')) {
85 $ftype = $oa->fieldSet->type;
86 if (($ftype !=
'frame') && ($ftype !=
'array')) {
92 $la = $this->doc->GetFieldAttributes();
93 foreach (
$la as & $oa) {
97 $ftype = $oa->fieldSet->type;
98 if ((
$type ==
'frame') && ($ftype !=
'tab') && ($oa->fieldSet->id != Adoc::HIDDENFIELD)) {
107 $la = $this->doc->getAttributes();
108 foreach (
$la as & $oa) {
110 $relativeOrder = $oa->getOption(
"relativeOrder");
111 if ($relativeOrder && $relativeOrder !== \Dcp\FamilyAbsoluteOrder::firstOrder && $relativeOrder !== \Dcp\FamilyAbsoluteOrder::autoOrder) {
112 if (!$this->doc->getAttribute($relativeOrder)) {
122 $this->doc->getAttributes();
123 $la = $this->doc->GetNormalAttributes();
124 foreach (
$la as & $oa) {
125 if (($oa->phpfile ==
'' || $oa->phpfile ==
'-') && (preg_match(
'/^[a-z0-9_]*::/i', $oa->phpfunc))) {
126 $this->checkMethod($oa);
128 if (preg_match(
'/^[a-z0-9_]*::/i', $oa->phpconstraint)) {
129 $this->checkConstraint($oa);
140 $strucFunc = $oParse->parse($oa->phpfunc);
141 $error = $oParse->getError();
146 $err = $this->verifyMethod($strucFunc, $oa,
"phpFunc");
158 $la = $this->doc->getAttributes();
159 foreach (
$la as & $oa) {
160 if ($oa) $this->checkLinkMethod($oa);
170 if (empty($oa->link))
return;
172 if (preg_match(
'/action=FDL_METHOD&.*method=([^&]*)/', $oa->link, $reg)) {
173 $link = urldecode($reg[1]);
174 if (preg_match(
'/^[a-z0-9_]+$/i', $link)) $link =
'::' . $link .
'()';
175 } elseif (preg_match(
'/^[a-z0-9_]*::/i', $oa->link, $reg)) {
181 $strucLink = $oParse->parse($link);
182 $error = $oParse->getError();
189 $err = $this->verifyMethod($strucLink, $oa,
"Link", $refMeth);
194 $methodComment = $refMeth->getDocComment();
195 if (!preg_match(
'/@apiExpose\b/', $methodComment)) {
196 $completeMethod = $refMeth->getDeclaringClass()->getName() .
'::' . $refMeth->getName() .
'()';
202 private function checkDefault()
204 $defaults = $this->doc->getOwnDefValues();
205 foreach ($defaults as $attrid => $def) {
209 $oa = $this->doc->getAttribute($attrid);
214 $strucFunc = $oParse->parse($def);
215 $error = $oParse->getError();
218 $err = $this->verifyMethod($strucFunc, $oa,
"Default value");
223 if ($oa->type ==
"array") {
224 $value = json_decode($def);
234 private function checkParameters()
236 $parameters = $this->doc->getOwnParams();
237 foreach ($parameters as $attrid => $def) {
246 if (is_object($this->importer)) {
247 $oa = $this->importer->getImportedAttribute($this->doc->id, $attrid);
253 $oa = $this->doc->getAttribute($attrid);
258 if ($oa->usefor !=
'Q') {
264 $strucFunc = $oParse->parse($def);
265 $error = $oParse->getError();
268 $err = $this->verifyMethod($strucFunc, $oa,
"Parameters");
280 $this->doc->getAttributes();
281 $la = $this->doc->getParamAttributes();
282 foreach (
$la as & $oa) {
283 $foa = $oa->fieldSet;
286 } elseif ((!is_a($foa,
"FieldSetAttribute")) && ($foa->type !=
'array')) {
290 $ftype = $oa->fieldSet->type;
291 if (($ftype !=
'frame') && ($ftype !=
'array')) {
293 } elseif ($ftype ==
'array') {
301 private function verifyMethod($strucFunc, $oa, $ctx, &$refMeth = null)
304 $phpMethName = $strucFunc->methodName;
305 if ($strucFunc->className) {
306 $phpClassName = $strucFunc->className;
308 $phpClassName = sprintf(
"Doc%d", $this->doc->id);
310 $phpLongName = $strucFunc->className .
'::' . $phpMethName;
312 $refMeth =
new ReflectionMethod($phpClassName, $phpMethName);
313 $numArgs = $refMeth->getNumberOfRequiredParameters();
314 if ($numArgs > count($strucFunc->inputs)) {
317 if ($strucFunc->className && (!$refMeth->isStatic())) {
322 catch(Exception $e) {
323 if ($oa->docid == $this->doc->id) {
338 $strucFunc = $oParse->parse($oa->phpconstraint,
true);
339 $error = $oParse->getError();
344 $phpMethName = $strucFunc->methodName;
345 if ($strucFunc->className) {
346 $phpClassName = $strucFunc->className;
348 $phpClassName = sprintf(
"Doc%d", $this->doc->id);
350 $phpLongName = $strucFunc->className .
'::' . $phpMethName;
352 $refMeth =
new ReflectionMethod($phpClassName, $phpMethName);
353 $numArgs = $refMeth->getNumberOfRequiredParameters();
354 if ($numArgs > count($strucFunc->inputs)) {
357 if ($strucFunc->className && (!$refMeth->isStatic())) {
362 catch(Exception $e) {
__construct(importDocumentDescription &$importer=null)
checkComputedConstraintAttributes()
static getError($code, $args=null)
GetSqlCond($Table, $column, $integer=false)
getNameFromId($dbaccess, $id)
Check worflow definition when importing definition.
simpleQuery($dbaccess, $query, &$result=array(), $singlecolumn=false, $singleresult=false, $useStrict=null)
if($file) if($subject==""&&$file) if($subject=="") $err
check(array $data, &$doc=null)
checkMaxAttributes(Doc &$doc)