@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | $classname = ''; |
119 | 119 | $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); |
120 | 120 | foreach ($dirmodels as $reldir) { |
121 | - $file = dol_buildpath($reldir . "core/modules/product_batch/doc/pdf_" . $modele . ".modules.php", 0); |
|
121 | + $file = dol_buildpath($reldir."core/modules/product_batch/doc/pdf_".$modele.".modules.php", 0); |
|
122 | 122 | if (file_exists($file)) { |
123 | - $classname = "pdf_" . $modele; |
|
123 | + $classname = "pdf_".$modele; |
|
124 | 124 | break; |
125 | 125 | } |
126 | 126 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | '@phan-var-force ModelePDFProductBatch $module'; |
134 | 134 | |
135 | 135 | if ($module->write_file($product_batch, $langs) > 0) { |
136 | - header("Location: " . DOL_URL_ROOT . "/document.php?modulepart=product_batch&file=SPECIMEN.pdf"); |
|
136 | + header("Location: ".DOL_URL_ROOT."/document.php?modulepart=product_batch&file=SPECIMEN.pdf"); |
|
137 | 137 | return; |
138 | 138 | } else { |
139 | 139 | setEventMessages($module->error, $module->errors, 'errors'); |
@@ -390,9 +390,9 @@ discard block |
||
390 | 390 | // Module to build doc |
391 | 391 | $def = array(); |
392 | 392 | $sql = "SELECT nom"; |
393 | -$sql .= " FROM " . MAIN_DB_PREFIX . "document_model"; |
|
394 | -$sql .= " WHERE type = '" . $db->escape($type) . "'"; |
|
395 | -$sql .= " AND entity = " . $conf->entity; |
|
393 | +$sql .= " FROM ".MAIN_DB_PREFIX."document_model"; |
|
394 | +$sql .= " WHERE type = '".$db->escape($type)."'"; |
|
395 | +$sql .= " AND entity = ".$conf->entity; |
|
396 | 396 | $resql = $db->query($sql); |
397 | 397 | if ($resql) { |
398 | 398 | $i = 0; |
@@ -415,12 +415,12 @@ discard block |
||
415 | 415 | print '<div class="div-table-responsive-no-min">'; |
416 | 416 | print '<table class="noborder centpercent">'; |
417 | 417 | print '<tr class="liste_titre">'; |
418 | -print '<td>' . $langs->trans("Name") . '</td>'; |
|
419 | -print '<td>' . $langs->trans("Description") . '</td>'; |
|
420 | -print '<td class="center" width="60">' . $langs->trans("Status") . "</td>\n"; |
|
421 | -print '<td class="center" width="60">' . $langs->trans("Default") . "</td>\n"; |
|
418 | +print '<td>'.$langs->trans("Name").'</td>'; |
|
419 | +print '<td>'.$langs->trans("Description").'</td>'; |
|
420 | +print '<td class="center" width="60">'.$langs->trans("Status")."</td>\n"; |
|
421 | +print '<td class="center" width="60">'.$langs->trans("Default")."</td>\n"; |
|
422 | 422 | print '<td class="center"></td>'; |
423 | -print '<td class="center" width="80">' . $langs->trans("Preview") . '</td>'; |
|
423 | +print '<td class="center" width="80">'.$langs->trans("Preview").'</td>'; |
|
424 | 424 | print "</tr>\n"; |
425 | 425 | |
426 | 426 | clearstatcache(); |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | $filelist = array(); |
429 | 429 | foreach ($dirmodels as $reldir) { |
430 | 430 | foreach (array('', '/doc') as $valdir) { |
431 | - $dir = dol_buildpath($reldir . "core/modules/product_batch" . $valdir); |
|
431 | + $dir = dol_buildpath($reldir."core/modules/product_batch".$valdir); |
|
432 | 432 | if (is_dir($dir)) { |
433 | 433 | $handle = opendir($dir); |
434 | 434 | if (is_resource($handle)) { |
@@ -440,11 +440,11 @@ discard block |
||
440 | 440 | |
441 | 441 | foreach ($filelist as $file) { |
442 | 442 | if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) { |
443 | - if (file_exists($dir . '/' . $file)) { |
|
443 | + if (file_exists($dir.'/'.$file)) { |
|
444 | 444 | $name = substr($file, 4, dol_strlen($file) - 16); |
445 | 445 | $classname = substr($file, 0, dol_strlen($file) - 12); |
446 | 446 | |
447 | - require_once $dir . '/' . $file; |
|
447 | + require_once $dir.'/'.$file; |
|
448 | 448 | $module = new $classname($db); |
449 | 449 | '@phan-var-force ModelePDFProductBatch $module'; |
450 | 450 | |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | print(empty($module->name) ? $name : $module->name); |
462 | 462 | print "</td><td>\n"; |
463 | 463 | if (method_exists($module, 'info')) { |
464 | - print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod |
|
464 | + print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod |
|
465 | 465 | } else { |
466 | 466 | print $module->description; |
467 | 467 | } |
@@ -469,14 +469,14 @@ discard block |
||
469 | 469 | |
470 | 470 | // Active |
471 | 471 | if (in_array($name, $def)) { |
472 | - print '<td class="center">' . "\n"; |
|
473 | - print '<a href="' . $_SERVER["PHP_SELF"] . '?action=del&token=' . newToken() . '&value=' . urlencode($name) . '">'; |
|
472 | + print '<td class="center">'."\n"; |
|
473 | + print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&token='.newToken().'&value='.urlencode($name).'">'; |
|
474 | 474 | print img_picto($langs->trans("Enabled"), 'switch_on'); |
475 | 475 | print '</a>'; |
476 | 476 | print '</td>'; |
477 | 477 | } else { |
478 | - print '<td class="center">' . "\n"; |
|
479 | - print '<a href="' . $_SERVER["PHP_SELF"] . '?action=set&token=' . newToken() . '&value=' . urlencode($name) . '&scan_dir=' . urlencode($module->scandir) . '&label=' . urlencode($module->name) . '">' . img_picto($langs->trans("Disabled"), 'switch_off') . '</a>'; |
|
478 | + print '<td class="center">'."\n"; |
|
479 | + print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; |
|
480 | 480 | print "</td>"; |
481 | 481 | } |
482 | 482 | |
@@ -485,19 +485,19 @@ discard block |
||
485 | 485 | if (getDolGlobalString('PRODUCT_BATCH_ADDON_PDF') == $name) { |
486 | 486 | print img_picto($langs->trans("Default"), 'on'); |
487 | 487 | } else { |
488 | - print '<a href="' . $_SERVER["PHP_SELF"] . '?action=setdoc&token=' . newToken() . '&value=' . urlencode($name) . '&scan_dir=' . urlencode($module->scandir) . '&label=' . urlencode($module->name) . '" alt="' . $langs->trans("Default") . '">' . img_picto($langs->trans("Disabled"), 'off') . '</a>'; |
|
488 | + print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; |
|
489 | 489 | } |
490 | 490 | print '</td>'; |
491 | 491 | |
492 | 492 | // Info |
493 | - $htmltooltip = '' . $langs->trans("Name") . ': ' . $module->name; |
|
494 | - $htmltooltip .= '<br>' . $langs->trans("Type") . ': ' . ($module->type ? $module->type : $langs->trans("Unknown")); |
|
493 | + $htmltooltip = ''.$langs->trans("Name").': '.$module->name; |
|
494 | + $htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown")); |
|
495 | 495 | if ($module->type == 'pdf') { |
496 | - $htmltooltip .= '<br>' . $langs->trans("Width") . '/' . $langs->trans("Height") . ': ' . $module->page_largeur . '/' . $module->page_hauteur; |
|
496 | + $htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; |
|
497 | 497 | } |
498 | - $htmltooltip .= '<br><br><u>' . $langs->trans("FeaturesSupported") . ':</u>'; |
|
499 | - $htmltooltip .= '<br>' . $langs->trans("Logo") . ': ' . yn($module->option_logo, 1, 1); |
|
500 | - $htmltooltip .= '<br>' . $langs->trans("MultiLanguage") . ': ' . yn($module->option_multilang, 1, 1); |
|
498 | + $htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>'; |
|
499 | + $htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1); |
|
500 | + $htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1); |
|
501 | 501 | |
502 | 502 | |
503 | 503 | print '<td class="center">'; |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | // Preview |
508 | 508 | print '<td class="center">'; |
509 | 509 | if ($module->type == 'pdf') { |
510 | - print '<a href="' . $_SERVER["PHP_SELF"] . '?action=specimen&module=' . $name . '">' . img_object($langs->trans("Preview"), 'contract') . '</a>'; |
|
510 | + print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'contract').'</a>'; |
|
511 | 511 | } else { |
512 | 512 | print img_object($langs->trans("PreviewNotAvailable"), 'generic'); |
513 | 513 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $formbarcode = null; |
101 | 101 | |
102 | 102 | // Get parameters |
103 | -$id = GETPOSTINT('id'); |
|
103 | +$id = GETPOSTINT('id'); |
|
104 | 104 | if (getDolGlobalString('MAIN_SECURITY_ALLOW_UNSECURED_REF_LABELS')) { |
105 | 105 | $ref = (GETPOSTISSET('ref') ? GETPOST('ref', 'nohtml') : null); |
106 | 106 | } else { |
@@ -512,11 +512,11 @@ discard block |
||
512 | 512 | if (!$error) { |
513 | 513 | $units = GETPOSTINT('units'); |
514 | 514 | |
515 | - $object->entity = $conf->entity; |
|
516 | - $object->ref = $ref; |
|
517 | - $object->label = GETPOST('label', $label_security_check); |
|
518 | - $object->price_base_type = GETPOST('price_base_type', 'aZ09'); |
|
519 | - $object->mandatory_period = !empty(GETPOST("mandatoryperiod", 'alpha')) ? 1 : 0; |
|
515 | + $object->entity = $conf->entity; |
|
516 | + $object->ref = $ref; |
|
517 | + $object->label = GETPOST('label', $label_security_check); |
|
518 | + $object->price_base_type = GETPOST('price_base_type', 'aZ09'); |
|
519 | + $object->mandatory_period = !empty(GETPOST("mandatoryperiod", 'alpha')) ? 1 : 0; |
|
520 | 520 | if ($object->price_base_type == 'TTC') { |
521 | 521 | $object->price_ttc = GETPOST('price'); |
522 | 522 | } else { |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | $object->duration_value = $duration_value; |
605 | 605 | $object->duration_unit = $duration_unit; |
606 | 606 | $object->fk_default_warehouse = GETPOSTINT('fk_default_warehouse'); |
607 | - $object->fk_default_workstation = GETPOSTINT('fk_default_workstation'); |
|
607 | + $object->fk_default_workstation = GETPOSTINT('fk_default_workstation'); |
|
608 | 608 | $object->seuil_stock_alerte = GETPOST('seuil_stock_alerte') ? GETPOST('seuil_stock_alerte') : 0; |
609 | 609 | $object->desiredstock = GETPOST('desiredstock') ? GETPOST('desiredstock') : 0; |
610 | 610 | $object->canvas = GETPOST('canvas'); |
@@ -753,7 +753,7 @@ discard block |
||
753 | 753 | $object->oldcopy = dol_clone($object, 1); |
754 | 754 | |
755 | 755 | if (!getDolGlobalString('PRODUCT_GENERATE_REF_AFTER_FORM')) { |
756 | - $object->ref = $ref; |
|
756 | + $object->ref = $ref; |
|
757 | 757 | } |
758 | 758 | $object->label = GETPOST('label', $label_security_check); |
759 | 759 | |
@@ -775,7 +775,7 @@ discard block |
||
775 | 775 | $object->status_batch = GETPOST('status_batch', 'aZ09'); |
776 | 776 | $object->sell_or_eat_by_mandatory = GETPOSTINT('sell_or_eat_by_mandatory'); |
777 | 777 | $object->batch_mask = GETPOST('batch_mask', 'alpha'); |
778 | - $object->fk_default_warehouse = GETPOSTINT('fk_default_warehouse'); |
|
778 | + $object->fk_default_warehouse = GETPOSTINT('fk_default_warehouse'); |
|
779 | 779 | $object->fk_default_workstation = GETPOSTINT('fk_default_workstation'); |
780 | 780 | // removed from update view so GETPOST always empty |
781 | 781 | /* |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | $object->accountancy_code_buy_export = $accountancy_code_buy_export; |
876 | 876 | } |
877 | 877 | if ($object->isService()) { |
878 | - $object->mandatory_period = (!empty($checkmandatory)) ? 1 : 0 ; |
|
878 | + $object->mandatory_period = (!empty($checkmandatory)) ? 1 : 0; |
|
879 | 879 | } |
880 | 880 | |
881 | 881 | |
@@ -1010,7 +1010,7 @@ discard block |
||
1010 | 1010 | $action = ""; |
1011 | 1011 | |
1012 | 1012 | $mesg = $langs->trans("ErrorProductAlreadyExists", $clone->ref); |
1013 | - $mesg .= ' <a href="' . $_SERVER["PHP_SELF"] . '?ref=' . $clone->ref . '">' . $langs->trans("ShowCardHere") . '</a>.'; |
|
1013 | + $mesg .= ' <a href="'.$_SERVER["PHP_SELF"].'?ref='.$clone->ref.'">'.$langs->trans("ShowCardHere").'</a>.'; |
|
1014 | 1014 | setEventMessages($mesg, null, 'errors'); |
1015 | 1015 | } else { |
1016 | 1016 | setEventMessages(empty($clone->error) ? '' : $langs->trans($clone->error), $clone->errors, 'errors'); |
@@ -1025,7 +1025,7 @@ discard block |
||
1025 | 1025 | } else { |
1026 | 1026 | $db->commit(); |
1027 | 1027 | $db->close(); |
1028 | - header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id); |
|
1028 | + header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); |
|
1029 | 1029 | exit; |
1030 | 1030 | } |
1031 | 1031 | } else { |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | |
193 | 193 | $sql = "SELECT t.rowid, t.ref, t.ref_ext"; |
194 | 194 | $sql .= " FROM ".$this->db->prefix()."product as t"; |
195 | - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_extrafields AS ef ON ef.fk_object = t.rowid"; // So we will be able to filter on extrafields |
|
195 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_extrafields AS ef ON ef.fk_object = t.rowid"; // So we will be able to filter on extrafields |
|
196 | 196 | if ($category > 0) { |
197 | 197 | $sql .= ", ".$this->db->prefix()."categorie_product as c"; |
198 | 198 | } |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | } |
233 | 233 | |
234 | 234 | //this query will return total products with the filters given |
235 | - $sqlTotals = str_replace('SELECT t.rowid, t.ref, t.ref_ext', 'SELECT count(t.rowid) as total', $sql); |
|
235 | + $sqlTotals = str_replace('SELECT t.rowid, t.ref, t.ref_ext', 'SELECT count(t.rowid) as total', $sql); |
|
236 | 236 | |
237 | 237 | $sql .= $this->db->order($sortfield, $sortorder); |
238 | 238 | if ($limit) { |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | |
330 | 330 | if (getDolGlobalString('PRODUIT_MULTIPRICES')) { |
331 | 331 | $key_max = getDolGlobalString('PRODUIT_MULTIPRICES_LIMIT'); |
332 | - for ($key = 1; $key <= $key_max ; $key++) { |
|
332 | + for ($key = 1; $key <= $key_max; $key++) { |
|
333 | 333 | $newvat = $this->product->multiprices_tva_tx[$key]; |
334 | 334 | $newnpr = 0; |
335 | 335 | $newvatsrccode = $this->product->default_vat_code; |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | |
463 | 463 | if ($result > 0 && getDolGlobalString('PRODUIT_MULTIPRICES')) { |
464 | 464 | $key_max = getDolGlobalString('PRODUIT_MULTIPRICES_LIMIT'); |
465 | - for ($key = 1; $key <= $key_max ; $key++) { |
|
465 | + for ($key = 1; $key <= $key_max; $key++) { |
|
466 | 466 | $pricemodified = false; |
467 | 467 | if ($this->product->multiprices_base_type[$key] != $oldproduct->multiprices_base_type[$key]) { |
468 | 468 | $pricemodified = true; |
@@ -2077,7 +2077,7 @@ discard block |
||
2077 | 2077 | unset($object->fk_bank); |
2078 | 2078 | unset($object->fk_account); |
2079 | 2079 | |
2080 | - unset($object->supplierprices); // Must use another API to get them |
|
2080 | + unset($object->supplierprices); // Must use another API to get them |
|
2081 | 2081 | |
2082 | 2082 | if (!DolibarrApiAccess::$user->hasRight('stock', 'lire')) { |
2083 | 2083 | unset($object->stock_reel); |
@@ -2170,7 +2170,7 @@ discard block |
||
2170 | 2170 | $children[] = array_combine($keys, $values); |
2171 | 2171 | } |
2172 | 2172 | |
2173 | - $this->product->sousprods = $children; // @phpstan-ignore-line |
|
2173 | + $this->product->sousprods = $children; // @phpstan-ignore-line |
|
2174 | 2174 | } |
2175 | 2175 | |
2176 | 2176 | if ($includeparentid) { |
@@ -130,7 +130,7 @@ |
||
130 | 130 | } |
131 | 131 | |
132 | 132 | // this query will return total products with the filters given |
133 | - $sqlTotals = str_replace('SELECT t.rowid, t.ref', 'SELECT count(t.rowid) as total', $sql); |
|
133 | + $sqlTotals = str_replace('SELECT t.rowid, t.ref', 'SELECT count(t.rowid) as total', $sql); |
|
134 | 134 | |
135 | 135 | $sql .= $this->db->order($sortfield, $sortorder); |
136 | 136 | if ($limit) { |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | { |
79 | 79 | global $conf, $langs, $user; |
80 | 80 | |
81 | - $managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty'); |
|
81 | + $managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty'); |
|
82 | 82 | |
83 | 83 | if ($managedfor != 'member') { |
84 | 84 | return 0; // If option 'PARTNERSHIP_IS_MANAGED_FOR' = 'thirdparty', this cron job does nothing. |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | |
194 | 194 | $subject = make_substitutions($arraydefaultmessage->topic, $substitutionarray, $outputlangs); |
195 | 195 | $msg = make_substitutions($arraydefaultmessage->content, $substitutionarray, $outputlangs); |
196 | - $from = dol_string_nospecial($conf->global->MAIN_INFO_SOCIETE_NOM, ' ', array(",")).' <' . getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>'; |
|
196 | + $from = dol_string_nospecial($conf->global->MAIN_INFO_SOCIETE_NOM, ' ', array(",")).' <'.getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>'; |
|
197 | 197 | |
198 | 198 | // We are in the case of autocancellation subscription because of missing backlink |
199 | 199 | $fk_partner = $object->fk_member; |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | $object->actionmsg2 = $langs->transnoentities("PartnershipSentByEMail", $object->ref); |
227 | 227 | ; // Short text ($langs->transnoentities('MailSentByTo')...); |
228 | 228 | if (getDolGlobalString('MAIN_MAIL_REPLACE_EVENT_TITLE_BY_EMAIL_SUBJECT')) { |
229 | - $object->actionmsg2 = $subject; // Short text |
|
229 | + $object->actionmsg2 = $subject; // Short text |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | $object->trackid = $trackid; |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | |
420 | 420 | $subject = make_substitutions($arraydefaultmessage->topic, $substitutionarray, $outputlangs); |
421 | 421 | $msg = make_substitutions($arraydefaultmessage->content, $substitutionarray, $outputlangs); |
422 | - $from = dol_string_nospecial($conf->global->MAIN_INFO_SOCIETE_NOM, ' ', array(",")).' <' . getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>'; |
|
422 | + $from = dol_string_nospecial($conf->global->MAIN_INFO_SOCIETE_NOM, ' ', array(",")).' <'.getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>'; |
|
423 | 423 | |
424 | 424 | $sendto = $obj->email; |
425 | 425 | |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | $object->actionmsg2 = $langs->transnoentities("PartnershipSentByEMail", $object->ref); |
451 | 451 | ; // Short text ($langs->transnoentities('MailSentByTo')...); |
452 | 452 | if (getDolGlobalString('MAIN_MAIL_REPLACE_EVENT_TITLE_BY_EMAIL_SUBJECT')) { |
453 | - $object->actionmsg2 = $subject; // Short text |
|
453 | + $object->actionmsg2 = $subject; // Short text |
|
454 | 454 | } |
455 | 455 | |
456 | 456 | $object->trackid = $trackid; |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | } |
565 | 565 | } |
566 | 566 | |
567 | - if ($webcontent && getDolGlobalString('PARTNERSHIP_BACKLINKS_TO_CHECK') && preg_match('/' . getDolGlobalString('PARTNERSHIP_BACKLINKS_TO_CHECK').'/', $webcontent)) { |
|
567 | + if ($webcontent && getDolGlobalString('PARTNERSHIP_BACKLINKS_TO_CHECK') && preg_match('/'.getDolGlobalString('PARTNERSHIP_BACKLINKS_TO_CHECK').'/', $webcontent)) { |
|
568 | 568 | $found = 1; |
569 | 569 | } |
570 | 570 |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | |
142 | 142 | const KEY_ID = 0; |
143 | 143 | const KEY_LABEL = 1; |
144 | - const KEY_TYPE = 2; // deprecated |
|
144 | + const KEY_TYPE = 2; // deprecated |
|
145 | 145 | const KEY_DEFAULT = 3; |
146 | 146 | const KEY_FIRST_LEVEL = 4; |
147 | 147 | const KEY_SECOND_LEVEL = 5; |
@@ -715,7 +715,7 @@ discard block |
||
715 | 715 | $moduleNameInConf = 'supplier_proposal'; |
716 | 716 | } |
717 | 717 | |
718 | - unset($conf->modules[$moduleNameInConf]); // Add this module in list of enabled modules so isModEnabled() will work (conf->module->enabled must no more be used) |
|
718 | + unset($conf->modules[$moduleNameInConf]); // Add this module in list of enabled modules so isModEnabled() will work (conf->module->enabled must no more be used) |
|
719 | 719 | |
720 | 720 | return 1; |
721 | 721 | } else { |
@@ -811,7 +811,7 @@ discard block |
||
811 | 811 | $pathoffile = $this->getDescLongReadmeFound(); |
812 | 812 | |
813 | 813 | if ($pathoffile) { // Mostly for external modules |
814 | - $content = file_get_contents($pathoffile, false, null, 0, 1024 * 1024); // Max size loaded 1Mb |
|
814 | + $content = file_get_contents($pathoffile, false, null, 0, 1024 * 1024); // Max size loaded 1Mb |
|
815 | 815 | |
816 | 816 | if ((float) DOL_VERSION >= 6.0) { // @phpstan-ignore-line |
817 | 817 | @include_once DOL_DOCUMENT_ROOT.'/core/lib/parsemd.lib.php'; |
@@ -1575,7 +1575,7 @@ discard block |
||
1575 | 1575 | |
1576 | 1576 | $sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes_def"; |
1577 | 1577 | $sql .= " WHERE file = '".$this->db->escape($file)."'"; |
1578 | - $sql .= " AND entity = ".$conf->entity; // Do not use getEntity here, we want to delete only in current company |
|
1578 | + $sql .= " AND entity = ".$conf->entity; // Do not use getEntity here, we want to delete only in current company |
|
1579 | 1579 | |
1580 | 1580 | dol_syslog(get_class($this)."::delete_boxes", LOG_DEBUG); |
1581 | 1581 | $resql = $this->db->query($sql); |
@@ -1598,15 +1598,15 @@ discard block |
||
1598 | 1598 | public function insert_cronjobs() |
1599 | 1599 | { |
1600 | 1600 | // phpcs:enable |
1601 | - include_once DOL_DOCUMENT_ROOT . '/core/class/infobox.class.php'; |
|
1602 | - include_once DOL_DOCUMENT_ROOT . '/cron/class/cronjob.class.php'; |
|
1601 | + include_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php'; |
|
1602 | + include_once DOL_DOCUMENT_ROOT.'/cron/class/cronjob.class.php'; |
|
1603 | 1603 | |
1604 | 1604 | global $conf, $user; |
1605 | 1605 | |
1606 | 1606 | $err = 0; |
1607 | 1607 | |
1608 | 1608 | if (is_array($this->cronjobs)) { |
1609 | - dol_syslog(get_class($this) . "::insert_cronjobs", LOG_DEBUG); |
|
1609 | + dol_syslog(get_class($this)."::insert_cronjobs", LOG_DEBUG); |
|
1610 | 1610 | |
1611 | 1611 | foreach ($this->cronjobs as $key => $value) { |
1612 | 1612 | $now = dol_now(); |
@@ -1633,7 +1633,7 @@ discard block |
||
1633 | 1633 | $test = isset($value['test']) ? $value['test'] : ''; // Line must be enabled or not (so visible or not) |
1634 | 1634 | |
1635 | 1635 | // Search if cron entry already present |
1636 | - $sql = "SELECT count(*) as nb FROM " . MAIN_DB_PREFIX . "cronjob"; |
|
1636 | + $sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."cronjob"; |
|
1637 | 1637 | //$sql .= " WHERE module_name = '" . $this->db->escape(empty($this->rights_class) ? strtolower($this->name) : $this->rights_class) . "'"; |
1638 | 1638 | $sql .= " WHERE label = '".$this->db->escape($label)."'"; |
1639 | 1639 | /* unique key is on label,entity so no need for this test |
@@ -1653,7 +1653,7 @@ discard block |
||
1653 | 1653 | $sql .= " AND params = '" . $this->db->escape($params) . "'"; |
1654 | 1654 | } |
1655 | 1655 | */ |
1656 | - $sql .= " AND entity = " . ((int) $entity); // Must be exact entity |
|
1656 | + $sql .= " AND entity = ".((int) $entity); // Must be exact entity |
|
1657 | 1657 | |
1658 | 1658 | $result = $this->db->query($sql); |
1659 | 1659 | if (!$result) { |
@@ -1979,9 +1979,9 @@ discard block |
||
1979 | 1979 | |
1980 | 1980 | // If the module is active |
1981 | 1981 | foreach ($this->rights as $key => $value) { |
1982 | - $r_id = $this->rights[$key][self::KEY_ID]; // permission id in llx_rights_def (not unique because primary key is couple id-entity) |
|
1982 | + $r_id = $this->rights[$key][self::KEY_ID]; // permission id in llx_rights_def (not unique because primary key is couple id-entity) |
|
1983 | 1983 | $r_label = $this->rights[$key][self::KEY_LABEL]; |
1984 | - $r_type = $this->rights[$key][self::KEY_TYPE] ?? 'w'; // TODO deprecated |
|
1984 | + $r_type = $this->rights[$key][self::KEY_TYPE] ?? 'w'; // TODO deprecated |
|
1985 | 1985 | $r_default = $this->rights[$key][self::KEY_DEFAULT] ?? 0; |
1986 | 1986 | $r_perms = $this->rights[$key][self::KEY_FIRST_LEVEL] ?? ''; |
1987 | 1987 | $r_subperms = $this->rights[$key][self::KEY_SECOND_LEVEL] ?? ''; |
@@ -2005,7 +2005,7 @@ discard block |
||
2005 | 2005 | } |
2006 | 2006 | |
2007 | 2007 | // condition to show or hide a user right (default: 1) (eg isModEnabled('anothermodule') or ($conf->global->MAIN_FEATURES_LEVEL > 0) or etc..) |
2008 | - $r_enabled = $this->rights[$key][self::KEY_ENABLED] ?? '1'; |
|
2008 | + $r_enabled = $this->rights[$key][self::KEY_ENABLED] ?? '1'; |
|
2009 | 2009 | |
2010 | 2010 | // Search if perm already present |
2011 | 2011 | $sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."rights_def"; |
@@ -2022,7 +2022,7 @@ discard block |
||
2022 | 2022 | $sql .= ", libelle"; |
2023 | 2023 | $sql .= ", module"; |
2024 | 2024 | $sql .= ", module_origin"; |
2025 | - $sql .= ", type"; // TODO deprecated |
|
2025 | + $sql .= ", type"; // TODO deprecated |
|
2026 | 2026 | $sql .= ", bydefault"; |
2027 | 2027 | $sql .= ", perms"; |
2028 | 2028 | $sql .= ", subperms"; |
@@ -2033,7 +2033,7 @@ discard block |
||
2033 | 2033 | $sql .= ", '".$this->db->escape($r_label)."'"; |
2034 | 2034 | $sql .= ", '".$this->db->escape($r_module)."'"; |
2035 | 2035 | $sql .= ", '".$this->db->escape($r_module_origin)."'"; |
2036 | - $sql .= ", '".$this->db->escape($r_type)."'"; // TODO deprecated |
|
2036 | + $sql .= ", '".$this->db->escape($r_type)."'"; // TODO deprecated |
|
2037 | 2037 | $sql .= ", ".((int) $r_default); |
2038 | 2038 | $sql .= ", '".$this->db->escape($r_perms)."'"; |
2039 | 2039 | $sql .= ", '".$this->db->escape($r_subperms)."'"; |
@@ -2255,7 +2255,7 @@ discard block |
||
2255 | 2255 | |
2256 | 2256 | $sql = "DELETE FROM ".MAIN_DB_PREFIX."menu"; |
2257 | 2257 | $sql .= " WHERE module = '".$this->db->escape($module)."'"; |
2258 | - $sql .= " AND menu_handler = 'all'"; // We delete only lines that were added manually or by the module activation. We keep entry added by menuhandler like 'auguria' |
|
2258 | + $sql .= " AND menu_handler = 'all'"; // We delete only lines that were added manually or by the module activation. We keep entry added by menuhandler like 'auguria' |
|
2259 | 2259 | $sql .= " AND entity IN (0, ".$conf->entity.")"; |
2260 | 2260 | |
2261 | 2261 | dol_syslog(get_class($this)."::delete_menus", LOG_DEBUG); |
@@ -2639,36 +2639,36 @@ discard block |
||
2639 | 2639 | } |
2640 | 2640 | |
2641 | 2641 | if ($this->isCoreOrExternalModule() == 'external' || preg_match('/development|experimental|deprecated/i', $version)) { |
2642 | - $versionTitle = $langs->trans("Version").' '.$this->getVersion(1); |
|
2642 | + $versionTitle = $langs->trans("Version").' '.$this->getVersion(1); |
|
2643 | 2643 | if ($this->needUpdate) { |
2644 | 2644 | $versionTitle .= '<br>'.$langs->trans('ModuleUpdateAvailable').' : '.$this->lastVersion; |
2645 | 2645 | } |
2646 | 2646 | |
2647 | - $return .= '<span class="info-box-icon-version'.($versiontrans ? ' '.$versiontrans : '').' classfortooltip" title="'.dol_escape_js($versionTitle).'" >'; |
|
2648 | - $return .= $this->getVersion(1); |
|
2649 | - $return .= '</span>'; |
|
2647 | + $return .= '<span class="info-box-icon-version'.($versiontrans ? ' '.$versiontrans : '').' classfortooltip" title="'.dol_escape_js($versionTitle).'" >'; |
|
2648 | + $return .= $this->getVersion(1); |
|
2649 | + $return .= '</span>'; |
|
2650 | 2650 | } |
2651 | 2651 | |
2652 | - $return .= '</div> |
|
2652 | + $return .= '</div> |
|
2653 | 2653 | <div class="info-box-content info-box-text-module'.(!getDolGlobalString($const_name) ? '' : ' info-box-module-enabled'.($versiontrans ? ' info-box-content-warning' : '')).'"> |
2654 | 2654 | <span class="info-box-title">'.$this->getName().'</span> |
2655 | 2655 | <span class="info-box-desc twolinesmax opacitymedium" title="'.dol_escape_htmltag($this->getDesc()).'">'.nl2br($this->getDesc()).'</span>'; |
2656 | 2656 | |
2657 | - $return .= '<div class="valignmiddle inline-block info-box-more">'; |
|
2657 | + $return .= '<div class="valignmiddle inline-block info-box-more">'; |
|
2658 | 2658 | //if ($versiontrans) print img_warning($langs->trans("Version").' '.$this->getVersion(1)).' '; |
2659 | - $return .= '<a class="valignmiddle inline-block" href="javascript:document_preview(\''.DOL_URL_ROOT.'/admin/modulehelp.php?id='.((int) $this->numero).'\',\'text/html\',\''.dol_escape_js($langs->trans("Module")).'\')">'.img_picto(($this->isCoreOrExternalModule() == 'external' ? $langs->trans("ExternalModule").' - ' : '').$langs->trans("ClickToShowDescription"), $imginfo).'</a>'; |
|
2660 | - $return .= '</div><br>'; |
|
2661 | - |
|
2662 | - $return .= '<div class="valignmiddle inline-block info-box-actions">'; |
|
2663 | - $return .= '<div class="valignmiddle inline-block info-box-setup">'; |
|
2664 | - $return .= $codetoconfig; |
|
2665 | - $return .= '</div>'; |
|
2666 | - $return .= '<div class="valignmiddle inline-block marginleftonly marginrightonly">'; |
|
2667 | - $return .= $codeenabledisable; |
|
2668 | - $return .= '</div>'; |
|
2669 | - $return .= '</div>'; |
|
2670 | - |
|
2671 | - $return .= ' |
|
2659 | + $return .= '<a class="valignmiddle inline-block" href="javascript:document_preview(\''.DOL_URL_ROOT.'/admin/modulehelp.php?id='.((int) $this->numero).'\',\'text/html\',\''.dol_escape_js($langs->trans("Module")).'\')">'.img_picto(($this->isCoreOrExternalModule() == 'external' ? $langs->trans("ExternalModule").' - ' : '').$langs->trans("ClickToShowDescription"), $imginfo).'</a>'; |
|
2660 | + $return .= '</div><br>'; |
|
2661 | + |
|
2662 | + $return .= '<div class="valignmiddle inline-block info-box-actions">'; |
|
2663 | + $return .= '<div class="valignmiddle inline-block info-box-setup">'; |
|
2664 | + $return .= $codetoconfig; |
|
2665 | + $return .= '</div>'; |
|
2666 | + $return .= '<div class="valignmiddle inline-block marginleftonly marginrightonly">'; |
|
2667 | + $return .= $codeenabledisable; |
|
2668 | + $return .= '</div>'; |
|
2669 | + $return .= '</div>'; |
|
2670 | + |
|
2671 | + $return .= ' |
|
2672 | 2672 | </div><!-- /.info-box-content --> |
2673 | 2673 | </div><!-- /.info-box --> |
2674 | 2674 | </div>'; |
@@ -2688,7 +2688,7 @@ discard block |
||
2688 | 2688 | { |
2689 | 2689 | require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; |
2690 | 2690 | if (!empty($this->url_last_version)) { |
2691 | - $lastVersion = getURLContent($this->url_last_version, 'GET', '', 1, array(), array('http', 'https'), 0); // Accept http or https links on external remote server only |
|
2691 | + $lastVersion = getURLContent($this->url_last_version, 'GET', '', 1, array(), array('http', 'https'), 0); // Accept http or https links on external remote server only |
|
2692 | 2692 | if (isset($lastVersion['content']) && strlen($lastVersion['content']) < 30) { |
2693 | 2693 | // Security warning : be careful with remote data content, the module editor could be hacked (or evil) so limit to a-z A-Z 0-9 _ . - |
2694 | 2694 | $this->lastVersion = preg_replace("/[^a-zA-Z0-9_\.\-]+/", "", $lastVersion['content']); |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | if (empty($this->piece_num)) { |
369 | 369 | $sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum"; |
370 | 370 | $sqlnum .= " FROM ".MAIN_DB_PREFIX.$this->table_element; |
371 | - $sqlnum .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
371 | + $sqlnum .= " WHERE entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
372 | 372 | |
373 | 373 | $resqlnum = $this->db->query($sqlnum); |
374 | 374 | if ($resqlnum) { |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | } |
465 | 465 | |
466 | 466 | // Call triggers |
467 | - if (! $error && ! $notrigger) { |
|
467 | + if (!$error && !$notrigger) { |
|
468 | 468 | $result = $this->call_trigger('BOOKKEEPING_CREATE', $user); |
469 | 469 | if ($result < 0) { |
470 | 470 | $error++; |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); |
549 | 549 | |
550 | 550 | global $action; |
551 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
551 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
552 | 552 | $parameters = array('id' => $this->id, 'getnomurl' => &$result); |
553 | 553 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
554 | 554 | if ($reshook > 0) { |
@@ -715,7 +715,7 @@ discard block |
||
715 | 715 | if (!$error) { |
716 | 716 | $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element.$mode); |
717 | 717 | // Call triggers |
718 | - if (! $notrigger) { |
|
718 | + if (!$notrigger) { |
|
719 | 719 | $result = $this->call_trigger('BOOKKEEPING_CREATE', $user); |
720 | 720 | if ($result < 0) { |
721 | 721 | $error++; |
@@ -780,7 +780,7 @@ discard block |
||
780 | 780 | $sql .= " t.date_validated as date_validation"; |
781 | 781 | $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.$mode.' as t'; |
782 | 782 | $sql .= ' WHERE 1 = 1'; |
783 | - $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
783 | + $sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
784 | 784 | if (null !== $ref) { |
785 | 785 | $sql .= " AND t.rowid = ".((int) $ref); |
786 | 786 | } else { |
@@ -952,7 +952,7 @@ discard block |
||
952 | 952 | } |
953 | 953 | } |
954 | 954 | $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; |
955 | - $sql .= ' WHERE entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
955 | + $sql .= ' WHERE entity = '.((int) $conf->entity); // Do not use getEntity for accounting features |
|
956 | 956 | if (count($sqlwhere) > 0) { |
957 | 957 | $sql .= " AND ".implode(" ".$this->db->sanitize($filtermode)." ", $sqlwhere); |
958 | 958 | } |
@@ -1087,7 +1087,7 @@ discard block |
||
1087 | 1087 | $sql .= " t.date_validated as date_validation"; |
1088 | 1088 | $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; |
1089 | 1089 | |
1090 | - $sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
1090 | + $sql .= ' WHERE t.entity = '.((int) $conf->entity); // Do not use getEntity for accounting features |
|
1091 | 1091 | if ($showAlreadyExportMovements == 0) { |
1092 | 1092 | $sql .= " AND t.date_export IS NULL"; |
1093 | 1093 | } |
@@ -1255,7 +1255,7 @@ discard block |
||
1255 | 1255 | $sql .= " SUM(t.debit) as debit,"; |
1256 | 1256 | $sql .= " SUM(t.credit) as credit"; |
1257 | 1257 | $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; |
1258 | - $sql .= ' WHERE entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
1258 | + $sql .= ' WHERE entity = '.((int) $conf->entity); // Do not use getEntity for accounting features |
|
1259 | 1259 | |
1260 | 1260 | // Manage filter |
1261 | 1261 | if (is_array($filter)) { |
@@ -1483,7 +1483,7 @@ discard block |
||
1483 | 1483 | } |
1484 | 1484 | |
1485 | 1485 | // Call triggers |
1486 | - if (! $error && ! $notrigger) { |
|
1486 | + if (!$error && !$notrigger) { |
|
1487 | 1487 | $result = $this->call_trigger('BOOKKEEPING_MODIFY', $user); |
1488 | 1488 | if ($result < 0) { |
1489 | 1489 | $error++; |
@@ -1576,7 +1576,7 @@ discard block |
||
1576 | 1576 | $this->db->begin(); |
1577 | 1577 | |
1578 | 1578 | // Call triggers |
1579 | - if (! $error && ! $notrigger) { |
|
1579 | + if (!$error && !$notrigger) { |
|
1580 | 1580 | $result = $this->call_trigger('BOOKKEEPING_DELETE', $user); |
1581 | 1581 | if ($result < 0) { |
1582 | 1582 | $error++; |
@@ -1679,7 +1679,7 @@ discard block |
||
1679 | 1679 | if (!empty($journal)) { |
1680 | 1680 | $sql .= " AND code_journal = '".$this->db->escape($journal)."'"; |
1681 | 1681 | } |
1682 | - $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
1682 | + $sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
1683 | 1683 | // Exclusion of validated entries at the time of deletion |
1684 | 1684 | $sql .= " AND date_validated IS NULL"; |
1685 | 1685 | $sql .= $sql_filter; |
@@ -1726,8 +1726,8 @@ discard block |
||
1726 | 1726 | $sql = "DELETE"; |
1727 | 1727 | $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode; |
1728 | 1728 | $sql .= " WHERE piece_num = ".(int) $piecenum; |
1729 | - $sql .= " AND date_validated IS NULL"; // For security, exclusion of validated entries at the time of deletion |
|
1730 | - $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
1729 | + $sql .= " AND date_validated IS NULL"; // For security, exclusion of validated entries at the time of deletion |
|
1730 | + $sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
1731 | 1731 | $sql .= $sql_filter; |
1732 | 1732 | |
1733 | 1733 | $resql = $this->db->query($sql); |
@@ -1855,7 +1855,7 @@ discard block |
||
1855 | 1855 | } |
1856 | 1856 | $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode; |
1857 | 1857 | $sql .= " WHERE piece_num = ".((int) $piecenum); |
1858 | - $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
1858 | + $sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
1859 | 1859 | |
1860 | 1860 | dol_syslog(__METHOD__, LOG_DEBUG); |
1861 | 1861 | $result = $this->db->query($sql); |
@@ -1896,7 +1896,7 @@ discard block |
||
1896 | 1896 | global $conf; |
1897 | 1897 | |
1898 | 1898 | $sql = "SELECT MAX(piece_num)+1 as max FROM ".MAIN_DB_PREFIX.$this->table_element.$mode; |
1899 | - $sql .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
1899 | + $sql .= " WHERE entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
1900 | 1900 | |
1901 | 1901 | dol_syslog(get_class($this)."::getNextNumMvt", LOG_DEBUG); |
1902 | 1902 | |
@@ -1940,7 +1940,7 @@ discard block |
||
1940 | 1940 | } |
1941 | 1941 | $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode; |
1942 | 1942 | $sql .= " WHERE piece_num = ".((int) $piecenum); |
1943 | - $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
1943 | + $sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
1944 | 1944 | |
1945 | 1945 | dol_syslog(__METHOD__, LOG_DEBUG); |
1946 | 1946 | $result = $this->db->query($sql); |
@@ -2005,7 +2005,7 @@ discard block |
||
2005 | 2005 | $sql .= " montant as amount, sens, fk_user_author, import_key, code_journal, piece_num,"; |
2006 | 2006 | $sql .= " date_validated as date_validation"; |
2007 | 2007 | $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; |
2008 | - $sql .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
2008 | + $sql .= " WHERE entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
2009 | 2009 | |
2010 | 2010 | dol_syslog(get_class($this)."::export_bookkeeping", LOG_DEBUG); |
2011 | 2011 | |
@@ -2083,7 +2083,7 @@ discard block |
||
2083 | 2083 | |
2084 | 2084 | if (!$error) { |
2085 | 2085 | // Delete if there is an empty line |
2086 | - $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity)." AND numero_compte IS NULL AND debit = 0 AND credit = 0"; |
|
2086 | + $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity)." AND numero_compte IS NULL AND debit = 0 AND credit = 0"; |
|
2087 | 2087 | $resql = $this->db->query($sql); |
2088 | 2088 | if (!$resql) { |
2089 | 2089 | $error++; |
@@ -2101,7 +2101,7 @@ discard block |
||
2101 | 2101 | $sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,'; |
2102 | 2102 | $sql .= ' numero_compte, label_compte, label_operation, debit, credit,'; |
2103 | 2103 | $sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.((int) $next_piecenum).", '".$this->db->idate($now)."'"; |
2104 | - $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND numero_compte IS NOT NULL AND entity = ' .((int) $conf->entity); |
|
2104 | + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND numero_compte IS NOT NULL AND entity = '.((int) $conf->entity); |
|
2105 | 2105 | $sql .= $sql_filter; |
2106 | 2106 | $resql = $this->db->query($sql); |
2107 | 2107 | if (!$resql) { |
@@ -2112,7 +2112,7 @@ discard block |
||
2112 | 2112 | } |
2113 | 2113 | |
2114 | 2114 | if (!$error) { |
2115 | - $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity); |
|
2115 | + $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity); |
|
2116 | 2116 | $resql = $this->db->query($sql); |
2117 | 2117 | if (!$resql) { |
2118 | 2118 | $error++; |
@@ -2122,7 +2122,7 @@ discard block |
||
2122 | 2122 | } |
2123 | 2123 | } elseif ($direction == 1) { |
2124 | 2124 | if (!$error) { |
2125 | - $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity); |
|
2125 | + $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity); |
|
2126 | 2126 | $resql = $this->db->query($sql); |
2127 | 2127 | if (!$resql) { |
2128 | 2128 | $error++; |
@@ -2140,7 +2140,7 @@ discard block |
||
2140 | 2140 | $sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,'; |
2141 | 2141 | $sql .= ' numero_compte, label_compte, label_operation, debit, credit,'; |
2142 | 2142 | $sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num'; |
2143 | - $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity); |
|
2143 | + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity); |
|
2144 | 2144 | $sql .= $sql_filter; |
2145 | 2145 | $resql = $this->db->query($sql); |
2146 | 2146 | if (!$resql) { |
@@ -2151,7 +2151,7 @@ discard block |
||
2151 | 2151 | } |
2152 | 2152 | |
2153 | 2153 | if (!$error) { |
2154 | - $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity); |
|
2154 | + $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity); |
|
2155 | 2155 | $sql .= $sql_filter; |
2156 | 2156 | $resql = $this->db->query($sql); |
2157 | 2157 | if (!$resql) { |
@@ -2208,7 +2208,7 @@ discard block |
||
2208 | 2208 | $sql .= " AND aa.active = 1"; |
2209 | 2209 | $sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; |
2210 | 2210 | $sql .= " AND asy.rowid = ".((int) $pcgver); |
2211 | - $sql .= " AND ab.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
2211 | + $sql .= " AND ab.entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
2212 | 2212 | $sql .= " ORDER BY account_number ASC"; |
2213 | 2213 | |
2214 | 2214 | dol_syslog(get_class($this)."::select_account", LOG_DEBUG); |
@@ -2272,7 +2272,7 @@ discard block |
||
2272 | 2272 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as parent ON aa.account_parent = parent.rowid AND parent.active = 1"; |
2273 | 2273 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as root ON parent.account_parent = root.rowid AND root.active = 1"; |
2274 | 2274 | $sql .= " WHERE aa.account_number = '".$this->db->escape($account)."'"; |
2275 | - $sql .= " AND aa.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
2275 | + $sql .= " AND aa.entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
2276 | 2276 | |
2277 | 2277 | dol_syslog(get_class($this)."::select_account", LOG_DEBUG); |
2278 | 2278 | $resql = $this->db->query($sql); |
@@ -2312,7 +2312,7 @@ discard block |
||
2312 | 2312 | $sql .= " AND asy.rowid = ".((int) $pcgver); |
2313 | 2313 | $sql .= " AND aa.active = 1"; |
2314 | 2314 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_accounting_category as cat ON aa.fk_accounting_category = cat.rowid"; |
2315 | - $sql .= " WHERE aa.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
2315 | + $sql .= " WHERE aa.entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
2316 | 2316 | |
2317 | 2317 | dol_syslog(get_class($this)."::select_account", LOG_DEBUG); |
2318 | 2318 | $resql = $this->db->query($sql); |
@@ -2345,7 +2345,7 @@ discard block |
||
2345 | 2345 | global $conf; |
2346 | 2346 | |
2347 | 2347 | $alias = trim($alias); |
2348 | - $alias = !empty($alias) && strpos($alias, '.') === false ? $alias . "." : $alias; |
|
2348 | + $alias = !empty($alias) && strpos($alias, '.') === false ? $alias."." : $alias; |
|
2349 | 2349 | |
2350 | 2350 | if (!isset(self::$can_modify_bookkeeping_sql_cached[$alias]) || $force) { |
2351 | 2351 | $result = $this->loadFiscalPeriods($force, 'active'); |
@@ -2358,10 +2358,10 @@ discard block |
||
2358 | 2358 | $i = 0; |
2359 | 2359 | foreach ($conf->cache['active_fiscal_period_cached'] as $fiscal_period) { |
2360 | 2360 | $sql_list[$i] = "("; |
2361 | - $sql_list[$i] .= "'".$this->db->idate($fiscal_period['date_start']) . "' <= ".$this->db->sanitize($alias)."doc_date"; |
|
2361 | + $sql_list[$i] .= "'".$this->db->idate($fiscal_period['date_start'])."' <= ".$this->db->sanitize($alias)."doc_date"; |
|
2362 | 2362 | if (!empty($fiscal_period['date_end'])) { |
2363 | 2363 | $sql_list[$i] .= " AND "; |
2364 | - $sql_list[$i] .= $this->db->sanitize($alias)."doc_date <= '" . $this->db->idate($fiscal_period['date_end'])."'"; |
|
2364 | + $sql_list[$i] .= $this->db->sanitize($alias)."doc_date <= '".$this->db->idate($fiscal_period['date_end'])."'"; |
|
2365 | 2365 | } |
2366 | 2366 | $sql_list[$i] .= ")"; |
2367 | 2367 | $i++; |
@@ -2489,8 +2489,8 @@ discard block |
||
2489 | 2489 | if ($mode == 'active') { |
2490 | 2490 | if (!isset($conf->cache['active_fiscal_period_cached']) || $force) { |
2491 | 2491 | $sql = "SELECT date_start, date_end"; |
2492 | - $sql .= " FROM " . $this->db->prefix() . "accounting_fiscalyear"; |
|
2493 | - $sql .= " WHERE entity = " . ((int) $conf->entity); |
|
2492 | + $sql .= " FROM ".$this->db->prefix()."accounting_fiscalyear"; |
|
2493 | + $sql .= " WHERE entity = ".((int) $conf->entity); |
|
2494 | 2494 | $sql .= " AND statut = 0"; |
2495 | 2495 | |
2496 | 2496 | $resql = $this->db->query($sql); |
@@ -2512,8 +2512,8 @@ discard block |
||
2512 | 2512 | if ($mode == 'closed') { |
2513 | 2513 | if (!isset($conf->cache['closed_fiscal_period_cached']) || $force) { |
2514 | 2514 | $sql = "SELECT date_start, date_end"; |
2515 | - $sql .= " FROM " . $this->db->prefix() . "accounting_fiscalyear"; |
|
2516 | - $sql .= " WHERE entity = " . ((int) $conf->entity); |
|
2515 | + $sql .= " FROM ".$this->db->prefix()."accounting_fiscalyear"; |
|
2516 | + $sql .= " WHERE entity = ".((int) $conf->entity); |
|
2517 | 2517 | $sql .= " AND statut = 1"; |
2518 | 2518 | |
2519 | 2519 | $resql = $this->db->query($sql); |
@@ -2548,10 +2548,10 @@ discard block |
||
2548 | 2548 | $list = array(); |
2549 | 2549 | |
2550 | 2550 | $sql = "SELECT rowid, label, date_start, date_end, statut"; |
2551 | - $sql .= " FROM " . $this->db->prefix() . "accounting_fiscalyear"; |
|
2552 | - $sql .= " WHERE entity = " . ((int) $conf->entity); |
|
2551 | + $sql .= " FROM ".$this->db->prefix()."accounting_fiscalyear"; |
|
2552 | + $sql .= " WHERE entity = ".((int) $conf->entity); |
|
2553 | 2553 | if (!empty($filter)) { |
2554 | - $sql .= " AND (" . $this->db->sanitize($filter, 1, 1, 1) . ')'; |
|
2554 | + $sql .= " AND (".$this->db->sanitize($filter, 1, 1, 1).')'; |
|
2555 | 2555 | } |
2556 | 2556 | $sql .= $this->db->order('date_start', 'ASC'); |
2557 | 2557 | |
@@ -2588,13 +2588,13 @@ discard block |
||
2588 | 2588 | |
2589 | 2589 | $sql = "SELECT YEAR(b.doc_date) as year"; |
2590 | 2590 | for ($i = 1; $i <= 12; $i++) { |
2591 | - $sql .= ", SUM(".$this->db->ifsql("MONTH(b.doc_date) = ".((int) $i), "1", "0") . ") AS month".((int) $i); |
|
2591 | + $sql .= ", SUM(".$this->db->ifsql("MONTH(b.doc_date) = ".((int) $i), "1", "0").") AS month".((int) $i); |
|
2592 | 2592 | } |
2593 | 2593 | $sql .= ", COUNT(b.rowid) as total"; |
2594 | - $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as b"; |
|
2595 | - $sql .= " WHERE b.doc_date >= '" . $this->db->idate($date_start) . "'"; |
|
2596 | - $sql .= " AND b.doc_date <= '" . $this->db->idate($date_end) . "'"; |
|
2597 | - $sql .= " AND b.entity IN (" . getEntity('bookkeeping', 0) . ")"; // We don't share object for accountancy |
|
2594 | + $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b"; |
|
2595 | + $sql .= " WHERE b.doc_date >= '".$this->db->idate($date_start)."'"; |
|
2596 | + $sql .= " AND b.doc_date <= '".$this->db->idate($date_end)."'"; |
|
2597 | + $sql .= " AND b.entity IN (".getEntity('bookkeeping', 0).")"; // We don't share object for accountancy |
|
2598 | 2598 | |
2599 | 2599 | // Get count for each month into the fiscal period |
2600 | 2600 | if (getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")) { |
@@ -2624,7 +2624,7 @@ discard block |
||
2624 | 2624 | 'total' => (int) $obj->total, |
2625 | 2625 | ); |
2626 | 2626 | for ($i = 1; $i <= 12; $i++) { |
2627 | - $year_list['count'][$i] = (int) $obj->{'month' . $i}; |
|
2627 | + $year_list['count'][$i] = (int) $obj->{'month'.$i}; |
|
2628 | 2628 | } |
2629 | 2629 | |
2630 | 2630 | $list[] = $year_list; |
@@ -2652,11 +2652,11 @@ discard block |
||
2652 | 2652 | $now = dol_now(); |
2653 | 2653 | |
2654 | 2654 | // Specify as export : update field date_validated on selected month/year |
2655 | - $sql = " UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping"; |
|
2656 | - $sql .= " SET date_validated = '" . $this->db->idate($now) . "'"; |
|
2657 | - $sql .= " WHERE entity = " . ((int) $conf->entity); |
|
2658 | - $sql .= " AND DATE(doc_date) >= '" . $this->db->idate($date_start) . "'"; |
|
2659 | - $sql .= " AND DATE(doc_date) <= '" . $this->db->idate($date_end) . "'"; |
|
2655 | + $sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping"; |
|
2656 | + $sql .= " SET date_validated = '".$this->db->idate($now)."'"; |
|
2657 | + $sql .= " WHERE entity = ".((int) $conf->entity); |
|
2658 | + $sql .= " AND DATE(doc_date) >= '".$this->db->idate($date_start)."'"; |
|
2659 | + $sql .= " AND DATE(doc_date) <= '".$this->db->idate($date_end)."'"; |
|
2660 | 2660 | $sql .= " AND date_validated IS NULL"; |
2661 | 2661 | |
2662 | 2662 | dol_syslog(__METHOD__, LOG_DEBUG); |
@@ -2689,27 +2689,27 @@ discard block |
||
2689 | 2689 | |
2690 | 2690 | $pcg_type_filter = array(); |
2691 | 2691 | foreach ($accounting_groups_used_for_income_statement as $item) { |
2692 | - $pcg_type_filter[] = "'" . $this->db->escape($item) . "'"; |
|
2692 | + $pcg_type_filter[] = "'".$this->db->escape($item)."'"; |
|
2693 | 2693 | } |
2694 | 2694 | |
2695 | 2695 | $sql = 'SELECT'; |
2696 | 2696 | $sql .= " t.numero_compte,"; |
2697 | 2697 | $sql .= " aa.pcg_type,"; |
2698 | 2698 | $sql .= " (SUM(t.credit) - SUM(t.debit)) as accounting_result"; |
2699 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; |
|
2700 | - $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'accounting_account as aa ON aa.account_number = t.numero_compte'; |
|
2701 | - $sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
2702 | - $sql .= " AND aa.entity = " . ((int) $conf->entity); |
|
2703 | - $sql .= ' AND aa.fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid = ' . ((int) getDolGlobalInt('CHARTOFACCOUNTS')) . ')'; |
|
2704 | - $sql .= ' AND aa.pcg_type IN (' . $this->db->sanitize(implode(',', $pcg_type_filter), 1) . ')'; |
|
2705 | - $sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($date_start) . "'"; |
|
2706 | - $sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($date_end) . "'"; |
|
2699 | + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; |
|
2700 | + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'accounting_account as aa ON aa.account_number = t.numero_compte'; |
|
2701 | + $sql .= ' WHERE t.entity = '.((int) $conf->entity); // Do not use getEntity for accounting features |
|
2702 | + $sql .= " AND aa.entity = ".((int) $conf->entity); |
|
2703 | + $sql .= ' AND aa.fk_pcg_version IN (SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid = '.((int) getDolGlobalInt('CHARTOFACCOUNTS')).')'; |
|
2704 | + $sql .= ' AND aa.pcg_type IN ('.$this->db->sanitize(implode(',', $pcg_type_filter), 1).')'; |
|
2705 | + $sql .= " AND DATE(t.doc_date) >= '".$this->db->idate($date_start)."'"; |
|
2706 | + $sql .= " AND DATE(t.doc_date) <= '".$this->db->idate($date_end)."'"; |
|
2707 | 2707 | $sql .= ' GROUP BY t.numero_compte, aa.pcg_type'; |
2708 | 2708 | |
2709 | 2709 | $resql = $this->db->query($sql); |
2710 | 2710 | if (!$resql) { |
2711 | - $this->errors[] = 'Error ' . $this->db->lasterror(); |
|
2712 | - dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); |
|
2711 | + $this->errors[] = 'Error '.$this->db->lasterror(); |
|
2712 | + dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR); |
|
2713 | 2713 | } else { |
2714 | 2714 | while ($obj = $this->db->fetch_object($resql)) { |
2715 | 2715 | $income_statement_amount += $obj->accounting_result; |
@@ -2748,7 +2748,7 @@ discard block |
||
2748 | 2748 | return -1; |
2749 | 2749 | } elseif (empty($fiscal_period->id)) { |
2750 | 2750 | $langs->loadLangs(array('errors', 'compta')); |
2751 | - $this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('FiscalPeriod') . ' (' . $fiscal_period_id . ')'; |
|
2751 | + $this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('FiscalPeriod').' ('.$fiscal_period_id.')'; |
|
2752 | 2752 | return -1; |
2753 | 2753 | } |
2754 | 2754 | |
@@ -2767,7 +2767,7 @@ discard block |
||
2767 | 2767 | return -1; |
2768 | 2768 | } elseif (empty($new_fiscal_period->id)) { |
2769 | 2769 | $langs->loadLangs(array('errors', 'compta')); |
2770 | - $this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('FiscalPeriod') . ' (' . $new_fiscal_period_id . ')'; |
|
2770 | + $this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('FiscalPeriod').' ('.$new_fiscal_period_id.')'; |
|
2771 | 2771 | return -1; |
2772 | 2772 | } |
2773 | 2773 | |
@@ -2787,7 +2787,7 @@ discard block |
||
2787 | 2787 | $journal_id = max(0, getDolGlobalString('ACCOUNTING_CLOSURE_DEFAULT_JOURNAL')); |
2788 | 2788 | if (empty($journal_id)) { |
2789 | 2789 | $langs->loadLangs(array('errors', 'accountancy')); |
2790 | - $this->errors[] = $langs->trans('ErrorBadParameters') . ' - ' . $langs->trans('Codejournal') . ' (' . $langs->trans('AccountingJournalType9') . ')'; |
|
2790 | + $this->errors[] = $langs->trans('ErrorBadParameters').' - '.$langs->trans('Codejournal').' ('.$langs->trans('AccountingJournalType9').')'; |
|
2791 | 2791 | $error++; |
2792 | 2792 | } |
2793 | 2793 | |
@@ -2801,7 +2801,7 @@ discard block |
||
2801 | 2801 | $error++; |
2802 | 2802 | } elseif ($result == 0) { |
2803 | 2803 | $langs->loadLangs(array('errors', 'accountancy')); |
2804 | - $this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('Codejournal') . ' (' . $langs->trans('AccountingJournalType9') . ')'; |
|
2804 | + $this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('Codejournal').' ('.$langs->trans('AccountingJournalType9').')'; |
|
2805 | 2805 | $error++; |
2806 | 2806 | } |
2807 | 2807 | } else { |
@@ -2815,7 +2815,7 @@ discard block |
||
2815 | 2815 | $pcg_type_filter = array(); |
2816 | 2816 | $tmp = array_merge($accounting_groups_used_for_balance_sheet_account, $accounting_groups_used_for_income_statement); |
2817 | 2817 | foreach ($tmp as $item) { |
2818 | - $pcg_type_filter[] = "'" . $this->db->escape($item) . "'"; |
|
2818 | + $pcg_type_filter[] = "'".$this->db->escape($item)."'"; |
|
2819 | 2819 | } |
2820 | 2820 | |
2821 | 2821 | $sql = 'SELECT'; |
@@ -2827,14 +2827,14 @@ discard block |
||
2827 | 2827 | } |
2828 | 2828 | $sql .= " aa.pcg_type,"; |
2829 | 2829 | $sql .= " (SUM(t.credit) - SUM(t.debit)) as opening_balance"; |
2830 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; |
|
2831 | - $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'accounting_account as aa ON aa.account_number = t.numero_compte'; |
|
2832 | - $sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
2833 | - $sql .= " AND aa.entity = ". ((int) $conf->entity); |
|
2830 | + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; |
|
2831 | + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'accounting_account as aa ON aa.account_number = t.numero_compte'; |
|
2832 | + $sql .= ' WHERE t.entity = '.((int) $conf->entity); // Do not use getEntity for accounting features |
|
2833 | + $sql .= " AND aa.entity = ".((int) $conf->entity); |
|
2834 | 2834 | $sql .= ' AND aa.fk_pcg_version IN (SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid = '.((int) getDolGlobalInt('CHARTOFACCOUNTS')).')'; |
2835 | - $sql .= ' AND aa.pcg_type IN (' . $this->db->sanitize(implode(',', $pcg_type_filter), 1) . ')'; |
|
2836 | - $sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($fiscal_period->date_start) . "'"; |
|
2837 | - $sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($fiscal_period->date_end) . "'"; |
|
2835 | + $sql .= ' AND aa.pcg_type IN ('.$this->db->sanitize(implode(',', $pcg_type_filter), 1).')'; |
|
2836 | + $sql .= " AND DATE(t.doc_date) >= '".$this->db->idate($fiscal_period->date_start)."'"; |
|
2837 | + $sql .= " AND DATE(t.doc_date) <= '".$this->db->idate($fiscal_period->date_end)."'"; |
|
2838 | 2838 | $sql .= ' GROUP BY t.numero_compte, t.label_compte, aa.pcg_type'; |
2839 | 2839 | if ($separate_auxiliary_account) { |
2840 | 2840 | $sql .= ' ,t.subledger_account, t.subledger_label'; |
@@ -2843,8 +2843,8 @@ discard block |
||
2843 | 2843 | |
2844 | 2844 | $resql = $this->db->query($sql); |
2845 | 2845 | if (!$resql) { |
2846 | - $this->errors[] = 'Error ' . $this->db->lasterror(); |
|
2847 | - dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); |
|
2846 | + $this->errors[] = 'Error '.$this->db->lasterror(); |
|
2847 | + dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR); |
|
2848 | 2848 | |
2849 | 2849 | $error++; |
2850 | 2850 | } else { |
@@ -2986,7 +2986,7 @@ discard block |
||
2986 | 2986 | return -1; |
2987 | 2987 | } elseif (empty($fiscal_period->id)) { |
2988 | 2988 | $langs->loadLangs(array('errors', 'compta')); |
2989 | - $this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('FiscalPeriod') . ' (' . $fiscal_period_id . ')'; |
|
2989 | + $this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('FiscalPeriod').' ('.$fiscal_period_id.')'; |
|
2990 | 2990 | return -1; |
2991 | 2991 | } |
2992 | 2992 | |
@@ -3005,7 +3005,7 @@ discard block |
||
3005 | 3005 | return -1; |
3006 | 3006 | } elseif (empty($new_fiscal_period->id)) { |
3007 | 3007 | $langs->loadLangs(array('errors', 'compta')); |
3008 | - $this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('FiscalPeriod') . ' (' . $new_fiscal_period_id . ')'; |
|
3008 | + $this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('FiscalPeriod').' ('.$new_fiscal_period_id.')'; |
|
3009 | 3009 | return -1; |
3010 | 3010 | } |
3011 | 3011 | |
@@ -3025,7 +3025,7 @@ discard block |
||
3025 | 3025 | return -1; |
3026 | 3026 | } elseif ($result == 0) { |
3027 | 3027 | $langs->loadLangs(array('errors', 'accountancy')); |
3028 | - $this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('InventoryJournal'); |
|
3028 | + $this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('InventoryJournal'); |
|
3029 | 3029 | return -1; |
3030 | 3030 | } |
3031 | 3031 | |
@@ -3033,18 +3033,18 @@ discard block |
||
3033 | 3033 | $this->db->begin(); |
3034 | 3034 | |
3035 | 3035 | $sql = 'SELECT t.rowid'; |
3036 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; |
|
3037 | - $sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
3038 | - $sql .= " AND code_journal = '" . $this->db->escape($inventory_journal->code) . "'"; |
|
3039 | - $sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($date_start) . "'"; |
|
3040 | - $sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($date_end) . "'"; |
|
3041 | - $sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($fiscal_period->date_start) . "'"; |
|
3042 | - $sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($fiscal_period->date_end) . "'"; |
|
3036 | + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; |
|
3037 | + $sql .= ' WHERE t.entity = '.((int) $conf->entity); // Do not use getEntity for accounting features |
|
3038 | + $sql .= " AND code_journal = '".$this->db->escape($inventory_journal->code)."'"; |
|
3039 | + $sql .= " AND DATE(t.doc_date) >= '".$this->db->idate($date_start)."'"; |
|
3040 | + $sql .= " AND DATE(t.doc_date) <= '".$this->db->idate($date_end)."'"; |
|
3041 | + $sql .= " AND DATE(t.doc_date) >= '".$this->db->idate($fiscal_period->date_start)."'"; |
|
3042 | + $sql .= " AND DATE(t.doc_date) <= '".$this->db->idate($fiscal_period->date_end)."'"; |
|
3043 | 3043 | |
3044 | 3044 | $resql = $this->db->query($sql); |
3045 | 3045 | if (!$resql) { |
3046 | - $this->errors[] = 'Error ' . $this->db->lasterror(); |
|
3047 | - dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); |
|
3046 | + $this->errors[] = 'Error '.$this->db->lasterror(); |
|
3047 | + dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR); |
|
3048 | 3048 | |
3049 | 3049 | $error++; |
3050 | 3050 | } else { |
@@ -3059,7 +3059,7 @@ discard block |
||
3059 | 3059 | break; |
3060 | 3060 | } elseif ($result == 0) { |
3061 | 3061 | $langs->loadLangs(array('errors', 'accountancy')); |
3062 | - $this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('LineId') . ': ' . $obj->rowid; |
|
3062 | + $this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('LineId').': '.$obj->rowid; |
|
3063 | 3063 | $error++; |
3064 | 3064 | break; |
3065 | 3065 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | |
136 | 136 | if (getDolGlobalString('PARTNERSHIP_IMAGE_PUBLIC_REGISTRATION')) { |
137 | 137 | print '<div class="backimagepublicregistration">'; |
138 | - print '<img id="idPARTNERSHIP_IMAGE_PUBLIC_INTERFACE" src="' . getDolGlobalString('PARTNERSHIP_IMAGE_PUBLIC_REGISTRATION').'">'; |
|
138 | + print '<img id="idPARTNERSHIP_IMAGE_PUBLIC_INTERFACE" src="'.getDolGlobalString('PARTNERSHIP_IMAGE_PUBLIC_REGISTRATION').'">'; |
|
139 | 139 | print '</div>'; |
140 | 140 | } |
141 | 141 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | |
227 | 227 | $partnership->status = 0; |
228 | 228 | $partnership->note_private = GETPOST('note_private'); |
229 | - $partnership->date_creation = dol_now(); |
|
229 | + $partnership->date_creation = dol_now(); |
|
230 | 230 | $partnership->date_partnership_start = dol_now(); |
231 | 231 | $partnership->fk_user_creat = 0; |
232 | 232 | $partnership->fk_type = GETPOSTINT('partnershiptype'); |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | |
607 | 607 | if (getDolGlobalInt('PARTNERSHIP_NEWFORM_FORCETYPE')) { |
608 | 608 | print $listofpartnership[getDolGlobalInt('PARTNERSHIP_NEWFORM_FORCETYPE')]; |
609 | - print '<input type="hidden" id="partnershiptype" name="partnershiptype" value="' . getDolGlobalInt('PARTNERSHIP_NEWFORM_FORCETYPE').'">'; |
|
609 | + print '<input type="hidden" id="partnershiptype" name="partnershiptype" value="'.getDolGlobalInt('PARTNERSHIP_NEWFORM_FORCETYPE').'">'; |
|
610 | 610 | } |
611 | 611 | |
612 | 612 | print '<table class="border" summary="form to subscribe" id="tablesubscribe">'."\n"; |
@@ -683,7 +683,7 @@ discard block |
||
683 | 683 | //print '<tr><td>'.$langs->trans("URLPhoto").'</td><td><input type="text" name="photo" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('photo')).'"></td></tr>'."\n"; |
684 | 684 | // Other attributes |
685 | 685 | $parameters['tdclass'] = 'titlefieldauto'; |
686 | -$parameters['tpl_context'] = 'public'; // define template context to public |
|
686 | +$parameters['tpl_context'] = 'public'; // define template context to public |
|
687 | 687 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; |
688 | 688 | // Comments |
689 | 689 | print '<tr>'; |