@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | $dateendvalidity = dol_mktime(0, 0, 0, GETPOSTINT('dateendvaliditymonth'), GETPOSTINT('dateendvalidityday'), GETPOSTINT('dateendvalidityyear')); |
| 94 | 94 | $dateofbirth = dol_mktime(0, 0, 0, GETPOSTINT('dateofbirthmonth'), GETPOSTINT('dateofbirthday'), GETPOSTINT('dateofbirthyear')); |
| 95 | 95 | |
| 96 | -$childids = $user->getAllChildIds(1); // For later, test on salary visibility |
|
| 96 | +$childids = $user->getAllChildIds(1); // For later, test on salary visibility |
|
| 97 | 97 | |
| 98 | 98 | $object = new User($db); |
| 99 | 99 | $extrafields = new ExtraFields($db); |
@@ -558,7 +558,7 @@ discard block |
||
| 558 | 558 | } |
| 559 | 559 | } |
| 560 | 560 | |
| 561 | - $ret = $object->update($user); // This may include call to setPassword if password has changed |
|
| 561 | + $ret = $object->update($user); // This may include call to setPassword if password has changed |
|
| 562 | 562 | if ($ret < 0) { |
| 563 | 563 | $error++; |
| 564 | 564 | if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { |
@@ -689,7 +689,7 @@ discard block |
||
| 689 | 689 | ) { |
| 690 | 690 | $object->fetch($id); |
| 691 | 691 | |
| 692 | - $newpassword = $object->setPassword($user, ''); // This will generate a new password |
|
| 692 | + $newpassword = $object->setPassword($user, ''); // This will generate a new password |
|
| 693 | 693 | if (is_int($newpassword) && $newpassword < 0) { |
| 694 | 694 | // Echec |
| 695 | 695 | setEventMessages($langs->trans("ErrorFailedToSetNewPassword"), null, 'errors'); |
@@ -818,7 +818,7 @@ discard block |
||
| 818 | 818 | $action = ""; |
| 819 | 819 | |
| 820 | 820 | $mesg = $langs->trans("ErrorProductAlreadyExists", $clone->ref); |
| 821 | - $mesg .= ' <a href="' . $_SERVER["PHP_SELF"] . '?ref=' . $clone->ref . '">' . $langs->trans("ShowCardHere") . '</a>.'; |
|
| 821 | + $mesg .= ' <a href="'.$_SERVER["PHP_SELF"].'?ref='.$clone->ref.'">'.$langs->trans("ShowCardHere").'</a>.'; |
|
| 822 | 822 | setEventMessages($mesg, null, 'errors'); |
| 823 | 823 | } else { |
| 824 | 824 | setEventMessages(empty($clone->error) ? '' : $langs->trans($clone->error), $clone->errors, 'errors'); |
@@ -832,7 +832,7 @@ discard block |
||
| 832 | 832 | } else { |
| 833 | 833 | $db->commit(); |
| 834 | 834 | $db->close(); |
| 835 | - header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id); |
|
| 835 | + header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); |
|
| 836 | 836 | exit; |
| 837 | 837 | } |
| 838 | 838 | } else { |
@@ -1536,7 +1536,7 @@ discard block |
||
| 1536 | 1536 | $ldap = new Ldap(); |
| 1537 | 1537 | $result = $ldap->connectBind(); |
| 1538 | 1538 | if ($result > 0) { |
| 1539 | - $userSearchFilter = '(' . getDolGlobalString('LDAP_FILTER_CONNECTION').'('.$ldap->getUserIdentifier().'='.$object->login.'))'; |
|
| 1539 | + $userSearchFilter = '('.getDolGlobalString('LDAP_FILTER_CONNECTION').'('.$ldap->getUserIdentifier().'='.$object->login.'))'; |
|
| 1540 | 1540 | $entries = $ldap->fetch($object->login, $userSearchFilter); |
| 1541 | 1541 | if (!$entries) { |
| 1542 | 1542 | setEventMessages($ldap->error, $ldap->errors, 'errors'); |
@@ -2054,7 +2054,7 @@ discard block |
||
| 2054 | 2054 | print '<td>'; |
| 2055 | 2055 | if (!empty($object->api_key)) { |
| 2056 | 2056 | print '<span class="opacitymedium">'; |
| 2057 | - print showValueWithClipboardCPButton($object->api_key, 1, $langs->trans("Hidden")); // TODO Add an option to also reveal the hash, not only copy paste |
|
| 2057 | + print showValueWithClipboardCPButton($object->api_key, 1, $langs->trans("Hidden")); // TODO Add an option to also reveal the hash, not only copy paste |
|
| 2058 | 2058 | print '</span>'; |
| 2059 | 2059 | } |
| 2060 | 2060 | print '</td></tr>'; |
@@ -2108,7 +2108,7 @@ discard block |
||
| 2108 | 2108 | $langs->load("mails"); |
| 2109 | 2109 | $params['attr']['title'] = $langs->trans('NoEMail'); |
| 2110 | 2110 | } |
| 2111 | - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle', '', $canSendMail, $params); |
|
| 2111 | + print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=presend&mode=init#formmailbeforetitle', '', $canSendMail, $params); |
|
| 2112 | 2112 | } |
| 2113 | 2113 | |
| 2114 | 2114 | if ($permissiontoedit && (!isModEnabled('multicompany') || !$user->entity || ($object->entity == $conf->entity) || (getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') && $object->entity == 1))) { |
@@ -2170,13 +2170,13 @@ discard block |
||
| 2170 | 2170 | if ($user->id != $id && $permissiontodisable && $object->statut == 0 && |
| 2171 | 2171 | ((!isModEnabled('multicompany') && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || (getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') && $object->entity == 1))) { |
| 2172 | 2172 | unset($params['attr']['title']); |
| 2173 | - print dolGetButtonAction($langs->trans('Reactivate'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=enable&token='.newToken(), '', true, $params); |
|
| 2173 | + print dolGetButtonAction($langs->trans('Reactivate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=enable&token='.newToken(), '', true, $params); |
|
| 2174 | 2174 | } |
| 2175 | 2175 | // Disable user |
| 2176 | 2176 | if ($user->id != $id && $permissiontodisable && $object->statut == 1 && |
| 2177 | 2177 | ((!isModEnabled('multicompany') && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || (getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') && $object->entity == 1))) { |
| 2178 | 2178 | unset($params['attr']['title']); |
| 2179 | - print dolGetButtonAction($langs->trans('DisableUser'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=disable&token='.newToken(), '', true, $params); |
|
| 2179 | + print dolGetButtonAction($langs->trans('DisableUser'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=disable&token='.newToken(), '', true, $params); |
|
| 2180 | 2180 | } else { |
| 2181 | 2181 | if ($user->id == $id) { |
| 2182 | 2182 | $params['attr']['title'] = $langs->trans('CantDisableYourself'); |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | $this->situationinvoice = false; |
| 176 | 176 | |
| 177 | 177 | if ($mysoc === null) { |
| 178 | - dol_syslog(get_class($this).'::__construct() Global $mysoc should not be null.'. getCallerInfoString(), LOG_ERR); |
|
| 178 | + dol_syslog(get_class($this).'::__construct() Global $mysoc should not be null.'.getCallerInfoString(), LOG_ERR); |
|
| 179 | 179 | return; |
| 180 | 180 | } |
| 181 | 181 | |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | if (!empty($conf->mycompany->multidir_output[$object->entity])) { |
| 338 | 338 | $logodir = $conf->mycompany->multidir_output[$object->entity]; |
| 339 | 339 | } |
| 340 | - $pagecount = $pdf->setSourceFile($logodir.'/' . getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')); |
|
| 340 | + $pagecount = $pdf->setSourceFile($logodir.'/'.getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')); |
|
| 341 | 341 | $tplidx = $pdf->importPage(1); |
| 342 | 342 | } |
| 343 | 343 | |
@@ -451,7 +451,7 @@ discard block |
||
| 451 | 451 | // $pdf->GetY() here can't be used. It is bottom of the second address box but first one may be higher |
| 452 | 452 | |
| 453 | 453 | // $tab_top is y where we must continue content (90 = 42 + 48: 42 is height of logo and ref, 48 is address blocks) |
| 454 | - $tab_top = 90 + $top_shift; // top_shift is an addition for linked objects or addons (0 in most cases) |
|
| 454 | + $tab_top = 90 + $top_shift; // top_shift is an addition for linked objects or addons (0 in most cases) |
|
| 455 | 455 | $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10); |
| 456 | 456 | |
| 457 | 457 | // You can add more thing under header here, if you increase $extra_under_address_shift too. |
@@ -794,11 +794,11 @@ discard block |
||
| 794 | 794 | if (!isset($this->tva[$vatrate])) { |
| 795 | 795 | $this->tva[$vatrate] = 0; |
| 796 | 796 | } |
| 797 | - $this->tva[$vatrate] += $tvaligne; // ->tva is abandoned, we use now ->tva_array that is more complete |
|
| 797 | + $this->tva[$vatrate] += $tvaligne; // ->tva is abandoned, we use now ->tva_array that is more complete |
|
| 798 | 798 | $vatcode = $object->lines[$i]->vat_src_code; |
| 799 | 799 | if (getDolGlobalInt('PDF_INVOICE_SHOW_VAT_ANALYSIS')) { |
| 800 | 800 | if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['tot_ht'])) { |
| 801 | - $this->tva_array[$vatrate . ($vatcode ? ' (' . $vatcode . ')' : '')]['tot_ht'] = 0; |
|
| 801 | + $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['tot_ht'] = 0; |
|
| 802 | 802 | } |
| 803 | 803 | $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne, 'tot_ht'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['tot_ht'] + $object->lines[$i]->total_ht); |
| 804 | 804 | } else { |
@@ -888,7 +888,7 @@ discard block |
||
| 888 | 888 | // Pagefoot |
| 889 | 889 | $this->_pagefoot($pdf, $object, $outputlangs, 0, $this->getHeightForQRInvoice($pdf->getPage(), $object, $langs)); |
| 890 | 890 | if (method_exists($pdf, 'AliasNbPages')) { |
| 891 | - $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod |
|
| 891 | + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod |
|
| 892 | 892 | } |
| 893 | 893 | |
| 894 | 894 | // Add terms to sale |
@@ -901,7 +901,7 @@ discard block |
||
| 901 | 901 | $pagecount = $pdf->setSourceFile($termsofsale); |
| 902 | 902 | for ($i = 1; $i <= $pagecount; $i++) { |
| 903 | 903 | $tplIdx = $pdf->importPage($i); |
| 904 | - if ($tplIdx!==false) { |
|
| 904 | + if ($tplIdx !== false) { |
|
| 905 | 905 | $s = $pdf->getTemplatesize($tplIdx); |
| 906 | 906 | $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); |
| 907 | 907 | $pdf->useTemplate($tplIdx); |
@@ -1202,7 +1202,7 @@ discard block |
||
| 1202 | 1202 | foreach ($this->tva_array as $tvakey => $tvaval) { |
| 1203 | 1203 | $pdf->SetFont('', '', $default_font_size - 2); |
| 1204 | 1204 | $pdf->SetXY($this->marge_gauche, $posy); |
| 1205 | - $titre = round((float) $tvakey, 2) . "%"; |
|
| 1205 | + $titre = round((float) $tvakey, 2)."%"; |
|
| 1206 | 1206 | $pdf->MultiCell(25, 4, $titre, 0, 'L'); |
| 1207 | 1207 | |
| 1208 | 1208 | $pdf->SetFont('', '', $default_font_size - 2); |
@@ -1241,7 +1241,7 @@ discard block |
||
| 1241 | 1241 | } |
| 1242 | 1242 | |
| 1243 | 1243 | $posxval = 52; |
| 1244 | - $posxend = 110; // End of x for text on left side |
|
| 1244 | + $posxend = 110; // End of x for text on left side |
|
| 1245 | 1245 | if ($this->page_largeur < 210) { // To work with US executive format |
| 1246 | 1246 | $posxend -= 10; |
| 1247 | 1247 | } |
@@ -1259,7 +1259,7 @@ discard block |
||
| 1259 | 1259 | $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement); |
| 1260 | 1260 | $pdf->MultiCell(67, 4, $lib_condition_paiement, 0, 'L'); |
| 1261 | 1261 | |
| 1262 | - $posy = $pdf->GetY() + 3; // We need spaces for 2 lines payment conditions |
|
| 1262 | + $posy = $pdf->GetY() + 3; // We need spaces for 2 lines payment conditions |
|
| 1263 | 1263 | } |
| 1264 | 1264 | |
| 1265 | 1265 | // Show category of operations |
@@ -1271,7 +1271,7 @@ discard block |
||
| 1271 | 1271 | |
| 1272 | 1272 | $pdf->SetFont('', '', $default_font_size - 2); |
| 1273 | 1273 | $pdf->SetXY($posxval, $posy); |
| 1274 | - $categoryOfOperationLabel = $outputlangs->transnoentities("MentionCategoryOfOperations" . $this->categoryOfOperation); |
|
| 1274 | + $categoryOfOperationLabel = $outputlangs->transnoentities("MentionCategoryOfOperations".$this->categoryOfOperation); |
|
| 1275 | 1275 | $pdf->MultiCell($posxend - $posxval, 4, $categoryOfOperationLabel, 0, 'L'); |
| 1276 | 1276 | |
| 1277 | 1277 | $posy = $pdf->GetY() + 3; // for 2 lines |
@@ -1422,7 +1422,7 @@ discard block |
||
| 1422 | 1422 | include_once DOL_DOCUMENT_ROOT.'/core/lib/functions_be.lib.php'; |
| 1423 | 1423 | $invoicePaymentKey = dolBECalculateStructuredCommunication($object->ref, $object->type); |
| 1424 | 1424 | |
| 1425 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities('StructuredCommunication').": " . $outputlangs->convToOutputCharset($invoicePaymentKey), 0, 'L', 0); |
|
| 1425 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities('StructuredCommunication').": ".$outputlangs->convToOutputCharset($invoicePaymentKey), 0, 'L', 0); |
|
| 1426 | 1426 | } |
| 1427 | 1427 | } |
| 1428 | 1428 | } |
@@ -1868,7 +1868,7 @@ discard block |
||
| 1868 | 1868 | if (empty($hidetop)) { |
| 1869 | 1869 | // Show category of operations |
| 1870 | 1870 | if (getDolGlobalInt('INVOICE_CATEGORY_OF_OPERATION') == 1 && $this->categoryOfOperation >= 0) { |
| 1871 | - $categoryOfOperations = $outputlangs->transnoentities("MentionCategoryOfOperations") . ' : ' . $outputlangs->transnoentities("MentionCategoryOfOperations" . $this->categoryOfOperation); |
|
| 1871 | + $categoryOfOperations = $outputlangs->transnoentities("MentionCategoryOfOperations").' : '.$outputlangs->transnoentities("MentionCategoryOfOperations".$this->categoryOfOperation); |
|
| 1872 | 1872 | $pdf->SetXY($this->marge_gauche, $tab_top - 4); |
| 1873 | 1873 | $pdf->MultiCell(($pdf->GetStringWidth($categoryOfOperations)) + 4, 2, $categoryOfOperations); |
| 1874 | 1874 | } |
@@ -2038,7 +2038,7 @@ discard block |
||
| 2038 | 2038 | } |
| 2039 | 2039 | if ($this->situationinvoice) { |
| 2040 | 2040 | $langs->loadLangs(array("other")); |
| 2041 | - $title = $outputlangs->transnoentities("PDFInvoiceSituation") . " " . $outputlangs->transnoentities("NumberingShort") . $object->situation_counter . " -"; |
|
| 2041 | + $title = $outputlangs->transnoentities("PDFInvoiceSituation")." ".$outputlangs->transnoentities("NumberingShort").$object->situation_counter." -"; |
|
| 2042 | 2042 | } |
| 2043 | 2043 | if (getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE') && is_object($outputlangsbis)) { |
| 2044 | 2044 | $title .= ' - '; |
@@ -2271,7 +2271,7 @@ discard block |
||
| 2271 | 2271 | |
| 2272 | 2272 | $carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs); |
| 2273 | 2273 | |
| 2274 | - $mode = 'target'; |
|
| 2274 | + $mode = 'target'; |
|
| 2275 | 2275 | $carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), ($usecontact ? 1 : 0), $mode, $object); |
| 2276 | 2276 | |
| 2277 | 2277 | // Show recipient |
@@ -2326,7 +2326,7 @@ discard block |
||
| 2326 | 2326 | if (!empty($carac_client_shipping)) { |
| 2327 | 2327 | $posy += $hautcadre; |
| 2328 | 2328 | |
| 2329 | - $hautcadre -= 10; // Height for the shipping address does not need to be as high as main box |
|
| 2329 | + $hautcadre -= 10; // Height for the shipping address does not need to be as high as main box |
|
| 2330 | 2330 | |
| 2331 | 2331 | // Show shipping frame |
| 2332 | 2332 | $pdf->SetXY($posx + 2, $posy - 5); |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | $this->watermark = ''; |
| 162 | 162 | |
| 163 | 163 | if ($mysoc === null) { |
| 164 | - dol_syslog(get_class($this).'::__construct() Global $mysoc should not be null.'. getCallerInfoString(), LOG_ERR); |
|
| 164 | + dol_syslog(get_class($this).'::__construct() Global $mysoc should not be null.'.getCallerInfoString(), LOG_ERR); |
|
| 165 | 165 | return; |
| 166 | 166 | } |
| 167 | 167 | |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | if (!empty($conf->mycompany->multidir_output[$object->entity])) { |
| 364 | 364 | $logodir = $conf->mycompany->multidir_output[$object->entity]; |
| 365 | 365 | } |
| 366 | - $pagecount = $pdf->setSourceFile($logodir.'/' . getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')); |
|
| 366 | + $pagecount = $pdf->setSourceFile($logodir.'/'.getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')); |
|
| 367 | 367 | $tplidx = $pdf->importPage(1); |
| 368 | 368 | } |
| 369 | 369 | |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | // $pdf->GetY() here can't be used. It is bottom of the second address box but first one may be higher |
| 461 | 461 | |
| 462 | 462 | // $this->tab_top is y where we must continue content (90 = 42 + 48: 42 is height of logo and ref, 48 is address blocks) |
| 463 | - $this->tab_top = 90 + $top_shift + $shipp_shift; // top_shift is an addition for linked objects or addons (0 in most cases) |
|
| 463 | + $this->tab_top = 90 + $top_shift + $shipp_shift; // top_shift is an addition for linked objects or addons (0 in most cases) |
|
| 464 | 464 | $this->tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10); |
| 465 | 465 | |
| 466 | 466 | // You can add more thing under header here, if you increase $extra_under_address_shift too. |
@@ -713,7 +713,7 @@ discard block |
||
| 713 | 713 | } |
| 714 | 714 | |
| 715 | 715 | $pdf->setTopMargin($this->tab_top_newpage); |
| 716 | - $page_bottom_margin = $this->heightforfooter + $this->heightforfreetext + $this->heightforinfotot + $this->getHeightForQRInvoice($pdf->getPage(), $object, $langs); |
|
| 716 | + $page_bottom_margin = $this->heightforfooter + $this->heightforfreetext + $this->heightforinfotot + $this->getHeightForQRInvoice($pdf->getPage(), $object, $langs); |
|
| 717 | 717 | $pdf->setPageOrientation('', 1, $page_bottom_margin); |
| 718 | 718 | $pageposbefore = $pdf->getPage(); |
| 719 | 719 | |
@@ -960,11 +960,11 @@ discard block |
||
| 960 | 960 | if (!isset($this->tva[$vatrate])) { |
| 961 | 961 | $this->tva[$vatrate] = 0; |
| 962 | 962 | } |
| 963 | - $this->tva[$vatrate] += $tvaligne; // ->tva is abandoned, we use now ->tva_array that is more complete |
|
| 963 | + $this->tva[$vatrate] += $tvaligne; // ->tva is abandoned, we use now ->tva_array that is more complete |
|
| 964 | 964 | $vatcode = $object->lines[$i]->vat_src_code; |
| 965 | 965 | if (getDolGlobalInt('PDF_INVOICE_SHOW_VAT_ANALYSIS')) { |
| 966 | 966 | if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['tot_ht'])) { |
| 967 | - $this->tva_array[$vatrate . ($vatcode ? ' (' . $vatcode . ')' : '')]['tot_ht'] = 0; |
|
| 967 | + $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['tot_ht'] = 0; |
|
| 968 | 968 | } |
| 969 | 969 | $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne, 'tot_ht'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['tot_ht'] + $object->lines[$i]->total_ht); |
| 970 | 970 | } else { |
@@ -1051,7 +1051,7 @@ discard block |
||
| 1051 | 1051 | // Pagefoot |
| 1052 | 1052 | $this->_pagefoot($pdf, $object, $outputlangs, 0, $this->getHeightForQRInvoice($pdf->getPage(), $object, $langs)); |
| 1053 | 1053 | if (method_exists($pdf, 'AliasNbPages')) { |
| 1054 | - $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod |
|
| 1054 | + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod |
|
| 1055 | 1055 | } |
| 1056 | 1056 | // Add terms to sale |
| 1057 | 1057 | if (!empty($mysoc->termsofsale) && getDolGlobalInt('MAIN_PDF_ADD_TERMSOFSALE_INVOICE')) { |
@@ -1063,7 +1063,7 @@ discard block |
||
| 1063 | 1063 | $pagecount = $pdf->setSourceFile($termsofsale); |
| 1064 | 1064 | for ($i = 1; $i <= $pagecount; $i++) { |
| 1065 | 1065 | $tplIdx = $pdf->importPage($i); |
| 1066 | - if ($tplIdx!==false) { |
|
| 1066 | + if ($tplIdx !== false) { |
|
| 1067 | 1067 | $s = $pdf->getTemplatesize($tplIdx); |
| 1068 | 1068 | $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); |
| 1069 | 1069 | $pdf->useTemplate($tplIdx); |
@@ -1302,7 +1302,7 @@ discard block |
||
| 1302 | 1302 | foreach ($this->tva_array as $tvakey => $tvaval) { |
| 1303 | 1303 | $pdf->SetFont('', '', $default_font_size - 2); |
| 1304 | 1304 | $pdf->SetXY($this->marge_gauche, $posy); |
| 1305 | - $titre = round((float) $tvakey, 2) . "%"; |
|
| 1305 | + $titre = round((float) $tvakey, 2)."%"; |
|
| 1306 | 1306 | $pdf->MultiCell(25, 4, $titre, 0, 'L'); |
| 1307 | 1307 | |
| 1308 | 1308 | $pdf->SetFont('', '', $default_font_size - 2); |
@@ -1340,8 +1340,8 @@ discard block |
||
| 1340 | 1340 | $posy = $pdf->GetY() + 4; |
| 1341 | 1341 | } |
| 1342 | 1342 | |
| 1343 | - $posxval = 52; // Position of values of properties shown on left side |
|
| 1344 | - $posxend = 110; // End of x for text on left side |
|
| 1343 | + $posxval = 52; // Position of values of properties shown on left side |
|
| 1344 | + $posxend = 110; // End of x for text on left side |
|
| 1345 | 1345 | if ($this->page_largeur < 210) { // To work with US executive format |
| 1346 | 1346 | $posxend -= 10; |
| 1347 | 1347 | } |
@@ -1371,7 +1371,7 @@ discard block |
||
| 1371 | 1371 | |
| 1372 | 1372 | $pdf->SetFont('', '', $default_font_size - 2); |
| 1373 | 1373 | $pdf->SetXY($posxval, $posy); |
| 1374 | - $categoryOfOperationLabel = $outputlangs->transnoentities("MentionCategoryOfOperations" . $this->categoryOfOperation); |
|
| 1374 | + $categoryOfOperationLabel = $outputlangs->transnoentities("MentionCategoryOfOperations".$this->categoryOfOperation); |
|
| 1375 | 1375 | $pdf->MultiCell($posxend - $posxval, 4, $categoryOfOperationLabel, 0, 'L'); |
| 1376 | 1376 | |
| 1377 | 1377 | $posy = $pdf->GetY() + 3; // for 2 lines |
@@ -1549,7 +1549,7 @@ discard block |
||
| 1549 | 1549 | include_once DOL_DOCUMENT_ROOT.'/core/lib/functions_be.lib.php'; |
| 1550 | 1550 | $invoicePaymentKey = dolBECalculateStructuredCommunication($object->ref, $object->type); |
| 1551 | 1551 | |
| 1552 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities('StructuredCommunication').": " . $outputlangs->convToOutputCharset($invoicePaymentKey), 0, 'L', 0); |
|
| 1552 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities('StructuredCommunication').": ".$outputlangs->convToOutputCharset($invoicePaymentKey), 0, 'L', 0); |
|
| 1553 | 1553 | } |
| 1554 | 1554 | } |
| 1555 | 1555 | } |
@@ -2171,7 +2171,7 @@ discard block |
||
| 2171 | 2171 | if (empty($hidetop)) { |
| 2172 | 2172 | // Show category of operations |
| 2173 | 2173 | if (getDolGlobalInt('INVOICE_CATEGORY_OF_OPERATION') == 1 && $this->categoryOfOperation >= 0) { |
| 2174 | - $categoryOfOperations = $outputlangs->transnoentities("MentionCategoryOfOperations") . ' : ' . $outputlangs->transnoentities("MentionCategoryOfOperations" . $this->categoryOfOperation); |
|
| 2174 | + $categoryOfOperations = $outputlangs->transnoentities("MentionCategoryOfOperations").' : '.$outputlangs->transnoentities("MentionCategoryOfOperations".$this->categoryOfOperation); |
|
| 2175 | 2175 | $pdf->SetXY($this->marge_gauche, $tab_top - 4); |
| 2176 | 2176 | $pdf->MultiCell(($pdf->GetStringWidth($categoryOfOperations)) + 4, 2, $categoryOfOperations); |
| 2177 | 2177 | } |
@@ -2287,7 +2287,7 @@ discard block |
||
| 2287 | 2287 | } |
| 2288 | 2288 | if ($this->situationinvoice) { |
| 2289 | 2289 | $langs->loadLangs(array("other")); |
| 2290 | - $title = $outputlangs->transnoentities("PDFInvoiceSituation") . " " . $outputlangs->transnoentities("NumberingShort") . $object->situation_counter . " -"; |
|
| 2290 | + $title = $outputlangs->transnoentities("PDFInvoiceSituation")." ".$outputlangs->transnoentities("NumberingShort").$object->situation_counter." -"; |
|
| 2291 | 2291 | } |
| 2292 | 2292 | if (getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE') && is_object($outputlangsbis)) { |
| 2293 | 2293 | $title .= ' - '; |
@@ -2575,7 +2575,7 @@ discard block |
||
| 2575 | 2575 | if (!empty($carac_client_shipping)) { |
| 2576 | 2576 | $posy += $hautcadre; |
| 2577 | 2577 | |
| 2578 | - $hautcadre -= 10; // Height for the shipping address does not need to be as high as main box |
|
| 2578 | + $hautcadre -= 10; // Height for the shipping address does not need to be as high as main box |
|
| 2579 | 2579 | |
| 2580 | 2580 | // Show shipping frame |
| 2581 | 2581 | $pdf->SetXY($posx + 2, $posy - 5); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * Dolibarr version of the loaded document |
| 79 | 79 | * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' |
| 80 | 80 | */ |
| 81 | - public $version = 'disabled'; // Disabled by default. Enabled in constructor if option INVOICE_USE_SITUATION is 2. |
|
| 81 | + public $version = 'disabled'; // Disabled by default. Enabled in constructor if option INVOICE_USE_SITUATION is 2. |
|
| 82 | 82 | |
| 83 | 83 | /** |
| 84 | 84 | * @var int height for info total |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | if ($mysoc === null) { |
| 250 | - dol_syslog(get_class($this).'::__construct() Global $mysoc should not be null.'. getCallerInfoString(), LOG_ERR); |
|
| 250 | + dol_syslog(get_class($this).'::__construct() Global $mysoc should not be null.'.getCallerInfoString(), LOG_ERR); |
|
| 251 | 251 | return; |
| 252 | 252 | } |
| 253 | 253 | |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | $outputlangsbis->loadLangs(array("main", "bills", "products", "dict", "companies", "compta")); |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | - if (empty($object) || ($object->type != Facture::TYPE_SITUATION && ($object->type != Facture::TYPE_CREDIT_NOTE && !empty($object->situation_cycle_ref)))) { |
|
| 300 | + if (empty($object) || ($object->type != Facture::TYPE_SITUATION && ($object->type != Facture::TYPE_CREDIT_NOTE && !empty($object->situation_cycle_ref)))) { |
|
| 301 | 301 | setEventMessage($langs->trans('WarningsObjectIsNotASituation'), 'warnings'); |
| 302 | 302 | return 1; |
| 303 | 303 | } |
@@ -416,15 +416,15 @@ discard block |
||
| 416 | 416 | $pdf->SetAutoPageBreak(1, 0); |
| 417 | 417 | |
| 418 | 418 | // compute height for situation invoices |
| 419 | - $this->heightforinfotot = 45; // Height reserved to output the info and total part and payment part |
|
| 419 | + $this->heightforinfotot = 45; // Height reserved to output the info and total part and payment part |
|
| 420 | 420 | if (!getDolGlobalString('INVOICE_NO_PAYMENT_DETAILS') && $nbpayments > 0) { |
| 421 | 421 | $this->heightforinfotot += 4 * ($nbpayments + 3); |
| 422 | 422 | } |
| 423 | 423 | if ($nbprevsituation > 0) { |
| 424 | 424 | $this->heightforinfotot += 4 * ($nbprevsituation + 3); |
| 425 | 425 | } |
| 426 | - $this->heightforfreetext = (getDolGlobalInt('MAIN_PDF_FREETEXT_HEIGHT', 5)); // Height reserved to output the free text on last page |
|
| 427 | - $this->heightforfooter = $this->marge_basse + (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS') ? 12 : 22); // Height reserved to output the footer (value include bottom margin) |
|
| 426 | + $this->heightforfreetext = (getDolGlobalInt('MAIN_PDF_FREETEXT_HEIGHT', 5)); // Height reserved to output the free text on last page |
|
| 427 | + $this->heightforfooter = $this->marge_basse + (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS') ? 12 : 22); // Height reserved to output the footer (value include bottom margin) |
|
| 428 | 428 | |
| 429 | 429 | if (class_exists('TCPDF')) { |
| 430 | 430 | $pdf->setPrintHeader(false); |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | if (!empty($conf->mycompany->multidir_output[$object->entity])) { |
| 439 | 439 | $logodir = $conf->mycompany->multidir_output[$object->entity]; |
| 440 | 440 | } |
| 441 | - $pagecount = $pdf->setSourceFile($logodir.'/' . getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')); |
|
| 441 | + $pagecount = $pdf->setSourceFile($logodir.'/'.getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')); |
|
| 442 | 442 | $this->tplidx = $pdf->importPage(1); |
| 443 | 443 | } |
| 444 | 444 | |
@@ -530,7 +530,7 @@ discard block |
||
| 530 | 530 | // $pdf->GetY() here can't be used. It is bottom of the second address box but first one may be higher |
| 531 | 531 | |
| 532 | 532 | // $this->tab_top is y where we must continue content (90 = 42 + 48: 42 is height of logo and ref, 48 is address blocks) |
| 533 | - $this->tab_top = 90 + $top_shift + $shipp_shift; // top_shift is an addition for linked objects or addons (0 in most cases) |
|
| 533 | + $this->tab_top = 90 + $top_shift + $shipp_shift; // top_shift is an addition for linked objects or addons (0 in most cases) |
|
| 534 | 534 | $this->tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10); |
| 535 | 535 | |
| 536 | 536 | // You can add more thing under header here, if you increase $extra_under_address_shift too. |
@@ -1040,11 +1040,11 @@ discard block |
||
| 1040 | 1040 | if (!isset($this->tva[$vatrate])) { |
| 1041 | 1041 | $this->tva[$vatrate] = 0; |
| 1042 | 1042 | } |
| 1043 | - $this->tva[$vatrate] += $tvaligne; // ->tva is abandoned, we use now ->tva_array that is more complete |
|
| 1043 | + $this->tva[$vatrate] += $tvaligne; // ->tva is abandoned, we use now ->tva_array that is more complete |
|
| 1044 | 1044 | $vatcode = $object->lines[$i]->vat_src_code; |
| 1045 | 1045 | if (getDolGlobalInt('PDF_INVOICE_SHOW_VAT_ANALYSIS')) { |
| 1046 | 1046 | if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['tot_ht'])) { |
| 1047 | - $this->tva_array[$vatrate . ($vatcode ? ' (' . $vatcode . ')' : '')]['tot_ht'] = 0; |
|
| 1047 | + $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['tot_ht'] = 0; |
|
| 1048 | 1048 | } |
| 1049 | 1049 | $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne, 'tot_ht'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['tot_ht'] + $object->lines[$i]->total_ht); |
| 1050 | 1050 | } else { |
@@ -1136,7 +1136,7 @@ discard block |
||
| 1136 | 1136 | // Pagefoot |
| 1137 | 1137 | $this->_pagefoot($pdf, $object, $outputlangs); |
| 1138 | 1138 | if (method_exists($pdf, 'AliasNbPages')) { |
| 1139 | - $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod |
|
| 1139 | + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod |
|
| 1140 | 1140 | } |
| 1141 | 1141 | |
| 1142 | 1142 | $this->resumeLastPage($pdf, $object, 0, $tab_top, $outputlangs, $outputlangsbis); |
@@ -1369,7 +1369,7 @@ discard block |
||
| 1369 | 1369 | foreach ($this->tva_array as $tvakey => $tvaval) { |
| 1370 | 1370 | $pdf->SetFont('', '', $default_font_size - 2); |
| 1371 | 1371 | $pdf->SetXY($this->marge_gauche, $posy); |
| 1372 | - $titre = round((float) $tvakey, 2) . "%"; |
|
| 1372 | + $titre = round((float) $tvakey, 2)."%"; |
|
| 1373 | 1373 | $pdf->MultiCell(25, 4, $titre, 0, 'L'); |
| 1374 | 1374 | |
| 1375 | 1375 | $pdf->SetFont('', '', $default_font_size - 2); |
@@ -1407,8 +1407,8 @@ discard block |
||
| 1407 | 1407 | $posy = $pdf->GetY() + 4; |
| 1408 | 1408 | } |
| 1409 | 1409 | |
| 1410 | - $posxval = 52; // Position of values of properties shown on left side |
|
| 1411 | - $posxend = 110; // End of x for text on left side |
|
| 1410 | + $posxval = 52; // Position of values of properties shown on left side |
|
| 1411 | + $posxend = 110; // End of x for text on left side |
|
| 1412 | 1412 | if ($this->page_largeur < 210) { // To work with US executive format |
| 1413 | 1413 | $posxend -= 10; |
| 1414 | 1414 | } |
@@ -1438,7 +1438,7 @@ discard block |
||
| 1438 | 1438 | |
| 1439 | 1439 | $pdf->SetFont('', '', $default_font_size - 2); |
| 1440 | 1440 | $pdf->SetXY($posxval, $posy); |
| 1441 | - $categoryOfOperationLabel = $outputlangs->transnoentities("MentionCategoryOfOperations" . $this->categoryOfOperation); |
|
| 1441 | + $categoryOfOperationLabel = $outputlangs->transnoentities("MentionCategoryOfOperations".$this->categoryOfOperation); |
|
| 1442 | 1442 | $pdf->MultiCell($posxend - $posxval, 4, $categoryOfOperationLabel, 0, 'L'); |
| 1443 | 1443 | |
| 1444 | 1444 | $posy = $pdf->GetY() + 3; // for 2 lines |
@@ -1605,7 +1605,7 @@ discard block |
||
| 1605 | 1605 | include_once DOL_DOCUMENT_ROOT.'/core/lib/functions_be.lib.php'; |
| 1606 | 1606 | $invoicePaymentKey = dolBECalculateStructuredCommunication($object->ref, $object->type); |
| 1607 | 1607 | |
| 1608 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities('StructuredCommunication').": " . $outputlangs->convToOutputCharset($invoicePaymentKey), 0, 'L', 0); |
|
| 1608 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities('StructuredCommunication').": ".$outputlangs->convToOutputCharset($invoicePaymentKey), 0, 'L', 0); |
|
| 1609 | 1609 | } |
| 1610 | 1610 | } |
| 1611 | 1611 | } |
@@ -1791,7 +1791,7 @@ discard block |
||
| 1791 | 1791 | if (($object->lines[$i]->info_bits & 0x01) == 0x01) { |
| 1792 | 1792 | $vatrate .= '*'; |
| 1793 | 1793 | } |
| 1794 | - if (! isset($tvas[$vatrate])) { |
|
| 1794 | + if (!isset($tvas[$vatrate])) { |
|
| 1795 | 1795 | $tvas[$vatrate] = 0; |
| 1796 | 1796 | } |
| 1797 | 1797 | $tvas[$vatrate] += $tvaligne; |
@@ -2060,7 +2060,7 @@ discard block |
||
| 2060 | 2060 | if (empty($hidetop)) { |
| 2061 | 2061 | // Show category of operations |
| 2062 | 2062 | if (getDolGlobalInt('INVOICE_CATEGORY_OF_OPERATION') == 1 && $this->categoryOfOperation >= 0) { |
| 2063 | - $categoryOfOperations = $outputlangs->transnoentities("MentionCategoryOfOperations") . ' : ' . $outputlangs->transnoentities("MentionCategoryOfOperations" . $this->categoryOfOperation); |
|
| 2063 | + $categoryOfOperations = $outputlangs->transnoentities("MentionCategoryOfOperations").' : '.$outputlangs->transnoentities("MentionCategoryOfOperations".$this->categoryOfOperation); |
|
| 2064 | 2064 | $pdf->SetXY($this->marge_gauche, $tab_top - 4); |
| 2065 | 2065 | $pdf->MultiCell(($pdf->GetStringWidth($categoryOfOperations)) + 4, 2, $categoryOfOperations); |
| 2066 | 2066 | } |
@@ -2080,7 +2080,7 @@ discard block |
||
| 2080 | 2080 | $pdf->SetFont('', '', $default_font_size - 1); |
| 2081 | 2081 | |
| 2082 | 2082 | // Output Rect |
| 2083 | - $this->printRoundedRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $this->corner_radius, $hidetop, $hidebottom, 'D'); // Rect prend une longueur en 3eme param et 4eme param |
|
| 2083 | + $this->printRoundedRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $this->corner_radius, $hidetop, $hidebottom, 'D'); // Rect prend une longueur en 3eme param et 4eme param |
|
| 2084 | 2084 | |
| 2085 | 2085 | // situation invoice |
| 2086 | 2086 | $pdf->SetFont('', '', $default_font_size - 2); |
@@ -2120,7 +2120,7 @@ discard block |
||
| 2120 | 2120 | $pdf->SetFont('', '', $default_font_size - 1); |
| 2121 | 2121 | |
| 2122 | 2122 | if (empty($hidetop)) { |
| 2123 | - $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5); // line prend une position y en 2eme param et 4eme param |
|
| 2123 | + $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5); // line prend une position y en 2eme param et 4eme param |
|
| 2124 | 2124 | } |
| 2125 | 2125 | } |
| 2126 | 2126 | |
@@ -2697,7 +2697,7 @@ discard block |
||
| 2697 | 2697 | 'overtitle' => array( |
| 2698 | 2698 | 'textkey' => 'Chantier', // use lang key is useful in somme case with module |
| 2699 | 2699 | 'align' => 'C', |
| 2700 | - 'padding' => array(0.5,0.5,0.5,0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left |
|
| 2700 | + 'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left |
|
| 2701 | 2701 | 'width' => 18 |
| 2702 | 2702 | ), |
| 2703 | 2703 | ); |
@@ -2722,13 +2722,13 @@ discard block |
||
| 2722 | 2722 | ), |
| 2723 | 2723 | 'border-left' => true, // add left line separator |
| 2724 | 2724 | 'overtitle' => array( |
| 2725 | - 'textkey' => 'S'.$derniere_situation->situation_counter . ' - ' . dol_print_date($derniere_situation->date, "%d/%m/%Y"), |
|
| 2725 | + 'textkey' => 'S'.$derniere_situation->situation_counter.' - '.dol_print_date($derniere_situation->date, "%d/%m/%Y"), |
|
| 2726 | 2726 | 'align' => 'C', |
| 2727 | - 'padding' => array(0.5,0.2,0.5,0.2), // Like css 0 => top, 1 => right, 2 => bottom, 3 => left |
|
| 2727 | + 'padding' => array(0.5, 0.2, 0.5, 0.2), // Like css 0 => top, 1 => right, 2 => bottom, 3 => left |
|
| 2728 | 2728 | 'width' => 10 + 15 //current width + amount cell width |
| 2729 | 2729 | ), |
| 2730 | 2730 | ); |
| 2731 | - if ($this->situationinvoice && ! empty($this->TDataSituation['date_derniere_situation'])) { |
|
| 2731 | + if ($this->situationinvoice && !empty($this->TDataSituation['date_derniere_situation'])) { |
|
| 2732 | 2732 | $this->cols['prev_progress']['status'] = true; |
| 2733 | 2733 | } |
| 2734 | 2734 | |
@@ -2743,7 +2743,7 @@ discard block |
||
| 2743 | 2743 | ), |
| 2744 | 2744 | 'border-left' => true, // add left line separator |
| 2745 | 2745 | ); |
| 2746 | - if ($this->situationinvoice && ! empty($this->TDataSituation['date_derniere_situation'])) { |
|
| 2746 | + if ($this->situationinvoice && !empty($this->TDataSituation['date_derniere_situation'])) { |
|
| 2747 | 2747 | $this->cols['prev_progress_amount']['status'] = true; |
| 2748 | 2748 | } |
| 2749 | 2749 | |
@@ -2758,9 +2758,9 @@ discard block |
||
| 2758 | 2758 | ), |
| 2759 | 2759 | 'border-left' => true, // add left line separator |
| 2760 | 2760 | 'overtitle' => array( |
| 2761 | - 'textkey' => 'S'.$object->situation_counter . ' - ' . dol_print_date($object->date, "%d/%m/%Y"), |
|
| 2761 | + 'textkey' => 'S'.$object->situation_counter.' - '.dol_print_date($object->date, "%d/%m/%Y"), |
|
| 2762 | 2762 | 'align' => 'C', |
| 2763 | - 'padding' => array(0.5,0.2,0.5,0.2), // Like css 0 => top, 1 => right, 2 => bottom, 3 => left |
|
| 2763 | + 'padding' => array(0.5, 0.2, 0.5, 0.2), // Like css 0 => top, 1 => right, 2 => bottom, 3 => left |
|
| 2764 | 2764 | 'width' => 10 + 15 |
| 2765 | 2765 | ), |
| 2766 | 2766 | ); |
@@ -2885,7 +2885,7 @@ discard block |
||
| 2885 | 2885 | |
| 2886 | 2886 | // Output Rect |
| 2887 | 2887 | // KEEPTHIS => Affiche les bords extérieurs |
| 2888 | - $this->printRoundedRectBtp($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $this->corner_radius, $hidetop, $hidebottom, 'D'); // Rect prend une longueur en 3eme param et 4eme param |
|
| 2888 | + $this->printRoundedRectBtp($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $this->corner_radius, $hidetop, $hidebottom, 'D'); // Rect prend une longueur en 3eme param et 4eme param |
|
| 2889 | 2889 | |
| 2890 | 2890 | $pdf->line($this->posx_cumul_anterieur - 1, $tab_top, $this->posx_cumul_anterieur - 1, $tab_top + $tab_height); |
| 2891 | 2891 | if (empty($hidetop)) { |
@@ -2942,7 +2942,7 @@ discard block |
||
| 2942 | 2942 | $pdf->SetXY($this->marge_gauche + 10, $tab_top + 24 + $i); |
| 2943 | 2943 | $pdf->MultiCell(80, 2, $outputlangs->transnoentities("TotalHT").' '.$TVatInfo['label'], '', 'L'); |
| 2944 | 2944 | |
| 2945 | - if (! empty($this->TDataSituation['current'][$tva_tx_formated]['TVA'])) { |
|
| 2945 | + if (!empty($this->TDataSituation['current'][$tva_tx_formated]['TVA'])) { |
|
| 2946 | 2946 | $pdf->SetXY($this->marge_gauche + 10, $tab_top + 28 + $i); |
| 2947 | 2947 | $pdf->MultiCell(80, 2, $outputlangs->transnoentities("VAT").' '.$TVatInfo['label'], '', 'L'); |
| 2948 | 2948 | } else { |
@@ -3006,7 +3006,7 @@ discard block |
||
| 3006 | 3006 | $pdf->MultiCell(32, 2, price($this->TDataSituation[$col][$tva_tx_formated]['HT'], 0, '', 1, -1, 2), '', 'R'); |
| 3007 | 3007 | |
| 3008 | 3008 | // Total TVA |
| 3009 | - if (! empty($this->TDataSituation['current'][$tva_tx_formated]['TVA'])) { |
|
| 3009 | + if (!empty($this->TDataSituation['current'][$tva_tx_formated]['TVA'])) { |
|
| 3010 | 3010 | $pdf->SetXY($x, $tab_top + 28 + $i); |
| 3011 | 3011 | $pdf->MultiCell(32, 2, price($this->TDataSituation[$col][$tva_tx_formated]['TVA'], 0, '', 1, -1, 2), '', 'R'); |
| 3012 | 3012 | } else { |
@@ -3086,7 +3086,7 @@ discard block |
||
| 3086 | 3086 | |
| 3087 | 3087 | $TDataSituation = array(); |
| 3088 | 3088 | |
| 3089 | - if (! empty($facDerniereSituation)) { |
|
| 3089 | + if (!empty($facDerniereSituation)) { |
|
| 3090 | 3090 | $TDataSituation['derniere_situation'] = $facDerniereSituation; |
| 3091 | 3091 | $TDataSituation['date_derniere_situation'] = $facDerniereSituation->date; |
| 3092 | 3092 | } |
@@ -3095,9 +3095,9 @@ discard block |
||
| 3095 | 3095 | $retenue_garantie_anterieure = 0; |
| 3096 | 3096 | // Init tous les champs à 0 |
| 3097 | 3097 | $TDataSituation['cumul_anterieur'] = array( |
| 3098 | - 'HT' => 0, //montant HT normal |
|
| 3099 | - 'TVA' => 0, //montant de la TVA sur le HTnet |
|
| 3100 | - 'TTC' => 0, //montant TTC (HTnet + TVA) |
|
| 3098 | + 'HT' => 0, //montant HT normal |
|
| 3099 | + 'TVA' => 0, //montant de la TVA sur le HTnet |
|
| 3100 | + 'TTC' => 0, //montant TTC (HTnet + TVA) |
|
| 3101 | 3101 | 'retenue_garantie' => 0, |
| 3102 | 3102 | 'travaux_sup' => 0, |
| 3103 | 3103 | 'HTnet' => 0, //montant HT |
@@ -3127,7 +3127,7 @@ discard block |
||
| 3127 | 3127 | $isFirstSituation = false; |
| 3128 | 3128 | if (!empty($l->fk_prev_id)) { |
| 3129 | 3129 | $prevSituationPercent = $l->get_prev_progress($previousInvoice->id, true); |
| 3130 | - } elseif (! array_key_exists($i + 1, $TPreviousInvoices)) { |
|
| 3130 | + } elseif (!array_key_exists($i + 1, $TPreviousInvoices)) { |
|
| 3131 | 3131 | $isFirstSituation = true; |
| 3132 | 3132 | } |
| 3133 | 3133 | |
@@ -3137,7 +3137,7 @@ discard block |
||
| 3137 | 3137 | |
| 3138 | 3138 | //1ere ligne |
| 3139 | 3139 | $amounttva = $calc_ht * ($ltvatx / 100); |
| 3140 | - if (! isset($TDataSituation['cumul_anterieur'][$ltvatx])) { |
|
| 3140 | + if (!isset($TDataSituation['cumul_anterieur'][$ltvatx])) { |
|
| 3141 | 3141 | $TDataSituation['cumul_anterieur'][$ltvatx]['HT'] = $calc_ht; |
| 3142 | 3142 | $TDataSituation['cumul_anterieur'][$ltvatx]['TVA'] = $amounttva; |
| 3143 | 3143 | } else { |
@@ -3149,14 +3149,14 @@ discard block |
||
| 3149 | 3149 | //le grand total de TVA |
| 3150 | 3150 | // $TDataSituation['cumul_anterieur']['TVA'] += $amounttva; |
| 3151 | 3151 | |
| 3152 | - if (empty($l->fk_prev_id) && ! $isFirstSituation) { |
|
| 3152 | + if (empty($l->fk_prev_id) && !$isFirstSituation) { |
|
| 3153 | 3153 | // TODO: à clarifier, mais pour moi, un facture de situation précédente qui a des progressions à 0% c'est pas logique |
| 3154 | 3154 | $TDataSituation['cumul_anterieur']['travaux_sup'] += $calc_ht; |
| 3155 | 3155 | } |
| 3156 | 3156 | } |
| 3157 | 3157 | } |
| 3158 | 3158 | |
| 3159 | - if (! empty($previousInvoice->retained_warranty) && !getDolGlobalString('USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION_FINAL')) { |
|
| 3159 | + if (!empty($previousInvoice->retained_warranty) && !getDolGlobalString('USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION_FINAL')) { |
|
| 3160 | 3160 | $retenue_garantie_anterieure += $previousInvoice->getRetainedWarrantyAmount(); |
| 3161 | 3161 | } |
| 3162 | 3162 | |
@@ -3170,7 +3170,7 @@ discard block |
||
| 3170 | 3170 | // print json_encode($facDerniereSituation->lines);exit; |
| 3171 | 3171 | $TDataSituation['current'] = $this->btpGetInvoiceAmounts($object->id); |
| 3172 | 3172 | |
| 3173 | - if (! empty($facDerniereSituation->lines)) { |
|
| 3173 | + if (!empty($facDerniereSituation->lines)) { |
|
| 3174 | 3174 | $TFacLinesKey = array_keys($facDerniereSituation->lines); |
| 3175 | 3175 | $TObjectLinesKey = array_keys($object->lines); |
| 3176 | 3176 | $TDiffKey = array_diff($TObjectLinesKey, $TFacLinesKey); |
@@ -3365,7 +3365,7 @@ discard block |
||
| 3365 | 3365 | */ |
| 3366 | 3366 | public function btpGetInvoiceAmounts($id, $forceReadFromDB = false) |
| 3367 | 3367 | { |
| 3368 | - global $user,$langs,$conf,$mysoc,$db,$hookmanager,$nblignes; |
|
| 3368 | + global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblignes; |
|
| 3369 | 3369 | |
| 3370 | 3370 | $object = new Facture($db); |
| 3371 | 3371 | $object->fetch($id); |
@@ -3383,16 +3383,16 @@ discard block |
||
| 3383 | 3383 | $facDerniereSituation = $TPreviousInvoices[0]; |
| 3384 | 3384 | |
| 3385 | 3385 | $ret = array( |
| 3386 | - 'HT' => 0, //montant HT normal |
|
| 3386 | + 'HT' => 0, //montant HT normal |
|
| 3387 | 3387 | 'HTnet' => 0, //montant HT |
| 3388 | - 'TVA' => 0, //montant de la TVA sur le HTnet |
|
| 3389 | - 'TTC' => 0, //montant TTC (HTnet + TVA) |
|
| 3388 | + 'TVA' => 0, //montant de la TVA sur le HTnet |
|
| 3389 | + 'TTC' => 0, //montant TTC (HTnet + TVA) |
|
| 3390 | 3390 | 'retenue_garantie' => 0, |
| 3391 | 3391 | 'travaux_sup' => 0, |
| 3392 | 3392 | 'total_a_payer' => 0 //montant "a payer" sur la facture |
| 3393 | 3393 | ); |
| 3394 | 3394 | |
| 3395 | - if (! empty($facDerniereSituation)) { |
|
| 3395 | + if (!empty($facDerniereSituation)) { |
|
| 3396 | 3396 | $ret['derniere_situation'] = $facDerniereSituation; |
| 3397 | 3397 | $ret['date_derniere_situation'] = $facDerniereSituation->date; |
| 3398 | 3398 | } |
@@ -3526,7 +3526,7 @@ discard block |
||
| 3526 | 3526 | $label = $outputlangs->transnoentities("SituationInvoiceTotalProposal"); |
| 3527 | 3527 | $pdf->MultiCell($this->page_largeur - ($this->marge_droite + $this->marge_gauche), 3, $label, 0, 'L', 0, 1, $posx, $posy + 1); |
| 3528 | 3528 | |
| 3529 | - $amount = price($sign * ($total_ht + (! empty($propal->remise) ? $propal->remise : 0))); |
|
| 3529 | + $amount = price($sign * ($total_ht + (!empty($propal->remise) ? $propal->remise : 0))); |
|
| 3530 | 3530 | $pdf->MultiCell($width2, 3, $amount, 0, 'R', 0, 1, $posx + $width, $posy + 1); |
| 3531 | 3531 | |
| 3532 | 3532 | $pdf->SetFont('', '', $default_font_size - 1); |
@@ -3569,7 +3569,7 @@ discard block |
||
| 3569 | 3569 | |
| 3570 | 3570 | $force_to_zero = false; |
| 3571 | 3571 | |
| 3572 | - $idinv = 0;//count($previousinvoices); |
|
| 3572 | + $idinv = 0; //count($previousinvoices); |
|
| 3573 | 3573 | while ($idinv < count($previousinvoices)) { |
| 3574 | 3574 | $invoice = $previousinvoices[$idinv]; |
| 3575 | 3575 | |
@@ -3591,7 +3591,7 @@ discard block |
||
| 3591 | 3591 | $force_to_zero = true; |
| 3592 | 3592 | } |
| 3593 | 3593 | |
| 3594 | - $ref .= ' - '. $invoice->ref; |
|
| 3594 | + $ref .= ' - '.$invoice->ref; |
|
| 3595 | 3595 | $ref .= ' ('.dol_print_date($invoice->date, "%d/%m/%Y", false, $outputlangs).')'; |
| 3596 | 3596 | $pdf->MultiCell($this->page_largeur - ($this->marge_droite + $this->marge_gauche), 3, $ref, 0, 'L', 0); |
| 3597 | 3597 | |
@@ -3622,7 +3622,7 @@ discard block |
||
| 3622 | 3622 | if (($invoice->lines[$i]->info_bits & 0x01) == 0x01) { |
| 3623 | 3623 | $vatrate .= '*'; |
| 3624 | 3624 | } |
| 3625 | - if (! isset($tvas[$vatrate])) { |
|
| 3625 | + if (!isset($tvas[$vatrate])) { |
|
| 3626 | 3626 | $tvas[$vatrate] = 0; |
| 3627 | 3627 | } |
| 3628 | 3628 | $tvas[$vatrate] += $tvaligne; |
@@ -3800,7 +3800,7 @@ discard block |
||
| 3800 | 3800 | $pdf->SetXY($posx + $width4, $posy + $height * $index + $y); |
| 3801 | 3801 | $pdf->MultiCell($width4, $height - 1, price($sign * $payment['amount'], 0, $outputlangs), 0, 'L', 0); |
| 3802 | 3802 | $pdf->SetXY($posx + $width4 * 2, $posy + $height * $index + $y); |
| 3803 | - $oper = $outputlangs->transnoentitiesnoconv("PaymentTypeShort" . $payment['type']); |
|
| 3803 | + $oper = $outputlangs->transnoentitiesnoconv("PaymentTypeShort".$payment['type']); |
|
| 3804 | 3804 | |
| 3805 | 3805 | $pdf->MultiCell($width4, $height - 1, $oper, 0, 'L', 0); |
| 3806 | 3806 | $pdf->SetXY($posx + $width4 * 3, $posy + $height * $index + $y); |
@@ -3831,7 +3831,7 @@ discard block |
||
| 3831 | 3831 | $this->_pagehead($pdf, $object, 0, $outputlangs); |
| 3832 | 3832 | } |
| 3833 | 3833 | $pdf->setPage($pageposafter + 1); |
| 3834 | - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
| 3834 | + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
| 3835 | 3835 | |
| 3836 | 3836 | $posy = $this->tab_top_newpage + 1; |
| 3837 | 3837 | } else { |
@@ -3863,7 +3863,7 @@ discard block |
||
| 3863 | 3863 | |
| 3864 | 3864 | $posy += 10; |
| 3865 | 3865 | |
| 3866 | - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
| 3866 | + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
| 3867 | 3867 | |
| 3868 | 3868 | $pdf->SetTextColor(0, 0, 60); |
| 3869 | 3869 | $pdf->SetFont('', '', $default_font_size - 1); |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | $object->delivery_date = $date_delivery; |
| 229 | 229 | foreach ($object->lines as $line) { |
| 230 | 230 | if (isset($line->date_start)) { |
| 231 | - $line->date_start += $difference; |
|
| 231 | + $line->date_start += $difference; |
|
| 232 | 232 | } |
| 233 | 233 | if (isset($line->date_end)) { |
| 234 | 234 | $line->date_end += $difference; |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | |
| 577 | 577 | $classname = ucfirst($subelement); |
| 578 | 578 | $srcobject = new $classname($db); |
| 579 | - '@phan-var-force Commande|Propal|Contrat|Fichinter|Expedition $srcobject'; // Can be other class, but CommonObject is too generic |
|
| 579 | + '@phan-var-force Commande|Propal|Contrat|Fichinter|Expedition $srcobject'; // Can be other class, but CommonObject is too generic |
|
| 580 | 580 | |
| 581 | 581 | dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add lines"); |
| 582 | 582 | $result = $srcobject->fetch($object->origin_id); |
@@ -766,7 +766,7 @@ discard block |
||
| 766 | 766 | $error++; |
| 767 | 767 | } else { |
| 768 | 768 | // Needed if object linked modified by trigger (because linked objects can't be fetched two times : linkedObjectsFullLoaded) |
| 769 | - $locationTarget = DOL_URL_ROOT . '/comm/propal/card.php?id=' . $object->id; |
|
| 769 | + $locationTarget = DOL_URL_ROOT.'/comm/propal/card.php?id='.$object->id; |
|
| 770 | 770 | } |
| 771 | 771 | |
| 772 | 772 | $deposit = null; |
@@ -777,7 +777,7 @@ discard block |
||
| 777 | 777 | !$error && GETPOSTINT('statut') == $object::STATUS_SIGNED && GETPOST('generate_deposit') == 'on' |
| 778 | 778 | && !empty($deposit_percent_from_payment_terms) && isModEnabled('invoice') && $user->hasRight('facture', 'creer') |
| 779 | 779 | ) { |
| 780 | - require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; |
|
| 780 | + require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; |
|
| 781 | 781 | |
| 782 | 782 | $date = dol_mktime(0, 0, 0, GETPOSTINT('datefmonth'), GETPOSTINT('datefday'), GETPOSTINT('datefyear')); |
| 783 | 783 | $forceFields = array(); |
@@ -790,7 +790,7 @@ discard block |
||
| 790 | 790 | |
| 791 | 791 | if ($deposit) { |
| 792 | 792 | setEventMessage('DepositGenerated'); |
| 793 | - $locationTarget = DOL_URL_ROOT . '/compta/facture/card.php?id=' . $deposit->id; |
|
| 793 | + $locationTarget = DOL_URL_ROOT.'/compta/facture/card.php?id='.$deposit->id; |
|
| 794 | 794 | } else { |
| 795 | 795 | $error++; |
| 796 | 796 | setEventMessages("Failed to create down payment - ".$object->error, $object->errors, 'errors'); |
@@ -818,7 +818,7 @@ discard block |
||
| 818 | 818 | } |
| 819 | 819 | |
| 820 | 820 | if ($locationTarget) { |
| 821 | - header('Location: ' . $locationTarget); |
|
| 821 | + header('Location: '.$locationTarget); |
|
| 822 | 822 | exit; |
| 823 | 823 | } |
| 824 | 824 | } else { |
@@ -1164,8 +1164,8 @@ discard block |
||
| 1164 | 1164 | $pricebycustomerexist = true; |
| 1165 | 1165 | $pu_ht = price($prodcustprice->lines[0]->price); |
| 1166 | 1166 | $pu_ttc = price($prodcustprice->lines[0]->price_ttc); |
| 1167 | - $price_min = price($prodcustprice->lines[0]->price_min); |
|
| 1168 | - $price_min_ttc = price($prodcustprice->lines[0]->price_min_ttc); |
|
| 1167 | + $price_min = price($prodcustprice->lines[0]->price_min); |
|
| 1168 | + $price_min_ttc = price($prodcustprice->lines[0]->price_min_ttc); |
|
| 1169 | 1169 | $price_base_type = $prodcustprice->lines[0]->price_base_type; |
| 1170 | 1170 | /*$tva_tx = ($prodcustprice->lines[0]->default_vat_code ? $prodcustprice->lines[0]->tva_tx.' ('.$prodcustprice->lines[0]->default_vat_code.' )' : $prodcustprice->lines[0]->tva_tx); |
| 1171 | 1171 | if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) { |
@@ -1221,8 +1221,8 @@ discard block |
||
| 1221 | 1221 | if (count($prodcustprice->lines) > 0) { |
| 1222 | 1222 | $pu_ht = price($prodcustprice->lines[0]->price); |
| 1223 | 1223 | $pu_ttc = price($prodcustprice->lines[0]->price_ttc); |
| 1224 | - $price_min = price($prodcustprice->lines[0]->price_min); |
|
| 1225 | - $price_min_ttc = price($prodcustprice->lines[0]->price_min_ttc); |
|
| 1224 | + $price_min = price($prodcustprice->lines[0]->price_min); |
|
| 1225 | + $price_min_ttc = price($prodcustprice->lines[0]->price_min_ttc); |
|
| 1226 | 1226 | $price_base_type = $prodcustprice->lines[0]->price_base_type; |
| 1227 | 1227 | /*$tva_tx = ($prodcustprice->lines[0]->default_vat_code ? $prodcustprice->lines[0]->tva_tx.' ('.$prodcustprice->lines[0]->default_vat_code.' )' : $prodcustprice->lines[0]->tva_tx); |
| 1228 | 1228 | if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) { |
@@ -1730,8 +1730,8 @@ discard block |
||
| 1730 | 1730 | } elseif ($action == 'setconditions' && $usercancreate) { |
| 1731 | 1731 | // Terms of payment |
| 1732 | 1732 | $sql = "SELECT code "; |
| 1733 | - $sql .= "FROM " . $db->prefix() . "c_payment_term"; |
|
| 1734 | - $sql .= " WHERE rowid = " . ((int) GETPOST('cond_reglement_id', 'int')); |
|
| 1733 | + $sql .= "FROM ".$db->prefix()."c_payment_term"; |
|
| 1734 | + $sql .= " WHERE rowid = ".((int) GETPOST('cond_reglement_id', 'int')); |
|
| 1735 | 1735 | $result = $db->query($sql); |
| 1736 | 1736 | if ($result) { |
| 1737 | 1737 | $obj = $db->fetch_object($result); |
@@ -1908,7 +1908,7 @@ discard block |
||
| 1908 | 1908 | |
| 1909 | 1909 | $classname = ucfirst($subelement); |
| 1910 | 1910 | $objectsrc = new $classname($db); |
| 1911 | - '@phan-var-force Commande|Propal|Contrat|Expedition $objectsrc'; // Can be other class, but CommonObject is too generic |
|
| 1911 | + '@phan-var-force Commande|Propal|Contrat|Expedition $objectsrc'; // Can be other class, but CommonObject is too generic |
|
| 1912 | 1912 | $objectsrc->fetch($originid); |
| 1913 | 1913 | if (empty($objectsrc->lines) && method_exists($objectsrc, 'fetch_lines')) { |
| 1914 | 1914 | $objectsrc->fetch_lines(); |
@@ -1983,7 +1983,7 @@ discard block |
||
| 1983 | 1983 | print '<form name="addprop" action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
| 1984 | 1984 | print '<input type="hidden" name="token" value="'.newToken().'">'; |
| 1985 | 1985 | print '<input type="hidden" name="action" value="add">'; |
| 1986 | - print '<input type="hidden" name="changecompany" value="0">'; // will be set to 1 by javascript so we know post is done after a company change |
|
| 1986 | + print '<input type="hidden" name="changecompany" value="0">'; // will be set to 1 by javascript so we know post is done after a company change |
|
| 1987 | 1987 | print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; |
| 1988 | 1988 | if ($origin != 'project' && $originid) { |
| 1989 | 1989 | print '<input type="hidden" name="origin" value="'.$origin.'">'; |
@@ -2145,7 +2145,7 @@ discard block |
||
| 2145 | 2145 | $sday = date("d", $tmpdte); |
| 2146 | 2146 | print $form->selectDate($syear."-".$smonth."-".$sday, 'date_livraison', 0, 0, 0, "addprop"); |
| 2147 | 2147 | } else { |
| 2148 | - $tmp_date_delivery = GETPOST('date_delivery') ? : -1; |
|
| 2148 | + $tmp_date_delivery = GETPOST('date_delivery') ?: -1; |
|
| 2149 | 2149 | print $form->selectDate($tmp_date_delivery, 'date_livraison', 0, 0, 0, "addprop", 1, 1); |
| 2150 | 2150 | } |
| 2151 | 2151 | print '</td></tr>'; |
@@ -2377,7 +2377,7 @@ discard block |
||
| 2377 | 2377 | if (!getDolGlobalString('PROPAL_SKIP_ACCEPT_REFUSE')) { |
| 2378 | 2378 | $formquestion[] = array('type' => 'select', 'name' => 'statut', 'label' => '<span class="fieldrequired">'.$langs->trans("CloseAs").'</span>', 'values' => array($object::STATUS_SIGNED => $object->LibStatut($object::STATUS_SIGNED), $object::STATUS_NOTSIGNED => $object->LibStatut($object::STATUS_NOTSIGNED))); |
| 2379 | 2379 | } |
| 2380 | - $formquestion[] = array('type' => 'text', 'name' => 'note_private', 'label' => $langs->trans("Note"), 'value' => ''); // Field to complete private note (not replace) |
|
| 2380 | + $formquestion[] = array('type' => 'text', 'name' => 'note_private', 'label' => $langs->trans("Note"), 'value' => ''); // Field to complete private note (not replace) |
|
| 2381 | 2381 | |
| 2382 | 2382 | if (getDolGlobalInt('PROPOSAL_SUGGEST_DOWN_PAYMENT_INVOICE_CREATION')) { |
| 2383 | 2383 | // This is a hidden option: |
@@ -2387,7 +2387,7 @@ discard block |
||
| 2387 | 2387 | $deposit_percent_from_payment_terms = getDictionaryValue('c_payment_term', 'deposit_percent', $object->cond_reglement_id); |
| 2388 | 2388 | |
| 2389 | 2389 | if (!empty($deposit_percent_from_payment_terms) && isModEnabled('invoice') && $user->hasRight('facture', 'creer')) { |
| 2390 | - require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; |
|
| 2390 | + require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; |
|
| 2391 | 2391 | |
| 2392 | 2392 | $object->fetchObjectLinked(); |
| 2393 | 2393 | |
@@ -2471,7 +2471,7 @@ discard block |
||
| 2471 | 2471 | 'type' => 'onecolumn', |
| 2472 | 2472 | 'value' => ' |
| 2473 | 2473 | <script> |
| 2474 | - let signedValue = ' . $object::STATUS_SIGNED . '; |
|
| 2474 | + let signedValue = ' . $object::STATUS_SIGNED.'; |
|
| 2475 | 2475 | |
| 2476 | 2476 | $(document).ready(function() { |
| 2477 | 2477 | $("[name=generate_deposit]").change(function () { |
@@ -2521,7 +2521,7 @@ discard block |
||
| 2521 | 2521 | if (!getDolGlobalString('PROPAL_SKIP_ACCEPT_REFUSE')) { |
| 2522 | 2522 | $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('SetAcceptedRefused'), '', 'confirm_closeas', $formquestion, '', 1, 250); |
| 2523 | 2523 | } else { |
| 2524 | - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?statut=3&id=' . $object->id, $langs->trans('Close'), '', 'confirm_closeas', $formquestion, '', 1, 250); |
|
| 2524 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?statut=3&id='.$object->id, $langs->trans('Close'), '', 'confirm_closeas', $formquestion, '', 1, 250); |
|
| 2525 | 2525 | } |
| 2526 | 2526 | } elseif ($action == 'cancel') { |
| 2527 | 2527 | // Confirm cancel |
@@ -2563,7 +2563,7 @@ discard block |
||
| 2563 | 2563 | $nbMandated = 0; |
| 2564 | 2564 | foreach ($object->lines as $line) { |
| 2565 | 2565 | $res = $line->fetch_product(); |
| 2566 | - if ($res > 0) { |
|
| 2566 | + if ($res > 0) { |
|
| 2567 | 2567 | if ($line->product->isService() && $line->product->isMandatoryPeriod() && (empty($line->date_start) || empty($line->date_end))) { |
| 2568 | 2568 | $nbMandated++; |
| 2569 | 2569 | break; |
@@ -2604,7 +2604,7 @@ discard block |
||
| 2604 | 2604 | $morehtmlref = '<div class="refidno">'; |
| 2605 | 2605 | // Ref customer |
| 2606 | 2606 | $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', 0, 1); |
| 2607 | - $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':' . getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1); |
|
| 2607 | + $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':'.getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1); |
|
| 2608 | 2608 | // Thirdparty |
| 2609 | 2609 | $morehtmlref .= '<br>'.$soc->getNomUrl(1, 'customer'); |
| 2610 | 2610 | if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $soc->id > 0) { |
@@ -2946,50 +2946,50 @@ discard block |
||
| 2946 | 2946 | include DOL_DOCUMENT_ROOT.'/core/tpl/object_currency_amount.tpl.php'; |
| 2947 | 2947 | |
| 2948 | 2948 | print '<tr>'; |
| 2949 | - print '<td class="titlefieldmiddle">' . $langs->trans('AmountHT') . '</td>'; |
|
| 2950 | - print '<td class="nowrap amountcard right">' . price($object->total_ht, 0, $langs, 1, -1, -1, $conf->currency) . '</td>'; |
|
| 2949 | + print '<td class="titlefieldmiddle">'.$langs->trans('AmountHT').'</td>'; |
|
| 2950 | + print '<td class="nowrap amountcard right">'.price($object->total_ht, 0, $langs, 1, -1, -1, $conf->currency).'</td>'; |
|
| 2951 | 2951 | if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { |
| 2952 | - print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_ht, 0, $langs, 1, -1, -1, $object->multicurrency_code) . '</td>'; |
|
| 2952 | + print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_ht, 0, $langs, 1, -1, -1, $object->multicurrency_code).'</td>'; |
|
| 2953 | 2953 | } |
| 2954 | 2954 | print '</tr>'; |
| 2955 | 2955 | |
| 2956 | 2956 | print '<tr>'; |
| 2957 | - print '<td>' . $langs->trans('AmountVAT') . '</td>'; |
|
| 2958 | - print '<td class="nowrap amountcard right">' . price($object->total_tva, 0, $langs, 1, -1, -1, $conf->currency) . '</td>'; |
|
| 2957 | + print '<td>'.$langs->trans('AmountVAT').'</td>'; |
|
| 2958 | + print '<td class="nowrap amountcard right">'.price($object->total_tva, 0, $langs, 1, -1, -1, $conf->currency).'</td>'; |
|
| 2959 | 2959 | if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { |
| 2960 | - print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_tva, 0, $langs, 1, -1, -1, $object->multicurrency_code) . '</td>'; |
|
| 2960 | + print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_tva, 0, $langs, 1, -1, -1, $object->multicurrency_code).'</td>'; |
|
| 2961 | 2961 | } |
| 2962 | 2962 | print '</tr>'; |
| 2963 | 2963 | |
| 2964 | 2964 | if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { |
| 2965 | 2965 | print '<tr>'; |
| 2966 | - print '<td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>'; |
|
| 2967 | - print '<td class="nowrap amountcard right">' . price($object->total_localtax1, 0, $langs, 1, -1, -1, $conf->currency) . '</td>'; |
|
| 2966 | + print '<td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>'; |
|
| 2967 | + print '<td class="nowrap amountcard right">'.price($object->total_localtax1, 0, $langs, 1, -1, -1, $conf->currency).'</td>'; |
|
| 2968 | 2968 | if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { |
| 2969 | 2969 | $object->multicurrency_total_localtax1 = price2num($object->total_localtax1 * $object->multicurrency_tx, 'MT'); |
| 2970 | 2970 | |
| 2971 | - print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_localtax1, 0, $langs, 1, -1, -1, $object->multicurrency_code) . '</td>'; |
|
| 2971 | + print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_localtax1, 0, $langs, 1, -1, -1, $object->multicurrency_code).'</td>'; |
|
| 2972 | 2972 | } |
| 2973 | 2973 | print '</tr>'; |
| 2974 | 2974 | } |
| 2975 | 2975 | |
| 2976 | 2976 | if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { |
| 2977 | 2977 | print '<tr>'; |
| 2978 | - print '<td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>'; |
|
| 2979 | - print '<td class="nowrap amountcard right">' . price($object->total_localtax2, 0, $langs, 1, -1, -1, $conf->currency) . '</td>'; |
|
| 2978 | + print '<td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>'; |
|
| 2979 | + print '<td class="nowrap amountcard right">'.price($object->total_localtax2, 0, $langs, 1, -1, -1, $conf->currency).'</td>'; |
|
| 2980 | 2980 | if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { |
| 2981 | 2981 | $object->multicurrency_total_localtax2 = price2num($object->total_localtax2 * $object->multicurrency_tx, 'MT'); |
| 2982 | 2982 | |
| 2983 | - print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_localtax2, 0, $langs, 1, -1, -1, $object->multicurrency_code) . '</td>'; |
|
| 2983 | + print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_localtax2, 0, $langs, 1, -1, -1, $object->multicurrency_code).'</td>'; |
|
| 2984 | 2984 | } |
| 2985 | 2985 | print '</tr>'; |
| 2986 | 2986 | } |
| 2987 | 2987 | |
| 2988 | 2988 | print '<tr>'; |
| 2989 | - print '<td>' . $langs->trans('AmountTTC') . '</td>'; |
|
| 2990 | - print '<td class="nowrap amountcard right">' . price($object->total_ttc, 0, $langs, 1, -1, -1, $conf->currency) . '</td>'; |
|
| 2989 | + print '<td>'.$langs->trans('AmountTTC').'</td>'; |
|
| 2990 | + print '<td class="nowrap amountcard right">'.price($object->total_ttc, 0, $langs, 1, -1, -1, $conf->currency).'</td>'; |
|
| 2991 | 2991 | if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { |
| 2992 | - print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_ttc, 0, $langs, 1, -1, -1, $object->multicurrency_code) . '</td>'; |
|
| 2992 | + print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_ttc, 0, $langs, 1, -1, -1, $object->multicurrency_code).'</td>'; |
|
| 2993 | 2993 | } |
| 2994 | 2994 | print '</tr>'; |
| 2995 | 2995 | |
@@ -3207,8 +3207,8 @@ discard block |
||
| 3207 | 3207 | } else { |
| 3208 | 3208 | // Set not signed (close) |
| 3209 | 3209 | if ($object->statut == Propal::STATUS_DRAFT && $usercanclose) { |
| 3210 | - print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&token='.newToken().'&action=closeas&token='.newToken() . (!getDolGlobalString('MAIN_JUMP_TAG') ? '' : '#close') . '"'; |
|
| 3211 | - print '>' . $langs->trans('SetRefusedAndClose') . '</a>'; |
|
| 3210 | + print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&token='.newToken().'&action=closeas&token='.newToken().(!getDolGlobalString('MAIN_JUMP_TAG') ? '' : '#close').'"'; |
|
| 3211 | + print '>'.$langs->trans('SetRefusedAndClose').'</a>'; |
|
| 3212 | 3212 | } |
| 3213 | 3213 | } |
| 3214 | 3214 | |
@@ -31,18 +31,18 @@ discard block |
||
| 31 | 31 | class Odf |
| 32 | 32 | { |
| 33 | 33 | protected $config = array( |
| 34 | - 'ZIP_PROXY' => 'PclZipProxy', // PclZipProxy, PhpZipProxy |
|
| 34 | + 'ZIP_PROXY' => 'PclZipProxy', // PclZipProxy, PhpZipProxy |
|
| 35 | 35 | 'DELIMITER_LEFT' => '{', |
| 36 | 36 | 'DELIMITER_RIGHT' => '}', |
| 37 | 37 | 'PATH_TO_TMP' => '/tmp' |
| 38 | 38 | ); |
| 39 | 39 | protected $file; |
| 40 | - protected $contentXml; // To store content of content.xml file |
|
| 41 | - protected $metaXml; // To store content of meta.xml file |
|
| 42 | - protected $stylesXml; // To store content of styles.xml file |
|
| 43 | - protected $manifestXml; // To store content of META-INF/manifest.xml file |
|
| 40 | + protected $contentXml; // To store content of content.xml file |
|
| 41 | + protected $metaXml; // To store content of meta.xml file |
|
| 42 | + protected $stylesXml; // To store content of styles.xml file |
|
| 43 | + protected $manifestXml; // To store content of META-INF/manifest.xml file |
|
| 44 | 44 | protected $tmpfile; |
| 45 | - protected $tmpdir=''; |
|
| 45 | + protected $tmpdir = ''; |
|
| 46 | 46 | protected $images = array(); |
| 47 | 47 | protected $vars = array(); |
| 48 | 48 | protected $segments = array(); |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | public $creator; |
| 51 | 51 | public $title; |
| 52 | 52 | public $subject; |
| 53 | - public $userdefined=array(); |
|
| 53 | + public $userdefined = array(); |
|
| 54 | 54 | |
| 55 | 55 | const PIXEL_TO_CM = 0.026458333; |
| 56 | 56 | const FIND_TAGS_REGEX = '/<([A-Za-z0-9]+)(?:\s([A-Za-z]+(?:\-[A-Za-z]+)?(?:=(?:".*?")|(?:[0-9]+))))*(?:(?:\s\/>)|(?:>(.*)<\/\1>))/s'; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | { |
| 69 | 69 | clearstatcache(); |
| 70 | 70 | |
| 71 | - if (! is_array($config)) { |
|
| 71 | + if (!is_array($config)) { |
|
| 72 | 72 | throw new OdfException('Configuration data must be provided as array'); |
| 73 | 73 | } |
| 74 | 74 | foreach ($config as $configKey => $configValue) { |
@@ -78,12 +78,12 @@ discard block |
||
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | $md5uniqid = md5(uniqid()); |
| 81 | - if ($this->config['PATH_TO_TMP']) $this->tmpdir = preg_replace('|[\/]$|', '', $this->config['PATH_TO_TMP']); // Remove last \ or / |
|
| 82 | - $this->tmpdir .= ($this->tmpdir?'/':'').$md5uniqid; |
|
| 83 | - $this->tmpfile = $this->tmpdir.'/'.$md5uniqid.'.odt'; // We keep .odt extension to allow OpenOffice usage during debug. |
|
| 81 | + if ($this->config['PATH_TO_TMP']) $this->tmpdir = preg_replace('|[\/]$|', '', $this->config['PATH_TO_TMP']); // Remove last \ or / |
|
| 82 | + $this->tmpdir .= ($this->tmpdir ? '/' : '').$md5uniqid; |
|
| 83 | + $this->tmpfile = $this->tmpdir.'/'.$md5uniqid.'.odt'; // We keep .odt extension to allow OpenOffice usage during debug. |
|
| 84 | 84 | |
| 85 | 85 | // A working directory is required for some zip proxy like PclZipProxy |
| 86 | - if (in_array($this->config['ZIP_PROXY'], array('PclZipProxy')) && ! is_dir($this->config['PATH_TO_TMP'])) { |
|
| 86 | + if (in_array($this->config['ZIP_PROXY'], array('PclZipProxy')) && !is_dir($this->config['PATH_TO_TMP'])) { |
|
| 87 | 87 | throw new OdfException('Temporary directory '.$this->config['PATH_TO_TMP'].' must exists'); |
| 88 | 88 | } |
| 89 | 89 | |
@@ -96,8 +96,8 @@ discard block |
||
| 96 | 96 | $zipHandler = $this->config['ZIP_PROXY']; |
| 97 | 97 | if (!defined('PCLZIP_TEMPORARY_DIR')) define('PCLZIP_TEMPORARY_DIR', $this->tmpdir); |
| 98 | 98 | include_once 'zip/'.$zipHandler.'.php'; |
| 99 | - if (! class_exists($this->config['ZIP_PROXY'])) { |
|
| 100 | - throw new OdfException($this->config['ZIP_PROXY'] . ' class not found - check your php settings'); |
|
| 99 | + if (!class_exists($this->config['ZIP_PROXY'])) { |
|
| 100 | + throw new OdfException($this->config['ZIP_PROXY'].' class not found - check your php settings'); |
|
| 101 | 101 | } |
| 102 | 102 | $this->file = new $zipHandler($this->tmpdir); |
| 103 | 103 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | public function setVars($key, $value, $encode = true, $charset = 'ISO-8859') |
| 146 | 146 | { |
| 147 | - $tag = $this->config['DELIMITER_LEFT'] . $key . $this->config['DELIMITER_RIGHT']; |
|
| 147 | + $tag = $this->config['DELIMITER_LEFT'].$key.$this->config['DELIMITER_RIGHT']; |
|
| 148 | 148 | |
| 149 | 149 | // TODO Warning string may be: |
| 150 | 150 | // <text:span text:style-name="T13">{</text:span><text:span text:style-name="T12">aaa</text:span><text:span text:style-name="T13">}</text:span> |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | |
| 180 | 180 | // Check if the value includes html tags |
| 181 | 181 | if ($this->_hasHtmlTag($value) === true) { |
| 182 | - $value = strip_tags($value, '<br><strong><b><i><em><u><s><sub><sup><span>'); // remove html tags except the one into the list in second parameter |
|
| 182 | + $value = strip_tags($value, '<br><strong><b><i><em><u><s><sub><sup><span>'); // remove html tags except the one into the list in second parameter |
|
| 183 | 183 | |
| 184 | 184 | // Default styles for strong/b, i/em, u, s, sub & sup |
| 185 | 185 | $automaticStyles = array( |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | $convertedValue = $this->_replaceHtmlWithOdtTag($this->_getDataFromHtml($value), $customStyles, $fontDeclarations, $encode, $charset); |
| 198 | 198 | |
| 199 | 199 | foreach ($customStyles as $key => $val) { |
| 200 | - array_push($automaticStyles, '<style:style style:name="customStyle' . $key . '" style:family="text">' . $val . '</style:style>'); |
|
| 200 | + array_push($automaticStyles, '<style:style style:name="customStyle'.$key.'" style:family="text">'.$val.'</style:style>'); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | // Join the styles and add them to the content xml |
@@ -207,16 +207,16 @@ discard block |
||
| 207 | 207 | $styles .= $style; |
| 208 | 208 | } |
| 209 | 209 | } |
| 210 | - $this->contentXml = str_replace('</office:automatic-styles>', $styles . '</office:automatic-styles>', $this->contentXml); |
|
| 210 | + $this->contentXml = str_replace('</office:automatic-styles>', $styles.'</office:automatic-styles>', $this->contentXml); |
|
| 211 | 211 | |
| 212 | 212 | // Join the font declarations and add them to the content xml |
| 213 | 213 | $fonts = ''; |
| 214 | 214 | foreach ($fontDeclarations as $font) { |
| 215 | - if (strpos($this->contentXml, 'style:name="' . $font . '"') === false) { |
|
| 216 | - $fonts .= '<style:font-face style:name="' . $font . '" svg:font-family="\'' . $font . '\'" />'; |
|
| 215 | + if (strpos($this->contentXml, 'style:name="'.$font.'"') === false) { |
|
| 216 | + $fonts .= '<style:font-face style:name="'.$font.'" svg:font-family="\''.$font.'\'" />'; |
|
| 217 | 217 | } |
| 218 | 218 | } |
| 219 | - $this->contentXml = str_replace('</office:font-face-decls>', $fonts . '</office:font-face-decls>', $this->contentXml); |
|
| 219 | + $this->contentXml = str_replace('</office:font-face-decls>', $fonts.'</office:font-face-decls>', $this->contentXml); |
|
| 220 | 220 | } else { |
| 221 | 221 | $convertedValue = $this->encode_chars($convertedValue, $encode, $charset); |
| 222 | 222 | $convertedValue = preg_replace('/(\r\n|\r|\n)/i', "<text:line-break/>", $convertedValue); |
@@ -253,23 +253,23 @@ discard block |
||
| 253 | 253 | break; |
| 254 | 254 | case 'strong': |
| 255 | 255 | case 'b': |
| 256 | - $odtResult .= '<text:span text:style-name="boldText">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)) . '</text:span>'; |
|
| 256 | + $odtResult .= '<text:span text:style-name="boldText">'.($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)).'</text:span>'; |
|
| 257 | 257 | break; |
| 258 | 258 | case 'i': |
| 259 | 259 | case 'em': |
| 260 | - $odtResult .= '<text:span text:style-name="italicText">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)) . '</text:span>'; |
|
| 260 | + $odtResult .= '<text:span text:style-name="italicText">'.($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)).'</text:span>'; |
|
| 261 | 261 | break; |
| 262 | 262 | case 'u': |
| 263 | - $odtResult .= '<text:span text:style-name="underlineText">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)) . '</text:span>'; |
|
| 263 | + $odtResult .= '<text:span text:style-name="underlineText">'.($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)).'</text:span>'; |
|
| 264 | 264 | break; |
| 265 | 265 | case 's': |
| 266 | - $odtResult .= '<text:span text:style-name="strikethroughText">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)) . '</text:span>'; |
|
| 266 | + $odtResult .= '<text:span text:style-name="strikethroughText">'.($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)).'</text:span>'; |
|
| 267 | 267 | break; |
| 268 | 268 | case 'sub': |
| 269 | - $odtResult .= '<text:span text:style-name="subText">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)) . '</text:span>'; |
|
| 269 | + $odtResult .= '<text:span text:style-name="subText">'.($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)).'</text:span>'; |
|
| 270 | 270 | break; |
| 271 | 271 | case 'sup': |
| 272 | - $odtResult .= '<text:span text:style-name="supText">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)) . '</text:span>'; |
|
| 272 | + $odtResult .= '<text:span text:style-name="supText">'.($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)).'</text:span>'; |
|
| 273 | 273 | break; |
| 274 | 274 | case 'span': |
| 275 | 275 | if (isset($tag['attributes']['style'])) { |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | if (!in_array($fontName, $fontDeclarations)) { |
| 285 | 285 | array_push($fontDeclarations, $fontName); |
| 286 | 286 | } |
| 287 | - $odtStyles .= '<style:text-properties style:font-name="' . $fontName . '" />'; |
|
| 287 | + $odtStyles .= '<style:text-properties style:font-name="'.$fontName.'" />'; |
|
| 288 | 288 | break; |
| 289 | 289 | case 'font-size': |
| 290 | 290 | if (preg_match('/([0-9]+)\s?(px|pt)/', $styleValue, $matches)) { |
@@ -292,21 +292,21 @@ discard block |
||
| 292 | 292 | if ($matches[2] == 'px') { |
| 293 | 293 | $fontSize = round($fontSize * 0.75); |
| 294 | 294 | } |
| 295 | - $odtStyles .= '<style:text-properties fo:font-size="' . $fontSize . 'pt" style:font-size-asian="' . $fontSize . 'pt" style:font-size-complex="' . $fontSize . 'pt" />'; |
|
| 295 | + $odtStyles .= '<style:text-properties fo:font-size="'.$fontSize.'pt" style:font-size-asian="'.$fontSize.'pt" style:font-size-complex="'.$fontSize.'pt" />'; |
|
| 296 | 296 | } |
| 297 | 297 | break; |
| 298 | 298 | case 'color': |
| 299 | 299 | if (preg_match('/#[0-9A-Fa-f]{3}(?:[0-9A-Fa-f]{3})?/', $styleValue)) { |
| 300 | - $odtStyles .= '<style:text-properties fo:color="' . $styleValue . '" />'; |
|
| 300 | + $odtStyles .= '<style:text-properties fo:color="'.$styleValue.'" />'; |
|
| 301 | 301 | } |
| 302 | 302 | break; |
| 303 | 303 | } |
| 304 | 304 | } |
| 305 | 305 | if (strlen($odtStyles) > 0) { |
| 306 | 306 | // Generate a unique id for the style (using microtime and random because some CPUs are really fast...) |
| 307 | - $key = str_replace('.', '', (string) microtime(true)) . uniqid(mt_rand()); |
|
| 307 | + $key = str_replace('.', '', (string) microtime(true)).uniqid(mt_rand()); |
|
| 308 | 308 | $customStyles[$key] = $odtStyles; |
| 309 | - $odtResult .= '<text:span text:style-name="customStyle' . $key . '">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)) . '</text:span>'; |
|
| 309 | + $odtResult .= '<text:span text:style-name="customStyle'.$key.'">'.($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)).'</text:span>'; |
|
| 310 | 310 | } |
| 311 | 311 | } |
| 312 | 312 | break; |
@@ -443,24 +443,24 @@ discard block |
||
| 443 | 443 | public function htmlToUTFAndPreOdf($value) |
| 444 | 444 | { |
| 445 | 445 | // We decode into utf8, entities |
| 446 | - $value=dol_html_entity_decode($value, ENT_QUOTES|ENT_HTML5); |
|
| 446 | + $value = dol_html_entity_decode($value, ENT_QUOTES | ENT_HTML5); |
|
| 447 | 447 | |
| 448 | 448 | // We convert html tags |
| 449 | - $ishtml=dol_textishtml($value); |
|
| 449 | + $ishtml = dol_textishtml($value); |
|
| 450 | 450 | if ($ishtml) { |
| 451 | 451 | // If string is "MYPODUCT - Desc <strong>bold</strong> with é accent<br />\n<br />\nUn texto en español ?" |
| 452 | 452 | // Result after clean must be "MYPODUCT - Desc bold with é accent\n\nUn texto en español ?" |
| 453 | 453 | |
| 454 | 454 | // We want to ignore \n and we want all <br> to be \n |
| 455 | - $value=preg_replace('/(\r\n|\r|\n)/i', '', $value); |
|
| 456 | - $value=preg_replace('/<br>/i', "\n", $value); |
|
| 457 | - $value=preg_replace('/<br\s+[^<>\/]*>/i', "\n", $value); |
|
| 458 | - $value=preg_replace('/<br\s+[^<>\/]*\/>/i', "\n", $value); |
|
| 455 | + $value = preg_replace('/(\r\n|\r|\n)/i', '', $value); |
|
| 456 | + $value = preg_replace('/<br>/i', "\n", $value); |
|
| 457 | + $value = preg_replace('/<br\s+[^<>\/]*>/i', "\n", $value); |
|
| 458 | + $value = preg_replace('/<br\s+[^<>\/]*\/>/i', "\n", $value); |
|
| 459 | 459 | |
| 460 | 460 | //$value=preg_replace('/<strong>/','__lt__text:p text:style-name=__quot__bold__quot____gt__',$value); |
| 461 | 461 | //$value=preg_replace('/<\/strong>/','__lt__/text:p__gt__',$value); |
| 462 | 462 | |
| 463 | - $value=dol_string_nohtmltag($value, 0); |
|
| 463 | + $value = dol_string_nohtmltag($value, 0); |
|
| 464 | 464 | } |
| 465 | 465 | |
| 466 | 466 | return $value; |
@@ -536,10 +536,10 @@ discard block |
||
| 536 | 536 | $balise = str_replace('row.', '', $matches2[1]); |
| 537 | 537 | // Move segment tags around the row |
| 538 | 538 | $replace = array( |
| 539 | - '[!-- BEGIN ' . $matches2[1] . ' --]' => '', |
|
| 540 | - '[!-- END ' . $matches2[1] . ' --]' => '', |
|
| 541 | - '<table:table-row' => '[!-- BEGIN ' . $balise . ' --]<table:table-row', |
|
| 542 | - '</table:table-row>' => '</table:table-row>[!-- END ' . $balise . ' --]' |
|
| 539 | + '[!-- BEGIN '.$matches2[1].' --]' => '', |
|
| 540 | + '[!-- END '.$matches2[1].' --]' => '', |
|
| 541 | + '<table:table-row' => '[!-- BEGIN '.$balise.' --]<table:table-row', |
|
| 542 | + '</table:table-row>' => '</table:table-row>[!-- END '.$balise.' --]' |
|
| 543 | 543 | ); |
| 544 | 544 | $replacedXML = str_replace(array_keys($replace), array_values($replace), $matches[0][$i]); |
| 545 | 545 | $this->contentXml = str_replace($matches[0][$i], $replacedXML, $this->contentXml); |
@@ -562,14 +562,14 @@ discard block |
||
| 562 | 562 | else return; |
| 563 | 563 | |
| 564 | 564 | // Search all tags found into condition to complete $this->vars, so we will proceed all tests even if not defined |
| 565 | - $reg='@\[!--\sIF\s([\[\]{}a-zA-Z0-9\.\,_]+)\s--\]@smU'; |
|
| 565 | + $reg = '@\[!--\sIF\s([\[\]{}a-zA-Z0-9\.\,_]+)\s--\]@smU'; |
|
| 566 | 566 | $matches = array(); |
| 567 | 567 | preg_match_all($reg, $xml, $matches, PREG_SET_ORDER); |
| 568 | 568 | |
| 569 | 569 | //var_dump($this->vars);exit; |
| 570 | 570 | foreach ($matches as $match) { // For each match, if there is no entry into this->vars, we add it |
| 571 | - if (! empty($match[1]) && ! isset($this->vars[$match[1]])) { |
|
| 572 | - $this->vars[$match[1]] = ''; // Not defined, so we set it to '', we just need entry into this->vars for next loop |
|
| 571 | + if (!empty($match[1]) && !isset($this->vars[$match[1]])) { |
|
| 572 | + $this->vars[$match[1]] = ''; // Not defined, so we set it to '', we just need entry into this->vars for next loop |
|
| 573 | 573 | } |
| 574 | 574 | } |
| 575 | 575 | //var_dump($this->vars);exit; |
@@ -584,7 +584,7 @@ discard block |
||
| 584 | 584 | // Remove the IF tag |
| 585 | 585 | $xml = str_replace('[!-- IF '.$key.' --]', '', $xml); |
| 586 | 586 | // Remove everything between the ELSE tag (if it exists) and the ENDIF tag |
| 587 | - $reg = '@(\[!--\sELSE\s' . preg_quote($key, '@') . '\s--\](.*))?\[!--\sENDIF\s' . preg_quote($key, '@') . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy |
|
| 587 | + $reg = '@(\[!--\sELSE\s'.preg_quote($key, '@').'\s--\](.*))?\[!--\sENDIF\s'.preg_quote($key, '@').'\s--\]@smU'; // U modifier = all quantifiers are non-greedy |
|
| 588 | 588 | $xml = preg_replace($reg, '', $xml); |
| 589 | 589 | /*if ($sav != $xml) |
| 590 | 590 | { |
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | //dol_syslog("Var ".$key." is not defined, we remove the IF, ELSE and ENDIF "); |
| 598 | 598 | //$sav=$xml; |
| 599 | 599 | // Find all conditional blocks for this variable: from IF to ELSE and to ENDIF |
| 600 | - $reg = '@\[!--\sIF\s' . preg_quote($key, '@') . '\s--\](.*)(\[!--\sELSE\s' . preg_quote($key, '@') . '\s--\](.*))?\[!--\sENDIF\s' . preg_quote($key, '@') . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy |
|
| 600 | + $reg = '@\[!--\sIF\s'.preg_quote($key, '@').'\s--\](.*)(\[!--\sELSE\s'.preg_quote($key, '@').'\s--\](.*))?\[!--\sENDIF\s'.preg_quote($key, '@').'\s--\]@smU'; // U modifier = all quantifiers are non-greedy |
|
| 601 | 601 | preg_match_all($reg, $xml, $matches, PREG_SET_ORDER); |
| 602 | 602 | foreach ($matches as $match) { // For each match, if there is an ELSE clause, we replace the whole block by the value in the ELSE clause |
| 603 | 603 | if (!empty($match[3])) $xml = str_replace($match[0], $match[3], $xml); |
@@ -625,12 +625,12 @@ discard block |
||
| 625 | 625 | */ |
| 626 | 626 | public function mergeSegment(Segment $segment) |
| 627 | 627 | { |
| 628 | - if (! array_key_exists($segment->getName(), $this->segments)) { |
|
| 629 | - throw new OdfException($segment->getName() . 'cannot be parsed, has it been set yet ?'); |
|
| 628 | + if (!array_key_exists($segment->getName(), $this->segments)) { |
|
| 629 | + throw new OdfException($segment->getName().'cannot be parsed, has it been set yet ?'); |
|
| 630 | 630 | } |
| 631 | 631 | $string = $segment->getName(); |
| 632 | 632 | // $reg = '@<text:p[^>]*>\[!--\sBEGIN\s' . $string . '\s--\](.*)\[!--.+END\s' . $string . '\s--\]<\/text:p>@smU'; |
| 633 | - $reg = '@\[!--\sBEGIN\s' . $string . '\s--\](.*)\[!--.+END\s' . $string . '\s--\]@smU'; |
|
| 633 | + $reg = '@\[!--\sBEGIN\s'.$string.'\s--\](.*)\[!--.+END\s'.$string.'\s--\]@smU'; |
|
| 634 | 634 | $this->contentXml = preg_replace($reg, $segment->getXmlParsed(), $this->contentXml); |
| 635 | 635 | return $this; |
| 636 | 636 | } |
@@ -642,7 +642,7 @@ discard block |
||
| 642 | 642 | */ |
| 643 | 643 | public function printVars() |
| 644 | 644 | { |
| 645 | - return print_r('<pre>' . print_r($this->vars, true) . '</pre>', true); |
|
| 645 | + return print_r('<pre>'.print_r($this->vars, true).'</pre>', true); |
|
| 646 | 646 | } |
| 647 | 647 | |
| 648 | 648 | /** |
@@ -663,7 +663,7 @@ discard block |
||
| 663 | 663 | */ |
| 664 | 664 | public function printDeclaredSegments() |
| 665 | 665 | { |
| 666 | - return '<pre>' . print_r(implode(' ', array_keys($this->segments)), true) . '</pre>'; |
|
| 666 | + return '<pre>'.print_r(implode(' ', array_keys($this->segments)), true).'</pre>'; |
|
| 667 | 667 | } |
| 668 | 668 | |
| 669 | 669 | /** |
@@ -699,7 +699,7 @@ discard block |
||
| 699 | 699 | { |
| 700 | 700 | if ($file !== null && is_string($file)) { |
| 701 | 701 | if (file_exists($file) && !(is_file($file) && is_writable($file))) { |
| 702 | - throw new OdfException('Permission denied : can\'t create ' . $file); |
|
| 702 | + throw new OdfException('Permission denied : can\'t create '.$file); |
|
| 703 | 703 | } |
| 704 | 704 | $this->_save(); |
| 705 | 705 | copy($this->tmpfile, $file); |
@@ -716,7 +716,7 @@ discard block |
||
| 716 | 716 | */ |
| 717 | 717 | private function _save() |
| 718 | 718 | { |
| 719 | - $res=$this->file->open($this->tmpfile); // tmpfile is odt template |
|
| 719 | + $res = $this->file->open($this->tmpfile); // tmpfile is odt template |
|
| 720 | 720 | $this->_parse('content'); |
| 721 | 721 | $this->_parse('styles'); |
| 722 | 722 | $this->_parse('meta'); |
@@ -724,23 +724,23 @@ discard block |
||
| 724 | 724 | $this->setMetaData(); |
| 725 | 725 | //print $this->metaXml;exit; |
| 726 | 726 | |
| 727 | - if (! $this->file->addFromString('content.xml', $this->contentXml)) { |
|
| 727 | + if (!$this->file->addFromString('content.xml', $this->contentXml)) { |
|
| 728 | 728 | throw new OdfException('Error during file export addFromString content'); |
| 729 | 729 | } |
| 730 | - if (! $this->file->addFromString('meta.xml', $this->metaXml)) { |
|
| 730 | + if (!$this->file->addFromString('meta.xml', $this->metaXml)) { |
|
| 731 | 731 | throw new OdfException('Error during file export addFromString meta'); |
| 732 | 732 | } |
| 733 | - if (! $this->file->addFromString('styles.xml', $this->stylesXml)) { |
|
| 733 | + if (!$this->file->addFromString('styles.xml', $this->stylesXml)) { |
|
| 734 | 734 | throw new OdfException('Error during file export addFromString styles'); |
| 735 | 735 | } |
| 736 | 736 | |
| 737 | 737 | foreach ($this->images as $imageKey => $imageValue) { |
| 738 | 738 | // Add the image inside the ODT document |
| 739 | - $this->file->addFile($imageKey, 'Pictures/' . $imageValue); |
|
| 739 | + $this->file->addFile($imageKey, 'Pictures/'.$imageValue); |
|
| 740 | 740 | // Add the image to the Manifest (which maintains a list of images, necessary to avoid "Corrupt ODT file. Repair?" when opening the file with LibreOffice) |
| 741 | 741 | $this->addImageToManifest($imageValue); |
| 742 | 742 | } |
| 743 | - if (! $this->file->addFromString('META-INF/manifest.xml', $this->manifestXml)) { |
|
| 743 | + if (!$this->file->addFromString('META-INF/manifest.xml', $this->manifestXml)) { |
|
| 744 | 744 | throw new OdfException('Error during file export: manifest.xml'); |
| 745 | 745 | } |
| 746 | 746 | $this->file->close(); |
@@ -754,7 +754,7 @@ discard block |
||
| 754 | 754 | */ |
| 755 | 755 | public function setMetaData() |
| 756 | 756 | { |
| 757 | - if (empty($this->creator)) $this->creator=''; |
|
| 757 | + if (empty($this->creator)) $this->creator = ''; |
|
| 758 | 758 | |
| 759 | 759 | $this->metaXml = preg_replace('/<dc:date>.*<\/dc:date>/', '<dc:date>'.gmdate("Y-m-d\TH:i:s").'</dc:date>', $this->metaXml); |
| 760 | 760 | $this->metaXml = preg_replace('/<dc:creator>.*<\/dc:creator>/', '<dc:creator>'.htmlspecialchars($this->creator).'</dc:creator>', $this->metaXml); |
@@ -800,8 +800,8 @@ discard block |
||
| 800 | 800 | throw new OdfException("headers already sent ($filename at $linenum)"); |
| 801 | 801 | } |
| 802 | 802 | |
| 803 | - if ( $name == "" ) { |
|
| 804 | - $name = md5(uniqid()) . ".odt"; |
|
| 803 | + if ($name == "") { |
|
| 804 | + $name = md5(uniqid()).".odt"; |
|
| 805 | 805 | } |
| 806 | 806 | |
| 807 | 807 | header('Content-type: application/vnd.oasis.opendocument.text'); |
@@ -822,18 +822,18 @@ discard block |
||
| 822 | 822 | { |
| 823 | 823 | global $conf; |
| 824 | 824 | |
| 825 | - if ( $name == "" ) $name = "temp".md5(uniqid()); |
|
| 825 | + if ($name == "") $name = "temp".md5(uniqid()); |
|
| 826 | 826 | |
| 827 | 827 | dol_syslog(get_class($this).'::exportAsAttachedPDF $name='.$name, LOG_DEBUG); |
| 828 | 828 | $this->saveToDisk($name); |
| 829 | 829 | |
| 830 | - $execmethod=(empty($conf->global->MAIN_EXEC_USE_POPEN)?1:2); // 1 or 2 |
|
| 830 | + $execmethod = (empty($conf->global->MAIN_EXEC_USE_POPEN) ? 1 : 2); // 1 or 2 |
|
| 831 | 831 | // Method 1 sometimes hang the server. |
| 832 | 832 | |
| 833 | 833 | |
| 834 | 834 | // Export to PDF using LibreOffice |
| 835 | 835 | if (getDolGlobalString('MAIN_ODT_AS_PDF') == 'libreoffice') { |
| 836 | - dol_mkdir($conf->user->dir_temp); // We must be sure the directory exists and is writable |
|
| 836 | + dol_mkdir($conf->user->dir_temp); // We must be sure the directory exists and is writable |
|
| 837 | 837 | |
| 838 | 838 | // We delete and recreate a subdir because the soffice may have change pemrissions on it |
| 839 | 839 | dol_delete_dir_recursive($conf->user->dir_temp.'/odtaspdf'); |
@@ -843,7 +843,7 @@ discard block |
||
| 843 | 843 | // using windows libreoffice that must be in path |
| 844 | 844 | // using linux/mac libreoffice that must be in path |
| 845 | 845 | // Note PHP Config "fastcgi.impersonate=0" must set to 0 - Default is 1 |
| 846 | - $command ='soffice --headless -env:UserInstallation=file:'.(getDolGlobalString('MAIN_ODT_ADD_SLASH_FOR_WINDOWS') ? '///' : '').'\''.$conf->user->dir_temp.'/odtaspdf\' --convert-to pdf --outdir '. escapeshellarg(dirname($name)). " ".escapeshellarg($name); |
|
| 846 | + $command = 'soffice --headless -env:UserInstallation=file:'.(getDolGlobalString('MAIN_ODT_ADD_SLASH_FOR_WINDOWS') ? '///' : '').'\''.$conf->user->dir_temp.'/odtaspdf\' --convert-to pdf --outdir '.escapeshellarg(dirname($name))." ".escapeshellarg($name); |
|
| 847 | 847 | } elseif (preg_match('/unoconv/', getDolGlobalString('MAIN_ODT_AS_PDF'))) { |
| 848 | 848 | // If issue with unoconv, see https://github.com/dagwieers/unoconv/issues/87 |
| 849 | 849 | |
@@ -873,13 +873,13 @@ discard block |
||
| 873 | 873 | //$command = '/usr/bin/unoconv -vvv '.escapeshellcmd($name); |
| 874 | 874 | } else { |
| 875 | 875 | // deprecated old method using odt2pdf.sh (native, jodconverter, ...) |
| 876 | - $tmpname=preg_replace('/\.odt/i', '', $name); |
|
| 876 | + $tmpname = preg_replace('/\.odt/i', '', $name); |
|
| 877 | 877 | |
| 878 | 878 | if (getDolGlobalString('MAIN_DOL_SCRIPTS_ROOT')) { |
| 879 | - $command = getDolGlobalString('MAIN_DOL_SCRIPTS_ROOT').'/scripts/odt2pdf/odt2pdf.sh '.escapeshellcmd($tmpname).' '.(is_numeric(getDolGlobalString('MAIN_ODT_AS_PDF'))?'jodconverter':getDolGlobalString('MAIN_ODT_AS_PDF')); |
|
| 879 | + $command = getDolGlobalString('MAIN_DOL_SCRIPTS_ROOT').'/scripts/odt2pdf/odt2pdf.sh '.escapeshellcmd($tmpname).' '.(is_numeric(getDolGlobalString('MAIN_ODT_AS_PDF')) ? 'jodconverter' : getDolGlobalString('MAIN_ODT_AS_PDF')); |
|
| 880 | 880 | } else { |
| 881 | 881 | dol_syslog(get_class($this).'::exportAsAttachedPDF is used but the constant MAIN_DOL_SCRIPTS_ROOT with path to script directory was not defined.', LOG_WARNING); |
| 882 | - $command = '../../scripts/odt2pdf/odt2pdf.sh '.escapeshellcmd($tmpname).' '.(is_numeric(getDolGlobalString('MAIN_ODT_AS_PDF'))?'jodconverter':getDolGlobalString('MAIN_ODT_AS_PDF')); |
|
| 882 | + $command = '../../scripts/odt2pdf/odt2pdf.sh '.escapeshellcmd($tmpname).' '.(is_numeric(getDolGlobalString('MAIN_ODT_AS_PDF')) ? 'jodconverter' : getDolGlobalString('MAIN_ODT_AS_PDF')); |
|
| 883 | 883 | } |
| 884 | 884 | } |
| 885 | 885 | |
@@ -892,14 +892,14 @@ discard block |
||
| 892 | 892 | // $result = $utils->executeCLI($command, $outputfile); and replace test on $execmethod. |
| 893 | 893 | // $retval will be $result['result'] |
| 894 | 894 | // $errorstring will be $result['output'] |
| 895 | - $retval=0; $output_arr=array(); |
|
| 895 | + $retval = 0; $output_arr = array(); |
|
| 896 | 896 | if ($execmethod == 1) { |
| 897 | 897 | exec($command, $output_arr, $retval); |
| 898 | 898 | } |
| 899 | 899 | if ($execmethod == 2) { |
| 900 | 900 | $outputfile = DOL_DATA_ROOT.'/odt2pdf.log'; |
| 901 | 901 | |
| 902 | - $ok=0; |
|
| 902 | + $ok = 0; |
|
| 903 | 903 | $handle = fopen($outputfile, 'w'); |
| 904 | 904 | if ($handle) { |
| 905 | 905 | dol_syslog(get_class($this)."Run command ".$command, LOG_DEBUG); |
@@ -908,7 +908,7 @@ discard block |
||
| 908 | 908 | while (!feof($handlein)) { |
| 909 | 909 | $read = fgets($handlein); |
| 910 | 910 | fwrite($handle, $read); |
| 911 | - $output_arr[]=$read; |
|
| 911 | + $output_arr[] = $read; |
|
| 912 | 912 | } |
| 913 | 913 | pclose($handlein); |
| 914 | 914 | fclose($handle); |
@@ -918,7 +918,7 @@ discard block |
||
| 918 | 918 | |
| 919 | 919 | if ($retval == 0) { |
| 920 | 920 | dol_syslog(get_class($this).'::exportAsAttachedPDF $ret_val='.$retval, LOG_DEBUG); |
| 921 | - $filename=''; $linenum=0; |
|
| 921 | + $filename = ''; $linenum = 0; |
|
| 922 | 922 | |
| 923 | 923 | if (php_sapi_name() != 'cli') { // If we are in a web context (not into CLI context) |
| 924 | 924 | if (headers_sent($filename, $linenum)) { |
@@ -926,7 +926,7 @@ discard block |
||
| 926 | 926 | } |
| 927 | 927 | |
| 928 | 928 | if (!empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { |
| 929 | - $name=preg_replace('/\.od(x|t)/i', '', $name); |
|
| 929 | + $name = preg_replace('/\.od(x|t)/i', '', $name); |
|
| 930 | 930 | header('Content-type: application/pdf'); |
| 931 | 931 | header('Content-Disposition: attachment; filename="'.basename($name).'.pdf"'); |
| 932 | 932 | readfile($name.".pdf"); |
@@ -941,13 +941,13 @@ discard block |
||
| 941 | 941 | dol_syslog(get_class($this).'::exportAsAttachedPDF $output_arr='.var_export($output_arr, true), LOG_DEBUG); |
| 942 | 942 | |
| 943 | 943 | if ($retval == 126) { |
| 944 | - throw new OdfException('Permission execute convert script : ' . $command); |
|
| 944 | + throw new OdfException('Permission execute convert script : '.$command); |
|
| 945 | 945 | } else { |
| 946 | - $errorstring=''; |
|
| 946 | + $errorstring = ''; |
|
| 947 | 947 | foreach ($output_arr as $line) { |
| 948 | - $errorstring.= $line."<br>"; |
|
| 948 | + $errorstring .= $line."<br>"; |
|
| 949 | 949 | } |
| 950 | - throw new OdfException('ODT to PDF convert fail (option MAIN_ODT_AS_PDF is '.$conf->global->MAIN_ODT_AS_PDF.', command was '.$command.', retval='.$retval.') : ' . $errorstring); |
|
| 950 | + throw new OdfException('ODT to PDF convert fail (option MAIN_ODT_AS_PDF is '.$conf->global->MAIN_ODT_AS_PDF.', command was '.$command.', retval='.$retval.') : '.$errorstring); |
|
| 951 | 951 | } |
| 952 | 952 | } |
| 953 | 953 | } |
@@ -1001,11 +1001,11 @@ discard block |
||
| 1001 | 1001 | if ($handle = opendir($dir)) { |
| 1002 | 1002 | while (($file = readdir($handle)) !== false) { |
| 1003 | 1003 | if ($file != '.' && $file != '..') { |
| 1004 | - if (is_dir($dir . '/' . $file)) { |
|
| 1005 | - $this->_rrmdir($dir . '/' . $file); |
|
| 1006 | - rmdir($dir . '/' . $file); |
|
| 1004 | + if (is_dir($dir.'/'.$file)) { |
|
| 1005 | + $this->_rrmdir($dir.'/'.$file); |
|
| 1006 | + rmdir($dir.'/'.$file); |
|
| 1007 | 1007 | } else { |
| 1008 | - unlink($dir . '/' . $file); |
|
| 1008 | + unlink($dir.'/'.$file); |
|
| 1009 | 1009 | } |
| 1010 | 1010 | } |
| 1011 | 1011 | } |
@@ -1021,7 +1021,7 @@ discard block |
||
| 1021 | 1021 | */ |
| 1022 | 1022 | public function getvalue($valuename) |
| 1023 | 1023 | { |
| 1024 | - $searchreg="/\\[".$valuename."\\](.*)\\[\\/".$valuename."\\]/"; |
|
| 1024 | + $searchreg = "/\\[".$valuename."\\](.*)\\[\\/".$valuename."\\]/"; |
|
| 1025 | 1025 | $matches = array(); |
| 1026 | 1026 | preg_match($searchreg, $this->contentXml, $matches); |
| 1027 | 1027 | $this->contentXml = preg_replace($searchreg, "", $this->contentXml); |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | |
| 206 | 206 | if (isset($CurrentBlock['continuable'])) |
| 207 | 207 | { |
| 208 | - $methodName = 'block' . $CurrentBlock['type'] . 'Continue'; |
|
| 208 | + $methodName = 'block'.$CurrentBlock['type'].'Continue'; |
|
| 209 | 209 | $Block = $this->$methodName($Line, $CurrentBlock); |
| 210 | 210 | |
| 211 | 211 | if (isset($Block)) |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | { |
| 219 | 219 | if ($this->isBlockCompletable($CurrentBlock['type'])) |
| 220 | 220 | { |
| 221 | - $methodName = 'block' . $CurrentBlock['type'] . 'Complete'; |
|
| 221 | + $methodName = 'block'.$CurrentBlock['type'].'Complete'; |
|
| 222 | 222 | $CurrentBlock = $this->$methodName($CurrentBlock); |
| 223 | 223 | } |
| 224 | 224 | } |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | { |
| 237 | 237 | foreach ($this->BlockTypes[$marker] as $blockType) |
| 238 | 238 | { |
| 239 | - $blockTypes []= $blockType; |
|
| 239 | + $blockTypes [] = $blockType; |
|
| 240 | 240 | } |
| 241 | 241 | } |
| 242 | 242 | |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | { |
| 252 | 252 | $Block['type'] = $blockType; |
| 253 | 253 | |
| 254 | - if ( ! isset($Block['identified'])) |
|
| 254 | + if (!isset($Block['identified'])) |
|
| 255 | 255 | { |
| 256 | 256 | if (isset($CurrentBlock)) |
| 257 | 257 | { |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | |
| 301 | 301 | if (isset($CurrentBlock['continuable']) and $this->isBlockCompletable($CurrentBlock['type'])) |
| 302 | 302 | { |
| 303 | - $methodName = 'block' . $CurrentBlock['type'] . 'Complete'; |
|
| 303 | + $methodName = 'block'.$CurrentBlock['type'].'Complete'; |
|
| 304 | 304 | $CurrentBlock = $this->$methodName($CurrentBlock); |
| 305 | 305 | } |
| 306 | 306 | |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | |
| 319 | 319 | protected function extractElement(array $Component) |
| 320 | 320 | { |
| 321 | - if ( ! isset($Component['element'])) |
|
| 321 | + if (!isset($Component['element'])) |
|
| 322 | 322 | { |
| 323 | 323 | if (isset($Component['markup'])) |
| 324 | 324 | { |
@@ -335,12 +335,12 @@ discard block |
||
| 335 | 335 | |
| 336 | 336 | protected function isBlockContinuable($Type) |
| 337 | 337 | { |
| 338 | - return method_exists($this, 'block' . $Type . 'Continue'); |
|
| 338 | + return method_exists($this, 'block'.$Type.'Continue'); |
|
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | protected function isBlockCompletable($Type) |
| 342 | 342 | { |
| 343 | - return method_exists($this, 'block' . $Type . 'Complete'); |
|
| 343 | + return method_exists($this, 'block'.$Type.'Complete'); |
|
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | # |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | |
| 349 | 349 | protected function blockCode($Line, $Block = null) |
| 350 | 350 | { |
| 351 | - if (isset($Block) and $Block['type'] === 'Paragraph' and ! isset($Block['interrupted'])) |
|
| 351 | + if (isset($Block) and $Block['type'] === 'Paragraph' and !isset($Block['interrupted'])) |
|
| 352 | 352 | { |
| 353 | 353 | return; |
| 354 | 354 | } |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | return; |
| 433 | 433 | } |
| 434 | 434 | |
| 435 | - $Block['element']['rawHtml'] .= "\n" . $Line['body']; |
|
| 435 | + $Block['element']['rawHtml'] .= "\n".$Line['body']; |
|
| 436 | 436 | |
| 437 | 437 | if (strpos($Line['text'], '-->') !== false) |
| 438 | 438 | { |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | return $Block; |
| 524 | 524 | } |
| 525 | 525 | |
| 526 | - $Block['element']['element']['text'] .= "\n" . $Line['body']; |
|
| 526 | + $Block['element']['element']['text'] .= "\n".$Line['body']; |
|
| 527 | 527 | |
| 528 | 528 | return $Block; |
| 529 | 529 | } |
@@ -556,7 +556,7 @@ discard block |
||
| 556 | 556 | |
| 557 | 557 | $Block = array( |
| 558 | 558 | 'element' => array( |
| 559 | - 'name' => 'h' . $level, |
|
| 559 | + 'name' => 'h'.$level, |
|
| 560 | 560 | 'handler' => array( |
| 561 | 561 | 'function' => 'lineElements', |
| 562 | 562 | 'argument' => $text, |
@@ -583,7 +583,7 @@ discard block |
||
| 583 | 583 | { |
| 584 | 584 | $contentIndent -= 1; |
| 585 | 585 | $matches[1] = substr($matches[1], 0, -$contentIndent); |
| 586 | - $matches[3] = str_repeat(' ', $contentIndent) . $matches[3]; |
|
| 586 | + $matches[3] = str_repeat(' ', $contentIndent).$matches[3]; |
|
| 587 | 587 | } |
| 588 | 588 | elseif ($contentIndent === 0) |
| 589 | 589 | { |
@@ -616,7 +616,7 @@ discard block |
||
| 616 | 616 | if ( |
| 617 | 617 | isset($CurrentBlock) |
| 618 | 618 | and $CurrentBlock['type'] === 'Paragraph' |
| 619 | - and ! isset($CurrentBlock['interrupted']) |
|
| 619 | + and !isset($CurrentBlock['interrupted']) |
|
| 620 | 620 | ) { |
| 621 | 621 | return; |
| 622 | 622 | } |
@@ -634,7 +634,7 @@ discard block |
||
| 634 | 634 | ) |
| 635 | 635 | ); |
| 636 | 636 | |
| 637 | - $Block['element']['elements'] []= & $Block['li']; |
|
| 637 | + $Block['element']['elements'] [] = & $Block['li']; |
|
| 638 | 638 | |
| 639 | 639 | return $Block; |
| 640 | 640 | } |
@@ -662,7 +662,7 @@ discard block |
||
| 662 | 662 | ) { |
| 663 | 663 | if (isset($Block['interrupted'])) |
| 664 | 664 | { |
| 665 | - $Block['li']['handler']['argument'] []= ''; |
|
| 665 | + $Block['li']['handler']['argument'] [] = ''; |
|
| 666 | 666 | |
| 667 | 667 | $Block['loose'] = true; |
| 668 | 668 | |
@@ -684,7 +684,7 @@ discard block |
||
| 684 | 684 | ) |
| 685 | 685 | ); |
| 686 | 686 | |
| 687 | - $Block['element']['elements'] []= & $Block['li']; |
|
| 687 | + $Block['element']['elements'] [] = & $Block['li']; |
|
| 688 | 688 | |
| 689 | 689 | return $Block; |
| 690 | 690 | } |
@@ -702,7 +702,7 @@ discard block |
||
| 702 | 702 | { |
| 703 | 703 | if (isset($Block['interrupted'])) |
| 704 | 704 | { |
| 705 | - $Block['li']['handler']['argument'] []= ''; |
|
| 705 | + $Block['li']['handler']['argument'] [] = ''; |
|
| 706 | 706 | |
| 707 | 707 | $Block['loose'] = true; |
| 708 | 708 | |
@@ -711,16 +711,16 @@ discard block |
||
| 711 | 711 | |
| 712 | 712 | $text = substr($Line['body'], $requiredIndent); |
| 713 | 713 | |
| 714 | - $Block['li']['handler']['argument'] []= $text; |
|
| 714 | + $Block['li']['handler']['argument'] [] = $text; |
|
| 715 | 715 | |
| 716 | 716 | return $Block; |
| 717 | 717 | } |
| 718 | 718 | |
| 719 | - if ( ! isset($Block['interrupted'])) |
|
| 719 | + if (!isset($Block['interrupted'])) |
|
| 720 | 720 | { |
| 721 | 721 | $text = preg_replace('/^[ ]{0,'.$requiredIndent.'}+/', '', $Line['body']); |
| 722 | 722 | |
| 723 | - $Block['li']['handler']['argument'] []= $text; |
|
| 723 | + $Block['li']['handler']['argument'] [] = $text; |
|
| 724 | 724 | |
| 725 | 725 | return $Block; |
| 726 | 726 | } |
@@ -734,7 +734,7 @@ discard block |
||
| 734 | 734 | { |
| 735 | 735 | if (end($li['handler']['argument']) !== '') |
| 736 | 736 | { |
| 737 | - $li['handler']['argument'] []= ''; |
|
| 737 | + $li['handler']['argument'] [] = ''; |
|
| 738 | 738 | } |
| 739 | 739 | } |
| 740 | 740 | } |
@@ -773,14 +773,14 @@ discard block |
||
| 773 | 773 | |
| 774 | 774 | if ($Line['text'][0] === '>' and preg_match('/^>[ ]?+(.*+)/', $Line['text'], $matches)) |
| 775 | 775 | { |
| 776 | - $Block['element']['handler']['argument'] []= $matches[1]; |
|
| 776 | + $Block['element']['handler']['argument'] [] = $matches[1]; |
|
| 777 | 777 | |
| 778 | 778 | return $Block; |
| 779 | 779 | } |
| 780 | 780 | |
| 781 | - if ( ! isset($Block['interrupted'])) |
|
| 781 | + if (!isset($Block['interrupted'])) |
|
| 782 | 782 | { |
| 783 | - $Block['element']['handler']['argument'] []= $Line['text']; |
|
| 783 | + $Block['element']['handler']['argument'] [] = $Line['text']; |
|
| 784 | 784 | |
| 785 | 785 | return $Block; |
| 786 | 786 | } |
@@ -810,7 +810,7 @@ discard block |
||
| 810 | 810 | |
| 811 | 811 | protected function blockSetextHeader($Line, $Block = null) |
| 812 | 812 | { |
| 813 | - if ( ! isset($Block) or $Block['type'] !== 'Paragraph' or isset($Block['interrupted'])) |
|
| 813 | + if (!isset($Block) or $Block['type'] !== 'Paragraph' or isset($Block['interrupted'])) |
|
| 814 | 814 | { |
| 815 | 815 | return; |
| 816 | 816 | } |
@@ -861,7 +861,7 @@ discard block |
||
| 861 | 861 | return; |
| 862 | 862 | } |
| 863 | 863 | |
| 864 | - $Block['element']['rawHtml'] .= "\n" . $Line['body']; |
|
| 864 | + $Block['element']['rawHtml'] .= "\n".$Line['body']; |
|
| 865 | 865 | |
| 866 | 866 | return $Block; |
| 867 | 867 | } |
@@ -896,7 +896,7 @@ discard block |
||
| 896 | 896 | |
| 897 | 897 | protected function blockTable($Line, array $Block = null) |
| 898 | 898 | { |
| 899 | - if ( ! isset($Block) or $Block['type'] !== 'Paragraph' or isset($Block['interrupted'])) |
|
| 899 | + if (!isset($Block) or $Block['type'] !== 'Paragraph' or isset($Block['interrupted'])) |
|
| 900 | 900 | { |
| 901 | 901 | return; |
| 902 | 902 | } |
@@ -945,7 +945,7 @@ discard block |
||
| 945 | 945 | $alignment = $alignment === 'left' ? 'center' : 'right'; |
| 946 | 946 | } |
| 947 | 947 | |
| 948 | - $alignments []= $alignment; |
|
| 948 | + $alignments [] = $alignment; |
|
| 949 | 949 | } |
| 950 | 950 | |
| 951 | 951 | # ~ |
@@ -986,7 +986,7 @@ discard block |
||
| 986 | 986 | ); |
| 987 | 987 | } |
| 988 | 988 | |
| 989 | - $HeaderElements []= $HeaderElement; |
|
| 989 | + $HeaderElements [] = $HeaderElement; |
|
| 990 | 990 | } |
| 991 | 991 | |
| 992 | 992 | # ~ |
@@ -1000,16 +1000,16 @@ discard block |
||
| 1000 | 1000 | ), |
| 1001 | 1001 | ); |
| 1002 | 1002 | |
| 1003 | - $Block['element']['elements'] []= array( |
|
| 1003 | + $Block['element']['elements'] [] = array( |
|
| 1004 | 1004 | 'name' => 'thead', |
| 1005 | 1005 | ); |
| 1006 | 1006 | |
| 1007 | - $Block['element']['elements'] []= array( |
|
| 1007 | + $Block['element']['elements'] [] = array( |
|
| 1008 | 1008 | 'name' => 'tbody', |
| 1009 | 1009 | 'elements' => array(), |
| 1010 | 1010 | ); |
| 1011 | 1011 | |
| 1012 | - $Block['element']['elements'][0]['elements'] []= array( |
|
| 1012 | + $Block['element']['elements'][0]['elements'] [] = array( |
|
| 1013 | 1013 | 'name' => 'tr', |
| 1014 | 1014 | 'elements' => $HeaderElements, |
| 1015 | 1015 | ); |
@@ -1053,11 +1053,11 @@ discard block |
||
| 1053 | 1053 | if (isset($Block['alignments'][$index])) |
| 1054 | 1054 | { |
| 1055 | 1055 | $Element['attributes'] = array( |
| 1056 | - 'style' => 'text-align: ' . $Block['alignments'][$index] . ';', |
|
| 1056 | + 'style' => 'text-align: '.$Block['alignments'][$index].';', |
|
| 1057 | 1057 | ); |
| 1058 | 1058 | } |
| 1059 | 1059 | |
| 1060 | - $Elements []= $Element; |
|
| 1060 | + $Elements [] = $Element; |
|
| 1061 | 1061 | } |
| 1062 | 1062 | |
| 1063 | 1063 | $Element = array( |
@@ -1065,7 +1065,7 @@ discard block |
||
| 1065 | 1065 | 'elements' => $Elements, |
| 1066 | 1066 | ); |
| 1067 | 1067 | |
| 1068 | - $Block['element']['elements'][1]['elements'] []= $Element; |
|
| 1068 | + $Block['element']['elements'][1]['elements'] [] = $Element; |
|
| 1069 | 1069 | |
| 1070 | 1070 | return $Block; |
| 1071 | 1071 | } |
@@ -1165,7 +1165,7 @@ discard block |
||
| 1165 | 1165 | |
| 1166 | 1166 | $Inline = $this->{"inline$inlineType"}($Excerpt); |
| 1167 | 1167 | |
| 1168 | - if ( ! isset($Inline)) |
|
| 1168 | + if (!isset($Inline)) |
|
| 1169 | 1169 | { |
| 1170 | 1170 | continue; |
| 1171 | 1171 | } |
@@ -1179,7 +1179,7 @@ discard block |
||
| 1179 | 1179 | |
| 1180 | 1180 | # sets a default inline position |
| 1181 | 1181 | |
| 1182 | - if ( ! isset($Inline['position'])) |
|
| 1182 | + if (!isset($Inline['position'])) |
|
| 1183 | 1183 | { |
| 1184 | 1184 | $Inline['position'] = $markerPosition; |
| 1185 | 1185 | } |
@@ -1223,7 +1223,7 @@ discard block |
||
| 1223 | 1223 | |
| 1224 | 1224 | foreach ($Elements as &$Element) |
| 1225 | 1225 | { |
| 1226 | - if ( ! isset($Element['autobreak'])) |
|
| 1226 | + if (!isset($Element['autobreak'])) |
|
| 1227 | 1227 | { |
| 1228 | 1228 | $Element['autobreak'] = false; |
| 1229 | 1229 | } |
@@ -1279,14 +1279,14 @@ discard block |
||
| 1279 | 1279 | $hostnameLabel = '[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?'; |
| 1280 | 1280 | |
| 1281 | 1281 | $commonMarkEmail = '[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]++@' |
| 1282 | - . $hostnameLabel . '(?:\.' . $hostnameLabel . ')*'; |
|
| 1282 | + . $hostnameLabel.'(?:\.'.$hostnameLabel.')*'; |
|
| 1283 | 1283 | |
| 1284 | 1284 | if (strpos($Excerpt['text'], '>') !== false |
| 1285 | 1285 | and preg_match("/^<((mailto:)?$commonMarkEmail)>/i", $Excerpt['text'], $matches) |
| 1286 | - ){ |
|
| 1286 | + ) { |
|
| 1287 | 1287 | $url = $matches[1]; |
| 1288 | 1288 | |
| 1289 | - if ( ! isset($matches[2])) |
|
| 1289 | + if (!isset($matches[2])) |
|
| 1290 | 1290 | { |
| 1291 | 1291 | $url = "mailto:$url"; |
| 1292 | 1292 | } |
@@ -1306,7 +1306,7 @@ discard block |
||
| 1306 | 1306 | |
| 1307 | 1307 | protected function inlineEmphasis($Excerpt) |
| 1308 | 1308 | { |
| 1309 | - if ( ! isset($Excerpt['text'][1])) |
|
| 1309 | + if (!isset($Excerpt['text'][1])) |
|
| 1310 | 1310 | { |
| 1311 | 1311 | return; |
| 1312 | 1312 | } |
@@ -1352,12 +1352,12 @@ discard block |
||
| 1352 | 1352 | |
| 1353 | 1353 | protected function inlineImage($Excerpt) |
| 1354 | 1354 | { |
| 1355 | - if ( ! isset($Excerpt['text'][1]) or $Excerpt['text'][1] !== '[') |
|
| 1355 | + if (!isset($Excerpt['text'][1]) or $Excerpt['text'][1] !== '[') |
|
| 1356 | 1356 | { |
| 1357 | 1357 | return; |
| 1358 | 1358 | } |
| 1359 | 1359 | |
| 1360 | - $Excerpt['text']= substr($Excerpt['text'], 1); |
|
| 1360 | + $Excerpt['text'] = substr($Excerpt['text'], 1); |
|
| 1361 | 1361 | |
| 1362 | 1362 | $Link = $this->inlineLink($Excerpt); |
| 1363 | 1363 | |
@@ -1443,7 +1443,7 @@ discard block |
||
| 1443 | 1443 | $definition = strtolower($Element['handler']['argument']); |
| 1444 | 1444 | } |
| 1445 | 1445 | |
| 1446 | - if ( ! isset($this->DefinitionData['Reference'][$definition])) |
|
| 1446 | + if (!isset($this->DefinitionData['Reference'][$definition])) |
|
| 1447 | 1447 | { |
| 1448 | 1448 | return; |
| 1449 | 1449 | } |
@@ -1498,7 +1498,7 @@ discard block |
||
| 1498 | 1498 | and preg_match('/^&(#?+[0-9a-zA-Z]++);/', $Excerpt['text'], $matches) |
| 1499 | 1499 | ) { |
| 1500 | 1500 | return array( |
| 1501 | - 'element' => array('rawHtml' => '&' . $matches[1] . ';'), |
|
| 1501 | + 'element' => array('rawHtml' => '&'.$matches[1].';'), |
|
| 1502 | 1502 | 'extent' => strlen($matches[0]), |
| 1503 | 1503 | ); |
| 1504 | 1504 | } |
@@ -1508,7 +1508,7 @@ discard block |
||
| 1508 | 1508 | |
| 1509 | 1509 | protected function inlineStrikethrough($Excerpt) |
| 1510 | 1510 | { |
| 1511 | - if ( ! isset($Excerpt['text'][1])) |
|
| 1511 | + if (!isset($Excerpt['text'][1])) |
|
| 1512 | 1512 | { |
| 1513 | 1513 | return; |
| 1514 | 1514 | } |
@@ -1531,7 +1531,7 @@ discard block |
||
| 1531 | 1531 | |
| 1532 | 1532 | protected function inlineUrl($Excerpt) |
| 1533 | 1533 | { |
| 1534 | - if ($this->urlsLinked !== true or ! isset($Excerpt['text'][2]) or $Excerpt['text'][2] !== '/') |
|
| 1534 | + if ($this->urlsLinked !== true or !isset($Excerpt['text'][2]) or $Excerpt['text'][2] !== '/') |
|
| 1535 | 1535 | { |
| 1536 | 1536 | return; |
| 1537 | 1537 | } |
@@ -1702,7 +1702,7 @@ discard block |
||
| 1702 | 1702 | |
| 1703 | 1703 | if ($hasName) |
| 1704 | 1704 | { |
| 1705 | - $markup .= '<' . $Element['name']; |
|
| 1705 | + $markup .= '<'.$Element['name']; |
|
| 1706 | 1706 | |
| 1707 | 1707 | if (isset($Element['attributes'])) |
| 1708 | 1708 | { |
@@ -1760,7 +1760,7 @@ discard block |
||
| 1760 | 1760 | } |
| 1761 | 1761 | } |
| 1762 | 1762 | |
| 1763 | - $markup .= $hasName ? '</' . $Element['name'] . '>' : ''; |
|
| 1763 | + $markup .= $hasName ? '</'.$Element['name'].'>' : ''; |
|
| 1764 | 1764 | } |
| 1765 | 1765 | elseif ($hasName) |
| 1766 | 1766 | { |
@@ -1789,7 +1789,7 @@ discard block |
||
| 1789 | 1789 | // (autobreak === false) covers both sides of an element |
| 1790 | 1790 | $autoBreak = !$autoBreak ? $autoBreak : $autoBreakNext; |
| 1791 | 1791 | |
| 1792 | - $markup .= ($autoBreak ? "\n" : '') . $this->element($Element); |
|
| 1792 | + $markup .= ($autoBreak ? "\n" : '').$this->element($Element); |
|
| 1793 | 1793 | $autoBreak = $autoBreakNext; |
| 1794 | 1794 | } |
| 1795 | 1795 | |
@@ -1804,7 +1804,7 @@ discard block |
||
| 1804 | 1804 | { |
| 1805 | 1805 | $Elements = $this->linesElements($lines); |
| 1806 | 1806 | |
| 1807 | - if ( ! in_array('', $lines) |
|
| 1807 | + if (!in_array('', $lines) |
|
| 1808 | 1808 | and isset($Elements[0]) and isset($Elements[0]['name']) |
| 1809 | 1809 | and $Elements[0]['name'] === 'p' |
| 1810 | 1810 | ) { |
@@ -1861,12 +1861,12 @@ discard block |
||
| 1861 | 1861 | protected function sanitiseElement(array $Element) |
| 1862 | 1862 | { |
| 1863 | 1863 | static $goodAttribute = '/^[a-zA-Z0-9][a-zA-Z0-9-_]*+$/'; |
| 1864 | - static $safeUrlNameToAtt = array( |
|
| 1864 | + static $safeUrlNameToAtt = array( |
|
| 1865 | 1865 | 'a' => 'href', |
| 1866 | 1866 | 'img' => 'src', |
| 1867 | 1867 | ); |
| 1868 | 1868 | |
| 1869 | - if ( ! isset($Element['name'])) |
|
| 1869 | + if (!isset($Element['name'])) |
|
| 1870 | 1870 | { |
| 1871 | 1871 | unset($Element['attributes']); |
| 1872 | 1872 | return $Element; |
@@ -1877,12 +1877,12 @@ discard block |
||
| 1877 | 1877 | $Element = $this->filterUnsafeUrlInAttribute($Element, $safeUrlNameToAtt[$Element['name']]); |
| 1878 | 1878 | } |
| 1879 | 1879 | |
| 1880 | - if ( ! empty($Element['attributes'])) |
|
| 1880 | + if (!empty($Element['attributes'])) |
|
| 1881 | 1881 | { |
| 1882 | 1882 | foreach ($Element['attributes'] as $att => $val) |
| 1883 | 1883 | { |
| 1884 | 1884 | # filter out badly parsed attribute |
| 1885 | - if ( ! preg_match($goodAttribute, $att)) |
|
| 1885 | + if (!preg_match($goodAttribute, $att)) |
|
| 1886 | 1886 | { |
| 1887 | 1887 | unset($Element['attributes'][$att]); |
| 1888 | 1888 | } |
@@ -1983,8 +1983,8 @@ discard block |
||
| 1983 | 1983 | protected $textLevelElements = array( |
| 1984 | 1984 | 'a', 'br', 'bdo', 'abbr', 'blink', 'nextid', 'acronym', 'basefont', |
| 1985 | 1985 | 'b', 'em', 'big', 'cite', 'small', 'spacer', 'listing', |
| 1986 | - 'i', 'rp', 'del', 'code', 'strike', 'marquee', |
|
| 1987 | - 'q', 'rt', 'ins', 'font', 'strong', |
|
| 1986 | + 'i', 'rp', 'del', 'code', 'strike', 'marquee', |
|
| 1987 | + 'q', 'rt', 'ins', 'font', 'strong', |
|
| 1988 | 1988 | 's', 'tt', 'kbd', 'mark', |
| 1989 | 1989 | 'u', 'xm', 'sub', 'nobr', |
| 1990 | 1990 | 'sup', 'ruby', |
@@ -4225,7 +4225,7 @@ discard block |
||
| 4225 | 4225 | |
| 4226 | 4226 | if (!is_object($user)) { |
| 4227 | 4227 | include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; |
| 4228 | - $user = new User($db); // To avoid error during migration |
|
| 4228 | + $user = new User($db); // To avoid error during migration |
|
| 4229 | 4229 | } |
| 4230 | 4230 | |
| 4231 | 4231 | dolibarr_install_syslog("upgrade2::migrate_reload_modules force=".$force.", listofmodule=".implode(',', array_keys($listofmodule))); |
@@ -4402,7 +4402,7 @@ discard block |
||
| 4402 | 4402 | $sql = "SELECT rowid , entity, batch, fk_product from ".MAIN_DB_PREFIX."product_lot"; |
| 4403 | 4403 | $resql = $db->query($sql); |
| 4404 | 4404 | if ($resql) { |
| 4405 | - $modulepart="product_batch"; |
|
| 4405 | + $modulepart = "product_batch"; |
|
| 4406 | 4406 | while ($obj = $db->fetch_object($resql)) { |
| 4407 | 4407 | $entity = (empty($obj->entity) ? 1 : $obj->entity); |
| 4408 | 4408 | if ($entity > 1) { |
@@ -4416,10 +4416,10 @@ discard block |
||
| 4416 | 4416 | |
| 4417 | 4417 | if ($dir && $res > 0) { |
| 4418 | 4418 | $lot->ref = $obj->batch; |
| 4419 | - $origin = $dir . '/' . get_exdir(0, 0, 0, 1, $lot, $modulepart); |
|
| 4419 | + $origin = $dir.'/'.get_exdir(0, 0, 0, 1, $lot, $modulepart); |
|
| 4420 | 4420 | |
| 4421 | 4421 | $lot->fetch($obj->rowid, $obj->fk_product, $obj->batch); |
| 4422 | - $destin = $dir . '/' . get_exdir(0, 0, 0, 1, $lot, $modulepart); |
|
| 4422 | + $destin = $dir.'/'.get_exdir(0, 0, 0, 1, $lot, $modulepart); |
|
| 4423 | 4423 | |
| 4424 | 4424 | if (dol_is_dir($origin) && !dol_is_dir($destin)) { |
| 4425 | 4425 | dol_move_dir($origin, $destin, 0); |
@@ -5102,7 +5102,7 @@ discard block |
||
| 5102 | 5102 | $error++; |
| 5103 | 5103 | } |
| 5104 | 5104 | |
| 5105 | - $current_contract = $obj->cid; |
|
| 5105 | + $current_contract = $obj->cid; |
|
| 5106 | 5106 | } |
| 5107 | 5107 | } else { |
| 5108 | 5108 | $error++; |
@@ -146,20 +146,20 @@ discard block |
||
| 146 | 146 | $search_date_creation_startmonth = GETPOSTINT('search_date_creation_startmonth'); |
| 147 | 147 | $search_date_creation_startyear = GETPOSTINT('search_date_creation_startyear'); |
| 148 | 148 | $search_date_creation_startday = GETPOSTINT('search_date_creation_startday'); |
| 149 | -$search_date_creation_start = dol_mktime(0, 0, 0, $search_date_creation_startmonth, $search_date_creation_startday, $search_date_creation_startyear); // Use tzserver |
|
| 149 | +$search_date_creation_start = dol_mktime(0, 0, 0, $search_date_creation_startmonth, $search_date_creation_startday, $search_date_creation_startyear); // Use tzserver |
|
| 150 | 150 | $search_date_creation_endmonth = GETPOSTINT('search_date_creation_endmonth'); |
| 151 | 151 | $search_date_creation_endyear = GETPOSTINT('search_date_creation_endyear'); |
| 152 | 152 | $search_date_creation_endday = GETPOSTINT('search_date_creation_endday'); |
| 153 | -$search_date_creation_end = dol_mktime(23, 59, 59, $search_date_creation_endmonth, $search_date_creation_endday, $search_date_creation_endyear); // Use tzserver |
|
| 153 | +$search_date_creation_end = dol_mktime(23, 59, 59, $search_date_creation_endmonth, $search_date_creation_endday, $search_date_creation_endyear); // Use tzserver |
|
| 154 | 154 | |
| 155 | 155 | $search_date_modif_startmonth = GETPOSTINT('search_date_modif_startmonth'); |
| 156 | 156 | $search_date_modif_startyear = GETPOSTINT('search_date_modif_startyear'); |
| 157 | 157 | $search_date_modif_startday = GETPOSTINT('search_date_modif_startday'); |
| 158 | -$search_date_modif_start = dol_mktime(0, 0, 0, $search_date_modif_startmonth, $search_date_modif_startday, $search_date_modif_startyear); // Use tzserver |
|
| 158 | +$search_date_modif_start = dol_mktime(0, 0, 0, $search_date_modif_startmonth, $search_date_modif_startday, $search_date_modif_startyear); // Use tzserver |
|
| 159 | 159 | $search_date_modif_endmonth = GETPOSTINT('search_date_modif_endmonth'); |
| 160 | 160 | $search_date_modif_endyear = GETPOSTINT('search_date_modif_endyear'); |
| 161 | 161 | $search_date_modif_endday = GETPOSTINT('search_date_modif_endday'); |
| 162 | -$search_date_modif_end = dol_mktime(23, 59, 59, $search_date_modif_endmonth, $search_date_modif_endday, $search_date_modif_endyear); // Use tzserver |
|
| 162 | +$search_date_modif_end = dol_mktime(23, 59, 59, $search_date_modif_endmonth, $search_date_modif_endday, $search_date_modif_endyear); // Use tzserver |
|
| 163 | 163 | |
| 164 | 164 | $type = GETPOST('type', 'alpha'); |
| 165 | 165 | $place = GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : '0'; // $place is string id of table for Bar or Restaurant |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | |
| 336 | 336 | $object->fields = dol_sort_array($object->fields, 'position'); |
| 337 | 337 | $arrayfields = dol_sort_array($arrayfields, 'position'); |
| 338 | -'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan |
|
| 338 | +'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan |
|
| 339 | 339 | |
| 340 | 340 | // Security check |
| 341 | 341 | $socid = GETPOSTINT('socid'); |
@@ -610,7 +610,7 @@ discard block |
||
| 610 | 610 | } |
| 611 | 611 | // Search on sale representative |
| 612 | 612 | if (!empty($search_sale) && $search_sale != '-1') { |
| 613 | - $search_sale_req = array_filter($search_sale, function (string $value): bool { |
|
| 613 | + $search_sale_req = array_filter($search_sale, function(string $value): bool { |
|
| 614 | 614 | $value = intval($value); |
| 615 | 615 | return $value >= 0; |
| 616 | 616 | }); |
@@ -638,7 +638,7 @@ discard block |
||
| 638 | 638 | if ($searchCategoryCustomerOperator == 0) { |
| 639 | 639 | $searchCategoryCustomerSqlList[] = " EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX."categorie_societe as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie = ".((int) $searchCategoryCustomer).")"; |
| 640 | 640 | } else { |
| 641 | - $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryCustomer); |
|
| 641 | + $listofcategoryid .= ($listofcategoryid ? ', ' : '').((int) $searchCategoryCustomer); |
|
| 642 | 642 | } |
| 643 | 643 | } |
| 644 | 644 | } |
@@ -667,7 +667,7 @@ discard block |
||
| 667 | 667 | if ($searchCategorySupplierOperator == 0) { |
| 668 | 668 | $searchCategorySupplierSqlList[] = " EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX."categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie = ".((int) $searchCategorySupplier).")"; |
| 669 | 669 | } else { |
| 670 | - $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategorySupplier); |
|
| 670 | + $listofcategoryid .= ($listofcategoryid ? ', ' : '').((int) $searchCategorySupplier); |
|
| 671 | 671 | } |
| 672 | 672 | } |
| 673 | 673 | } |
@@ -950,7 +950,7 @@ discard block |
||
| 950 | 950 | } |
| 951 | 951 | if (is_array($search_sale)) { |
| 952 | 952 | foreach ($search_sale as $sale_id) { |
| 953 | - $param .= '&search_sale[]=' . urlencode($sale_id); |
|
| 953 | + $param .= '&search_sale[]='.urlencode($sale_id); |
|
| 954 | 954 | } |
| 955 | 955 | } |
| 956 | 956 | if ($search_id > 0) { |
@@ -1108,7 +1108,7 @@ discard block |
||
| 1108 | 1108 | $param .= '&search_date_modif_endday='.urlencode((string) ($search_date_modif_endday)); |
| 1109 | 1109 | } |
| 1110 | 1110 | if ($search_date_modif_end) { |
| 1111 | - $param .= '&search_date_modif_end=' . urlencode($search_date_modif_end); |
|
| 1111 | + $param .= '&search_date_modif_end='.urlencode($search_date_modif_end); |
|
| 1112 | 1112 | } |
| 1113 | 1113 | |
| 1114 | 1114 | // Add $param from extra fields |
@@ -1178,7 +1178,7 @@ discard block |
||
| 1178 | 1178 | if (!empty($socid)) { |
| 1179 | 1179 | $url .= '&socid='.$socid; |
| 1180 | 1180 | } |
| 1181 | - $newcardbutton = ''; |
|
| 1181 | + $newcardbutton = ''; |
|
| 1182 | 1182 | $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition')); |
| 1183 | 1183 | $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition')); |
| 1184 | 1184 | $newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', $url, '', $user->hasRight('societe', 'creer')); |
@@ -1279,7 +1279,7 @@ discard block |
||
| 1279 | 1279 | $moreforfilter .= '<div class="divsearchfield">'; |
| 1280 | 1280 | $tmptitle = $langs->trans('SalesRepresentatives'); |
| 1281 | 1281 | $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"'); |
| 1282 | - $moreforfilter .= $form->multiselectarray('search_sale', $userlist, $search_sale, 0, 0, '', 0, 300, '', '', $langs->trans('SalesRepresentatives'), 1); |
|
| 1282 | + $moreforfilter .= $form->multiselectarray('search_sale', $userlist, $search_sale, 0, 0, '', 0, 300, '', '', $langs->trans('SalesRepresentatives'), 1); |
|
| 1283 | 1283 | $moreforfilter .= '</div>'; |
| 1284 | 1284 | } |
| 1285 | 1285 | if (!empty($moreforfilter)) { |
@@ -1292,7 +1292,7 @@ discard block |
||
| 1292 | 1292 | } |
| 1293 | 1293 | |
| 1294 | 1294 | $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; |
| 1295 | -$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup |
|
| 1295 | +$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup |
|
| 1296 | 1296 | $selectedfields = ($mode != 'kanban' ? $htmlofselectarray : ''); |
| 1297 | 1297 | $selectedfields .= ((count($arrayofmassactions) && $contextpage != 'poslist') ? $form->showCheckAddButtons('checkforselect', 1) : ''); |
| 1298 | 1298 | |
@@ -1748,15 +1748,15 @@ discard block |
||
| 1748 | 1748 | print $hookmanager->resPrint; |
| 1749 | 1749 | if (!empty($arrayfields['s.datec']['checked'])) { |
| 1750 | 1750 | print_liste_field_titre($arrayfields['s.datec']['label'], $_SERVER["PHP_SELF"], "s.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); |
| 1751 | - $totalarray['nbfield']++; // For the column action |
|
| 1751 | + $totalarray['nbfield']++; // For the column action |
|
| 1752 | 1752 | } |
| 1753 | 1753 | if (!empty($arrayfields['s.tms']['checked'])) { |
| 1754 | 1754 | print_liste_field_titre($arrayfields['s.tms']['label'], $_SERVER["PHP_SELF"], "s.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); |
| 1755 | - $totalarray['nbfield']++; // For the column action |
|
| 1755 | + $totalarray['nbfield']++; // For the column action |
|
| 1756 | 1756 | } |
| 1757 | 1757 | if (!empty($arrayfields['s.status']['checked'])) { |
| 1758 | 1758 | print_liste_field_titre($arrayfields['s.status']['label'], $_SERVER["PHP_SELF"], "s.status", "", $param, '', $sortfield, $sortorder, 'center '); |
| 1759 | - $totalarray['nbfield']++; // For the column action |
|
| 1759 | + $totalarray['nbfield']++; // For the column action |
|
| 1760 | 1760 | } |
| 1761 | 1761 | if (!empty($arrayfields['s.note_public']['checked'])) { |
| 1762 | 1762 | print_liste_field_titre($arrayfields['s.note_public']['label'], $_SERVER["PHP_SELF"], "s.note_public", "", $param, '', $sortfield, $sortorder, 'center nowrap '); |
@@ -1768,7 +1768,7 @@ discard block |
||
| 1768 | 1768 | } |
| 1769 | 1769 | if (!empty($arrayfields['s.import_key']['checked'])) { |
| 1770 | 1770 | print_liste_field_titre($arrayfields['s.import_key']['label'], $_SERVER["PHP_SELF"], "s.import_key", "", $param, '', $sortfield, $sortorder, 'center '); |
| 1771 | - $totalarray['nbfield']++; // For the column action |
|
| 1771 | + $totalarray['nbfield']++; // For the column action |
|
| 1772 | 1772 | } |
| 1773 | 1773 | // Action column |
| 1774 | 1774 | if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { |