@@ -1221,8 +1221,11 @@ discard block |
||
1221 | 1221 | $this->fk_facture_source = trim($this->fk_facture_source); |
1222 | 1222 | } |
1223 | 1223 | if (isset($this->fk_project)) { |
1224 | - if (empty($this->fk_project)) $this->fk_project = null; |
|
1225 | - else $this->fk_project = intval($this->fk_project); |
|
1224 | + if (empty($this->fk_project)) { |
|
1225 | + $this->fk_project = null; |
|
1226 | + } else { |
|
1227 | + $this->fk_project = intval($this->fk_project); |
|
1228 | + } |
|
1226 | 1229 | } |
1227 | 1230 | if (isset($this->cond_reglement_id)) { |
1228 | 1231 | $this->cond_reglement_id = trim($this->cond_reglement_id); |
@@ -1804,7 +1807,9 @@ discard block |
||
1804 | 1807 | $array_to_check = array('IDPROF1', 'IDPROF2', 'IDPROF3', 'IDPROF4', 'IDPROF5', 'IDPROF6', 'EMAIL', 'ACCOUNTANCY_CODE_SUPPLIER'); |
1805 | 1808 | foreach ($array_to_check as $key) { |
1806 | 1809 | $keymin = strtolower($key); |
1807 | - if ($keymin == 'accountancy_code_supplier') $keymin = 'code_compta_fournisseur'; |
|
1810 | + if ($keymin == 'accountancy_code_supplier') { |
|
1811 | + $keymin = 'code_compta_fournisseur'; |
|
1812 | + } |
|
1808 | 1813 | if (!property_exists($this->thirdparty, $keymin)) { |
1809 | 1814 | continue; |
1810 | 1815 | } |
@@ -3856,8 +3861,11 @@ discard block |
||
3856 | 3861 | $sql .= ", pu_ttc = ".price2num($this->pu_ttc); |
3857 | 3862 | $sql .= ", qty = ".price2num($this->qty); |
3858 | 3863 | $sql .= ", remise_percent = ".price2num($this->remise_percent); |
3859 | - if ($this->fk_remise_except > 0) $sql .= ", fk_remise_except=".((int) $this->fk_remise_except); |
|
3860 | - else $sql .= ", fk_remise_except=null"; |
|
3864 | + if ($this->fk_remise_except > 0) { |
|
3865 | + $sql .= ", fk_remise_except=".((int) $this->fk_remise_except); |
|
3866 | + } else { |
|
3867 | + $sql .= ", fk_remise_except=null"; |
|
3868 | + } |
|
3861 | 3869 | $sql .= ", vat_src_code = '".$this->db->escape(empty($this->vat_src_code) ? '' : $this->vat_src_code)."'"; |
3862 | 3870 | $sql .= ", tva_tx = ".price2num($this->tva_tx); |
3863 | 3871 | $sql .= ", localtax1_tx = ".price2num($this->localtax1_tx); |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | /** |
204 | 204 | * @var int ID |
205 | 205 | */ |
206 | - public $fk_account; // default bank account |
|
206 | + public $fk_account; // default bank account |
|
207 | 207 | |
208 | 208 | /** |
209 | 209 | * @var int transport mode id |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | if ($this->fac_rec > 0) { |
406 | 406 | $this->fk_fac_rec_source = $this->fac_rec; |
407 | 407 | |
408 | - require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture-rec.class.php'; |
|
408 | + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture-rec.class.php'; |
|
409 | 409 | $_facrec = new FactureFournisseurRec($this->db); |
410 | 410 | $result = $_facrec->fetch($this->fac_rec); |
411 | 411 | $result = $_facrec->fetchObjectLinked(null, '', null, '', 'OR', 1, 'sourcetype', 0); // This load $_facrec->linkedObjectsIds |
@@ -439,13 +439,13 @@ discard block |
||
439 | 439 | $this->location_incoterms = $_facrec->location_incoterms; |
440 | 440 | |
441 | 441 | // Clean parameters |
442 | - if (! $this->type) { |
|
442 | + if (!$this->type) { |
|
443 | 443 | $this->type = self::TYPE_STANDARD; |
444 | 444 | } |
445 | 445 | if (!empty(GETPOST('ref_supplier'))) { |
446 | 446 | $this->ref_supplier = trim($this->ref_supplier); |
447 | 447 | } else { |
448 | - $this->ref_supplier = trim($this->ref_supplier . '_' . ($_facrec->nb_gen_done + 1)); |
|
448 | + $this->ref_supplier = trim($this->ref_supplier.'_'.($_facrec->nb_gen_done + 1)); |
|
449 | 449 | } |
450 | 450 | $this->note_public = trim($this->note_public); |
451 | 451 | $this->note_private = trim($this->note_private); |
@@ -453,11 +453,11 @@ discard block |
||
453 | 453 | |
454 | 454 | $this->array_options = $_facrec->array_options; |
455 | 455 | |
456 | - if (! $this->mode_reglement_id) { |
|
456 | + if (!$this->mode_reglement_id) { |
|
457 | 457 | $this->mode_reglement_id = 0; |
458 | 458 | } |
459 | 459 | $this->status = self::STATUS_DRAFT; |
460 | - $this->statut = self::STATUS_DRAFT; // deprecated |
|
460 | + $this->statut = self::STATUS_DRAFT; // deprecated |
|
461 | 461 | |
462 | 462 | $this->linked_objects = $_facrec->linkedObjectsIds; |
463 | 463 | // We do not add link to template invoice or next invoice will be linked to all generated invoices |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | /* |
705 | 705 | * Insert lines of template invoices |
706 | 706 | */ |
707 | - if (! $error && $this->fac_rec > 0) { |
|
707 | + if (!$error && $this->fac_rec > 0) { |
|
708 | 708 | foreach ($_facrec->lines as $i => $val) { |
709 | 709 | if ($_facrec->lines[$i]->fk_product) { |
710 | 710 | $prod = new Product($this->db); |
@@ -719,7 +719,7 @@ discard block |
||
719 | 719 | $localtax1_tx=get_localtax($tva_tx,1,$soc,$mysoc,$tva_npr); |
720 | 720 | $localtax2_tx=get_localtax($tva_tx,2,$soc,$mysoc,$tva_npr); |
721 | 721 | */ |
722 | - $tva_tx = $_facrec->lines[$i]->tva_tx . ($_facrec->lines[$i]->vat_src_code ? '(' . $_facrec->lines[$i]->vat_src_code . ')' : ''); |
|
722 | + $tva_tx = $_facrec->lines[$i]->tva_tx.($_facrec->lines[$i]->vat_src_code ? '('.$_facrec->lines[$i]->vat_src_code.')' : ''); |
|
723 | 723 | $tva_npr = $_facrec->lines[$i]->info_bits; |
724 | 724 | if (empty($tva_tx)) { |
725 | 725 | $tva_npr = 0; |
@@ -731,8 +731,8 @@ discard block |
||
731 | 731 | $buyprice = empty($_facrec->lines[$i]->buyprice) ? 0 : $_facrec->lines[$i]->buyprice; |
732 | 732 | |
733 | 733 | // If buyprice not defined from template invoice, we try to guess the best value |
734 | - if (! $buyprice && $_facrec->lines[$i]->fk_product > 0) { |
|
735 | - require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.product.class.php'; |
|
734 | + if (!$buyprice && $_facrec->lines[$i]->fk_product > 0) { |
|
735 | + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; |
|
736 | 736 | $producttmp = new ProductFournisseur($this->db); |
737 | 737 | $producttmp->fetch($_facrec->lines[$i]->fk_product); |
738 | 738 | |
@@ -937,13 +937,13 @@ discard block |
||
937 | 937 | $this->total_tva = $obj->total_tva; |
938 | 938 | $this->total_ttc = $obj->total_ttc; |
939 | 939 | $this->status = $obj->status; |
940 | - $this->statut = $obj->status; // For backward compatibility |
|
941 | - $this->fk_statut = $obj->status; // For backward compatibility |
|
940 | + $this->statut = $obj->status; // For backward compatibility |
|
941 | + $this->fk_statut = $obj->status; // For backward compatibility |
|
942 | 942 | $this->fk_user_author = $obj->fk_user_author; |
943 | 943 | $this->author = $obj->fk_user_author; |
944 | 944 | $this->fk_user_valid = $obj->fk_user_valid; |
945 | 945 | $this->fk_facture_source = $obj->fk_facture_source; |
946 | - $this->vat_reverse_charge = empty($obj->vat_reverse_charge) ? '0' : '1'; |
|
946 | + $this->vat_reverse_charge = empty($obj->vat_reverse_charge) ? '0' : '1'; |
|
947 | 947 | $this->fk_fac_rec_source = $obj->fk_fac_rec_source; |
948 | 948 | $this->fk_project = $obj->fk_project; |
949 | 949 | $this->cond_reglement_id = $obj->fk_cond_reglement; |
@@ -1061,7 +1061,7 @@ discard block |
||
1061 | 1061 | $line->localtax2_tx = $obj->localtax2_tx; |
1062 | 1062 | $line->localtax1_type = $obj->localtax1_type; |
1063 | 1063 | $line->localtax2_type = $obj->localtax2_type; |
1064 | - $line->qty = $obj->qty; |
|
1064 | + $line->qty = $obj->qty; |
|
1065 | 1065 | $line->remise_percent = $obj->remise_percent; |
1066 | 1066 | $line->fk_remise_except = $obj->fk_remise_except; |
1067 | 1067 | //$line->tva = $obj->total_tva; // deprecated |
@@ -1342,7 +1342,7 @@ discard block |
||
1342 | 1342 | $facligne->rang = 1; |
1343 | 1343 | $linecount = count($this->lines); |
1344 | 1344 | for ($ii = 1; $ii <= $linecount; $ii++) { |
1345 | - $this->updateRangOfLine($this->lines[$ii - 1]->id, $ii+1); |
|
1345 | + $this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1); |
|
1346 | 1346 | } |
1347 | 1347 | } |
1348 | 1348 | |
@@ -2696,7 +2696,7 @@ discard block |
||
2696 | 2696 | |
2697 | 2697 | while ($obj = $this->db->fetch_object($resql)) { |
2698 | 2698 | $facturestatic->date_echeance = $this->db->jdate($obj->datefin); |
2699 | - $facturestatic->statut = $obj->status; // For backward compatibility |
|
2699 | + $facturestatic->statut = $obj->status; // For backward compatibility |
|
2700 | 2700 | $facturestatic->status = $obj->status; |
2701 | 2701 | |
2702 | 2702 | $response->nbtodo++; |
@@ -2878,7 +2878,7 @@ discard block |
||
2878 | 2878 | $label = $langs->trans("ShowSupplierInvoice"); |
2879 | 2879 | $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; |
2880 | 2880 | } |
2881 | - $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); |
|
2881 | + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); |
|
2882 | 2882 | $linkclose .= $dataparams.' class="'.$classfortooltip.'"'; |
2883 | 2883 | } |
2884 | 2884 | |
@@ -2907,7 +2907,7 @@ discard block |
||
2907 | 2907 | } |
2908 | 2908 | } |
2909 | 2909 | global $action; |
2910 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
2910 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
2911 | 2911 | $parameters = array('id'=>$this->id, 'getnomurl' => &$result); |
2912 | 2912 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
2913 | 2913 | if ($reshook > 0) { |
@@ -3129,7 +3129,7 @@ discard block |
||
3129 | 3129 | // Load source object |
3130 | 3130 | $object->fetch($fromid); |
3131 | 3131 | $object->id = 0; |
3132 | - $object->statut = self::STATUS_DRAFT; // For backward compatibility |
|
3132 | + $object->statut = self::STATUS_DRAFT; // For backward compatibility |
|
3133 | 3133 | $object->status = self::STATUS_DRAFT; |
3134 | 3134 | |
3135 | 3135 | $object->fetch_thirdparty(); // We need it to recalculate VAT localtaxes according to main sale taxes and vendor |
@@ -3677,7 +3677,7 @@ discard block |
||
3677 | 3677 | $this->localtax1_type = $obj->localtax1_type; |
3678 | 3678 | $this->localtax2_type = $obj->localtax2_type; |
3679 | 3679 | |
3680 | - $this->qty = $obj->qty; |
|
3680 | + $this->qty = $obj->qty; |
|
3681 | 3681 | $this->remise_percent = $obj->remise_percent; |
3682 | 3682 | $this->fk_remise_except = $obj->fk_remise_except; |
3683 | 3683 | //$this->tva = $obj->total_tva; // deprecated |
@@ -51,13 +51,13 @@ discard block |
||
51 | 51 | define("DOLENTITY", $entity); |
52 | 52 | } |
53 | 53 | include '../../main.inc.php'; |
54 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; |
|
54 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
55 | 55 | |
56 | 56 | $action = GETPOST('action', 'aZ09'); |
57 | 57 | |
58 | 58 | $signature = GETPOST('signaturebase64'); |
59 | 59 | $ref = GETPOST('ref', 'aZ09'); |
60 | -$mode = GETPOST('mode', 'aZ09'); // 'proposal', ... |
|
60 | +$mode = GETPOST('mode', 'aZ09'); // 'proposal', ... |
|
61 | 61 | $SECUREKEY = GETPOST("securekey"); // Secure key |
62 | 62 | $online_sign_name = GETPOST("onlinesignname") ? GETPOST("onlinesignname") : ''; |
63 | 63 | |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | $securekeyseed = getDolGlobalString('PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN'); |
73 | 73 | } |
74 | 74 | |
75 | -if (empty($SECUREKEY) || !dol_verifyHash($securekeyseed . $type . $ref . (!isModEnabled('multicompany') ? '' : $entity), $SECUREKEY, '0')) { |
|
76 | - httponly_accessforbidden('Bad value for securitykey. Value provided ' . dol_escape_htmltag($SECUREKEY) . ' does not match expected value for ref=' . dol_escape_htmltag($ref), 403); |
|
75 | +if (empty($SECUREKEY) || !dol_verifyHash($securekeyseed.$type.$ref.(!isModEnabled('multicompany') ? '' : $entity), $SECUREKEY, '0')) { |
|
76 | + httponly_accessforbidden('Bad value for securitykey. Value provided '.dol_escape_htmltag($SECUREKEY).' does not match expected value for ref='.dol_escape_htmltag($ref), 403); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | |
@@ -97,29 +97,29 @@ discard block |
||
97 | 97 | $data = base64_decode($signature); |
98 | 98 | |
99 | 99 | if ($mode == "propale" || $mode == 'proposal') { |
100 | - require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php'; |
|
101 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/pdf.lib.php'; |
|
100 | + require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; |
|
101 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; |
|
102 | 102 | $object = new Propal($db); |
103 | 103 | $object->fetch(0, $ref); |
104 | 104 | |
105 | 105 | $upload_dir = !empty($conf->propal->multidir_output[$object->entity]) ? $conf->propal->multidir_output[$object->entity] : $conf->propal->dir_output; |
106 | - $upload_dir .= '/' . dol_sanitizeFileName($object->ref) . '/'; |
|
106 | + $upload_dir .= '/'.dol_sanitizeFileName($object->ref).'/'; |
|
107 | 107 | |
108 | - $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
109 | - $default_font = pdf_getPDFFont($langs); // Must be after pdf_getInstance |
|
108 | + $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
109 | + $default_font = pdf_getPDFFont($langs); // Must be after pdf_getInstance |
|
110 | 110 | $langs->loadLangs(array("main", "companies")); |
111 | 111 | |
112 | 112 | $date = dol_print_date(dol_now(), "%Y%m%d%H%M%S"); |
113 | - $filename = "signatures/" . $date . "_signature.png"; |
|
114 | - if (!is_dir($upload_dir . "signatures/")) { |
|
115 | - if (!dol_mkdir($upload_dir . "signatures/")) { |
|
116 | - $response = "Error mkdir. Failed to create dir " . $upload_dir . "signatures/"; |
|
113 | + $filename = "signatures/".$date."_signature.png"; |
|
114 | + if (!is_dir($upload_dir."signatures/")) { |
|
115 | + if (!dol_mkdir($upload_dir."signatures/")) { |
|
116 | + $response = "Error mkdir. Failed to create dir ".$upload_dir."signatures/"; |
|
117 | 117 | $error++; |
118 | 118 | } |
119 | 119 | } |
120 | 120 | |
121 | 121 | if (!$error) { |
122 | - $return = file_put_contents($upload_dir . $filename, $data); |
|
122 | + $return = file_put_contents($upload_dir.$filename, $data); |
|
123 | 123 | if ($return == false) { |
124 | 124 | $error++; |
125 | 125 | $response = 'Error file_put_content: failed to create signature file.'; |
@@ -129,12 +129,12 @@ discard block |
||
129 | 129 | if (!$error) { |
130 | 130 | // Defined modele of doc |
131 | 131 | $last_main_doc_file = $object->last_main_doc; |
132 | - $directdownloadlink = $object->getLastMainDocLink('proposal'); // url to download the $object->last_main_doc |
|
132 | + $directdownloadlink = $object->getLastMainDocLink('proposal'); // url to download the $object->last_main_doc |
|
133 | 133 | |
134 | 134 | if (preg_match('/\.pdf/i', $last_main_doc_file)) { |
135 | 135 | // TODO Use the $last_main_doc_file to defined the $newpdffilename and $sourcefile |
136 | - $newpdffilename = $upload_dir . $ref . "_signed-" . $date . ".pdf"; |
|
137 | - $sourcefile = $upload_dir . $ref . ".pdf"; |
|
136 | + $newpdffilename = $upload_dir.$ref."_signed-".$date.".pdf"; |
|
137 | + $sourcefile = $upload_dir.$ref.".pdf"; |
|
138 | 138 | |
139 | 139 | if (dol_is_file($sourcefile)) { |
140 | 140 | // We build the new PDF |
@@ -150,9 +150,9 @@ discard block |
||
150 | 150 | } |
151 | 151 | |
152 | 152 | //$pdf->Open(); |
153 | - $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
153 | + $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
154 | 154 | |
155 | - $s = array(); // Array with size of each page. Exemple array(w'=>210, 'h'=>297); |
|
155 | + $s = array(); // Array with size of each page. Exemple array(w'=>210, 'h'=>297); |
|
156 | 156 | for ($i = 1; $i < ($pagecount + 1); $i++) { |
157 | 157 | try { |
158 | 158 | $tppl = $pdf->importPage($i); |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); |
161 | 161 | $pdf->useTemplate($tppl); |
162 | 162 | } catch (Exception $e) { |
163 | - dol_syslog("Error when manipulating the PDF " . $sourcefile . " by onlineSign: " . $e->getMessage(), LOG_ERR); |
|
163 | + dol_syslog("Error when manipulating the PDF ".$sourcefile." by onlineSign: ".$e->getMessage(), LOG_ERR); |
|
164 | 164 | $response = $e->getMessage(); |
165 | 165 | $error++; |
166 | 166 | } |
@@ -174,11 +174,11 @@ discard block |
||
174 | 174 | |
175 | 175 | $pdf->SetXY($xforimgstart, $yforimgstart + round($wforimg / 4) - 4); |
176 | 176 | $pdf->SetFont($default_font, '', $default_font_size - 1); |
177 | - $pdf->MultiCell($wforimg, 4, $langs->trans("DateSigning") . ': ' . dol_print_date(dol_now(), "daytext", false, $langs, true), 0, 'L'); |
|
177 | + $pdf->MultiCell($wforimg, 4, $langs->trans("DateSigning").': '.dol_print_date(dol_now(), "daytext", false, $langs, true), 0, 'L'); |
|
178 | 178 | $pdf->SetXY($xforimgstart, $yforimgstart + round($wforimg / 4)); |
179 | - $pdf->MultiCell($wforimg, 4, $langs->trans("Lastname") . ': ' . $online_sign_name, 0, 'L'); |
|
179 | + $pdf->MultiCell($wforimg, 4, $langs->trans("Lastname").': '.$online_sign_name, 0, 'L'); |
|
180 | 180 | |
181 | - $pdf->Image($upload_dir . $filename, $xforimgstart, $yforimgstart, $wforimg, round($wforimg / 4)); |
|
181 | + $pdf->Image($upload_dir.$filename, $xforimgstart, $yforimgstart, $wforimg, round($wforimg / 4)); |
|
182 | 182 | |
183 | 183 | //$pdf->Close(); |
184 | 184 | $pdf->Output($newpdffilename, "F"); |
@@ -200,14 +200,14 @@ discard block |
||
200 | 200 | |
201 | 201 | $online_sign_ip = getUserRemoteIP(); |
202 | 202 | |
203 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "propal"; |
|
204 | - $sql .= " SET fk_statut = " . ((int) $object::STATUS_SIGNED) . ", note_private = '" . $db->escape($object->note_private) . "',"; |
|
205 | - $sql .= " date_signature = '" . $db->idate(dol_now()) . "',"; |
|
206 | - $sql .= " online_sign_ip = '" . $db->escape($online_sign_ip) . "'"; |
|
203 | + $sql = "UPDATE ".MAIN_DB_PREFIX."propal"; |
|
204 | + $sql .= " SET fk_statut = ".((int) $object::STATUS_SIGNED).", note_private = '".$db->escape($object->note_private)."',"; |
|
205 | + $sql .= " date_signature = '".$db->idate(dol_now())."',"; |
|
206 | + $sql .= " online_sign_ip = '".$db->escape($online_sign_ip)."'"; |
|
207 | 207 | if ($online_sign_name) { |
208 | - $sql .= ", online_sign_name = '" . $db->escape($online_sign_name) . "'"; |
|
208 | + $sql .= ", online_sign_name = '".$db->escape($online_sign_name)."'"; |
|
209 | 209 | } |
210 | - $sql .= " WHERE rowid = " . ((int) $object->id); |
|
210 | + $sql .= " WHERE rowid = ".((int) $object->id); |
|
211 | 211 | |
212 | 212 | dol_syslog(__METHOD__, LOG_DEBUG); |
213 | 213 | $resql = $db->query($sql); |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | $result = $object->call_trigger('PROPAL_CLOSE_SIGNED', $user); |
227 | 227 | if ($result < 0) { |
228 | 228 | $error++; |
229 | - $response = "error in trigger " . $object->error; |
|
229 | + $response = "error in trigger ".$object->error; |
|
230 | 230 | } else { |
231 | 231 | $response = "success"; |
232 | 232 | } |
@@ -247,25 +247,25 @@ discard block |
||
247 | 247 | } |
248 | 248 | } |
249 | 249 | } elseif ($mode == 'contract') { |
250 | - require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php'; |
|
251 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/pdf.lib.php'; |
|
250 | + require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; |
|
251 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; |
|
252 | 252 | $object = new Contrat($db); |
253 | 253 | $object->fetch(0, $ref); |
254 | 254 | |
255 | 255 | $upload_dir = !empty($conf->contrat->multidir_output[$object->entity]) ? $conf->contrat->multidir_output[$object->entity] : $conf->contrat->dir_output; |
256 | - $upload_dir .= '/' . dol_sanitizeFileName($object->ref) . '/'; |
|
256 | + $upload_dir .= '/'.dol_sanitizeFileName($object->ref).'/'; |
|
257 | 257 | |
258 | 258 | $date = dol_print_date(dol_now(), "%Y%m%d%H%M%S"); |
259 | - $filename = "signatures/" . $date . "_signature.png"; |
|
260 | - if (!is_dir($upload_dir . "signatures/")) { |
|
261 | - if (!dol_mkdir($upload_dir . "signatures/")) { |
|
262 | - $response = "Error mkdir. Failed to create dir " . $upload_dir . "signatures/"; |
|
259 | + $filename = "signatures/".$date."_signature.png"; |
|
260 | + if (!is_dir($upload_dir."signatures/")) { |
|
261 | + if (!dol_mkdir($upload_dir."signatures/")) { |
|
262 | + $response = "Error mkdir. Failed to create dir ".$upload_dir."signatures/"; |
|
263 | 263 | $error++; |
264 | 264 | } |
265 | 265 | } |
266 | 266 | |
267 | 267 | if (!$error) { |
268 | - $return = file_put_contents($upload_dir . $filename, $data); |
|
268 | + $return = file_put_contents($upload_dir.$filename, $data); |
|
269 | 269 | if ($return == false) { |
270 | 270 | $error++; |
271 | 271 | $response = 'Error file_put_content: failed to create signature file.'; |
@@ -275,11 +275,11 @@ discard block |
||
275 | 275 | if (!$error) { |
276 | 276 | // Defined modele of doc |
277 | 277 | $last_main_doc_file = $object->last_main_doc; |
278 | - $directdownloadlink = $object->getLastMainDocLink('contrat'); // url to download the $object->last_main_doc |
|
278 | + $directdownloadlink = $object->getLastMainDocLink('contrat'); // url to download the $object->last_main_doc |
|
279 | 279 | if (preg_match('/\.pdf/i', $last_main_doc_file)) { |
280 | 280 | // TODO Use the $last_main_doc_file to defined the $newpdffilename and $sourcefile |
281 | - $newpdffilename = $upload_dir . $ref . "_signed-" . $date . ".pdf"; |
|
282 | - $sourcefile = $upload_dir . $ref . ".pdf"; |
|
281 | + $newpdffilename = $upload_dir.$ref."_signed-".$date.".pdf"; |
|
282 | + $sourcefile = $upload_dir.$ref.".pdf"; |
|
283 | 283 | |
284 | 284 | if (dol_is_file($sourcefile)) { |
285 | 285 | // We build the new PDF |
@@ -296,8 +296,8 @@ discard block |
||
296 | 296 | |
297 | 297 | |
298 | 298 | //$pdf->Open(); |
299 | - $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
300 | - $s = array(); // Array with size of each page. Exemple array(w'=>210, 'h'=>297); |
|
299 | + $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
300 | + $s = array(); // Array with size of each page. Exemple array(w'=>210, 'h'=>297); |
|
301 | 301 | for ($i = 1; $i < ($pagecount + 1); $i++) { |
302 | 302 | try { |
303 | 303 | $tppl = $pdf->importPage($i); |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); |
306 | 306 | $pdf->useTemplate($tppl); |
307 | 307 | } catch (Exception $e) { |
308 | - dol_syslog("Error when manipulating some PDF by onlineSign: " . $e->getMessage(), LOG_ERR); |
|
308 | + dol_syslog("Error when manipulating some PDF by onlineSign: ".$e->getMessage(), LOG_ERR); |
|
309 | 309 | $response = $e->getMessage(); |
310 | 310 | $error++; |
311 | 311 | } |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | $yforimgstart = (empty($s['h']) ? 240 : $s['h'] - 65); |
318 | 318 | $wforimg = $s['w'] / 2 - $xforimgstart; |
319 | 319 | |
320 | - $pdf->Image($upload_dir . $filename, $xforimgstart, $yforimgstart, $wforimg, round($wforimg / 4)); |
|
320 | + $pdf->Image($upload_dir.$filename, $xforimgstart, $yforimgstart, $wforimg, round($wforimg / 4)); |
|
321 | 321 | //$pdf->Close(); |
322 | 322 | $pdf->Output($newpdffilename, "F"); |
323 | 323 | |
@@ -336,24 +336,24 @@ discard block |
||
336 | 336 | } |
337 | 337 | } |
338 | 338 | } elseif ($mode == 'fichinter') { |
339 | - require_once DOL_DOCUMENT_ROOT . '/fichinter/class/fichinter.class.php'; |
|
340 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/pdf.lib.php'; |
|
339 | + require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; |
|
340 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; |
|
341 | 341 | $object = new Fichinter($db); |
342 | 342 | $object->fetch(0, $ref); |
343 | 343 | |
344 | 344 | $upload_dir = !empty($conf->ficheinter->multidir_output[$object->entity]) ? $conf->ficheinter->multidir_output[$object->entity] : $conf->ficheinter->dir_output; |
345 | - $upload_dir .= '/' . dol_sanitizeFileName($object->ref) . '/'; |
|
345 | + $upload_dir .= '/'.dol_sanitizeFileName($object->ref).'/'; |
|
346 | 346 | $date = dol_print_date(dol_now(), "%Y%m%d%H%M%S"); |
347 | - $filename = "signatures/" . $date . "_signature.png"; |
|
348 | - if (!is_dir($upload_dir . "signatures/")) { |
|
349 | - if (!dol_mkdir($upload_dir . "signatures/")) { |
|
350 | - $response = "Error mkdir. Failed to create dir " . $upload_dir . "signatures/"; |
|
347 | + $filename = "signatures/".$date."_signature.png"; |
|
348 | + if (!is_dir($upload_dir."signatures/")) { |
|
349 | + if (!dol_mkdir($upload_dir."signatures/")) { |
|
350 | + $response = "Error mkdir. Failed to create dir ".$upload_dir."signatures/"; |
|
351 | 351 | $error++; |
352 | 352 | } |
353 | 353 | } |
354 | 354 | |
355 | 355 | if (!$error) { |
356 | - $return = file_put_contents($upload_dir . $filename, $data); |
|
356 | + $return = file_put_contents($upload_dir.$filename, $data); |
|
357 | 357 | if ($return == false) { |
358 | 358 | $error++; |
359 | 359 | $response = 'Error file_put_content: failed to create signature file.'; |
@@ -363,11 +363,11 @@ discard block |
||
363 | 363 | if (!$error) { |
364 | 364 | // Defined modele of doc |
365 | 365 | $last_main_doc_file = $object->last_main_doc; |
366 | - $directdownloadlink = $object->getLastMainDocLink('fichinter'); // url to download the $object->last_main_doc |
|
366 | + $directdownloadlink = $object->getLastMainDocLink('fichinter'); // url to download the $object->last_main_doc |
|
367 | 367 | if (preg_match('/\.pdf/i', $last_main_doc_file)) { |
368 | 368 | // TODO Use the $last_main_doc_file to defined the $newpdffilename and $sourcefile |
369 | - $newpdffilename = $upload_dir . $ref . "_signed-" . $date . ".pdf"; |
|
370 | - $sourcefile = $upload_dir . $ref . ".pdf"; |
|
369 | + $newpdffilename = $upload_dir.$ref."_signed-".$date.".pdf"; |
|
370 | + $sourcefile = $upload_dir.$ref.".pdf"; |
|
371 | 371 | |
372 | 372 | if (dol_is_file($sourcefile)) { |
373 | 373 | // We build the new PDF |
@@ -384,8 +384,8 @@ discard block |
||
384 | 384 | |
385 | 385 | |
386 | 386 | //$pdf->Open(); |
387 | - $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
388 | - $s = array(); // Array with size of each page. Exemple array(w'=>210, 'h'=>297); |
|
387 | + $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
388 | + $s = array(); // Array with size of each page. Exemple array(w'=>210, 'h'=>297); |
|
389 | 389 | for ($i = 1; $i < ($pagecount + 1); $i++) { |
390 | 390 | try { |
391 | 391 | $tppl = $pdf->importPage($i); |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); |
394 | 394 | $pdf->useTemplate($tppl); |
395 | 395 | } catch (Exception $e) { |
396 | - dol_syslog("Error when manipulating some PDF by onlineSign: " . $e->getMessage(), LOG_ERR); |
|
396 | + dol_syslog("Error when manipulating some PDF by onlineSign: ".$e->getMessage(), LOG_ERR); |
|
397 | 397 | $response = $e->getMessage(); |
398 | 398 | $error++; |
399 | 399 | } |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | $xforimgstart = 105; |
405 | 405 | $yforimgstart = (empty($s['h']) ? 250 : $s['h'] - 57); |
406 | 406 | $wforimg = $s['w'] / 1 - ($xforimgstart + 16); |
407 | - $pdf->Image($upload_dir . $filename, $xforimgstart, $yforimgstart, $wforimg, round($wforimg / 4)); |
|
407 | + $pdf->Image($upload_dir.$filename, $xforimgstart, $yforimgstart, $wforimg, round($wforimg / 4)); |
|
408 | 408 | //$pdf->Close(); |
409 | 409 | $pdf->Output($newpdffilename, "F"); |
410 | 410 | |
@@ -424,8 +424,8 @@ discard block |
||
424 | 424 | } |
425 | 425 | } elseif ($mode == "societe_rib") { |
426 | 426 | $langs->load('withdrawals'); |
427 | - require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php'; |
|
428 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/pdf.lib.php'; |
|
427 | + require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; |
|
428 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; |
|
429 | 429 | $modelpath = "core/modules/bank/doc/"; |
430 | 430 | $object = new CompanyBankAccount($db); |
431 | 431 | $object->fetch($ref); |
@@ -433,24 +433,24 @@ discard block |
||
433 | 433 | $object->fetch_thirdparty(); |
434 | 434 | |
435 | 435 | |
436 | - $upload_dir = $conf->societe->multidir_output[$object->thirdparty->entity] . '/' |
|
437 | - . dol_sanitizeFileName($object->thirdparty->id) . '/'; |
|
436 | + $upload_dir = $conf->societe->multidir_output[$object->thirdparty->entity].'/' |
|
437 | + . dol_sanitizeFileName($object->thirdparty->id).'/'; |
|
438 | 438 | |
439 | - $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
440 | - $default_font = pdf_getPDFFont($langs); // Must be after pdf_getInstance |
|
439 | + $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
440 | + $default_font = pdf_getPDFFont($langs); // Must be after pdf_getInstance |
|
441 | 441 | $langs->loadLangs(array("main", "companies")); |
442 | 442 | |
443 | 443 | $date = dol_print_date(dol_now(), "%Y%m%d%H%M%S"); |
444 | - $filename = "signatures/" . $date . "_signature.png"; |
|
445 | - if (!is_dir($upload_dir . "signatures/")) { |
|
446 | - if (!dol_mkdir($upload_dir . "signatures/")) { |
|
447 | - $response = "Error mkdir. Failed to create dir " . $upload_dir . "signatures/"; |
|
444 | + $filename = "signatures/".$date."_signature.png"; |
|
445 | + if (!is_dir($upload_dir."signatures/")) { |
|
446 | + if (!dol_mkdir($upload_dir."signatures/")) { |
|
447 | + $response = "Error mkdir. Failed to create dir ".$upload_dir."signatures/"; |
|
448 | 448 | $error++; |
449 | 449 | } |
450 | 450 | } |
451 | 451 | |
452 | 452 | if (!$error) { |
453 | - $return = file_put_contents($upload_dir . $filename, $data); |
|
453 | + $return = file_put_contents($upload_dir.$filename, $data); |
|
454 | 454 | if ($return == false) { |
455 | 455 | $error++; |
456 | 456 | $response = 'Error file_put_content: failed to create signature file.'; |
@@ -461,14 +461,14 @@ discard block |
||
461 | 461 | // Defined modele of doc |
462 | 462 | $last_main_doc_file = $object->last_main_doc; |
463 | 463 | $last_modelpdf = $object->model_pdf; |
464 | - $directdownloadlink = $object->getLastMainDocLink('company'); // url to download the $object->last_main_doc |
|
464 | + $directdownloadlink = $object->getLastMainDocLink('company'); // url to download the $object->last_main_doc |
|
465 | 465 | |
466 | 466 | if (preg_match('/\.pdf/i', $last_main_doc_file)) { |
467 | 467 | $sourcefile = ''; |
468 | 468 | $newpdffilename = ''; |
469 | 469 | if ($last_modelpdf == 'sepamandate') { |
470 | - $newpdffilename = $upload_dir . $langs->transnoentitiesnoconv("SepaMandateShort") . ' ' . dol_sanitizeFileName($object->ref) . "-" . dol_sanitizeFileName($object->rum) . "_signed-" . $date . ".pdf"; |
|
471 | - $sourcefile = $upload_dir . $langs->transnoentitiesnoconv("SepaMandateShort") . ' ' . dol_sanitizeFileName($object->ref) . "-" . dol_sanitizeFileName($object->rum) . ".pdf"; |
|
470 | + $newpdffilename = $upload_dir.$langs->transnoentitiesnoconv("SepaMandateShort").' '.dol_sanitizeFileName($object->ref)."-".dol_sanitizeFileName($object->rum)."_signed-".$date.".pdf"; |
|
471 | + $sourcefile = $upload_dir.$langs->transnoentitiesnoconv("SepaMandateShort").' '.dol_sanitizeFileName($object->ref)."-".dol_sanitizeFileName($object->rum).".pdf"; |
|
472 | 472 | } |
473 | 473 | if (dol_is_file($sourcefile)) { |
474 | 474 | // We build the new PDF |
@@ -484,9 +484,9 @@ discard block |
||
484 | 484 | } |
485 | 485 | |
486 | 486 | //$pdf->Open(); |
487 | - $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
487 | + $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
488 | 488 | |
489 | - $s = array(); // Array with size of each page. Exemple array(w'=>210, 'h'=>297); |
|
489 | + $s = array(); // Array with size of each page. Exemple array(w'=>210, 'h'=>297); |
|
490 | 490 | for ($i = 1; $i < ($pagecount + 1); $i++) { |
491 | 491 | try { |
492 | 492 | $tppl = $pdf->importPage($i); |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); |
495 | 495 | $pdf->useTemplate($tppl); |
496 | 496 | } catch (Exception $e) { |
497 | - dol_syslog("Error when manipulating the PDF " . $sourcefile . " by onlineSign: " . $e->getMessage(), LOG_ERR); |
|
497 | + dol_syslog("Error when manipulating the PDF ".$sourcefile." by onlineSign: ".$e->getMessage(), LOG_ERR); |
|
498 | 498 | $response = $e->getMessage(); |
499 | 499 | $error++; |
500 | 500 | } |
@@ -510,12 +510,12 @@ discard block |
||
510 | 510 | $dirmodels = array_merge($dirmodels, $conf->modules_parts['models']); |
511 | 511 | } |
512 | 512 | foreach ($dirmodels as $reldir) { |
513 | - $file = "pdf_" . $last_modelpdf . ".modules.php"; |
|
513 | + $file = "pdf_".$last_modelpdf.".modules.php"; |
|
514 | 514 | // On vérifie l'emplacement du modele |
515 | - $file = dol_buildpath($reldir . $modelpath . $file, 0); |
|
515 | + $file = dol_buildpath($reldir.$modelpath.$file, 0); |
|
516 | 516 | if (file_exists($file)) { |
517 | 517 | $filefound = $file; |
518 | - $classname = 'pdf_' . $last_modelpdf; |
|
518 | + $classname = 'pdf_'.$last_modelpdf; |
|
519 | 519 | break; |
520 | 520 | } |
521 | 521 | if ($filefound) { |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | } |
525 | 525 | |
526 | 526 | if (!$filefound) { |
527 | - $response = $langs->trans("Error") . ' Failed to load doc generator with modelpaths=' . $modelpath . ' - modele=' . $last_modelpdf; |
|
527 | + $response = $langs->trans("Error").' Failed to load doc generator with modelpaths='.$modelpath.' - modele='.$last_modelpdf; |
|
528 | 528 | dol_syslog($response, LOG_ERR); |
529 | 529 | $error++; |
530 | 530 | } |
@@ -547,10 +547,10 @@ discard block |
||
547 | 547 | $wforimg = $s['w'] - 20 - $xforimgstart; |
548 | 548 | |
549 | 549 | $pdf->SetXY($xforimgstart, $yforimgstart + round($wforimg / 4)); |
550 | - $pdf->MultiCell($wforimg, 4, $langs->trans("Lastname") . ': ' . $online_sign_name, 0, 'L'); |
|
550 | + $pdf->MultiCell($wforimg, 4, $langs->trans("Lastname").': '.$online_sign_name, 0, 'L'); |
|
551 | 551 | |
552 | 552 | // A signature image file is 720 x 180 (ratio 1/4) but we use only the size into PDF |
553 | - $pdf->Image($upload_dir . $filename, $xforimgstart, $yforimgstart, $wforimg, round($wforimg / 4)); |
|
553 | + $pdf->Image($upload_dir.$filename, $xforimgstart, $yforimgstart, $wforimg, round($wforimg / 4)); |
|
554 | 554 | } |
555 | 555 | //$pdf->Close(); |
556 | 556 | $pdf->Output($newpdffilename, "F"); |
@@ -576,16 +576,16 @@ discard block |
||
576 | 576 | |
577 | 577 | $online_sign_ip = getUserRemoteIP(); |
578 | 578 | |
579 | - $sql = "UPDATE " . MAIN_DB_PREFIX . $object->table_element; |
|
579 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$object->table_element; |
|
580 | 580 | $sql .= " SET "; |
581 | - $sql .= " date_signature = '" . $db->idate(dol_now()) . "',"; |
|
582 | - $sql .= " online_sign_ip = '" . $db->escape($online_sign_ip) . "'"; |
|
581 | + $sql .= " date_signature = '".$db->idate(dol_now())."',"; |
|
582 | + $sql .= " online_sign_ip = '".$db->escape($online_sign_ip)."'"; |
|
583 | 583 | if ($online_sign_name) { |
584 | - $sql .= ", online_sign_name = '" . $db->escape($online_sign_name) . "'"; |
|
584 | + $sql .= ", online_sign_name = '".$db->escape($online_sign_name)."'"; |
|
585 | 585 | } |
586 | 586 | //$sql .= ", last_main_doc = '" . $db->escape($object->element'..') . "'"; |
587 | 587 | |
588 | - $sql .= " WHERE rowid = " . ((int) $object->id); |
|
588 | + $sql .= " WHERE rowid = ".((int) $object->id); |
|
589 | 589 | |
590 | 590 | dol_syslog(__METHOD__, LOG_DEBUG); |
591 | 591 | $resql = $db->query($sql); |
@@ -846,16 +846,16 @@ discard block |
||
846 | 846 | } |
847 | 847 | $labelextra = $langs->trans((string) $extrafields->attributes[$this->table_element]['label'][$key]); |
848 | 848 | if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') { |
849 | - $datas[$key]= '<br><b><u>'. $labelextra . '</u></b>'; |
|
849 | + $datas[$key] = '<br><b><u>'.$labelextra.'</u></b>'; |
|
850 | 850 | } else { |
851 | - $value = (empty($this->array_options['options_' . $key]) ? '' : $this->array_options['options_' . $key]); |
|
852 | - $datas[$key]= '<br><b>'. $labelextra . ':</b> ' . $extrafields->showOutputField($key, $value, '', $this->table_element); |
|
851 | + $value = (empty($this->array_options['options_'.$key]) ? '' : $this->array_options['options_'.$key]); |
|
852 | + $datas[$key] = '<br><b>'.$labelextra.':</b> '.$extrafields->showOutputField($key, $value, '', $this->table_element); |
|
853 | 853 | $count++; |
854 | 854 | } |
855 | 855 | } |
856 | 856 | } |
857 | 857 | |
858 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
858 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
859 | 859 | $parameters = array( |
860 | 860 | 'tooltipcontentarray' => &$datas, |
861 | 861 | 'params' => $params, |
@@ -1334,7 +1334,7 @@ discard block |
||
1334 | 1334 | if ($source == 'external' || $source == 'thirdparty') { |
1335 | 1335 | $sql .= " AND tc.source = 'external'"; |
1336 | 1336 | if ($status >= 0) { |
1337 | - $sql .= " AND t.statut = ".((int) $status); // t is llx_socpeople |
|
1337 | + $sql .= " AND t.statut = ".((int) $status); // t is llx_socpeople |
|
1338 | 1338 | } |
1339 | 1339 | } |
1340 | 1340 | $sql .= " AND tc.active = 1"; |
@@ -1693,8 +1693,8 @@ discard block |
||
1693 | 1693 | if ($idtofetch) { |
1694 | 1694 | $thirdparty = new Societe($this->db); |
1695 | 1695 | $result = $thirdparty->fetch($idtofetch); |
1696 | - if ($result<0) { |
|
1697 | - $this->errors=array_merge($this->errors, $thirdparty->errors); |
|
1696 | + if ($result < 0) { |
|
1697 | + $this->errors = array_merge($this->errors, $thirdparty->errors); |
|
1698 | 1698 | } |
1699 | 1699 | $this->thirdparty = $thirdparty; |
1700 | 1700 | |
@@ -1996,9 +1996,9 @@ discard block |
||
1996 | 1996 | if ($trigkey) { |
1997 | 1997 | $oldvalue = null; |
1998 | 1998 | |
1999 | - $sql = "SELECT " . $field; |
|
2000 | - $sql .= " FROM " . MAIN_DB_PREFIX . $table; |
|
2001 | - $sql .= " WHERE " . $id_field . " = " . ((int) $id); |
|
1999 | + $sql = "SELECT ".$field; |
|
2000 | + $sql .= " FROM ".MAIN_DB_PREFIX.$table; |
|
2001 | + $sql .= " WHERE ".$id_field." = ".((int) $id); |
|
2002 | 2002 | |
2003 | 2003 | $resql = $this->db->query($sql); |
2004 | 2004 | if ($resql) { |
@@ -2127,7 +2127,7 @@ discard block |
||
2127 | 2127 | } |
2128 | 2128 | $restrictiononfksoc = empty($this->restrictiononfksoc) ? 0 : $this->restrictiononfksoc; |
2129 | 2129 | $sql = "SELECT MAX(te.".$fieldid.")"; |
2130 | - $sql .= " FROM ".(empty($nodbprefix) ?$this->db->prefix():'').$this->table_element." as te"; |
|
2130 | + $sql .= " FROM ".(empty($nodbprefix) ? $this->db->prefix() : '').$this->table_element." as te"; |
|
2131 | 2131 | if ($this->element == 'user' && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { |
2132 | 2132 | $sql .= ",".$this->db->prefix()."usergroup_user as ug"; |
2133 | 2133 | } |
@@ -2201,7 +2201,7 @@ discard block |
||
2201 | 2201 | $this->ref_previous = $row[0]; |
2202 | 2202 | |
2203 | 2203 | $sql = "SELECT MIN(te.".$fieldid.")"; |
2204 | - $sql .= " FROM ".(empty($nodbprefix) ?$this->db->prefix():'').$this->table_element." as te"; |
|
2204 | + $sql .= " FROM ".(empty($nodbprefix) ? $this->db->prefix() : '').$this->table_element." as te"; |
|
2205 | 2205 | if ($this->element == 'user' && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { |
2206 | 2206 | $sql .= ",".$this->db->prefix()."usergroup_user as ug"; |
2207 | 2207 | } |
@@ -2359,7 +2359,7 @@ discard block |
||
2359 | 2359 | // Triggers |
2360 | 2360 | if (!$error && !$notrigger) { |
2361 | 2361 | // Call triggers |
2362 | - $result = $this->call_trigger(strtoupper($this->element) . '_MODIFY', $user); |
|
2362 | + $result = $this->call_trigger(strtoupper($this->element).'_MODIFY', $user); |
|
2363 | 2363 | if ($result < 0) { |
2364 | 2364 | $error++; |
2365 | 2365 | } //Do also here what you must do to rollback action if trigger fail |
@@ -2724,7 +2724,7 @@ discard block |
||
2724 | 2724 | $sql = 'UPDATE '.$this->db->prefix().$this->table_element; |
2725 | 2725 | $sql .= " SET ".$fieldname." = ".(($id > 0 || $id == '0') ? ((int) $id) : 'NULL'); |
2726 | 2726 | if (in_array($this->table_element, array('propal', 'commande', 'societe'))) { |
2727 | - $sql .= " , deposit_percent = " . (empty($deposit_percent) ? 'NULL' : "'".$this->db->escape($deposit_percent)."'"); |
|
2727 | + $sql .= " , deposit_percent = ".(empty($deposit_percent) ? 'NULL' : "'".$this->db->escape($deposit_percent)."'"); |
|
2728 | 2728 | } |
2729 | 2729 | $sql .= ' WHERE rowid='.((int) $this->id); |
2730 | 2730 | |
@@ -3074,10 +3074,10 @@ discard block |
||
3074 | 3074 | $sql = "SELECT count(rowid) FROM ".$this->db->prefix().$this->table_element_line; |
3075 | 3075 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
3076 | 3076 | if (!$renum) { |
3077 | - $sql .= " AND " . $fieldposition . " = 0"; |
|
3077 | + $sql .= " AND ".$fieldposition." = 0"; |
|
3078 | 3078 | } |
3079 | 3079 | if ($renum) { |
3080 | - $sql .= " AND " . $fieldposition . " <> 0"; |
|
3080 | + $sql .= " AND ".$fieldposition." <> 0"; |
|
3081 | 3081 | } |
3082 | 3082 | |
3083 | 3083 | dol_syslog(get_class($this)."::line_order", LOG_DEBUG); |
@@ -3098,7 +3098,7 @@ discard block |
||
3098 | 3098 | if ($fk_parent_line) { |
3099 | 3099 | $sql .= ' AND fk_parent_line IS NULL'; |
3100 | 3100 | } |
3101 | - $sql .= " ORDER BY " . $fieldposition . " ASC, rowid " . $rowidorder; |
|
3101 | + $sql .= " ORDER BY ".$fieldposition." ASC, rowid ".$rowidorder; |
|
3102 | 3102 | |
3103 | 3103 | dol_syslog(get_class($this)."::line_order search all parent lines", LOG_DEBUG); |
3104 | 3104 | $resql = $this->db->query($sql); |
@@ -3149,7 +3149,7 @@ discard block |
||
3149 | 3149 | $sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line; |
3150 | 3150 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
3151 | 3151 | $sql .= ' AND fk_parent_line = '.((int) $id); |
3152 | - $sql .= " ORDER BY " . $fieldposition . " ASC"; |
|
3152 | + $sql .= " ORDER BY ".$fieldposition." ASC"; |
|
3153 | 3153 | |
3154 | 3154 | dol_syslog(get_class($this)."::getChildrenOfLine search children lines for line ".$id, LOG_DEBUG); |
3155 | 3155 | $resql = $this->db->query($sql); |
@@ -3232,8 +3232,8 @@ discard block |
||
3232 | 3232 | dol_print_error($this->db); |
3233 | 3233 | return -1; |
3234 | 3234 | } else { |
3235 | - $parameters=array('rowid'=>$rowid, 'rang'=>$rang, 'fieldposition' => $fieldposition); |
|
3236 | - $action=''; |
|
3235 | + $parameters = array('rowid'=>$rowid, 'rang'=>$rang, 'fieldposition' => $fieldposition); |
|
3236 | + $action = ''; |
|
3237 | 3237 | $reshook = $hookmanager->executeHooks('afterRankOfLineUpdate', $parameters, $this, $action); |
3238 | 3238 | return 1; |
3239 | 3239 | } |
@@ -3272,7 +3272,7 @@ discard block |
||
3272 | 3272 | |
3273 | 3273 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang); |
3274 | 3274 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
3275 | - $sql .= " AND " . $fieldposition . " = " . ((int) ($rang - 1)); |
|
3275 | + $sql .= " AND ".$fieldposition." = ".((int) ($rang - 1)); |
|
3276 | 3276 | if ($this->db->query($sql)) { |
3277 | 3277 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) ($rang - 1)); |
3278 | 3278 | $sql .= ' WHERE rowid = '.((int) $rowid); |
@@ -3303,7 +3303,7 @@ discard block |
||
3303 | 3303 | |
3304 | 3304 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang); |
3305 | 3305 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
3306 | - $sql .= " AND " . $fieldposition . " = " . ((int) ($rang + 1)); |
|
3306 | + $sql .= " AND ".$fieldposition." = ".((int) ($rang + 1)); |
|
3307 | 3307 | if ($this->db->query($sql)) { |
3308 | 3308 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) ($rang + 1)); |
3309 | 3309 | $sql .= ' WHERE rowid = '.((int) $rowid); |
@@ -3329,7 +3329,7 @@ discard block |
||
3329 | 3329 | $fieldposition = 'position'; |
3330 | 3330 | } |
3331 | 3331 | |
3332 | - $sql = "SELECT " . $fieldposition . " FROM ".$this->db->prefix().$this->table_element_line; |
|
3332 | + $sql = "SELECT ".$fieldposition." FROM ".$this->db->prefix().$this->table_element_line; |
|
3333 | 3333 | $sql .= " WHERE rowid = ".((int) $rowid); |
3334 | 3334 | |
3335 | 3335 | dol_syslog(get_class($this)."::getRangOfLine", LOG_DEBUG); |
@@ -3357,7 +3357,7 @@ discard block |
||
3357 | 3357 | |
3358 | 3358 | $sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line; |
3359 | 3359 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
3360 | - $sql .= " AND " . $fieldposition . " = ".((int) $rang); |
|
3360 | + $sql .= " AND ".$fieldposition." = ".((int) $rang); |
|
3361 | 3361 | $resql = $this->db->query($sql); |
3362 | 3362 | if ($resql) { |
3363 | 3363 | $row = $this->db->fetch_row($resql); |
@@ -3474,7 +3474,7 @@ discard block |
||
3474 | 3474 | $newsuffix = ''; |
3475 | 3475 | } |
3476 | 3476 | if (in_array($this->table_element, array('actioncomm', 'adherent', 'advtargetemailing', 'cronjob', 'establishment'))) { |
3477 | - $fieldusermod = "fk_user_mod"; |
|
3477 | + $fieldusermod = "fk_user_mod"; |
|
3478 | 3478 | } elseif ($this->table_element == 'ecm_files') { |
3479 | 3479 | $fieldusermod = "fk_user_m"; |
3480 | 3480 | } else { |
@@ -3846,7 +3846,7 @@ discard block |
||
3846 | 3846 | // It's because an entry for this element may be exist in llx_element_element before this modification (version <=14.2) and ave named only with their element name in fk_source or fk_target. |
3847 | 3847 | $coremodule = array('knowledgemanagement', 'partnership', 'workstation', 'ticket', 'recruitment', 'eventorganization', 'asset'); |
3848 | 3848 | // Add module part to target type if object has $module property and isn't in core modules. |
3849 | - $targettype = ((!empty($this->module) && ! in_array($this->module, $coremodule)) ? $this->module.'_' : '').$this->element; |
|
3849 | + $targettype = ((!empty($this->module) && !in_array($this->module, $coremodule)) ? $this->module.'_' : '').$this->element; |
|
3850 | 3850 | |
3851 | 3851 | $parameters = array('targettype'=>$targettype); |
3852 | 3852 | // Hook for explicitly set the targettype if it must be differtent than $this->element |
@@ -3858,19 +3858,19 @@ discard block |
||
3858 | 3858 | $this->db->begin(); |
3859 | 3859 | $error = 0; |
3860 | 3860 | |
3861 | - $sql = "INSERT INTO " . $this->db->prefix() . "element_element ("; |
|
3861 | + $sql = "INSERT INTO ".$this->db->prefix()."element_element ("; |
|
3862 | 3862 | $sql .= "fk_source"; |
3863 | 3863 | $sql .= ", sourcetype"; |
3864 | 3864 | $sql .= ", fk_target"; |
3865 | 3865 | $sql .= ", targettype"; |
3866 | 3866 | $sql .= ") VALUES ("; |
3867 | 3867 | $sql .= ((int) $origin_id); |
3868 | - $sql .= ", '" . $this->db->escape($origin) . "'"; |
|
3869 | - $sql .= ", " . ((int) $this->id); |
|
3870 | - $sql .= ", '" . $this->db->escape($targettype) . "'"; |
|
3868 | + $sql .= ", '".$this->db->escape($origin)."'"; |
|
3869 | + $sql .= ", ".((int) $this->id); |
|
3870 | + $sql .= ", '".$this->db->escape($targettype)."'"; |
|
3871 | 3871 | $sql .= ")"; |
3872 | 3872 | |
3873 | - dol_syslog(get_class($this) . "::add_object_linked", LOG_DEBUG); |
|
3873 | + dol_syslog(get_class($this)."::add_object_linked", LOG_DEBUG); |
|
3874 | 3874 | if ($this->db->query($sql)) { |
3875 | 3875 | if (!$notrigger) { |
3876 | 3876 | // Call trigger |
@@ -4177,20 +4177,20 @@ discard block |
||
4177 | 4177 | $this->db->begin(); |
4178 | 4178 | $error = 0; |
4179 | 4179 | |
4180 | - $sql = "UPDATE " . $this->db->prefix() . "element_element SET "; |
|
4180 | + $sql = "UPDATE ".$this->db->prefix()."element_element SET "; |
|
4181 | 4181 | if ($updatesource) { |
4182 | - $sql .= "fk_source = " . ((int) $sourceid); |
|
4183 | - $sql .= ", sourcetype = '" . $this->db->escape($sourcetype) . "'"; |
|
4184 | - $sql .= " WHERE fk_target = " . ((int) $this->id); |
|
4185 | - $sql .= " AND targettype = '" . $this->db->escape($this->element) . "'"; |
|
4182 | + $sql .= "fk_source = ".((int) $sourceid); |
|
4183 | + $sql .= ", sourcetype = '".$this->db->escape($sourcetype)."'"; |
|
4184 | + $sql .= " WHERE fk_target = ".((int) $this->id); |
|
4185 | + $sql .= " AND targettype = '".$this->db->escape($this->element)."'"; |
|
4186 | 4186 | } elseif ($updatetarget) { |
4187 | - $sql .= "fk_target = " . ((int) $targetid); |
|
4188 | - $sql .= ", targettype = '" . $this->db->escape($targettype) . "'"; |
|
4189 | - $sql .= " WHERE fk_source = " . ((int) $this->id); |
|
4190 | - $sql .= " AND sourcetype = '" . $this->db->escape($this->element) . "'"; |
|
4187 | + $sql .= "fk_target = ".((int) $targetid); |
|
4188 | + $sql .= ", targettype = '".$this->db->escape($targettype)."'"; |
|
4189 | + $sql .= " WHERE fk_source = ".((int) $this->id); |
|
4190 | + $sql .= " AND sourcetype = '".$this->db->escape($this->element)."'"; |
|
4191 | 4191 | } |
4192 | 4192 | |
4193 | - dol_syslog(get_class($this) . "::updateObjectLinked", LOG_DEBUG); |
|
4193 | + dol_syslog(get_class($this)."::updateObjectLinked", LOG_DEBUG); |
|
4194 | 4194 | if ($this->db->query($sql)) { |
4195 | 4195 | if (!$notrigger) { |
4196 | 4196 | // Call trigger |
@@ -4266,25 +4266,25 @@ discard block |
||
4266 | 4266 | } |
4267 | 4267 | |
4268 | 4268 | if (!$error) { |
4269 | - $sql = "DELETE FROM " . $this->db->prefix() . "element_element"; |
|
4269 | + $sql = "DELETE FROM ".$this->db->prefix()."element_element"; |
|
4270 | 4270 | $sql .= " WHERE"; |
4271 | 4271 | if ($rowid > 0) { |
4272 | - $sql .= " rowid = " . ((int) $rowid); |
|
4272 | + $sql .= " rowid = ".((int) $rowid); |
|
4273 | 4273 | } else { |
4274 | 4274 | if ($deletesource) { |
4275 | - $sql .= " fk_source = " . ((int) $sourceid) . " AND sourcetype = '" . $this->db->escape($sourcetype) . "'"; |
|
4276 | - $sql .= " AND fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($this->element) . "'"; |
|
4275 | + $sql .= " fk_source = ".((int) $sourceid)." AND sourcetype = '".$this->db->escape($sourcetype)."'"; |
|
4276 | + $sql .= " AND fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($this->element)."'"; |
|
4277 | 4277 | } elseif ($deletetarget) { |
4278 | - $sql .= " fk_target = " . ((int) $targetid) . " AND targettype = '" . $this->db->escape($targettype) . "'"; |
|
4279 | - $sql .= " AND fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($this->element) . "'"; |
|
4278 | + $sql .= " fk_target = ".((int) $targetid)." AND targettype = '".$this->db->escape($targettype)."'"; |
|
4279 | + $sql .= " AND fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($this->element)."'"; |
|
4280 | 4280 | } else { |
4281 | - $sql .= " (fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($this->element) . "')"; |
|
4281 | + $sql .= " (fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($this->element)."')"; |
|
4282 | 4282 | $sql .= " OR"; |
4283 | - $sql .= " (fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($this->element) . "')"; |
|
4283 | + $sql .= " (fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($this->element)."')"; |
|
4284 | 4284 | } |
4285 | 4285 | } |
4286 | 4286 | |
4287 | - dol_syslog(get_class($this) . "::deleteObjectLinked", LOG_DEBUG); |
|
4287 | + dol_syslog(get_class($this)."::deleteObjectLinked", LOG_DEBUG); |
|
4288 | 4288 | if (!$this->db->query($sql)) { |
4289 | 4289 | $this->error = $this->db->lasterror(); |
4290 | 4290 | $this->errors[] = $this->error; |
@@ -4446,14 +4446,14 @@ discard block |
||
4446 | 4446 | $sql .= ", date_validation = '".$this->db->idate(dol_now())."'"; |
4447 | 4447 | } |
4448 | 4448 | $sql .= " WHERE rowid = ".((int) $elementId); |
4449 | - $sql .= " AND ".$fieldstatus." <> ".((int) $status); // We avoid update if status already correct |
|
4449 | + $sql .= " AND ".$fieldstatus." <> ".((int) $status); // We avoid update if status already correct |
|
4450 | 4450 | |
4451 | 4451 | dol_syslog(get_class($this)."::setStatut", LOG_DEBUG); |
4452 | 4452 | $resql = $this->db->query($sql); |
4453 | 4453 | if ($resql) { |
4454 | 4454 | $error = 0; |
4455 | 4455 | |
4456 | - $nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct |
|
4456 | + $nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct |
|
4457 | 4457 | |
4458 | 4458 | if ($nb_rows_affected > 0) { |
4459 | 4459 | if (empty($trigkey)) { |
@@ -4607,7 +4607,7 @@ discard block |
||
4607 | 4607 | return -1; |
4608 | 4608 | } |
4609 | 4609 | |
4610 | - $arraytoscan = $this->childtables; // array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...) |
|
4610 | + $arraytoscan = $this->childtables; // array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...) |
|
4611 | 4611 | // For backward compatibility, we check if array is old format array('tablename1', 'tablename2', ...) |
4612 | 4612 | $tmparray = array_keys($this->childtables); |
4613 | 4613 | if (is_numeric($tmparray[0])) { |
@@ -4620,26 +4620,26 @@ discard block |
||
4620 | 4620 | //print $id.'-'.$table.'-'.$elementname.'<br>'; |
4621 | 4621 | // Check if element can be deleted |
4622 | 4622 | $sql = "SELECT COUNT(*) as nb"; |
4623 | - $sql.= " FROM ".$this->db->prefix().$table." as c"; |
|
4623 | + $sql .= " FROM ".$this->db->prefix().$table." as c"; |
|
4624 | 4624 | if (!empty($element['parent']) && !empty($element['parentkey'])) { |
4625 | - $sql.= ", ".$this->db->prefix().$element['parent']." as p"; |
|
4625 | + $sql .= ", ".$this->db->prefix().$element['parent']." as p"; |
|
4626 | 4626 | } |
4627 | 4627 | if (!empty($element['fk_element'])) { |
4628 | - $sql.= " WHERE c.".$element['fk_element']." = ".((int) $id); |
|
4628 | + $sql .= " WHERE c.".$element['fk_element']." = ".((int) $id); |
|
4629 | 4629 | } else { |
4630 | - $sql.= " WHERE c.".$this->fk_element." = ".((int) $id); |
|
4630 | + $sql .= " WHERE c.".$this->fk_element." = ".((int) $id); |
|
4631 | 4631 | } |
4632 | 4632 | if (!empty($element['parent']) && !empty($element['parentkey'])) { |
4633 | - $sql.= " AND c.".$element['parentkey']." = p.rowid"; |
|
4633 | + $sql .= " AND c.".$element['parentkey']." = p.rowid"; |
|
4634 | 4634 | } |
4635 | 4635 | if (!empty($element['parent']) && !empty($element['parenttypefield']) && !empty($element['parenttypevalue'])) { |
4636 | - $sql.= " AND c.".$element['parenttypefield']." = '".$this->db->escape($element['parenttypevalue'])."'"; |
|
4636 | + $sql .= " AND c.".$element['parenttypefield']." = '".$this->db->escape($element['parenttypevalue'])."'"; |
|
4637 | 4637 | } |
4638 | 4638 | if (!empty($entity)) { |
4639 | 4639 | if (!empty($element['parent']) && !empty($element['parentkey'])) { |
4640 | - $sql.= " AND p.entity = ".((int) $entity); |
|
4640 | + $sql .= " AND p.entity = ".((int) $entity); |
|
4641 | 4641 | } else { |
4642 | - $sql.= " AND c.entity = ".((int) $entity); |
|
4642 | + $sql .= " AND c.entity = ".((int) $entity); |
|
4643 | 4643 | } |
4644 | 4644 | } |
4645 | 4645 | |
@@ -4653,9 +4653,9 @@ discard block |
||
4653 | 4653 | if (is_numeric($element)) { // very old usage array('table1', 'table2', ...) |
4654 | 4654 | $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $table); |
4655 | 4655 | } elseif (is_string($element)) { // old usage array('table1' => 'TranslateKey1', 'table2' => 'TranslateKey2', ...) |
4656 | - $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element)); |
|
4656 | + $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element)); |
|
4657 | 4657 | } else { // new usage: $element['name']=Translation key |
4658 | - $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element['name'])); |
|
4658 | + $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element['name'])); |
|
4659 | 4659 | } |
4660 | 4660 | break; // We found at least one, we stop here |
4661 | 4661 | } |
@@ -4714,7 +4714,7 @@ discard block |
||
4714 | 4714 | */ |
4715 | 4715 | public function getTotalDiscount() |
4716 | 4716 | { |
4717 | - if (!empty($this->table_element_line) ) { |
|
4717 | + if (!empty($this->table_element_line)) { |
|
4718 | 4718 | $total_discount = 0.00; |
4719 | 4719 | |
4720 | 4720 | $sql = "SELECT subprice as pu_ht, qty, remise_percent, total_ht"; |
@@ -5661,7 +5661,7 @@ discard block |
||
5661 | 5661 | $setsharekey = false; |
5662 | 5662 | if ($this->element == 'propal' || $this->element == 'proposal') { |
5663 | 5663 | if (getDolGlobalInt("PROPOSAL_ALLOW_ONLINESIGN")) { |
5664 | - $setsharekey = true; // feature to make online signature is not set or set to on (default) |
|
5664 | + $setsharekey = true; // feature to make online signature is not set or set to on (default) |
|
5665 | 5665 | } |
5666 | 5666 | if (getDolGlobalInt("PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD")) { |
5667 | 5667 | $setsharekey = true; |
@@ -5719,7 +5719,7 @@ discard block |
||
5719 | 5719 | $ecmfile->gen_or_uploaded = 'generated'; |
5720 | 5720 | $ecmfile->description = ''; // indexed content |
5721 | 5721 | $ecmfile->keywords = ''; // keyword content |
5722 | - $ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'. |
|
5722 | + $ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'. |
|
5723 | 5723 | $ecmfile->src_object_id = $this->id; |
5724 | 5724 | |
5725 | 5725 | $result = $ecmfile->create($user); |
@@ -5771,7 +5771,7 @@ discard block |
||
5771 | 5771 | $maxwidthmini = $tmparraysize['maxwidthmini']; |
5772 | 5772 | $maxheightmini = $tmparraysize['maxheightmini']; |
5773 | 5773 | //$quality = $tmparraysize['quality']; |
5774 | - $quality = 50; // For thumbs, we force quality to 50 |
|
5774 | + $quality = 50; // For thumbs, we force quality to 50 |
|
5775 | 5775 | |
5776 | 5776 | // Create small thumbs for company (Ratio is near 16/9) |
5777 | 5777 | // Used on logon for example |
@@ -5872,8 +5872,8 @@ discard block |
||
5872 | 5872 | { |
5873 | 5873 | // phpcs:enable |
5874 | 5874 | global $langs, $conf; |
5875 | - if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX . '_') !== 0) { |
|
5876 | - dol_print_error('', 'The trigger "' . $triggerName . '" does not start with "' . self::TRIGGER_PREFIX . '_" as required.'); |
|
5875 | + if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX.'_') !== 0) { |
|
5876 | + dol_print_error('', 'The trigger "'.$triggerName.'" does not start with "'.self::TRIGGER_PREFIX.'_" as required.'); |
|
5877 | 5877 | exit; |
5878 | 5878 | } |
5879 | 5879 | if (!is_object($langs)) { // If lang was not defined, we set it. It is required by run_triggers(). |
@@ -6166,9 +6166,9 @@ discard block |
||
6166 | 6166 | if (!empty($extrafields->attributes[$this->table_element]) && !empty($extrafields->attributes[$this->table_element]['computed'][$key])) { |
6167 | 6167 | //var_dump($conf->disable_compute); |
6168 | 6168 | if (empty($conf->disable_compute)) { |
6169 | - global $objectoffield; // We set a global variable to $objectoffield so |
|
6170 | - $objectoffield = $this; // we can use it inside computed formula |
|
6171 | - $this->array_options['options_' . $key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2'); |
|
6169 | + global $objectoffield; // We set a global variable to $objectoffield so |
|
6170 | + $objectoffield = $this; // we can use it inside computed formula |
|
6171 | + $this->array_options['options_'.$key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2'); |
|
6172 | 6172 | } |
6173 | 6173 | } |
6174 | 6174 | } |
@@ -6182,7 +6182,7 @@ discard block |
||
6182 | 6182 | return 0; |
6183 | 6183 | } |
6184 | 6184 | } else { |
6185 | - $this->errors[]=$this->db->lasterror; |
|
6185 | + $this->errors[] = $this->db->lasterror; |
|
6186 | 6186 | return -1; |
6187 | 6187 | } |
6188 | 6188 | } |
@@ -6945,7 +6945,7 @@ discard block |
||
6945 | 6945 | // Special case that force options and type ($type can be integer, varchar, ...) |
6946 | 6946 | if (!empty($this->fields[$key]['arrayofkeyval']) && is_array($this->fields[$key]['arrayofkeyval'])) { |
6947 | 6947 | $param['options'] = $this->fields[$key]['arrayofkeyval']; |
6948 | - $type = (($this->fields[$key]['type']=='checkbox')?$this->fields[$key]['type']:'select'); |
|
6948 | + $type = (($this->fields[$key]['type'] == 'checkbox') ? $this->fields[$key]['type'] : 'select'); |
|
6949 | 6949 | } |
6950 | 6950 | |
6951 | 6951 | $label = $this->fields[$key]['label']; |
@@ -6997,7 +6997,7 @@ discard block |
||
6997 | 6997 | |
6998 | 6998 | // Add validation state class |
6999 | 6999 | if (!empty($validationClass)) { |
7000 | - $morecss.= $validationClass; |
|
7000 | + $morecss .= $validationClass; |
|
7001 | 7001 | } |
7002 | 7002 | |
7003 | 7003 | if (in_array($type, array('date'))) { |
@@ -7141,8 +7141,8 @@ discard block |
||
7141 | 7141 | } |
7142 | 7142 | |
7143 | 7143 | $sqlwhere = ''; |
7144 | - $sql = "SELECT " . $keyList; |
|
7145 | - $sql .= " FROM " . $this->db->prefix() . $InfoFieldList[0]; |
|
7144 | + $sql = "SELECT ".$keyList; |
|
7145 | + $sql .= " FROM ".$this->db->prefix().$InfoFieldList[0]; |
|
7146 | 7146 | if (!empty($InfoFieldList[4])) { |
7147 | 7147 | // can use SELECT request |
7148 | 7148 | if (strpos($InfoFieldList[4], '$SEL$') !== false) { |
@@ -7158,24 +7158,24 @@ discard block |
||
7158 | 7158 | |
7159 | 7159 | //We have to join on extrafield table |
7160 | 7160 | if (strpos($InfoFieldList[4], 'extra') !== false) { |
7161 | - $sql .= " as main, " . $this->db->prefix() . $InfoFieldList[0] . "_extrafields as extra"; |
|
7162 | - $sqlwhere .= " WHERE extra.fk_object=main." . $InfoFieldList[2] . " AND " . $InfoFieldList[4]; |
|
7161 | + $sql .= " as main, ".$this->db->prefix().$InfoFieldList[0]."_extrafields as extra"; |
|
7162 | + $sqlwhere .= " WHERE extra.fk_object=main.".$InfoFieldList[2]." AND ".$InfoFieldList[4]; |
|
7163 | 7163 | } else { |
7164 | - $sqlwhere .= " WHERE " . $InfoFieldList[4]; |
|
7164 | + $sqlwhere .= " WHERE ".$InfoFieldList[4]; |
|
7165 | 7165 | } |
7166 | 7166 | } else { |
7167 | 7167 | $sqlwhere .= ' WHERE 1=1'; |
7168 | 7168 | } |
7169 | 7169 | // Some tables may have field, some other not. For the moment we disable it. |
7170 | 7170 | if (in_array($InfoFieldList[0], array('tablewithentity'))) { |
7171 | - $sqlwhere .= " AND entity = " . ((int) $conf->entity); |
|
7171 | + $sqlwhere .= " AND entity = ".((int) $conf->entity); |
|
7172 | 7172 | } |
7173 | 7173 | $sql .= $sqlwhere; |
7174 | 7174 | //print $sql; |
7175 | 7175 | |
7176 | - $sql .= ' ORDER BY ' . implode(', ', $fields_label); |
|
7176 | + $sql .= ' ORDER BY '.implode(', ', $fields_label); |
|
7177 | 7177 | |
7178 | - dol_syslog(get_class($this) . '::showInputField type=sellist', LOG_DEBUG); |
|
7178 | + dol_syslog(get_class($this).'::showInputField type=sellist', LOG_DEBUG); |
|
7179 | 7179 | $resql = $this->db->query($sql); |
7180 | 7180 | if ($resql) { |
7181 | 7181 | $out .= '<option value="0"> </option>'; |
@@ -7191,7 +7191,7 @@ discard block |
||
7191 | 7191 | if (count($fields_label) > 1) { |
7192 | 7192 | $notrans = true; |
7193 | 7193 | foreach ($fields_label as $field_toshow) { |
7194 | - $labeltoshow .= $obj->$field_toshow . ' '; |
|
7194 | + $labeltoshow .= $obj->$field_toshow.' '; |
|
7195 | 7195 | } |
7196 | 7196 | } else { |
7197 | 7197 | $labeltoshow = $obj->{$InfoFieldList[1]}; |
@@ -7202,12 +7202,12 @@ discard block |
||
7202 | 7202 | foreach ($fields_label as $field_toshow) { |
7203 | 7203 | $translabel = $langs->trans($obj->$field_toshow); |
7204 | 7204 | if ($translabel != $obj->$field_toshow) { |
7205 | - $labeltoshow = dol_trunc($translabel) . ' '; |
|
7205 | + $labeltoshow = dol_trunc($translabel).' '; |
|
7206 | 7206 | } else { |
7207 | - $labeltoshow = dol_trunc($obj->$field_toshow) . ' '; |
|
7207 | + $labeltoshow = dol_trunc($obj->$field_toshow).' '; |
|
7208 | 7208 | } |
7209 | 7209 | } |
7210 | - $out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>'; |
|
7210 | + $out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>'; |
|
7211 | 7211 | } else { |
7212 | 7212 | if (!$notrans) { |
7213 | 7213 | $translabel = $langs->trans($obj->{$InfoFieldList[1]}); |
@@ -7221,34 +7221,34 @@ discard block |
||
7221 | 7221 | $labeltoshow = '(not defined)'; |
7222 | 7222 | } |
7223 | 7223 | if ($value == $obj->rowid) { |
7224 | - $out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>'; |
|
7224 | + $out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>'; |
|
7225 | 7225 | } |
7226 | 7226 | |
7227 | 7227 | if (!empty($InfoFieldList[3]) && $parentField) { |
7228 | - $parent = $parentName . ':' . $obj->{$parentField}; |
|
7228 | + $parent = $parentName.':'.$obj->{$parentField}; |
|
7229 | 7229 | $isDependList = 1; |
7230 | 7230 | } |
7231 | 7231 | |
7232 | - $out .= '<option value="' . $obj->rowid . '"'; |
|
7232 | + $out .= '<option value="'.$obj->rowid.'"'; |
|
7233 | 7233 | $out .= ($value == $obj->rowid ? ' selected' : ''); |
7234 | - $out .= (!empty($parent) ? ' parent="' . $parent . '"' : ''); |
|
7235 | - $out .= '>' . $labeltoshow . '</option>'; |
|
7234 | + $out .= (!empty($parent) ? ' parent="'.$parent.'"' : ''); |
|
7235 | + $out .= '>'.$labeltoshow.'</option>'; |
|
7236 | 7236 | } |
7237 | 7237 | |
7238 | 7238 | $i++; |
7239 | 7239 | } |
7240 | 7240 | $this->db->free($resql); |
7241 | 7241 | } else { |
7242 | - print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>'; |
|
7242 | + print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>'; |
|
7243 | 7243 | } |
7244 | 7244 | } else { |
7245 | 7245 | require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
7246 | 7246 | $data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1); |
7247 | 7247 | $out .= '<option value="0"> </option>'; |
7248 | 7248 | foreach ($data as $data_key => $data_value) { |
7249 | - $out .= '<option value="' . $data_key . '"'; |
|
7249 | + $out .= '<option value="'.$data_key.'"'; |
|
7250 | 7250 | $out .= ($value == $data_key ? ' selected' : ''); |
7251 | - $out .= '>' . $data_value . '</option>'; |
|
7251 | + $out .= '>'.$data_value.'</option>'; |
|
7252 | 7252 | } |
7253 | 7253 | } |
7254 | 7254 | } |
@@ -7313,8 +7313,8 @@ discard block |
||
7313 | 7313 | } |
7314 | 7314 | |
7315 | 7315 | $sqlwhere = ''; |
7316 | - $sql = "SELECT " . $keyList; |
|
7317 | - $sql .= ' FROM ' . $this->db->prefix() . $InfoFieldList[0]; |
|
7316 | + $sql = "SELECT ".$keyList; |
|
7317 | + $sql .= ' FROM '.$this->db->prefix().$InfoFieldList[0]; |
|
7318 | 7318 | if (!empty($InfoFieldList[4])) { |
7319 | 7319 | // can use SELECT request |
7320 | 7320 | if (strpos($InfoFieldList[4], '$SEL$') !== false) { |
@@ -7330,23 +7330,23 @@ discard block |
||
7330 | 7330 | |
7331 | 7331 | // We have to join on extrafield table |
7332 | 7332 | if (strpos($InfoFieldList[4], 'extra') !== false) { |
7333 | - $sql .= ' as main, ' . $this->db->prefix() . $InfoFieldList[0] . '_extrafields as extra'; |
|
7334 | - $sqlwhere .= " WHERE extra.fk_object=main." . $InfoFieldList[2] . " AND " . $InfoFieldList[4]; |
|
7333 | + $sql .= ' as main, '.$this->db->prefix().$InfoFieldList[0].'_extrafields as extra'; |
|
7334 | + $sqlwhere .= " WHERE extra.fk_object=main.".$InfoFieldList[2]." AND ".$InfoFieldList[4]; |
|
7335 | 7335 | } else { |
7336 | - $sqlwhere .= " WHERE " . $InfoFieldList[4]; |
|
7336 | + $sqlwhere .= " WHERE ".$InfoFieldList[4]; |
|
7337 | 7337 | } |
7338 | 7338 | } else { |
7339 | 7339 | $sqlwhere .= ' WHERE 1=1'; |
7340 | 7340 | } |
7341 | 7341 | // Some tables may have field, some other not. For the moment we disable it. |
7342 | 7342 | if (in_array($InfoFieldList[0], array('tablewithentity'))) { |
7343 | - $sqlwhere .= " AND entity = " . ((int) $conf->entity); |
|
7343 | + $sqlwhere .= " AND entity = ".((int) $conf->entity); |
|
7344 | 7344 | } |
7345 | 7345 | // $sql.=preg_replace('/^ AND /','',$sqlwhere); |
7346 | 7346 | // print $sql; |
7347 | 7347 | |
7348 | 7348 | $sql .= $sqlwhere; |
7349 | - dol_syslog(get_class($this) . '::showInputField type=chkbxlst', LOG_DEBUG); |
|
7349 | + dol_syslog(get_class($this).'::showInputField type=chkbxlst', LOG_DEBUG); |
|
7350 | 7350 | $resql = $this->db->query($sql); |
7351 | 7351 | if ($resql) { |
7352 | 7352 | $num = $this->db->num_rows($resql); |
@@ -7364,7 +7364,7 @@ discard block |
||
7364 | 7364 | if (count($fields_label) > 1) { |
7365 | 7365 | $notrans = true; |
7366 | 7366 | foreach ($fields_label as $field_toshow) { |
7367 | - $labeltoshow .= $obj->$field_toshow . ' '; |
|
7367 | + $labeltoshow .= $obj->$field_toshow.' '; |
|
7368 | 7368 | } |
7369 | 7369 | } else { |
7370 | 7370 | $labeltoshow = $obj->{$InfoFieldList[1]}; |
@@ -7375,9 +7375,9 @@ discard block |
||
7375 | 7375 | foreach ($fields_label as $field_toshow) { |
7376 | 7376 | $translabel = $langs->trans($obj->$field_toshow); |
7377 | 7377 | if ($translabel != $obj->$field_toshow) { |
7378 | - $labeltoshow = dol_trunc($translabel, 18) . ' '; |
|
7378 | + $labeltoshow = dol_trunc($translabel, 18).' '; |
|
7379 | 7379 | } else { |
7380 | - $labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' '; |
|
7380 | + $labeltoshow = dol_trunc($obj->$field_toshow, 18).' '; |
|
7381 | 7381 | } |
7382 | 7382 | } |
7383 | 7383 | |
@@ -7400,7 +7400,7 @@ discard block |
||
7400 | 7400 | } |
7401 | 7401 | |
7402 | 7402 | if (!empty($InfoFieldList[3]) && $parentField) { |
7403 | - $parent = $parentName . ':' . $obj->{$parentField}; |
|
7403 | + $parent = $parentName.':'.$obj->{$parentField}; |
|
7404 | 7404 | $isDependList = 1; |
7405 | 7405 | } |
7406 | 7406 | |
@@ -7411,14 +7411,14 @@ discard block |
||
7411 | 7411 | } |
7412 | 7412 | $this->db->free($resql); |
7413 | 7413 | |
7414 | - $out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%'); |
|
7414 | + $out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%'); |
|
7415 | 7415 | } else { |
7416 | - print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>'; |
|
7416 | + print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>'; |
|
7417 | 7417 | } |
7418 | 7418 | } else { |
7419 | 7419 | require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
7420 | 7420 | $data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1); |
7421 | - $out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%'); |
|
7421 | + $out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%'); |
|
7422 | 7422 | } |
7423 | 7423 | } |
7424 | 7424 | } elseif ($type == 'link') { |
@@ -7499,7 +7499,7 @@ discard block |
||
7499 | 7499 | $out = '<input type="hidden" value="'.$value.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'"/>'; |
7500 | 7500 | } |
7501 | 7501 | |
7502 | - if ($isDependList==1) { |
|
7502 | + if ($isDependList == 1) { |
|
7503 | 7503 | $out .= $this->getJSListDependancies('_common'); |
7504 | 7504 | } |
7505 | 7505 | /* Add comments |
@@ -7550,7 +7550,7 @@ discard block |
||
7550 | 7550 | $type = 'varchar'; // convert varchar(xx) int varchar |
7551 | 7551 | } |
7552 | 7552 | if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { |
7553 | - $type = (($this->fields[$key]['type']=='checkbox')?$this->fields[$key]['type']:'select'); |
|
7553 | + $type = (($this->fields[$key]['type'] == 'checkbox') ? $this->fields[$key]['type'] : 'select'); |
|
7554 | 7554 | } |
7555 | 7555 | if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)) { |
7556 | 7556 | $type = 'link'; |
@@ -7634,7 +7634,7 @@ discard block |
||
7634 | 7634 | $value = $this->getLibStatut(3); |
7635 | 7635 | } elseif ($type == 'date') { |
7636 | 7636 | if (!empty($value)) { |
7637 | - $value = dol_print_date($value, 'day'); // We suppose dates without time are always gmt (storage of course + output) |
|
7637 | + $value = dol_print_date($value, 'day'); // We suppose dates without time are always gmt (storage of course + output) |
|
7638 | 7638 | } else { |
7639 | 7639 | $value = ''; |
7640 | 7640 | } |
@@ -7672,7 +7672,7 @@ discard block |
||
7672 | 7672 | $value = price($value, 0, $langs, 0, 0, -1, $conf->currency); |
7673 | 7673 | } |
7674 | 7674 | } elseif ($type == 'select') { |
7675 | - $value = isset($param['options'][$value])?$param['options'][$value]:''; |
|
7675 | + $value = isset($param['options'][$value]) ? $param['options'][$value] : ''; |
|
7676 | 7676 | } elseif ($type == 'sellist') { |
7677 | 7677 | $param_list = array_keys($param['options']); |
7678 | 7678 | $InfoFieldList = explode(":", $param_list[0]); |
@@ -7732,9 +7732,9 @@ discard block |
||
7732 | 7732 | $translabel = $langs->trans($obj->$field_toshow); |
7733 | 7733 | } |
7734 | 7734 | if ($translabel != $field_toshow) { |
7735 | - $value .= dol_trunc($translabel, 18) . ' '; |
|
7735 | + $value .= dol_trunc($translabel, 18).' '; |
|
7736 | 7736 | } else { |
7737 | - $value .= $obj->$field_toshow . ' '; |
|
7737 | + $value .= $obj->$field_toshow.' '; |
|
7738 | 7738 | } |
7739 | 7739 | } |
7740 | 7740 | } else { |
@@ -7750,7 +7750,7 @@ discard block |
||
7750 | 7750 | } |
7751 | 7751 | } |
7752 | 7752 | } else { |
7753 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
7753 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
7754 | 7754 | |
7755 | 7755 | $toprint = array(); |
7756 | 7756 | $obj = $this->db->fetch_object($resql); |
@@ -7758,7 +7758,7 @@ discard block |
||
7758 | 7758 | $c->fetch($obj->rowid); |
7759 | 7759 | $ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text |
7760 | 7760 | foreach ($ways as $way) { |
7761 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>'; |
|
7761 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>'; |
|
7762 | 7762 | } |
7763 | 7763 | $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
7764 | 7764 | } |
@@ -7774,11 +7774,11 @@ discard block |
||
7774 | 7774 | $toprint = array(); |
7775 | 7775 | foreach ($value_arr as $keyval => $valueval) { |
7776 | 7776 | if (!empty($valueval)) { |
7777 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $param['options'][$valueval] . '</li>'; |
|
7777 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$param['options'][$valueval].'</li>'; |
|
7778 | 7778 | } |
7779 | 7779 | } |
7780 | 7780 | if (!empty($toprint)) { |
7781 | - $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; |
|
7781 | + $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
|
7782 | 7782 | } |
7783 | 7783 | } |
7784 | 7784 | } elseif ($type == 'chkbxlst') { |
@@ -7833,9 +7833,9 @@ discard block |
||
7833 | 7833 | $translabel = $langs->trans($obj->$field_toshow); |
7834 | 7834 | } |
7835 | 7835 | if ($translabel != $field_toshow) { |
7836 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>'; |
|
7836 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>'; |
|
7837 | 7837 | } else { |
7838 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->$field_toshow . '</li>'; |
|
7838 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->$field_toshow.'</li>'; |
|
7839 | 7839 | } |
7840 | 7840 | } |
7841 | 7841 | } else { |
@@ -7844,15 +7844,15 @@ discard block |
||
7844 | 7844 | $translabel = $langs->trans($obj->{$InfoFieldList[1]}); |
7845 | 7845 | } |
7846 | 7846 | if ($translabel != $obj->{$InfoFieldList[1]}) { |
7847 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>'; |
|
7847 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>'; |
|
7848 | 7848 | } else { |
7849 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->{$InfoFieldList[1]} . '</li>'; |
|
7849 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->{$InfoFieldList[1]}.'</li>'; |
|
7850 | 7850 | } |
7851 | 7851 | } |
7852 | 7852 | } |
7853 | 7853 | } |
7854 | 7854 | } else { |
7855 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
7855 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
7856 | 7856 | |
7857 | 7857 | $toprint = array(); |
7858 | 7858 | while ($obj = $this->db->fetch_object($resql)) { |
@@ -7861,7 +7861,7 @@ discard block |
||
7861 | 7861 | $c->fetch($obj->rowid); |
7862 | 7862 | $ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text |
7863 | 7863 | foreach ($ways as $way) { |
7864 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>'; |
|
7864 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>'; |
|
7865 | 7865 | } |
7866 | 7866 | } |
7867 | 7867 | } |
@@ -7995,7 +7995,7 @@ discard block |
||
7995 | 7995 | global $langs; |
7996 | 7996 | |
7997 | 7997 | if (!class_exists('Validate')) { |
7998 | - require_once DOL_DOCUMENT_ROOT . '/core/class/validate.class.php'; |
|
7998 | + require_once DOL_DOCUMENT_ROOT.'/core/class/validate.class.php'; |
|
7999 | 7999 | } |
8000 | 8000 | |
8001 | 8001 | $this->clearFieldError($fieldKey); |
@@ -8209,7 +8209,7 @@ discard block |
||
8209 | 8209 | $out .= "\n"; |
8210 | 8210 | |
8211 | 8211 | $nbofextrafieldsshown = 0; |
8212 | - $e = 0; // var to manage the modulo (odd/even) |
|
8212 | + $e = 0; // var to manage the modulo (odd/even) |
|
8213 | 8213 | |
8214 | 8214 | $lastseparatorkeyfound = ''; |
8215 | 8215 | $extrafields_collapse_num = ''; |
@@ -8260,7 +8260,7 @@ discard block |
||
8260 | 8260 | } |
8261 | 8261 | |
8262 | 8262 | $colspan = 0; |
8263 | - if (is_array($params) && count($params) > 0 && $display_type=='card') { |
|
8263 | + if (is_array($params) && count($params) > 0 && $display_type == 'card') { |
|
8264 | 8264 | if (array_key_exists('cols', $params)) { |
8265 | 8265 | $colspan = $params['cols']; |
8266 | 8266 | } elseif (array_key_exists('colspan', $params)) { // For backward compatibility. Use cols instead now. |
@@ -8347,7 +8347,7 @@ discard block |
||
8347 | 8347 | $domData .= ' data-targetid="'.$this->id.'"'; |
8348 | 8348 | |
8349 | 8349 | $html_id = (empty($this->id) ? '' : 'extrarow-'.$this->element.'_'.$key.'_'.$this->id); |
8350 | - if ($display_type=='card') { |
|
8350 | + if ($display_type == 'card') { |
|
8351 | 8351 | if (!empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) { |
8352 | 8352 | $colspan = 0; |
8353 | 8353 | } |
@@ -8458,12 +8458,12 @@ discard block |
||
8458 | 8458 | break; |
8459 | 8459 | } |
8460 | 8460 | |
8461 | - $out .= ($display_type=='card' ? '</td>' : '</div>'); |
|
8461 | + $out .= ($display_type == 'card' ? '</td>' : '</div>'); |
|
8462 | 8462 | |
8463 | 8463 | if (!empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && (($e % 2) == 1)) { |
8464 | - $out .= ($display_type=='card' ? '</tr>' : '</div>'); |
|
8464 | + $out .= ($display_type == 'card' ? '</tr>' : '</div>'); |
|
8465 | 8465 | } else { |
8466 | - $out .= ($display_type=='card' ? '</tr>' : '</div>'); |
|
8466 | + $out .= ($display_type == 'card' ? '</tr>' : '</div>'); |
|
8467 | 8467 | } |
8468 | 8468 | |
8469 | 8469 | $e++; |
@@ -8845,7 +8845,7 @@ discard block |
||
8845 | 8845 | if ($val['share']) { |
8846 | 8846 | if (empty($maxHeight) || ($photo_vignette && $imgarray['height'] > $maxHeight)) { |
8847 | 8847 | $return .= '<!-- Show original file (thumb not yet available with shared links) -->'; |
8848 | - $return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' '.$addphotorefcss : '').'"'.($maxHeight ?' height="'.$maxHeight.'"': '').' src="'.DOL_URL_ROOT.'/viewimage.php?hashp='.urlencode($val['share']).($cache ? '&cache='.urlencode($cache) : '').'" title="'.dol_escape_htmltag($alt).'">'; |
|
8848 | + $return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' '.$addphotorefcss : '').'"'.($maxHeight ? ' height="'.$maxHeight.'"' : '').' src="'.DOL_URL_ROOT.'/viewimage.php?hashp='.urlencode($val['share']).($cache ? '&cache='.urlencode($cache) : '').'" title="'.dol_escape_htmltag($alt).'">'; |
|
8849 | 8849 | } else { |
8850 | 8850 | $return .= '<!-- Show original file -->'; |
8851 | 8851 | $return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' '.$addphotorefcss : '').'" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?hashp='.urlencode($val['share']).($cache ? '&cache='.urlencode($cache) : '').'" title="'.dol_escape_htmltag($alt).'">'; |
@@ -8857,7 +8857,7 @@ discard block |
||
8857 | 8857 | } else { |
8858 | 8858 | if (empty($maxHeight) || ($photo_vignette && $imgarray['height'] > $maxHeight)) { |
8859 | 8859 | $return .= '<!-- Show thumb -->'; |
8860 | - $return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' '.$addphotorefcss : '').' maxwidth150onsmartphone maxwidth200"'.($maxHeight ?' height="'.$maxHeight.'"': '').' src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$this->entity.($cache ? '&cache='.urlencode($cache) : '').'&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">'; |
|
8860 | + $return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' '.$addphotorefcss : '').' maxwidth150onsmartphone maxwidth200"'.($maxHeight ? ' height="'.$maxHeight.'"' : '').' src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$this->entity.($cache ? '&cache='.urlencode($cache) : '').'&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">'; |
|
8861 | 8861 | } else { |
8862 | 8862 | $return .= '<!-- Show original file -->'; |
8863 | 8863 | $return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' '.$addphotorefcss : '').'" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$this->entity.($cache ? '&cache='.urlencode($cache) : '').'&file='.urlencode($pdir.$photo).'" title="'.dol_escape_htmltag($alt).'">'; |
@@ -9266,7 +9266,7 @@ discard block |
||
9266 | 9266 | continue; |
9267 | 9267 | } |
9268 | 9268 | } |
9269 | - $keys_with_alias[] = $alias . '.' . $fieldname; |
|
9269 | + $keys_with_alias[] = $alias.'.'.$fieldname; |
|
9270 | 9270 | } |
9271 | 9271 | return implode(',', $keys_with_alias); |
9272 | 9272 | } else { |
@@ -9382,7 +9382,7 @@ discard block |
||
9382 | 9382 | if (!$error) { |
9383 | 9383 | $sql = "INSERT INTO ".$this->db->prefix().$this->table_element; |
9384 | 9384 | $sql .= " (".implode(", ", $keys).')'; |
9385 | - $sql .= " VALUES (".implode(", ", $values).")"; // $values can contains 'abc' or 123 |
|
9385 | + $sql .= " VALUES (".implode(", ", $values).")"; // $values can contains 'abc' or 123 |
|
9386 | 9386 | |
9387 | 9387 | $res = $this->db->query($sql); |
9388 | 9388 | if (!$res) { |
@@ -10179,7 +10179,7 @@ discard block |
||
10179 | 10179 | // Process |
10180 | 10180 | foreach ($to_del as $del) { |
10181 | 10181 | if ($c->fetch($del) > 0) { |
10182 | - $result=$c->del_type($this, $type_categ); |
|
10182 | + $result = $c->del_type($this, $type_categ); |
|
10183 | 10183 | if ($result < 0) { |
10184 | 10184 | $error++; |
10185 | 10185 | $this->error = $c->error; |
@@ -100,11 +100,11 @@ discard block |
||
100 | 100 | // Define column position |
101 | 101 | $this->posxref = $this->marge_gauche; |
102 | 102 | |
103 | - $this->update_main_doc_field=1; |
|
103 | + $this->update_main_doc_field = 1; |
|
104 | 104 | |
105 | - $this->heightforinfotot=50; |
|
105 | + $this->heightforinfotot = 50; |
|
106 | 106 | |
107 | - $this->xPosSignArea=120; |
|
107 | + $this->xPosSignArea = 120; |
|
108 | 108 | |
109 | 109 | $this->heightforfreetext = (getDolGlobalInt('MAIN_PDF_FREETEXT_HEIGHT') > 0 ? getDolGlobalInt('MAIN_PDF_FREETEXT_HEIGHT') : 5); |
110 | 110 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
184 | 184 | |
185 | 185 | if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) { |
186 | - $this->heightforfooter += 6; |
|
186 | + $this->heightforfooter += 6; |
|
187 | 187 | } |
188 | 188 | $pdf->SetAutoPageBreak(1, 0); |
189 | 189 | |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $tab_top = 50; |
220 | 220 | $tab_top_newpage = 40; |
221 | 221 | |
222 | - $tab_height = $this->page_hauteur - $tab_top - $this->heightforfooter - $this->heightforfreetext ; |
|
222 | + $tab_height = $this->page_hauteur - $tab_top - $this->heightforfooter - $this->heightforfreetext; |
|
223 | 223 | |
224 | 224 | // Show notes |
225 | 225 | if (!empty($object->note_public)) { |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | if ($idbankfordirectdebit > 0) { |
262 | 262 | $tmpbankfordirectdebit = new Account($this->db); |
263 | 263 | $tmpbankfordirectdebit->fetch($idbankfordirectdebit); |
264 | - $ics = $tmpbankfordirectdebit->ics; // ICS for direct debit |
|
264 | + $ics = $tmpbankfordirectdebit->ics; // ICS for direct debit |
|
265 | 265 | } |
266 | 266 | if (empty($ics) && !empty($conf->global->PRELEVEMENT_ICS)) { |
267 | 267 | $ics = $conf->global->PRELEVEMENT_ICS; |
@@ -330,9 +330,9 @@ discard block |
||
330 | 330 | |
331 | 331 | $address = '______________________________________________'; |
332 | 332 | if ($thirdparty->id > 0) { |
333 | - $tmpaddresswithoutcountry = $thirdparty->getFullAddress(); // we test on address without country |
|
333 | + $tmpaddresswithoutcountry = $thirdparty->getFullAddress(); // we test on address without country |
|
334 | 334 | if ($tmpaddresswithoutcountry) { |
335 | - $address = $thirdparty->getFullAddress(1); // full address |
|
335 | + $address = $thirdparty->getFullAddress(1); // full address |
|
336 | 336 | } |
337 | 337 | } |
338 | 338 | $posY = $pdf->GetY(); |
@@ -407,11 +407,11 @@ discard block |
||
407 | 407 | |
408 | 408 | // Show square |
409 | 409 | if ($pagenb == 1) { |
410 | - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter, 0, $outputlangs, 0, 0); |
|
411 | - $bottomlasttab = $this->page_hauteur - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter + 1; |
|
410 | + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter, 0, $outputlangs, 0, 0); |
|
411 | + $bottomlasttab = $this->page_hauteur - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter + 1; |
|
412 | 412 | } else { |
413 | - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter, 0, $outputlangs, 1, 0); |
|
414 | - $bottomlasttab = $this->page_hauteur - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter + 1; |
|
413 | + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter, 0, $outputlangs, 1, 0); |
|
414 | + $bottomlasttab = $this->page_hauteur - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter + 1; |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | //var_dump($tab_top); |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | // Ajout |
292 | 292 | $companybankaccount = new CompanyBankAccount($db); |
293 | 293 | |
294 | - $companybankaccount->socid = $object->id; |
|
294 | + $companybankaccount->socid = $object->id; |
|
295 | 295 | |
296 | 296 | $companybankaccount->fetch_thirdparty(); |
297 | 297 | |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | } |
587 | 587 | if ($action == 'syncsepatostripe') { |
588 | 588 | // Create the bank account on current Stripe env |
589 | - $companypaymentmode = new CompanyPaymentMode($db); // Get record in llx_societe_rib |
|
589 | + $companypaymentmode = new CompanyPaymentMode($db); // Get record in llx_societe_rib |
|
590 | 590 | $companypaymentmode->fetch($id); |
591 | 591 | |
592 | 592 | if ($companypaymentmode->type != 'ban') { |
@@ -1179,7 +1179,7 @@ discard block |
||
1179 | 1179 | print '<table class="liste centpercent">'."\n"; |
1180 | 1180 | print '<tr class="liste_titre">'; |
1181 | 1181 | print '<td>'.$langs->trans('Label').'</td>'; |
1182 | - print '<td>'.$form->textwithpicto($langs->trans('ExternalSystemID'), $langs->trans("IDOfPaymentInAnExternalSystem")).'</td>'; // external system ID |
|
1182 | + print '<td>'.$form->textwithpicto($langs->trans('ExternalSystemID'), $langs->trans("IDOfPaymentInAnExternalSystem")).'</td>'; // external system ID |
|
1183 | 1183 | print '<td>'.$langs->trans('Type').'</td>'; |
1184 | 1184 | print '<td>'.$langs->trans('Informations').'</td>'; |
1185 | 1185 | print '<td></td>'; |
@@ -1509,7 +1509,7 @@ discard block |
||
1509 | 1509 | |
1510 | 1510 | if (is_array($currencybalance)) { |
1511 | 1511 | foreach ($currencybalance as $cpt) { |
1512 | - print '<tr><td>'.$langs->trans("Currency".strtoupper($cpt['currency'])).'</td><td>'.price($cpt['available'], 0, '', 1, - 1, - 1, strtoupper($cpt['currency'])).'</td><td>'.price(isset($cpt->pending)?$cpt->pending:0, 0, '', 1, - 1, - 1, strtoupper($cpt['currency'])).'</td><td>'.price($cpt['available'] + (isset($cpt->pending)?$cpt->pending:0), 0, '', 1, - 1, - 1, strtoupper($cpt['currency'])).'</td></tr>'; |
|
1512 | + print '<tr><td>'.$langs->trans("Currency".strtoupper($cpt['currency'])).'</td><td>'.price($cpt['available'], 0, '', 1, - 1, - 1, strtoupper($cpt['currency'])).'</td><td>'.price(isset($cpt->pending) ? $cpt->pending : 0, 0, '', 1, - 1, - 1, strtoupper($cpt['currency'])).'</td><td>'.price($cpt['available'] + (isset($cpt->pending) ? $cpt->pending : 0), 0, '', 1, - 1, - 1, strtoupper($cpt['currency'])).'</td></tr>'; |
|
1513 | 1513 | } |
1514 | 1514 | } |
1515 | 1515 | |
@@ -1519,7 +1519,7 @@ discard block |
||
1519 | 1519 | |
1520 | 1520 | // List of bank accounts |
1521 | 1521 | if ($permissiontoaddupdatepaymentinformation) { |
1522 | - $morehtmlright = dolGetButtonTitle($langs->trans('Add'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"] . '?socid=' . $object->id . '&action=create'); |
|
1522 | + $morehtmlright = dolGetButtonTitle($langs->trans('Add'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=create'); |
|
1523 | 1523 | } |
1524 | 1524 | |
1525 | 1525 | print load_fiche_titre($langs->trans("BankAccounts"), $morehtmlright, 'bank'); |
@@ -1535,7 +1535,7 @@ discard block |
||
1535 | 1535 | |
1536 | 1536 | print '<tr class="liste_titre">'; |
1537 | 1537 | print_liste_field_titre("Label"); |
1538 | - print_liste_field_titre($form->textwithpicto($langs->trans('ExternalSystemID'), $langs->trans("IDOfPaymentInAnExternalSystem"))); // external system ID |
|
1538 | + print_liste_field_titre($form->textwithpicto($langs->trans('ExternalSystemID'), $langs->trans("IDOfPaymentInAnExternalSystem"))); // external system ID |
|
1539 | 1539 | print_liste_field_titre("Bank"); |
1540 | 1540 | print_liste_field_titre("RIB"); |
1541 | 1541 | print_liste_field_titre("IBAN"); |
@@ -1731,7 +1731,7 @@ discard block |
||
1731 | 1731 | print '<td class="right nowraponall">'; |
1732 | 1732 | $useonlinesignature = 1; |
1733 | 1733 | if ($useonlinesignature) { |
1734 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/signature.lib.php'; |
|
1734 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php'; |
|
1735 | 1735 | print showOnlineSignatureUrl($companybankaccount->element, $rib->id); |
1736 | 1736 | } |
1737 | 1737 | print '</td>'; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | /** |
87 | 87 | * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. |
88 | 88 | */ |
89 | - public $fields=array( |
|
89 | + public $fields = array( |
|
90 | 90 | 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>-1,), |
91 | 91 | 'type' => array('type'=>'varchar(32)', 'label'=>'Type', 'enabled'=>'1', 'position'=>15, 'notnull'=>1, 'visible'=>-1,), |
92 | 92 | 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'picto'=>'company', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>-1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'csslist'=>'tdoverflowmax150',), |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | public $total_amount_of_all_payments; |
186 | 186 | |
187 | 187 | |
188 | - public $ext_payment_site; // Name of the external payment system ('StripeLive', 'StripeTest', 'StancerLive', 'StancerTest', ...) |
|
188 | + public $ext_payment_site; // Name of the external payment system ('StripeLive', 'StripeTest', 'StancerLive', 'StancerTest', ...) |
|
189 | 189 | public $comment; |
190 | 190 | public $ipaddress; |
191 | 191 | |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | } |
263 | 263 | |
264 | 264 | if (empty($this->datec)) { |
265 | - $this->datec=$now; |
|
265 | + $this->datec = $now; |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | // Correct ->default_rib to not set the new account as default, if there is already 1. We want to be sure to have always 1 default for type = 'ban'. |
@@ -464,9 +464,9 @@ discard block |
||
464 | 464 | $this->rum = $obj->rum; |
465 | 465 | $this->frstrecur = $obj->frstrecur; |
466 | 466 | $this->date_rum = $this->db->jdate($obj->date_rum); |
467 | - $this->stripe_card_ref = $obj->stripe_card_ref; // External system payment mode ID |
|
468 | - $this->stripe_account = $obj->stripe_account; // External system customer ID |
|
469 | - $this->ext_payment_site= $obj->ext_payment_site; // External system name ('StripeLive', 'StripeTest', 'StancerLive', 'StancerTest', ...) |
|
467 | + $this->stripe_card_ref = $obj->stripe_card_ref; // External system payment mode ID |
|
468 | + $this->stripe_account = $obj->stripe_account; // External system customer ID |
|
469 | + $this->ext_payment_site = $obj->ext_payment_site; // External system name ('StripeLive', 'StripeTest', 'StancerLive', 'StancerTest', ...) |
|
470 | 470 | $this->last_main_doc = $obj->last_main_doc; |
471 | 471 | $this->model_pdf = $obj->model_pdf; |
472 | 472 | } |
@@ -969,8 +969,8 @@ discard block |
||
969 | 969 | $sql .= ", '".$this->db->escape($this->multicurrency_code)."'"; |
970 | 970 | if (empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { |
971 | 971 | $sql .= ", ".(empty($this->vat_reverse_charge) ? '0' : '1'); |
972 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'"; |
|
973 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'"; |
|
972 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'"; |
|
973 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'"; |
|
974 | 974 | } |
975 | 975 | $sql .= ")"; |
976 | 976 | |
@@ -1254,7 +1254,7 @@ discard block |
||
1254 | 1254 | if ($this->id_prof_exists($keymin, $vallabel, ($this->id > 0 ? $this->id : 0))) { |
1255 | 1255 | $langs->loadLangs(array("errors", 'compta')); |
1256 | 1256 | $error++; |
1257 | - $this->errors[] = $langs->trans('CustomerAccountancyCodeShort') . " " . $langs->trans("ErrorProdIdAlreadyExist", $vallabel) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')'; |
|
1257 | + $this->errors[] = $langs->trans('CustomerAccountancyCodeShort')." ".$langs->trans("ErrorProdIdAlreadyExist", $vallabel).' ('.$langs->trans("ForbiddenBySetupRules").')'; |
|
1258 | 1258 | } |
1259 | 1259 | } |
1260 | 1260 | |
@@ -1262,7 +1262,7 @@ discard block |
||
1262 | 1262 | if (!empty($conf->global->SOCIETE_ACCOUNTANCY_CODE_CUSTOMER_MANDATORY) && (!isset($vallabel) || trim($vallabel) === '')) { |
1263 | 1263 | $langs->loadLangs(array("errors", 'compta')); |
1264 | 1264 | $error++; |
1265 | - $this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('CustomerAccountancyCodeShort')) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')'; |
|
1265 | + $this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('CustomerAccountancyCodeShort')).' ('.$langs->trans("ForbiddenBySetupRules").')'; |
|
1266 | 1266 | } |
1267 | 1267 | } elseif ($key == 'ACCOUNTANCY_CODE_SUPPLIER' && !empty($this->fournisseur)) { |
1268 | 1268 | // Check for unicity |
@@ -1270,7 +1270,7 @@ discard block |
||
1270 | 1270 | if ($this->id_prof_exists($keymin, $vallabel, ($this->id > 0 ? $this->id : 0))) { |
1271 | 1271 | $langs->loadLangs(array("errors", 'compta')); |
1272 | 1272 | $error++; |
1273 | - $this->errors[] = $langs->trans('SupplierAccountancyCodeShort') . " " . $langs->trans("ErrorProdIdAlreadyExist", $vallabel) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')'; |
|
1273 | + $this->errors[] = $langs->trans('SupplierAccountancyCodeShort')." ".$langs->trans("ErrorProdIdAlreadyExist", $vallabel).' ('.$langs->trans("ForbiddenBySetupRules").')'; |
|
1274 | 1274 | } |
1275 | 1275 | } |
1276 | 1276 | |
@@ -1278,7 +1278,7 @@ discard block |
||
1278 | 1278 | if (!empty($conf->global->SOCIETE_ACCOUNTANCY_CODE_SUPPLIER_MANDATORY) && (!isset($vallabel) || trim($vallabel) === '')) { |
1279 | 1279 | $langs->loadLangs(array("errors", 'compta')); |
1280 | 1280 | $error++; |
1281 | - $this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('SupplierAccountancyCodeShort')) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')'; |
|
1281 | + $this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('SupplierAccountancyCodeShort')).' ('.$langs->trans("ForbiddenBySetupRules").')'; |
|
1282 | 1282 | } |
1283 | 1283 | } |
1284 | 1284 | } |
@@ -1337,7 +1337,7 @@ discard block |
||
1337 | 1337 | $this->fax = trim($this->fax); |
1338 | 1338 | $this->fax = preg_replace("/\s/", "", $this->fax); |
1339 | 1339 | $this->fax = preg_replace("/\./", "", $this->fax); |
1340 | - $this->email = trim($this->email); |
|
1340 | + $this->email = trim($this->email); |
|
1341 | 1341 | $this->url = $this->url ?clean_url($this->url, 0) : ''; |
1342 | 1342 | $this->note_private = trim($this->note_private); |
1343 | 1343 | $this->note_public = trim($this->note_public); |
@@ -1354,7 +1354,7 @@ discard block |
||
1354 | 1354 | |
1355 | 1355 | $this->tva_assuj = trim($this->tva_assuj); |
1356 | 1356 | $this->tva_intra = dol_sanitizeFileName($this->tva_intra, ''); |
1357 | - $this->vat_reverse_charge = empty($this->vat_reverse_charge) ? '0' : '1'; |
|
1357 | + $this->vat_reverse_charge = empty($this->vat_reverse_charge) ? '0' : '1'; |
|
1358 | 1358 | if (empty($this->status)) { |
1359 | 1359 | $this->status = 0; |
1360 | 1360 | } |
@@ -1509,7 +1509,7 @@ discard block |
||
1509 | 1509 | $sql .= ",tva_assuj = ".($this->tva_assuj != '' ? "'".$this->db->escape($this->tva_assuj)."'" : "null"); |
1510 | 1510 | $sql .= ",tva_intra = '".$this->db->escape($this->tva_intra)."'"; |
1511 | 1511 | if (empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { |
1512 | - $sql .= ",vat_reverse_charge = " . ($this->vat_reverse_charge != '' ? "'" . $this->db->escape($this->vat_reverse_charge) . "'" : 0); |
|
1512 | + $sql .= ",vat_reverse_charge = ".($this->vat_reverse_charge != '' ? "'".$this->db->escape($this->vat_reverse_charge)."'" : 0); |
|
1513 | 1513 | } |
1514 | 1514 | $sql .= ",status = ".((int) $this->status); |
1515 | 1515 | |
@@ -1570,8 +1570,8 @@ discard block |
||
1570 | 1570 | $sql .= ",supplier_order_min_amount= ".($this->supplier_order_min_amount != '' ? $this->supplier_order_min_amount : 'null'); |
1571 | 1571 | $sql .= ",fk_prospectlevel='".$this->db->escape($this->fk_prospectlevel)."'"; |
1572 | 1572 | if (empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { |
1573 | - $sql .= ", accountancy_code_buy = '" . $this->db->escape($this->accountancy_code_buy) . "'"; |
|
1574 | - $sql .= ", accountancy_code_sell= '" . $this->db->escape($this->accountancy_code_sell) . "'"; |
|
1573 | + $sql .= ", accountancy_code_buy = '".$this->db->escape($this->accountancy_code_buy)."'"; |
|
1574 | + $sql .= ", accountancy_code_sell= '".$this->db->escape($this->accountancy_code_sell)."'"; |
|
1575 | 1575 | if ($customer) { |
1576 | 1576 | $sql .= ", code_compta = ".(!empty($this->code_compta_client) ? "'".$this->db->escape($this->code_compta_client)."'" : "null"); |
1577 | 1577 | } |
@@ -1929,7 +1929,7 @@ discard block |
||
1929 | 1929 | $this->code_client = $obj->code_client; |
1930 | 1930 | $this->code_fournisseur = $obj->code_fournisseur; |
1931 | 1931 | |
1932 | - $this->code_compta = $obj->code_compta; // For backward compatibility |
|
1932 | + $this->code_compta = $obj->code_compta; // For backward compatibility |
|
1933 | 1933 | $this->code_compta_client = $obj->code_compta; |
1934 | 1934 | $this->code_compta_fournisseur = $obj->code_compta_fournisseur; |
1935 | 1935 | |
@@ -1946,7 +1946,7 @@ discard block |
||
1946 | 1946 | $this->vat_reverse_charge = 0; |
1947 | 1947 | } |
1948 | 1948 | |
1949 | - $this->status = $obj->status; |
|
1949 | + $this->status = $obj->status; |
|
1950 | 1950 | |
1951 | 1951 | // Local Taxes |
1952 | 1952 | $this->localtax1_assuj = $obj->localtax1_assuj; |
@@ -1973,7 +1973,7 @@ discard block |
||
1973 | 1973 | |
1974 | 1974 | $this->mode_reglement_id = $obj->mode_reglement; |
1975 | 1975 | $this->cond_reglement_id = $obj->cond_reglement; |
1976 | - $this->deposit_percent = $obj->deposit_percent; |
|
1976 | + $this->deposit_percent = $obj->deposit_percent; |
|
1977 | 1977 | $this->transport_mode_id = $obj->transport_mode; |
1978 | 1978 | $this->mode_reglement_supplier_id = $obj->mode_reglement_supplier; |
1979 | 1979 | $this->cond_reglement_supplier_id = $obj->cond_reglement_supplier; |
@@ -2510,10 +2510,10 @@ discard block |
||
2510 | 2510 | $reparray[$i]['firstname'] = $obj->firstname; |
2511 | 2511 | $reparray[$i]['email'] = $obj->email; |
2512 | 2512 | $reparray[$i]['phone'] = $obj->office_phone; |
2513 | - $reparray[$i]['office_phone'] = $obj->office_phone; // Pro phone |
|
2513 | + $reparray[$i]['office_phone'] = $obj->office_phone; // Pro phone |
|
2514 | 2514 | $reparray[$i]['office_fax'] = $obj->office_fax; |
2515 | - $reparray[$i]['user_mobile'] = $obj->user_mobile; // Pro mobile |
|
2516 | - $reparray[$i]['personal_mobile'] = $obj->personal_mobile; // Personal mobile |
|
2515 | + $reparray[$i]['user_mobile'] = $obj->user_mobile; // Pro mobile |
|
2516 | + $reparray[$i]['personal_mobile'] = $obj->personal_mobile; // Personal mobile |
|
2517 | 2517 | $reparray[$i]['job'] = $obj->job; |
2518 | 2518 | $reparray[$i]['statut'] = $obj->status; // deprecated |
2519 | 2519 | $reparray[$i]['status'] = $obj->status; |
@@ -2719,7 +2719,7 @@ discard block |
||
2719 | 2719 | $datas['status'] = ' '.$this->getLibStatut(5); |
2720 | 2720 | } |
2721 | 2721 | if (isset($this->client) && isset($this->fournisseur)) { |
2722 | - $datas['type'] = ' ' . $this->getTypeUrl(1); |
|
2722 | + $datas['type'] = ' '.$this->getTypeUrl(1); |
|
2723 | 2723 | } |
2724 | 2724 | $datas['name'] = '<br><b>'.$langs->trans('Name').':</b> '.dol_escape_htmltag(dol_string_nohtmltag($this->name)); |
2725 | 2725 | if (!empty($this->name_alias) && empty($noaliasinname)) { |
@@ -2783,9 +2783,9 @@ discard block |
||
2783 | 2783 | } |
2784 | 2784 | // show categories for this record only in ajax to not overload lists |
2785 | 2785 | if (!$nofetch && isModEnabled('categorie') && $this->client) { |
2786 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
2786 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
2787 | 2787 | $form = new Form($this->db); |
2788 | - $datas['categories_customer'] = '<br>' . $form->showCategories($this->id, Categorie::TYPE_CUSTOMER, 1, 1); |
|
2788 | + $datas['categories_customer'] = '<br>'.$form->showCategories($this->id, Categorie::TYPE_CUSTOMER, 1, 1); |
|
2789 | 2789 | } |
2790 | 2790 | if (!empty($this->code_fournisseur) && $this->fournisseur) { |
2791 | 2791 | $datas['suppliercode'] = '<br><b>'.$langs->trans('SupplierCode').':</b> '.$this->code_fournisseur; |
@@ -2796,9 +2796,9 @@ discard block |
||
2796 | 2796 | } |
2797 | 2797 | // show categories for this record only in ajax to not overload lists |
2798 | 2798 | if (!$nofetch && isModEnabled('categorie') && $this->fournisseur) { |
2799 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
2799 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
2800 | 2800 | $form = new Form($this->db); |
2801 | - $datas['categories_supplier'] = '<br>' . $form->showCategories($this->id, Categorie::TYPE_SUPPLIER, 1, 1); |
|
2801 | + $datas['categories_supplier'] = '<br>'.$form->showCategories($this->id, Categorie::TYPE_SUPPLIER, 1, 1); |
|
2802 | 2802 | } |
2803 | 2803 | |
2804 | 2804 | $datas['divclose'] = '</div>'; |
@@ -2921,7 +2921,7 @@ discard block |
||
2921 | 2921 | $label = $langs->trans("ShowCompany"); |
2922 | 2922 | $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; |
2923 | 2923 | } |
2924 | - $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); |
|
2924 | + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); |
|
2925 | 2925 | $linkclose .= $dataparams.' class="'.$classfortooltip.' refurl valignmiddle"'; |
2926 | 2926 | $target_value = array('_self', '_blank', '_parent', '_top'); |
2927 | 2927 | if (in_array($target, $target_value)) { |
@@ -3566,7 +3566,7 @@ discard block |
||
3566 | 3566 | global $conf; |
3567 | 3567 | |
3568 | 3568 | if (!empty($conf->global->SOCIETE_CODECOMPTA_ADDON)) { |
3569 | - $module=$conf->global->SOCIETE_CODECOMPTA_ADDON; |
|
3569 | + $module = $conf->global->SOCIETE_CODECOMPTA_ADDON; |
|
3570 | 3570 | $res = false; |
3571 | 3571 | $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); |
3572 | 3572 | foreach ($dirsociete as $dirroot) { |
@@ -3689,7 +3689,7 @@ discard block |
||
3689 | 3689 | global $langs; |
3690 | 3690 | |
3691 | 3691 | if ($company_id > 0) { |
3692 | - $sql = "SELECT parent FROM " . MAIN_DB_PREFIX . "societe WHERE rowid = ".((int) $company_id); |
|
3692 | + $sql = "SELECT parent FROM ".MAIN_DB_PREFIX."societe WHERE rowid = ".((int) $company_id); |
|
3693 | 3693 | $resql = $this->db->query($sql); |
3694 | 3694 | if ($resql) { |
3695 | 3695 | if ($obj = $this->db->fetch_object($resql)) { |
@@ -4324,7 +4324,7 @@ discard block |
||
4324 | 4324 | |
4325 | 4325 | if ($member->morphy == 'mor') { |
4326 | 4326 | if (empty($socname)) { |
4327 | - $socname = $member->company? $member->company : $member->societe; |
|
4327 | + $socname = $member->company ? $member->company : $member->societe; |
|
4328 | 4328 | } |
4329 | 4329 | if (!empty($fullname) && empty($socalias)) { |
4330 | 4330 | $socalias = $fullname; |
@@ -4520,7 +4520,7 @@ discard block |
||
4520 | 4520 | $this->forme_juridique_code = getDolGlobalString('MAIN_INFO_SOCIETE_FORME_JURIDIQUE'); |
4521 | 4521 | $this->email = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL'); |
4522 | 4522 | $this->default_lang = getDolGlobalString('MAIN_LANG_DEFAULT', 'auto'); |
4523 | - $this->logo =getDolGlobalString('MAIN_INFO_SOCIETE_LOGO'); |
|
4523 | + $this->logo = getDolGlobalString('MAIN_INFO_SOCIETE_LOGO'); |
|
4524 | 4524 | $this->logo_small = getDolGlobalString('MAIN_INFO_SOCIETE_LOGO_SMALL'); |
4525 | 4525 | $this->logo_mini = getDolGlobalString('MAIN_INFO_SOCIETE_LOGO_MINI'); |
4526 | 4526 | $this->logo_squarred = getDolGlobalString('MAIN_INFO_SOCIETE_LOGO_SQUARRED'); |
@@ -5020,7 +5020,7 @@ discard block |
||
5020 | 5020 | dol_print_error($this->db, $companybankaccount->error, $companybankaccount->errors); |
5021 | 5021 | } |
5022 | 5022 | $result = $companybankaccount->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); |
5023 | - $this->last_main_doc=$companybankaccount->last_main_doc; |
|
5023 | + $this->last_main_doc = $companybankaccount->last_main_doc; |
|
5024 | 5024 | } else { |
5025 | 5025 | // Positionne le modele sur le nom du modele a utiliser |
5026 | 5026 | if (!dol_strlen($modele)) { |
@@ -1196,8 +1196,11 @@ |
||
1196 | 1196 | $array_to_check = array('IDPROF1', 'IDPROF2', 'IDPROF3', 'IDPROF4', 'IDPROF5', 'IDPROF6', 'EMAIL', 'TVA_INTRA', 'ACCOUNTANCY_CODE_CUSTOMER', 'ACCOUNTANCY_CODE_SUPPLIER'); |
1197 | 1197 | foreach ($array_to_check as $key) { |
1198 | 1198 | $keymin = strtolower($key); |
1199 | - if ($key == 'ACCOUNTANCY_CODE_CUSTOMER') $keymin = 'code_compta'; |
|
1200 | - elseif ($key == 'ACCOUNTANCY_CODE_SUPPLIER') $keymin = 'code_compta_fournisseur'; |
|
1199 | + if ($key == 'ACCOUNTANCY_CODE_CUSTOMER') { |
|
1200 | + $keymin = 'code_compta'; |
|
1201 | + } elseif ($key == 'ACCOUNTANCY_CODE_SUPPLIER') { |
|
1202 | + $keymin = 'code_compta_fournisseur'; |
|
1203 | + } |
|
1201 | 1204 | $i = (int) preg_replace('/[^0-9]/', '', $key); |
1202 | 1205 | $vallabel = $this->$keymin; |
1203 | 1206 |
@@ -146,19 +146,19 @@ discard block |
||
146 | 146 | if ($source == 'proposal') { |
147 | 147 | require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; |
148 | 148 | $object = new Propal($db); |
149 | - $result= $object->fetch(0, $ref, '', $entity); |
|
149 | + $result = $object->fetch(0, $ref, '', $entity); |
|
150 | 150 | } elseif ($source == 'contract') { |
151 | 151 | require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; |
152 | 152 | $object = new Contrat($db); |
153 | - $result= $object->fetch(0, $ref); |
|
153 | + $result = $object->fetch(0, $ref); |
|
154 | 154 | } elseif ($source == 'fichinter') { |
155 | 155 | require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; |
156 | 156 | $object = new Fichinter($db); |
157 | - $result= $object->fetch(0, $ref); |
|
157 | + $result = $object->fetch(0, $ref); |
|
158 | 158 | } elseif ($source == 'societe_rib') { |
159 | 159 | require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; |
160 | 160 | $object = new CompanyBankAccount($db); |
161 | - $result= $object->fetch($ref); |
|
161 | + $result = $object->fetch($ref); |
|
162 | 162 | } else { |
163 | 163 | httponly_accessforbidden($langs->trans('ErrorBadParameters')." - Bad value for source", 400, 1); |
164 | 164 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | llxHeader($head, $langs->trans("OnlineSignature"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea, 1); |
227 | 227 | |
228 | 228 | if ($action == 'refusepropal') { |
229 | - print $form->formconfirm($_SERVER["PHP_SELF"].'?ref='.urlencode($ref).'&securekey='.urlencode($SECUREKEY).(isModEnabled('multicompany')?'&entity='.$entity:''), $langs->trans('RefusePropal'), $langs->trans('ConfirmRefusePropal', $object->ref), 'confirm_refusepropal', '', '', 1); |
|
229 | + print $form->formconfirm($_SERVER["PHP_SELF"].'?ref='.urlencode($ref).'&securekey='.urlencode($SECUREKEY).(isModEnabled('multicompany') ? '&entity='.$entity : ''), $langs->trans('RefusePropal'), $langs->trans('ConfirmRefusePropal', $object->ref), 'confirm_refusepropal', '', '', 1); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | // Check link validity for param 'source' to avoid use of the examples as value |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | if (empty($last_main_doc_file) || !dol_is_file(DOL_DATA_ROOT.'/'.$object->last_main_doc)) { |
389 | 389 | // It seems document has never been generated, or was generated and then deleted. |
390 | 390 | // So we try to regenerate it with its default template. |
391 | - $defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used. |
|
391 | + $defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used. |
|
392 | 392 | $object->generateDocument($defaulttemplate, $langs); |
393 | 393 | } |
394 | 394 | |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | if (empty($last_main_doc_file) || !dol_is_file(DOL_DATA_ROOT.'/'.$object->last_main_doc)) { |
460 | 460 | // It seems document has never been generated, or was generated and then deleted. |
461 | 461 | // So we try to regenerate it with its default template. |
462 | - $defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used. |
|
462 | + $defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used. |
|
463 | 463 | $object->generateDocument($defaulttemplate, $langs); |
464 | 464 | } |
465 | 465 | |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | if (empty($last_main_doc_file) || !dol_is_file(DOL_DATA_ROOT.'/'.$object->last_main_doc)) { |
511 | 511 | // It seems document has never been generated, or was generated and then deleted. |
512 | 512 | // So we try to regenerate it with its default template. |
513 | - $defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used. |
|
513 | + $defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used. |
|
514 | 514 | $object->generateDocument($defaulttemplate, $langs); |
515 | 515 | } |
516 | 516 | |
@@ -534,24 +534,24 @@ discard block |
||
534 | 534 | $result = $object->fetch_thirdparty(); |
535 | 535 | |
536 | 536 | // Proposer |
537 | - print '<tr class="CTableRow2"><td class="CTableRow2">' . $langs->trans("Proposer"); |
|
537 | + print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Proposer"); |
|
538 | 538 | print '</td><td class="CTableRow2">'; |
539 | 539 | print img_picto('', 'company', 'class="pictofixedwidth"'); |
540 | - print '<b>' . $creditor . '</b>'; |
|
541 | - print '<input type="hidden" name="creditor" value="' . $creditor . '">'; |
|
542 | - print '</td></tr>' . "\n"; |
|
540 | + print '<b>'.$creditor.'</b>'; |
|
541 | + print '<input type="hidden" name="creditor" value="'.$creditor.'">'; |
|
542 | + print '</td></tr>'."\n"; |
|
543 | 543 | |
544 | 544 | // Target |
545 | - print '<tr class="CTableRow2"><td class="CTableRow2">' . $langs->trans("ThirdParty"); |
|
545 | + print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("ThirdParty"); |
|
546 | 546 | print '</td><td class="CTableRow2">'; |
547 | 547 | print img_picto('', 'company', 'class="pictofixedwidth"'); |
548 | - print '<b>' . $object->thirdparty->name . '</b>'; |
|
549 | - print '</td></tr>' . "\n"; |
|
548 | + print '<b>'.$object->thirdparty->name.'</b>'; |
|
549 | + print '</td></tr>'."\n"; |
|
550 | 550 | |
551 | 551 | // Object |
552 | - $text = '<b>' . $langs->trans("Signature" . dol_ucfirst($source) . "Ref", $object->ref) . '</b>'; |
|
553 | - print '<tr class="CTableRow2"><td class="CTableRow2">' . $langs->trans("Designation"); |
|
554 | - print '</td><td class="CTableRow2">' . $text; |
|
552 | + $text = '<b>'.$langs->trans("Signature".dol_ucfirst($source)."Ref", $object->ref).'</b>'; |
|
553 | + print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Designation"); |
|
554 | + print '</td><td class="CTableRow2">'.$text; |
|
555 | 555 | |
556 | 556 | $last_main_doc_file = $object->last_main_doc; |
557 | 557 | $diroutput = $conf->societe->multidir_output[$object->thirdparty->entity].'/' |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | 'force_dir_output'=>$diroutput |
572 | 572 | ); |
573 | 573 | $result = $object->thirdparty->generateDocument($defaulttemplate, $langs, 0, 0, 0, $moreparams); |
574 | - $object->last_main_doc=$object->thirdparty->last_main_doc; |
|
574 | + $object->last_main_doc = $object->thirdparty->last_main_doc; |
|
575 | 575 | } |
576 | 576 | $directdownloadlink = $object->getLastMainDocLink('company'); |
577 | 577 | if ($directdownloadlink) { |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | if (empty($last_main_doc_file) || !dol_is_file(DOL_DATA_ROOT.'/'.$object->last_main_doc)) { |
617 | 617 | // It seems document has never been generated, or was generated and then deleted. |
618 | 618 | // So we try to regenerate it with its default template. |
619 | - $defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used. |
|
619 | + $defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used. |
|
620 | 620 | $object->generateDocument($defaulttemplate, $langs); |
621 | 621 | } |
622 | 622 | |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | print '<script language="JavaScript" type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jSignature/jSignature.js"></script> |
676 | 676 | <script type="text/javascript"> |
677 | 677 | $(document).ready(function() { |
678 | - $("#signature").jSignature({ color:"#000", lineWidth:0, '.(empty($conf->dol_optimize_smallscreen) ? '' : 'width: 280, ' ).'height: 180}); |
|
678 | + $("#signature").jSignature({ color:"#000", lineWidth:0, '.(empty($conf->dol_optimize_smallscreen) ? '' : 'width: 280, ').'height: 180}); |
|
679 | 679 | |
680 | 680 | $("#signature").on("change",function(){ |
681 | 681 | $("#clearsignature").css("display",""); |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | success: function(response) { |
704 | 704 | if(response == "success"){ |
705 | 705 | console.log("Success on saving signature"); |
706 | - window.location.replace("'.$_SERVER["PHP_SELF"].'?ref='.urlencode($ref).'&source='.urlencode($source).'&message=signed&securekey='.urlencode($SECUREKEY).(isModEnabled('multicompany')?'&entity='.$entity:'').'"); |
|
706 | + window.location.replace("'.$_SERVER["PHP_SELF"].'?ref='.urlencode($ref).'&source='.urlencode($source).'&message=signed&securekey='.urlencode($SECUREKEY).(isModEnabled('multicompany') ? '&entity='.$entity : '').'"); |
|
707 | 707 | }else{ |
708 | 708 | console.error(response); |
709 | 709 | } |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | // @CHANGE LDR DOCUMENT_ROOT fix for IIS Webserver |
44 | 44 | if ((!isset($_SERVER['DOCUMENT_ROOT'])) OR (empty($_SERVER['DOCUMENT_ROOT']))) { |
45 | 45 | if (isset($_SERVER['SCRIPT_FILENAME']) && isset($_SERVER['PHP_SELF'])) { |
46 | - $_SERVER['DOCUMENT_ROOT'] = str_replace( '\\', '/', substr($_SERVER['SCRIPT_FILENAME'], 0, 0-strlen($_SERVER['PHP_SELF']))); |
|
46 | + $_SERVER['DOCUMENT_ROOT'] = str_replace('\\', '/', substr($_SERVER['SCRIPT_FILENAME'], 0, 0 - strlen($_SERVER['PHP_SELF']))); |
|
47 | 47 | } elseif (isset($_SERVER['PATH_TRANSLATED']) && isset($_SERVER['PHP_SELF'])) { |
48 | - $_SERVER['DOCUMENT_ROOT'] = str_replace( '\\', '/', substr(str_replace('\\\\', '\\', $_SERVER['PATH_TRANSLATED']), 0, 0-strlen($_SERVER['PHP_SELF']))); |
|
48 | + $_SERVER['DOCUMENT_ROOT'] = str_replace('\\', '/', substr(str_replace('\\\\', '\\', $_SERVER['PATH_TRANSLATED']), 0, 0 - strlen($_SERVER['PHP_SELF']))); |
|
49 | 49 | } else { |
50 | 50 | // define here your DOCUMENT_ROOT path if the previous fails (e.g. '/var/www') |
51 | 51 | $_SERVER['DOCUMENT_ROOT'] = '/'; |
@@ -69,32 +69,32 @@ discard block |
||
69 | 69 | } |
70 | 70 | |
71 | 71 | if (!defined('K_PATH_MAIN')) { |
72 | - define ('K_PATH_MAIN', dirname(__FILE__).'/'); |
|
72 | + define('K_PATH_MAIN', dirname(__FILE__).'/'); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | if (!defined('K_PATH_FONTS')) { |
76 | - define ('K_PATH_FONTS', K_PATH_MAIN.'fonts/'); |
|
76 | + define('K_PATH_FONTS', K_PATH_MAIN.'fonts/'); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | if (!defined('K_PATH_URL')) { |
80 | 80 | $k_path_url = K_PATH_MAIN; // default value for console mode |
81 | 81 | if (isset($_SERVER['HTTP_HOST']) AND (!empty($_SERVER['HTTP_HOST']))) { |
82 | - if(isset($_SERVER['HTTPS']) AND (!empty($_SERVER['HTTPS'])) AND (strtolower($_SERVER['HTTPS']) != 'off')) { |
|
82 | + if (isset($_SERVER['HTTPS']) AND (!empty($_SERVER['HTTPS'])) AND (strtolower($_SERVER['HTTPS']) != 'off')) { |
|
83 | 83 | $k_path_url = 'https://'; |
84 | 84 | } else { |
85 | 85 | $k_path_url = 'http://'; |
86 | 86 | } |
87 | 87 | $k_path_url .= $_SERVER['HTTP_HOST']; |
88 | - $k_path_url .= str_replace( '\\', '/', substr(K_PATH_MAIN, (strlen($_SERVER['DOCUMENT_ROOT']) - 1))); |
|
88 | + $k_path_url .= str_replace('\\', '/', substr(K_PATH_MAIN, (strlen($_SERVER['DOCUMENT_ROOT']) - 1))); |
|
89 | 89 | } |
90 | - define ('K_PATH_URL', $k_path_url); |
|
90 | + define('K_PATH_URL', $k_path_url); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | if (!defined('K_PATH_IMAGES')) { |
94 | 94 | $tcpdf_images_dirs = array(K_PATH_MAIN.'examples/images/', K_PATH_MAIN.'images/', '/usr/share/doc/php-tcpdf/examples/images/', '/usr/share/doc/tcpdf/examples/images/', '/usr/share/doc/php/tcpdf/examples/images/', '/var/www/tcpdf/images/', '/var/www/html/tcpdf/images/', '/usr/local/apache2/htdocs/tcpdf/images/', K_PATH_MAIN); |
95 | 95 | foreach ($tcpdf_images_dirs as $tcpdf_images_path) { |
96 | 96 | if (@file_exists($tcpdf_images_path)) { |
97 | - define ('K_PATH_IMAGES', $tcpdf_images_path); |
|
97 | + define('K_PATH_IMAGES', $tcpdf_images_path); |
|
98 | 98 | break; |
99 | 99 | } |
100 | 100 | } |
@@ -105,14 +105,14 @@ discard block |
||
105 | 105 | if (@file_exists(K_PATH_IMAGES.'tcpdf_logo.jpg')) { |
106 | 106 | $tcpdf_header_logo = 'tcpdf_logo.jpg'; |
107 | 107 | } |
108 | - define ('PDF_HEADER_LOGO', $tcpdf_header_logo); |
|
108 | + define('PDF_HEADER_LOGO', $tcpdf_header_logo); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | if (!defined('PDF_HEADER_LOGO_WIDTH')) { |
112 | 112 | if (!empty($tcpdf_header_logo)) { |
113 | - define ('PDF_HEADER_LOGO_WIDTH', 30); |
|
113 | + define('PDF_HEADER_LOGO_WIDTH', 30); |
|
114 | 114 | } else { |
115 | - define ('PDF_HEADER_LOGO_WIDTH', 0); |
|
115 | + define('PDF_HEADER_LOGO_WIDTH', 0); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
@@ -121,87 +121,87 @@ discard block |
||
121 | 121 | if (substr($K_PATH_CACHE, -1) != '/') { |
122 | 122 | $K_PATH_CACHE .= '/'; |
123 | 123 | } |
124 | - define ('K_PATH_CACHE', $K_PATH_CACHE); |
|
124 | + define('K_PATH_CACHE', $K_PATH_CACHE); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | if (!defined('K_BLANK_IMAGE')) { |
128 | - define ('K_BLANK_IMAGE', '_blank.png'); |
|
128 | + define('K_BLANK_IMAGE', '_blank.png'); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | if (!defined('PDF_PAGE_FORMAT')) { |
132 | - define ('PDF_PAGE_FORMAT', 'A4'); |
|
132 | + define('PDF_PAGE_FORMAT', 'A4'); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | if (!defined('PDF_PAGE_ORIENTATION')) { |
136 | - define ('PDF_PAGE_ORIENTATION', 'P'); |
|
136 | + define('PDF_PAGE_ORIENTATION', 'P'); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | if (!defined('PDF_CREATOR')) { |
140 | - define ('PDF_CREATOR', 'TCPDF'); |
|
140 | + define('PDF_CREATOR', 'TCPDF'); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | if (!defined('PDF_AUTHOR')) { |
144 | - define ('PDF_AUTHOR', 'TCPDF'); |
|
144 | + define('PDF_AUTHOR', 'TCPDF'); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | if (!defined('PDF_HEADER_TITLE')) { |
148 | - define ('PDF_HEADER_TITLE', 'TCPDF Example'); |
|
148 | + define('PDF_HEADER_TITLE', 'TCPDF Example'); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | if (!defined('PDF_HEADER_STRING')) { |
152 | - define ('PDF_HEADER_STRING', "by Nicola Asuni - Tecnick.com\nwww.tcpdf.org"); |
|
152 | + define('PDF_HEADER_STRING', "by Nicola Asuni - Tecnick.com\nwww.tcpdf.org"); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | if (!defined('PDF_UNIT')) { |
156 | - define ('PDF_UNIT', 'mm'); |
|
156 | + define('PDF_UNIT', 'mm'); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | if (!defined('PDF_MARGIN_HEADER')) { |
160 | - define ('PDF_MARGIN_HEADER', 5); |
|
160 | + define('PDF_MARGIN_HEADER', 5); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | if (!defined('PDF_MARGIN_FOOTER')) { |
164 | - define ('PDF_MARGIN_FOOTER', 10); |
|
164 | + define('PDF_MARGIN_FOOTER', 10); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | if (!defined('PDF_MARGIN_TOP')) { |
168 | - define ('PDF_MARGIN_TOP', 27); |
|
168 | + define('PDF_MARGIN_TOP', 27); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | if (!defined('PDF_MARGIN_BOTTOM')) { |
172 | - define ('PDF_MARGIN_BOTTOM', 25); |
|
172 | + define('PDF_MARGIN_BOTTOM', 25); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | if (!defined('PDF_MARGIN_LEFT')) { |
176 | - define ('PDF_MARGIN_LEFT', 15); |
|
176 | + define('PDF_MARGIN_LEFT', 15); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | if (!defined('PDF_MARGIN_RIGHT')) { |
180 | - define ('PDF_MARGIN_RIGHT', 15); |
|
180 | + define('PDF_MARGIN_RIGHT', 15); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | if (!defined('PDF_FONT_NAME_MAIN')) { |
184 | - define ('PDF_FONT_NAME_MAIN', 'helvetica'); |
|
184 | + define('PDF_FONT_NAME_MAIN', 'helvetica'); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | if (!defined('PDF_FONT_SIZE_MAIN')) { |
188 | - define ('PDF_FONT_SIZE_MAIN', 10); |
|
188 | + define('PDF_FONT_SIZE_MAIN', 10); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | if (!defined('PDF_FONT_NAME_DATA')) { |
192 | - define ('PDF_FONT_NAME_DATA', 'helvetica'); |
|
192 | + define('PDF_FONT_NAME_DATA', 'helvetica'); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | if (!defined('PDF_FONT_SIZE_DATA')) { |
196 | - define ('PDF_FONT_SIZE_DATA', 8); |
|
196 | + define('PDF_FONT_SIZE_DATA', 8); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | if (!defined('PDF_FONT_MONOSPACED')) { |
200 | - define ('PDF_FONT_MONOSPACED', 'courier'); |
|
200 | + define('PDF_FONT_MONOSPACED', 'courier'); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | if (!defined('PDF_IMAGE_SCALE_RATIO')) { |
204 | - define ('PDF_IMAGE_SCALE_RATIO', 1.25); |
|
204 | + define('PDF_IMAGE_SCALE_RATIO', 1.25); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | if (!defined('HEAD_MAGNIFICATION')) { |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | } |
218 | 218 | |
219 | 219 | if (!defined('K_SMALL_RATIO')) { |
220 | - define('K_SMALL_RATIO', 2/3); |
|
220 | + define('K_SMALL_RATIO', 2 / 3); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | if (!defined('K_THAI_TOPCHARS')) { |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | */ |
42 | 42 | |
43 | 43 | // @CHANGE LDR DOCUMENT_ROOT fix for IIS Webserver |
44 | -if ((!isset($_SERVER['DOCUMENT_ROOT'])) OR (empty($_SERVER['DOCUMENT_ROOT']))) { |
|
44 | +if ((!isset($_SERVER['DOCUMENT_ROOT'])) or (empty($_SERVER['DOCUMENT_ROOT']))) { |
|
45 | 45 | if (isset($_SERVER['SCRIPT_FILENAME']) && isset($_SERVER['PHP_SELF'])) { |
46 | 46 | $_SERVER['DOCUMENT_ROOT'] = str_replace( '\\', '/', substr($_SERVER['SCRIPT_FILENAME'], 0, 0-strlen($_SERVER['PHP_SELF']))); |
47 | 47 | } elseif (isset($_SERVER['PATH_TRANSLATED']) && isset($_SERVER['PHP_SELF'])) { |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | // Load main configuration file only if the K_TCPDF_EXTERNAL_CONFIG constant is set to false. |
60 | -if (!defined('K_TCPDF_EXTERNAL_CONFIG') OR !K_TCPDF_EXTERNAL_CONFIG) { |
|
60 | +if (!defined('K_TCPDF_EXTERNAL_CONFIG') or !K_TCPDF_EXTERNAL_CONFIG) { |
|
61 | 61 | // define a list of default config files in order of priority |
62 | 62 | $tcpdf_config_files = array(dirname(__FILE__).'/config/tcpdf_config.php', '/etc/php-tcpdf/tcpdf_config.php', '/etc/tcpdf/tcpdf_config.php', '/etc/tcpdf_config.php'); |
63 | 63 | foreach ($tcpdf_config_files as $tcpdf_config) { |
64 | - if (@file_exists($tcpdf_config) AND is_readable($tcpdf_config)) { |
|
64 | + if (@file_exists($tcpdf_config) and is_readable($tcpdf_config)) { |
|
65 | 65 | require_once($tcpdf_config); |
66 | 66 | break; |
67 | 67 | } |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | |
79 | 79 | if (!defined('K_PATH_URL')) { |
80 | 80 | $k_path_url = K_PATH_MAIN; // default value for console mode |
81 | - if (isset($_SERVER['HTTP_HOST']) AND (!empty($_SERVER['HTTP_HOST']))) { |
|
82 | - if(isset($_SERVER['HTTPS']) AND (!empty($_SERVER['HTTPS'])) AND (strtolower($_SERVER['HTTPS']) != 'off')) { |
|
81 | + if (isset($_SERVER['HTTP_HOST']) and (!empty($_SERVER['HTTP_HOST']))) { |
|
82 | + if(isset($_SERVER['HTTPS']) and (!empty($_SERVER['HTTPS'])) and (strtolower($_SERVER['HTTPS']) != 'off')) { |
|
83 | 83 | $k_path_url = 'https://'; |
84 | 84 | } else { |
85 | 85 | $k_path_url = 'http://'; |