@@ -274,12 +274,12 @@ discard block |
||
| 274 | 274 | /* |
| 275 | 275 | * No signature |
| 276 | 276 | */ |
| 277 | - const STATUS_NO_SIGNATURE = 0; |
|
| 277 | + const STATUS_NO_SIGNATURE = 0; |
|
| 278 | 278 | |
| 279 | 279 | /* |
| 280 | 280 | * Signed by sender |
| 281 | 281 | */ |
| 282 | - const STATUS_SIGNED_SENDER = 1; |
|
| 282 | + const STATUS_SIGNED_SENDER = 1; |
|
| 283 | 283 | |
| 284 | 284 | /* |
| 285 | 285 | * Signed by receiver |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | /* |
| 290 | 290 | * Signed by all |
| 291 | 291 | */ |
| 292 | - const STATUS_SIGNED_ALL = 9; // To handle future kind of signature (ex: tripartite contract) |
|
| 292 | + const STATUS_SIGNED_ALL = 9; // To handle future kind of signature (ex: tripartite contract) |
|
| 293 | 293 | |
| 294 | 294 | |
| 295 | 295 | /** |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | if (getDolGlobalString('CONTRACT_ADDON')) { |
| 320 | 320 | $mybool = false; |
| 321 | 321 | |
| 322 | - $file = getDolGlobalString('CONTRACT_ADDON') . ".php"; |
|
| 322 | + $file = getDolGlobalString('CONTRACT_ADDON').".php"; |
|
| 323 | 323 | $classname = getDolGlobalString('CONTRACT_ADDON'); |
| 324 | 324 | |
| 325 | 325 | // Include file with class |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | if ($contratline->statut != ContratLigne::STATUS_OPEN) { |
| 430 | 430 | $contratline->context = $this->context; |
| 431 | 431 | |
| 432 | - $result = $contratline->active_line($user, $date_start, !empty($date_end) ? $date_end : -1, $comment); // This call trigger LINECONTRACT_ACTIVATE |
|
| 432 | + $result = $contratline->active_line($user, $date_start, !empty($date_end) ? $date_end : -1, $comment); // This call trigger LINECONTRACT_ACTIVATE |
|
| 433 | 433 | if ($result < 0) { |
| 434 | 434 | $error++; |
| 435 | 435 | $this->error = $contratline->error; |
@@ -479,7 +479,7 @@ discard block |
||
| 479 | 479 | // Close lines not already closed |
| 480 | 480 | if ($contratline->statut != ContratLigne::STATUS_CLOSED) { |
| 481 | 481 | $contratline->date_end_real = $now; |
| 482 | - $contratline->date_cloture = $now; // For backward compatibility |
|
| 482 | + $contratline->date_cloture = $now; // For backward compatibility |
|
| 483 | 483 | $contratline->user_closing_id = $user->id; |
| 484 | 484 | $contratline->statut = ContratLigne::STATUS_CLOSED; |
| 485 | 485 | $result = $contratline->close_line($user, $now, $comment, $notrigger); |
@@ -618,7 +618,7 @@ discard block |
||
| 618 | 618 | if (!$error) { |
| 619 | 619 | $this->ref = $num; |
| 620 | 620 | $this->status = self::STATUS_VALIDATED; |
| 621 | - $this->statut = self::STATUS_VALIDATED; // deprecated |
|
| 621 | + $this->statut = self::STATUS_VALIDATED; // deprecated |
|
| 622 | 622 | $this->date_validation = $now; |
| 623 | 623 | } |
| 624 | 624 | } else { |
@@ -888,10 +888,10 @@ discard block |
||
| 888 | 888 | $line->localtax2_tx = $objp->localtax2_tx; |
| 889 | 889 | $line->localtax1_type = $objp->localtax1_type; |
| 890 | 890 | $line->localtax2_type = $objp->localtax2_type; |
| 891 | - $line->subprice = $objp->subprice; |
|
| 891 | + $line->subprice = $objp->subprice; |
|
| 892 | 892 | $line->statut = $objp->status; |
| 893 | 893 | $line->status = $objp->status; |
| 894 | - $line->remise_percent = $objp->remise_percent; |
|
| 894 | + $line->remise_percent = $objp->remise_percent; |
|
| 895 | 895 | $line->price_ht = $objp->price_ht; |
| 896 | 896 | $line->price = $objp->price_ht; // For backward compatibility |
| 897 | 897 | $line->total_ht = $objp->total_ht; |
@@ -934,7 +934,7 @@ discard block |
||
| 934 | 934 | //$line->date_fin_prevue = $this->db->jdate($objp->date_fin_validite); |
| 935 | 935 | //$line->date_fin_reel = $this->db->jdate($objp->date_cloture); |
| 936 | 936 | |
| 937 | - $line->rang = $objp->rang; |
|
| 937 | + $line->rang = $objp->rang; |
|
| 938 | 938 | |
| 939 | 939 | // Retrieve all extrafields for contract line |
| 940 | 940 | // fetch optionals attributes and labels |
@@ -1447,7 +1447,7 @@ discard block |
||
| 1447 | 1447 | } |
| 1448 | 1448 | |
| 1449 | 1449 | if (!$error) { |
| 1450 | - $result = $this->insertExtraFields(); // This delete and reinsert extrafields |
|
| 1450 | + $result = $this->insertExtraFields(); // This delete and reinsert extrafields |
|
| 1451 | 1451 | if ($result < 0) { |
| 1452 | 1452 | $error++; |
| 1453 | 1453 | } |
@@ -2083,7 +2083,7 @@ discard block |
||
| 2083 | 2083 | } |
| 2084 | 2084 | $datas['customer'] = '<br><b>'.$langs->trans('Customer').':</b> '.$this->thirdparty->getNomUrl(1, '', 0, 1); |
| 2085 | 2085 | } |
| 2086 | - $datas['refcustomer'] = '<br><b>'.$langs->trans('RefCustomer').':</b> '. $this->ref_customer; |
|
| 2086 | + $datas['refcustomer'] = '<br><b>'.$langs->trans('RefCustomer').':</b> '.$this->ref_customer; |
|
| 2087 | 2087 | if (!$nofetch) { |
| 2088 | 2088 | $langs->load('project'); |
| 2089 | 2089 | if (empty($this->project)) { |
@@ -2551,7 +2551,7 @@ discard block |
||
| 2551 | 2551 | global $user; |
| 2552 | 2552 | |
| 2553 | 2553 | $ticket = new Ticket($this->db); |
| 2554 | - $nbTicket = $ticket->fetchAll($user, 'ASC', 't.datec', '', 0, '', array('t.fk_contract' => $this->id)); |
|
| 2554 | + $nbTicket = $ticket->fetchAll($user, 'ASC', 't.datec', '', 0, '', array('t.fk_contract' => $this->id)); |
|
| 2555 | 2555 | |
| 2556 | 2556 | return ($nbTicket < 0 ? $nbTicket : $ticket->lines); |
| 2557 | 2557 | } |
@@ -2573,7 +2573,7 @@ discard block |
||
| 2573 | 2573 | global $conf, $langs; |
| 2574 | 2574 | |
| 2575 | 2575 | if (!dol_strlen($modele)) { |
| 2576 | - $modele = ''; // No doc template/generation by default |
|
| 2576 | + $modele = ''; // No doc template/generation by default |
|
| 2577 | 2577 | |
| 2578 | 2578 | if (!empty($this->model_pdf)) { |
| 2579 | 2579 | $modele = $this->model_pdf; |
@@ -2670,14 +2670,14 @@ discard block |
||
| 2670 | 2670 | } |
| 2671 | 2671 | } |
| 2672 | 2672 | |
| 2673 | - if (!getDolGlobalString('CONTRACT_ADDON') || !is_readable(DOL_DOCUMENT_ROOT."/core/modules/contract/" . getDolGlobalString('CONTRACT_ADDON').".php")) { |
|
| 2673 | + if (!getDolGlobalString('CONTRACT_ADDON') || !is_readable(DOL_DOCUMENT_ROOT."/core/modules/contract/".getDolGlobalString('CONTRACT_ADDON').".php")) { |
|
| 2674 | 2674 | $this->error = 'ErrorSetupNotComplete'; |
| 2675 | 2675 | dol_syslog($this->error); |
| 2676 | 2676 | return -1; |
| 2677 | 2677 | } |
| 2678 | 2678 | |
| 2679 | 2679 | // Set ref |
| 2680 | - require_once DOL_DOCUMENT_ROOT."/core/modules/contract/" . getDolGlobalString('CONTRACT_ADDON').'.php'; |
|
| 2680 | + require_once DOL_DOCUMENT_ROOT."/core/modules/contract/".getDolGlobalString('CONTRACT_ADDON').'.php'; |
|
| 2681 | 2681 | $obj = getDolGlobalString('CONTRACT_ADDON'); |
| 2682 | 2682 | $modContract = new $obj(); |
| 2683 | 2683 | '@phan-var-force CommonNumRefGenerator $modContrat'; |
@@ -2800,7 +2800,7 @@ discard block |
||
| 2800 | 2800 | |
| 2801 | 2801 | // Load contract |
| 2802 | 2802 | $object = new Contrat($this->db); |
| 2803 | - $object->fetch($obj->rowid); // fetch also lines |
|
| 2803 | + $object->fetch($obj->rowid); // fetch also lines |
|
| 2804 | 2804 | //$object->fetch_thirdparty(); |
| 2805 | 2805 | |
| 2806 | 2806 | if ($object->id <= 0) { |
@@ -2847,7 +2847,7 @@ discard block |
||
| 2847 | 2847 | if ($expirationdate && $expirationdate < $enddatetoscan) { |
| 2848 | 2848 | dol_syslog("Define the newdate of end of services from expirationdate=".$expirationdate); |
| 2849 | 2849 | $newdate = $expirationdate; |
| 2850 | - $protecti = 0; //$protecti is to avoid infinite loop |
|
| 2850 | + $protecti = 0; //$protecti is to avoid infinite loop |
|
| 2851 | 2851 | while ($newdate < $enddatetoscan && $protecti < 1000) { |
| 2852 | 2852 | $newdate = dol_time_plus_duree($newdate, $duration_value, $duration_unit); |
| 2853 | 2853 | $protecti++; |
@@ -2875,20 +2875,20 @@ discard block |
||
| 2875 | 2875 | |
| 2876 | 2876 | // Create an event |
| 2877 | 2877 | $actioncomm = new ActionComm($this->db); |
| 2878 | - $actioncomm->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) |
|
| 2878 | + $actioncomm->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) |
|
| 2879 | 2879 | $actioncomm->code = 'AC_'.$actioncode; |
| 2880 | 2880 | $actioncomm->label = $label; |
| 2881 | 2881 | $actioncomm->datep = $now; |
| 2882 | 2882 | $actioncomm->datef = $now; |
| 2883 | - $actioncomm->percentage = -1; // Not applicable |
|
| 2883 | + $actioncomm->percentage = -1; // Not applicable |
|
| 2884 | 2884 | $actioncomm->socid = $object->socid; |
| 2885 | - $actioncomm->authorid = $user->id; // User saving action |
|
| 2886 | - $actioncomm->userownerid = $user->id; // Owner of action |
|
| 2885 | + $actioncomm->authorid = $user->id; // User saving action |
|
| 2886 | + $actioncomm->userownerid = $user->id; // Owner of action |
|
| 2887 | 2887 | $actioncomm->fk_element = $object->id; |
| 2888 | 2888 | $actioncomm->elementtype = 'contract'; |
| 2889 | 2889 | $actioncomm->note_private = $comment; |
| 2890 | 2890 | |
| 2891 | - $ret = $actioncomm->create($user); // User creating action |
|
| 2891 | + $ret = $actioncomm->create($user); // User creating action |
|
| 2892 | 2892 | } else { |
| 2893 | 2893 | $contracterror[$object->id] = $object->ref; |
| 2894 | 2894 | |
@@ -2897,7 +2897,7 @@ discard block |
||
| 2897 | 2897 | $this->error = $this->db->lasterror(); |
| 2898 | 2898 | } |
| 2899 | 2899 | |
| 2900 | - if (! $errorforlocaltransaction) { |
|
| 2900 | + if (!$errorforlocaltransaction) { |
|
| 2901 | 2901 | $this->db->commit(); |
| 2902 | 2902 | } else { |
| 2903 | 2903 | $this->db->rollback(); |
@@ -141,10 +141,10 @@ discard block |
||
| 141 | 141 | public function regexpsql($subject, $pattern, $sqlstring = 0) |
| 142 | 142 | { |
| 143 | 143 | if ($sqlstring) { |
| 144 | - return "(". $subject ." REGEXP '" . $this->escape($pattern) . "')"; |
|
| 144 | + return "(".$subject." REGEXP '".$this->escape($pattern)."')"; |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | - return "('". $this->escape($subject) ."' REGEXP '" . $this->escape($pattern) . "')"; |
|
| 147 | + return "('".$this->escape($subject)."' REGEXP '".$this->escape($pattern)."')"; |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | public function getRows($sql) |
| 421 | 421 | { |
| 422 | 422 | if (!preg_match('/LIMIT \d+$/', $sql)) { |
| 423 | - trigger_error(__CLASS__ .'::'.__FUNCTION__.'() query must have a LIMIT clause', E_USER_ERROR); |
|
| 423 | + trigger_error(__CLASS__.'::'.__FUNCTION__.'() query must have a LIMIT clause', E_USER_ERROR); |
|
| 424 | 424 | } |
| 425 | 425 | |
| 426 | 426 | $resql = $this->query($sql); |
@@ -48,18 +48,18 @@ discard block |
||
| 48 | 48 | if (!defined('NOBROWSERNOTIF')) { |
| 49 | 49 | define('NOBROWSERNOTIF', '1'); |
| 50 | 50 | } |
| 51 | -$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); // Keep $_GET and $_POST here. GETPOST not yet defined. |
|
| 51 | +$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); // Keep $_GET and $_POST here. GETPOST not yet defined. |
|
| 52 | 52 | if (is_numeric($entity)) { |
| 53 | 53 | define("DOLENTITY", $entity); |
| 54 | 54 | } |
| 55 | 55 | include '../../main.inc.php'; |
| 56 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; |
|
| 56 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
| 57 | 57 | |
| 58 | 58 | $action = GETPOST('action', 'aZ09'); |
| 59 | 59 | |
| 60 | 60 | $signature = GETPOST('signaturebase64'); |
| 61 | 61 | $ref = GETPOST('ref', 'aZ09'); |
| 62 | -$mode = GETPOST('mode', 'aZ09'); // 'proposal', ... |
|
| 62 | +$mode = GETPOST('mode', 'aZ09'); // 'proposal', ... |
|
| 63 | 63 | $SECUREKEY = GETPOST("securekey"); // Secure key |
| 64 | 64 | $online_sign_name = GETPOST("onlinesignname"); |
| 65 | 65 | |
@@ -80,8 +80,8 @@ discard block |
||
| 80 | 80 | $securekeyseed = getDolGlobalString(strtoupper($type).'_ONLINE_SIGNATURE_SECURITY_TOKEN'); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | -if (empty($SECUREKEY) || !dol_verifyHash($securekeyseed . $type . $ref . (!isModEnabled('multicompany') ? '' : $entity), $SECUREKEY, '0')) { |
|
| 84 | - httponly_accessforbidden('Bad value for securitykey. Value provided ' . dol_escape_htmltag($SECUREKEY) . ' does not match expected value for ref=' . dol_escape_htmltag($ref), 403); |
|
| 83 | +if (empty($SECUREKEY) || !dol_verifyHash($securekeyseed.$type.$ref.(!isModEnabled('multicompany') ? '' : $entity), $SECUREKEY, '0')) { |
|
| 84 | + httponly_accessforbidden('Bad value for securitykey. Value provided '.dol_escape_htmltag($SECUREKEY).' does not match expected value for ref='.dol_escape_htmltag($ref), 403); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context |
@@ -108,29 +108,29 @@ discard block |
||
| 108 | 108 | $data = base64_decode($signature); |
| 109 | 109 | |
| 110 | 110 | if ($mode == "propale" || $mode == 'proposal') { |
| 111 | - require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php'; |
|
| 112 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/pdf.lib.php'; |
|
| 111 | + require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; |
|
| 112 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; |
|
| 113 | 113 | $object = new Propal($db); |
| 114 | 114 | $object->fetch(0, $ref); |
| 115 | 115 | |
| 116 | 116 | $upload_dir = !empty($conf->propal->multidir_output[$object->entity]) ? $conf->propal->multidir_output[$object->entity] : $conf->propal->dir_output; |
| 117 | - $upload_dir .= '/' . dol_sanitizeFileName($object->ref) . '/'; |
|
| 117 | + $upload_dir .= '/'.dol_sanitizeFileName($object->ref).'/'; |
|
| 118 | 118 | |
| 119 | - $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 120 | - $default_font = pdf_getPDFFont($langs); // Must be after pdf_getInstance |
|
| 119 | + $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 120 | + $default_font = pdf_getPDFFont($langs); // Must be after pdf_getInstance |
|
| 121 | 121 | $langs->loadLangs(array("main", "companies")); |
| 122 | 122 | |
| 123 | 123 | $date = dol_print_date(dol_now(), "%Y%m%d%H%M%S"); |
| 124 | - $filename = "signatures/" . $date . "_signature.png"; |
|
| 125 | - if (!is_dir($upload_dir . "signatures/")) { |
|
| 126 | - if (!dol_mkdir($upload_dir . "signatures/")) { |
|
| 127 | - $response = "Error mkdir. Failed to create dir " . $upload_dir . "signatures/"; |
|
| 124 | + $filename = "signatures/".$date."_signature.png"; |
|
| 125 | + if (!is_dir($upload_dir."signatures/")) { |
|
| 126 | + if (!dol_mkdir($upload_dir."signatures/")) { |
|
| 127 | + $response = "Error mkdir. Failed to create dir ".$upload_dir."signatures/"; |
|
| 128 | 128 | $error++; |
| 129 | 129 | } |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (!$error) { |
| 133 | - $return = file_put_contents($upload_dir . $filename, $data); |
|
| 133 | + $return = file_put_contents($upload_dir.$filename, $data); |
|
| 134 | 134 | if ($return == false) { |
| 135 | 135 | $error++; |
| 136 | 136 | $response = 'Error file_put_content: failed to create signature file.'; |
@@ -140,12 +140,12 @@ discard block |
||
| 140 | 140 | if (!$error) { |
| 141 | 141 | // Defined modele of doc |
| 142 | 142 | $last_main_doc_file = $object->last_main_doc; |
| 143 | - $directdownloadlink = $object->getLastMainDocLink('proposal'); // url to download the $object->last_main_doc |
|
| 143 | + $directdownloadlink = $object->getLastMainDocLink('proposal'); // url to download the $object->last_main_doc |
|
| 144 | 144 | |
| 145 | 145 | if (preg_match('/\.pdf/i', $last_main_doc_file)) { |
| 146 | 146 | // TODO Use the $last_main_doc_file to defined the $newpdffilename and $sourcefile |
| 147 | - $newpdffilename = $upload_dir . $ref . "_signed-" . $date . ".pdf"; |
|
| 148 | - $sourcefile = $upload_dir . $ref . ".pdf"; |
|
| 147 | + $newpdffilename = $upload_dir.$ref."_signed-".$date.".pdf"; |
|
| 148 | + $sourcefile = $upload_dir.$ref.".pdf"; |
|
| 149 | 149 | |
| 150 | 150 | if (dol_is_file($sourcefile)) { |
| 151 | 151 | $parameters = array('sourcefile' => $sourcefile, 'newpdffilename' => $newpdffilename); |
@@ -168,13 +168,13 @@ discard block |
||
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | //$pdf->Open(); |
| 171 | - $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 171 | + $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 172 | 172 | |
| 173 | 173 | $param = array(); |
| 174 | 174 | $param['online_sign_name'] = $online_sign_name; |
| 175 | - $param['pathtoimage'] = $upload_dir . $filename; |
|
| 175 | + $param['pathtoimage'] = $upload_dir.$filename; |
|
| 176 | 176 | |
| 177 | - $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 177 | + $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 178 | 178 | for ($i = 1; $i < ($pagecount + 1); $i++) { |
| 179 | 179 | try { |
| 180 | 180 | $tppl = $pdf->importPage($i); |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | dolPrintSignatureImage($pdf, $langs, $param); |
| 206 | 206 | } |
| 207 | 207 | } catch (Exception $e) { |
| 208 | - dol_syslog("Error when manipulating the PDF " . $sourcefile . " by onlineSign: " . $e->getMessage(), LOG_ERR); |
|
| 208 | + dol_syslog("Error when manipulating the PDF ".$sourcefile." by onlineSign: ".$e->getMessage(), LOG_ERR); |
|
| 209 | 209 | $response = $e->getMessage(); |
| 210 | 210 | $error++; |
| 211 | 211 | } |
@@ -243,14 +243,14 @@ discard block |
||
| 243 | 243 | |
| 244 | 244 | $online_sign_ip = getUserRemoteIP(); |
| 245 | 245 | |
| 246 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "propal"; |
|
| 247 | - $sql .= " SET fk_statut = " . ((int) $object::STATUS_SIGNED) . ", note_private = '" . $db->escape($object->note_private) . "',"; |
|
| 248 | - $sql .= " date_signature = '" . $db->idate(dol_now()) . "',"; |
|
| 249 | - $sql .= " online_sign_ip = '" . $db->escape($online_sign_ip) . "'"; |
|
| 246 | + $sql = "UPDATE ".MAIN_DB_PREFIX."propal"; |
|
| 247 | + $sql .= " SET fk_statut = ".((int) $object::STATUS_SIGNED).", note_private = '".$db->escape($object->note_private)."',"; |
|
| 248 | + $sql .= " date_signature = '".$db->idate(dol_now())."',"; |
|
| 249 | + $sql .= " online_sign_ip = '".$db->escape($online_sign_ip)."'"; |
|
| 250 | 250 | if ($online_sign_name) { |
| 251 | - $sql .= ", online_sign_name = '" . $db->escape($online_sign_name) . "'"; |
|
| 251 | + $sql .= ", online_sign_name = '".$db->escape($online_sign_name)."'"; |
|
| 252 | 252 | } |
| 253 | - $sql .= " WHERE rowid = " . ((int) $object->id); |
|
| 253 | + $sql .= " WHERE rowid = ".((int) $object->id); |
|
| 254 | 254 | |
| 255 | 255 | dol_syslog(__FILE__, LOG_DEBUG); |
| 256 | 256 | $resql = $db->query($sql); |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | $result = $object->call_trigger('PROPAL_CLOSE_SIGNED', $user); |
| 270 | 270 | if ($result < 0) { |
| 271 | 271 | $error++; |
| 272 | - $response = "error in trigger " . $object->error; |
|
| 272 | + $response = "error in trigger ".$object->error; |
|
| 273 | 273 | } else { |
| 274 | 274 | $response = "success"; |
| 275 | 275 | } |
@@ -290,25 +290,25 @@ discard block |
||
| 290 | 290 | } |
| 291 | 291 | } |
| 292 | 292 | } elseif ($mode == 'contract') { |
| 293 | - require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php'; |
|
| 294 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/pdf.lib.php'; |
|
| 293 | + require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; |
|
| 294 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; |
|
| 295 | 295 | $object = new Contrat($db); |
| 296 | 296 | $object->fetch(0, $ref); |
| 297 | 297 | |
| 298 | 298 | $upload_dir = !empty($conf->contrat->multidir_output[$object->entity]) ? $conf->contrat->multidir_output[$object->entity] : $conf->contrat->dir_output; |
| 299 | - $upload_dir .= '/' . dol_sanitizeFileName($object->ref) . '/'; |
|
| 299 | + $upload_dir .= '/'.dol_sanitizeFileName($object->ref).'/'; |
|
| 300 | 300 | |
| 301 | 301 | $date = dol_print_date(dol_now(), "%Y%m%d%H%M%S"); |
| 302 | - $filename = "signatures/" . $date . "_signature.png"; |
|
| 303 | - if (!is_dir($upload_dir . "signatures/")) { |
|
| 304 | - if (!dol_mkdir($upload_dir . "signatures/")) { |
|
| 305 | - $response = "Error mkdir. Failed to create dir " . $upload_dir . "signatures/"; |
|
| 302 | + $filename = "signatures/".$date."_signature.png"; |
|
| 303 | + if (!is_dir($upload_dir."signatures/")) { |
|
| 304 | + if (!dol_mkdir($upload_dir."signatures/")) { |
|
| 305 | + $response = "Error mkdir. Failed to create dir ".$upload_dir."signatures/"; |
|
| 306 | 306 | $error++; |
| 307 | 307 | } |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | if (!$error) { |
| 311 | - $return = file_put_contents($upload_dir . $filename, $data); |
|
| 311 | + $return = file_put_contents($upload_dir.$filename, $data); |
|
| 312 | 312 | if ($return == false) { |
| 313 | 313 | $error++; |
| 314 | 314 | $response = 'Error file_put_content: failed to create signature file.'; |
@@ -318,12 +318,12 @@ discard block |
||
| 318 | 318 | if (!$error) { |
| 319 | 319 | // Defined modele of doc |
| 320 | 320 | $last_main_doc_file = $object->last_main_doc; |
| 321 | - $directdownloadlink = $object->getLastMainDocLink('contrat'); // url to download the $object->last_main_doc |
|
| 321 | + $directdownloadlink = $object->getLastMainDocLink('contrat'); // url to download the $object->last_main_doc |
|
| 322 | 322 | |
| 323 | 323 | if (preg_match('/\.pdf/i', $last_main_doc_file)) { |
| 324 | 324 | // TODO Use the $last_main_doc_file to defined the $newpdffilename and $sourcefile |
| 325 | - $newpdffilename = $upload_dir . $ref . "_signed-" . $date . ".pdf"; |
|
| 326 | - $sourcefile = $upload_dir . $ref . ".pdf"; |
|
| 325 | + $newpdffilename = $upload_dir.$ref."_signed-".$date.".pdf"; |
|
| 326 | + $sourcefile = $upload_dir.$ref.".pdf"; |
|
| 327 | 327 | |
| 328 | 328 | if (dol_is_file($sourcefile)) { |
| 329 | 329 | $parameters = array('sourcefile' => $sourcefile, 'newpdffilename' => $newpdffilename); |
@@ -346,13 +346,13 @@ discard block |
||
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | //$pdf->Open(); |
| 349 | - $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 349 | + $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 350 | 350 | |
| 351 | 351 | $param = array(); |
| 352 | 352 | $param['online_sign_name'] = $online_sign_name; |
| 353 | - $param['pathtoimage'] = $upload_dir . $filename; |
|
| 353 | + $param['pathtoimage'] = $upload_dir.$filename; |
|
| 354 | 354 | |
| 355 | - $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 355 | + $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 356 | 356 | for ($i = 1; $i < ($pagecount + 1); $i++) { |
| 357 | 357 | try { |
| 358 | 358 | $tppl = $pdf->importPage($i); |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | dolPrintSignatureImage($pdf, $langs, $param); |
| 384 | 384 | } |
| 385 | 385 | } catch (Exception $e) { |
| 386 | - dol_syslog("Error when manipulating some PDF by onlineSign: " . $e->getMessage(), LOG_ERR); |
|
| 386 | + dol_syslog("Error when manipulating some PDF by onlineSign: ".$e->getMessage(), LOG_ERR); |
|
| 387 | 387 | $response = $e->getMessage(); |
| 388 | 388 | $error++; |
| 389 | 389 | } |
@@ -419,8 +419,8 @@ discard block |
||
| 419 | 419 | } |
| 420 | 420 | } |
| 421 | 421 | } elseif ($mode == 'fichinter') { |
| 422 | - require_once DOL_DOCUMENT_ROOT . '/fichinter/class/fichinter.class.php'; |
|
| 423 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/pdf.lib.php'; |
|
| 422 | + require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; |
|
| 423 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; |
|
| 424 | 424 | $object = new Fichinter($db); |
| 425 | 425 | $object->fetch(0, $ref); |
| 426 | 426 | |
@@ -429,20 +429,20 @@ discard block |
||
| 429 | 429 | |
| 430 | 430 | $langs->loadLangs(array("main", "companies")); |
| 431 | 431 | |
| 432 | - $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 433 | - $default_font = pdf_getPDFFont($langs); // Must be |
|
| 432 | + $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 433 | + $default_font = pdf_getPDFFont($langs); // Must be |
|
| 434 | 434 | |
| 435 | 435 | $date = dol_print_date(dol_now(), "%Y%m%d%H%M%S"); |
| 436 | - $filename = "signatures/" . $date . "_signature.png"; |
|
| 437 | - if (!is_dir($upload_dir . "signatures/")) { |
|
| 438 | - if (!dol_mkdir($upload_dir . "signatures/")) { |
|
| 439 | - $response = "Error mkdir. Failed to create dir " . $upload_dir . "signatures/"; |
|
| 436 | + $filename = "signatures/".$date."_signature.png"; |
|
| 437 | + if (!is_dir($upload_dir."signatures/")) { |
|
| 438 | + if (!dol_mkdir($upload_dir."signatures/")) { |
|
| 439 | + $response = "Error mkdir. Failed to create dir ".$upload_dir."signatures/"; |
|
| 440 | 440 | $error++; |
| 441 | 441 | } |
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | if (!$error) { |
| 445 | - $return = file_put_contents($upload_dir . $filename, $data); |
|
| 445 | + $return = file_put_contents($upload_dir.$filename, $data); |
|
| 446 | 446 | if ($return == false) { |
| 447 | 447 | $error++; |
| 448 | 448 | $response = 'Error file_put_content: failed to create signature file.'; |
@@ -452,12 +452,12 @@ discard block |
||
| 452 | 452 | if (!$error) { |
| 453 | 453 | // Defined modele of doc |
| 454 | 454 | $last_main_doc_file = $object->last_main_doc; |
| 455 | - $directdownloadlink = $object->getLastMainDocLink('fichinter'); // url to download the $object->last_main_doc |
|
| 455 | + $directdownloadlink = $object->getLastMainDocLink('fichinter'); // url to download the $object->last_main_doc |
|
| 456 | 456 | |
| 457 | 457 | if (preg_match('/\.pdf/i', $last_main_doc_file)) { |
| 458 | 458 | // TODO Use the $last_main_doc_file to defined the $newpdffilename and $sourcefile |
| 459 | - $newpdffilename = $upload_dir . $ref . "_signed-" . $date . ".pdf"; |
|
| 460 | - $sourcefile = $upload_dir . $ref . ".pdf"; |
|
| 459 | + $newpdffilename = $upload_dir.$ref."_signed-".$date.".pdf"; |
|
| 460 | + $sourcefile = $upload_dir.$ref.".pdf"; |
|
| 461 | 461 | |
| 462 | 462 | if (dol_is_file($sourcefile)) { |
| 463 | 463 | $parameters = array('sourcefile' => $sourcefile, 'newpdffilename' => $newpdffilename); |
@@ -480,13 +480,13 @@ discard block |
||
| 480 | 480 | } |
| 481 | 481 | |
| 482 | 482 | //$pdf->Open(); |
| 483 | - $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 483 | + $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 484 | 484 | |
| 485 | 485 | $param = array(); |
| 486 | 486 | $param['online_sign_name'] = $online_sign_name; |
| 487 | - $param['pathtoimage'] = $upload_dir . $filename; |
|
| 487 | + $param['pathtoimage'] = $upload_dir.$filename; |
|
| 488 | 488 | |
| 489 | - $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 489 | + $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 490 | 490 | for ($i = 1; $i < ($pagecount + 1); $i++) { |
| 491 | 491 | try { |
| 492 | 492 | $tppl = $pdf->importPage($i); |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | dolPrintSignatureImage($pdf, $langs, $param); |
| 518 | 518 | } |
| 519 | 519 | } catch (Exception $e) { |
| 520 | - dol_syslog("Error when manipulating some PDF by onlineSign: " . $e->getMessage(), LOG_ERR); |
|
| 520 | + dol_syslog("Error when manipulating some PDF by onlineSign: ".$e->getMessage(), LOG_ERR); |
|
| 521 | 521 | $response = $e->getMessage(); |
| 522 | 522 | $error++; |
| 523 | 523 | } |
@@ -554,39 +554,39 @@ discard block |
||
| 554 | 554 | } |
| 555 | 555 | } elseif ($mode == "societe_rib") { |
| 556 | 556 | $langs->load('withdrawals'); |
| 557 | - require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php'; |
|
| 558 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/pdf.lib.php'; |
|
| 557 | + require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; |
|
| 558 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; |
|
| 559 | 559 | $modelpath = "core/modules/bank/doc/"; |
| 560 | 560 | $object = new CompanyBankAccount($db); |
| 561 | 561 | $object->fetch(0, $ref); |
| 562 | 562 | if (!empty($object->id)) { |
| 563 | 563 | $object->fetch_thirdparty(); |
| 564 | 564 | |
| 565 | - $upload_dir = $conf->societe->multidir_output[$object->thirdparty->entity] . '/' . dol_sanitizeFileName($object->thirdparty->id) . '/'; |
|
| 565 | + $upload_dir = $conf->societe->multidir_output[$object->thirdparty->entity].'/'.dol_sanitizeFileName($object->thirdparty->id).'/'; |
|
| 566 | 566 | |
| 567 | - $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 568 | - $default_font = pdf_getPDFFont($langs); // Must be after pdf_getInstance |
|
| 567 | + $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 568 | + $default_font = pdf_getPDFFont($langs); // Must be after pdf_getInstance |
|
| 569 | 569 | $langs->loadLangs(array("main", "companies")); |
| 570 | 570 | |
| 571 | 571 | $date = dol_print_date(dol_now(), "%Y%m%d%H%M%S"); |
| 572 | - $filename = "signatures/" . $date . "_signature.png"; |
|
| 573 | - if (!dol_is_dir($upload_dir . "signatures/")) { |
|
| 574 | - if (!dol_mkdir($upload_dir . "signatures/")) { |
|
| 575 | - $response = "Error mkdir. Failed to create dir " . $upload_dir . "signatures/"; |
|
| 572 | + $filename = "signatures/".$date."_signature.png"; |
|
| 573 | + if (!dol_is_dir($upload_dir."signatures/")) { |
|
| 574 | + if (!dol_mkdir($upload_dir."signatures/")) { |
|
| 575 | + $response = "Error mkdir. Failed to create dir ".$upload_dir."signatures/"; |
|
| 576 | 576 | $error++; |
| 577 | 577 | } |
| 578 | 578 | } |
| 579 | - if (!dol_is_writable($upload_dir . "signatures/")) { |
|
| 580 | - $response = "Error directory " . $upload_dir . "signatures/ is not writable"; |
|
| 579 | + if (!dol_is_writable($upload_dir."signatures/")) { |
|
| 580 | + $response = "Error directory ".$upload_dir."signatures/ is not writable"; |
|
| 581 | 581 | $error++; |
| 582 | 582 | } |
| 583 | 583 | if (!dol_is_writable(DOL_DATA_ROOT.'/admin/temp/')) { // This is used by TCPDF as working directory |
| 584 | - $response = "Error directory " . DOL_DATA_ROOT."/admin/temp/ is not writable"; |
|
| 584 | + $response = "Error directory ".DOL_DATA_ROOT."/admin/temp/ is not writable"; |
|
| 585 | 585 | $error++; |
| 586 | 586 | } |
| 587 | 587 | |
| 588 | 588 | if (!$error) { |
| 589 | - $return = file_put_contents($upload_dir . $filename, $data); |
|
| 589 | + $return = file_put_contents($upload_dir.$filename, $data); |
|
| 590 | 590 | if ($return == false) { |
| 591 | 591 | $error++; |
| 592 | 592 | $response = 'Error file_put_content: failed to create signature file.'; |
@@ -597,14 +597,14 @@ discard block |
||
| 597 | 597 | // Defined modele of doc |
| 598 | 598 | $last_main_doc_file = $object->last_main_doc; |
| 599 | 599 | $last_modelpdf = $object->model_pdf; |
| 600 | - $directdownloadlink = $object->getLastMainDocLink('company'); // url to download the $object->last_main_doc |
|
| 600 | + $directdownloadlink = $object->getLastMainDocLink('company'); // url to download the $object->last_main_doc |
|
| 601 | 601 | |
| 602 | 602 | if (preg_match('/\.pdf/i', $last_main_doc_file)) { |
| 603 | 603 | $sourcefile = ''; |
| 604 | 604 | $newpdffilename = ''; |
| 605 | 605 | if ($last_modelpdf == 'sepamandate') { |
| 606 | - $newpdffilename = $upload_dir . $langs->transnoentitiesnoconv("SepaMandateShort") . ' ' . dol_sanitizeFileName($object->ref) . "-" . dol_sanitizeFileName($object->rum) . "_signed-" . $date . ".pdf"; |
|
| 607 | - $sourcefile = $upload_dir . $langs->transnoentitiesnoconv("SepaMandateShort") . ' ' . dol_sanitizeFileName($object->ref) . "-" . dol_sanitizeFileName($object->rum) . ".pdf"; |
|
| 606 | + $newpdffilename = $upload_dir.$langs->transnoentitiesnoconv("SepaMandateShort").' '.dol_sanitizeFileName($object->ref)."-".dol_sanitizeFileName($object->rum)."_signed-".$date.".pdf"; |
|
| 607 | + $sourcefile = $upload_dir.$langs->transnoentitiesnoconv("SepaMandateShort").' '.dol_sanitizeFileName($object->ref)."-".dol_sanitizeFileName($object->rum).".pdf"; |
|
| 608 | 608 | } |
| 609 | 609 | if (dol_is_file($sourcefile)) { |
| 610 | 610 | $parameters = array('sourcefile' => $sourcefile, 'newpdffilename' => $newpdffilename); |
@@ -627,9 +627,9 @@ discard block |
||
| 627 | 627 | } |
| 628 | 628 | |
| 629 | 629 | //$pdf->Open(); |
| 630 | - $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 630 | + $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 631 | 631 | |
| 632 | - $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 632 | + $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 633 | 633 | for ($i = 1; $i < ($pagecount + 1); $i++) { |
| 634 | 634 | try { |
| 635 | 635 | $tppl = $pdf->importPage($i); |
@@ -637,7 +637,7 @@ discard block |
||
| 637 | 637 | $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); |
| 638 | 638 | $pdf->useTemplate($tppl); |
| 639 | 639 | } catch (Exception $e) { |
| 640 | - dol_syslog("Error when manipulating the PDF " . $sourcefile . " by onlineSign: " . $e->getMessage(), LOG_ERR); |
|
| 640 | + dol_syslog("Error when manipulating the PDF ".$sourcefile." by onlineSign: ".$e->getMessage(), LOG_ERR); |
|
| 641 | 641 | $response = $e->getMessage(); |
| 642 | 642 | $error++; |
| 643 | 643 | } |
@@ -653,18 +653,18 @@ discard block |
||
| 653 | 653 | $dirmodels = array_merge($dirmodels, $conf->modules_parts['models']); |
| 654 | 654 | } |
| 655 | 655 | foreach ($dirmodels as $reldir) { |
| 656 | - $file = "pdf_" . $last_modelpdf . ".modules.php"; |
|
| 656 | + $file = "pdf_".$last_modelpdf.".modules.php"; |
|
| 657 | 657 | // On vérifie l'emplacement du modele |
| 658 | - $file = dol_buildpath($reldir . $modelpath . $file, 0); |
|
| 658 | + $file = dol_buildpath($reldir.$modelpath.$file, 0); |
|
| 659 | 659 | if (file_exists($file)) { |
| 660 | 660 | $filefound = $file; |
| 661 | - $classname = 'pdf_' . $last_modelpdf; |
|
| 661 | + $classname = 'pdf_'.$last_modelpdf; |
|
| 662 | 662 | break; |
| 663 | 663 | } |
| 664 | 664 | } |
| 665 | 665 | |
| 666 | 666 | if ($filefound === '') { |
| 667 | - $response = $langs->trans("Error") . ' Failed to load doc generator with modelpaths=' . $modelpath . ' - modele=' . $last_modelpdf; |
|
| 667 | + $response = $langs->trans("Error").' Failed to load doc generator with modelpaths='.$modelpath.' - modele='.$last_modelpdf; |
|
| 668 | 668 | dol_syslog($response, LOG_ERR); |
| 669 | 669 | $error++; |
| 670 | 670 | } |
@@ -688,7 +688,7 @@ discard block |
||
| 688 | 688 | |
| 689 | 689 | $param = array(); |
| 690 | 690 | $param['online_sign_name'] = $online_sign_name; |
| 691 | - $param['pathtoimage'] = $upload_dir . $filename; |
|
| 691 | + $param['pathtoimage'] = $upload_dir.$filename; |
|
| 692 | 692 | |
| 693 | 693 | // A signature image file is 720 x 180 (ratio 1/4) but we use only the size into PDF |
| 694 | 694 | // TODO Get position of box from PDF template |
@@ -724,16 +724,16 @@ discard block |
||
| 724 | 724 | |
| 725 | 725 | $online_sign_ip = getUserRemoteIP(); |
| 726 | 726 | |
| 727 | - $sql = "UPDATE " . MAIN_DB_PREFIX . $object->table_element; |
|
| 727 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$object->table_element; |
|
| 728 | 728 | $sql .= " SET "; |
| 729 | - $sql .= " date_signature = '" . $db->idate(dol_now()) . "',"; |
|
| 730 | - $sql .= " online_sign_ip = '" . $db->escape($online_sign_ip) . "'"; |
|
| 729 | + $sql .= " date_signature = '".$db->idate(dol_now())."',"; |
|
| 730 | + $sql .= " online_sign_ip = '".$db->escape($online_sign_ip)."'"; |
|
| 731 | 731 | if ($online_sign_name) { |
| 732 | - $sql .= ", online_sign_name = '" . $db->escape($online_sign_name) . "'"; |
|
| 732 | + $sql .= ", online_sign_name = '".$db->escape($online_sign_name)."'"; |
|
| 733 | 733 | } |
| 734 | 734 | //$sql .= ", last_main_doc = '" . $db->escape($object->element'..') . "'"; |
| 735 | 735 | |
| 736 | - $sql .= " WHERE rowid = " . ((int) $object->id); |
|
| 736 | + $sql .= " WHERE rowid = ".((int) $object->id); |
|
| 737 | 737 | |
| 738 | 738 | dol_syslog(__FILE__, LOG_DEBUG); |
| 739 | 739 | $resql = $db->query($sql); |
@@ -759,8 +759,8 @@ discard block |
||
| 759 | 759 | } |
| 760 | 760 | } |
| 761 | 761 | } elseif ($mode == 'expedition') { |
| 762 | - require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php'; |
|
| 763 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/pdf.lib.php'; |
|
| 762 | + require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; |
|
| 763 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; |
|
| 764 | 764 | |
| 765 | 765 | $object = new Expedition($db); |
| 766 | 766 | $object->fetch(0, $ref); |
@@ -770,20 +770,20 @@ discard block |
||
| 770 | 770 | |
| 771 | 771 | $langs->loadLangs(array("main", "companies")); |
| 772 | 772 | |
| 773 | - $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 774 | - $default_font = pdf_getPDFFont($langs); // Must be |
|
| 773 | + $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 774 | + $default_font = pdf_getPDFFont($langs); // Must be |
|
| 775 | 775 | |
| 776 | 776 | $date = dol_print_date(dol_now(), "%Y%m%d%H%M%S"); |
| 777 | - $filename = "signatures/" . $date . "_signature.png"; |
|
| 778 | - if (!is_dir($upload_dir . "signatures/")) { |
|
| 779 | - if (!dol_mkdir($upload_dir . "signatures/")) { |
|
| 780 | - $response = "Error mkdir. Failed to create dir " . $upload_dir . "signatures/"; |
|
| 777 | + $filename = "signatures/".$date."_signature.png"; |
|
| 778 | + if (!is_dir($upload_dir."signatures/")) { |
|
| 779 | + if (!dol_mkdir($upload_dir."signatures/")) { |
|
| 780 | + $response = "Error mkdir. Failed to create dir ".$upload_dir."signatures/"; |
|
| 781 | 781 | $error++; |
| 782 | 782 | } |
| 783 | 783 | } |
| 784 | 784 | |
| 785 | 785 | if (!$error) { |
| 786 | - $return = file_put_contents($upload_dir . $filename, $data); |
|
| 786 | + $return = file_put_contents($upload_dir.$filename, $data); |
|
| 787 | 787 | if ($return == false) { |
| 788 | 788 | $error++; |
| 789 | 789 | $response = 'Error file_put_content: failed to create signature file.'; |
@@ -796,16 +796,16 @@ discard block |
||
| 796 | 796 | if (empty($last_main_doc_file) || !dol_is_file(DOL_DATA_ROOT.'/'.$object->last_main_doc)) { |
| 797 | 797 | // It seems document has never been generated, or was generated and then deleted. |
| 798 | 798 | // So we try to regenerate it with its default template. |
| 799 | - $defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used. |
|
| 799 | + $defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used. |
|
| 800 | 800 | $object->generateDocument($defaulttemplate, $langs); |
| 801 | 801 | } |
| 802 | 802 | $last_main_doc_file = $object->last_main_doc; |
| 803 | - $directdownloadlink = $object->getLastMainDocLink('expedition'); // url to download the $object->last_main_doc |
|
| 803 | + $directdownloadlink = $object->getLastMainDocLink('expedition'); // url to download the $object->last_main_doc |
|
| 804 | 804 | |
| 805 | 805 | if (preg_match('/\.pdf/i', $last_main_doc_file)) { |
| 806 | 806 | // TODO Use the $last_main_doc_file to defined the $newpdffilename and $sourcefile |
| 807 | - $newpdffilename = $upload_dir . $ref . "_signed-" . $date . ".pdf"; |
|
| 808 | - $sourcefile = $upload_dir . $ref . ".pdf"; |
|
| 807 | + $newpdffilename = $upload_dir.$ref."_signed-".$date.".pdf"; |
|
| 808 | + $sourcefile = $upload_dir.$ref.".pdf"; |
|
| 809 | 809 | |
| 810 | 810 | if (dol_is_file($sourcefile)) { |
| 811 | 811 | $parameters = array('sourcefile' => $sourcefile, 'newpdffilename' => $newpdffilename); |
@@ -828,13 +828,13 @@ discard block |
||
| 828 | 828 | } |
| 829 | 829 | |
| 830 | 830 | //$pdf->Open(); |
| 831 | - $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 831 | + $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 832 | 832 | |
| 833 | 833 | $param = array(); |
| 834 | 834 | $param['online_sign_name'] = $online_sign_name; |
| 835 | - $param['pathtoimage'] = $upload_dir . $filename; |
|
| 835 | + $param['pathtoimage'] = $upload_dir.$filename; |
|
| 836 | 836 | |
| 837 | - $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 837 | + $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 838 | 838 | for ($i = 1; $i < ($pagecount + 1); $i++) { |
| 839 | 839 | try { |
| 840 | 840 | $tppl = $pdf->importPage($i); |
@@ -853,7 +853,7 @@ discard block |
||
| 853 | 853 | dolPrintSignatureImage($pdf, $langs, $param); |
| 854 | 854 | } |
| 855 | 855 | } catch (Exception $e) { |
| 856 | - dol_syslog("Error when manipulating some PDF by onlineSign: " . $e->getMessage(), LOG_ERR); |
|
| 856 | + dol_syslog("Error when manipulating some PDF by onlineSign: ".$e->getMessage(), LOG_ERR); |
|
| 857 | 857 | $response = $e->getMessage(); |
| 858 | 858 | $error++; |
| 859 | 859 | } |
@@ -892,9 +892,9 @@ discard block |
||
| 892 | 892 | if (!$error) { |
| 893 | 893 | $db->begin(); |
| 894 | 894 | |
| 895 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "expedition"; |
|
| 896 | - $sql .= " SET signed_status = " . ((int) $object::STATUS_SIGNED) ; |
|
| 897 | - $sql .= " WHERE rowid = " . ((int) $object->id); |
|
| 895 | + $sql = "UPDATE ".MAIN_DB_PREFIX."expedition"; |
|
| 896 | + $sql .= " SET signed_status = ".((int) $object::STATUS_SIGNED); |
|
| 897 | + $sql .= " WHERE rowid = ".((int) $object->id); |
|
| 898 | 898 | |
| 899 | 899 | dol_syslog(__FILE__, LOG_DEBUG); |
| 900 | 900 | $resql = $db->query($sql); |
@@ -936,8 +936,8 @@ discard block |
||
| 936 | 936 | */ |
| 937 | 937 | function dolPrintSignatureImage(TCPDF $pdf, $langs, $params) |
| 938 | 938 | { |
| 939 | - $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 940 | - $default_font = pdf_getPDFFont($langs); // Must be |
|
| 939 | + $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 940 | + $default_font = pdf_getPDFFont($langs); // Must be |
|
| 941 | 941 | $xforimgstart = $params['xforimgstart']; |
| 942 | 942 | $yforimgstart = $params['yforimgstart']; |
| 943 | 943 | $wforimg = $params['wforimg']; |
@@ -945,7 +945,7 @@ discard block |
||
| 945 | 945 | $pdf->SetXY($xforimgstart, $yforimgstart + round($wforimg / 4) - 4); |
| 946 | 946 | $pdf->SetFont($default_font, '', $default_font_size - 1); |
| 947 | 947 | $pdf->SetTextColor(80, 80, 80); |
| 948 | - $pdf->MultiCell($wforimg, 4, $langs->trans("Signature") . ': ' . dol_print_date(dol_now(), "day", false, $langs, true). ' - '.$params['online_sign_name'], 0, 'L'); |
|
| 948 | + $pdf->MultiCell($wforimg, 4, $langs->trans("Signature").': '.dol_print_date(dol_now(), "day", false, $langs, true).' - '.$params['online_sign_name'], 0, 'L'); |
|
| 949 | 949 | //$pdf->SetXY($xforimgstart, $yforimgstart + round($wforimg / 4)); |
| 950 | 950 | //$pdf->MultiCell($wforimg, 4, $langs->trans("Lastname") . ': ' . $online_sign_name, 0, 'L'); |
| 951 | 951 | |
@@ -297,7 +297,7 @@ |
||
| 297 | 297 | if ($out != '') { |
| 298 | 298 | try { |
| 299 | 299 | // @phan-suppress-next-line PhanPluginUnsafeEval |
| 300 | - eval('$array = '.$out.';'); // not secured but this is no mode used as php json lib is always expected to be loaded now. |
|
| 300 | + eval('$array = '.$out.';'); // not secured but this is no mode used as php json lib is always expected to be loaded now. |
|
| 301 | 301 | } catch (Exception $e) { |
| 302 | 302 | $array = array(); |
| 303 | 303 | } |
@@ -48,8 +48,8 @@ discard block |
||
| 48 | 48 | $month_current = (int) dol_print_date(dol_now(), "%m"); |
| 49 | 49 | $year_start = $year - $nbofyear + (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') > 1 ? 0 : 1); |
| 50 | 50 | } |
| 51 | -$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear, 'tzserver'); // We use timezone of server so report is same from everywhere |
|
| 52 | -$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear, 'tzserver'); // We use timezone of server so report is same from everywhere |
|
| 51 | +$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear, 'tzserver'); // We use timezone of server so report is same from everywhere |
|
| 52 | +$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear, 'tzserver'); // We use timezone of server so report is same from everywhere |
|
| 53 | 53 | |
| 54 | 54 | // We define date_start and date_end |
| 55 | 55 | if (empty($date_start) || empty($date_end)) { // We define date_start and date_end |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | $sql .= " AND b.numero_compte = aa.account_number"; |
| 269 | 269 | $sql .= " AND aa.entity = ".$conf->entity; |
| 270 | 270 | $sql .= " AND aa.fk_pcg_version = '".$db->escape($pcgvercode)."'"; |
| 271 | - $sql .= " AND aa.pcg_type = 'EXPENSE'"; // TODO Be able to use a custom group |
|
| 271 | + $sql .= " AND aa.pcg_type = 'EXPENSE'"; // TODO Be able to use a custom group |
|
| 272 | 272 | } |
| 273 | 273 | $sql .= " GROUP BY dm"; |
| 274 | 274 | $sql .= " ORDER BY dm"; |
@@ -92,8 +92,8 @@ discard block |
||
| 92 | 92 | $month_current = (int) dol_print_date(dol_now(), "%m"); |
| 93 | 93 | $year_start = $year - $nbofyear + (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') > 1 ? 0 : 1); |
| 94 | 94 | } |
| 95 | -$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear, 'tzserver'); // We use timezone of server so report is same from everywhere |
|
| 96 | -$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear, 'tzserver'); // We use timezone of server so report is same from everywhere |
|
| 95 | +$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear, 'tzserver'); // We use timezone of server so report is same from everywhere |
|
| 96 | +$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear, 'tzserver'); // We use timezone of server so report is same from everywhere |
|
| 97 | 97 | |
| 98 | 98 | // We define date_start and date_end |
| 99 | 99 | if (empty($date_start) || empty($date_end)) { // We define date_start and date_end |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | $address_town[$obj->socid] = $obj->town; |
| 369 | 369 | $address_pays[$obj->socid] = getCountry($obj->fk_pays); |
| 370 | 370 | |
| 371 | - $catotal_ht += (empty($obj->amount) ? 0 : $obj->amount); |
|
| 371 | + $catotal_ht += (empty($obj->amount) ? 0 : $obj->amount); |
|
| 372 | 372 | $catotal += $obj->amount_ttc; |
| 373 | 373 | |
| 374 | 374 | $i++; |
@@ -84,8 +84,8 @@ |
||
| 84 | 84 | $month_current = (int) dol_print_date(dol_now(), "%m"); |
| 85 | 85 | $year_start = $year - $nbofyear + (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') > 1 ? 0 : 1); |
| 86 | 86 | } |
| 87 | -$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear, 'tzserver'); // We use timezone of server so report is same from everywhere |
|
| 88 | -$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear, 'tzserver'); // We use timezone of server so report is same from everywhere |
|
| 87 | +$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear, 'tzserver'); // We use timezone of server so report is same from everywhere |
|
| 88 | +$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear, 'tzserver'); // We use timezone of server so report is same from everywhere |
|
| 89 | 89 | |
| 90 | 90 | // We define date_start and date_end |
| 91 | 91 | if (empty($date_start) || empty($date_end)) { // We define date_start and date_end |