@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | $sapi_type = php_sapi_name(); |
28 | 28 | $script_file = basename(__FILE__); |
29 | -$path=dirname(__FILE__).'/'; |
|
29 | +$path = dirname(__FILE__).'/'; |
|
30 | 30 | |
31 | 31 | // Test si mode batch |
32 | 32 | $sapi_type = php_sapi_name(); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | // Recupere root dolibarr |
39 | 39 | //$path=preg_replace('/generate-produit.php/i','',$_SERVER["PHP_SELF"]); |
40 | -require __DIR__. '/../../htdocs/master.inc.php'; |
|
40 | +require __DIR__.'/../../htdocs/master.inc.php'; |
|
41 | 41 | require_once DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"; |
42 | 42 | require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"; |
43 | 43 | |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | mktime(12, 0, 0, 12, 13, $year), |
101 | 101 | ); |
102 | 102 | |
103 | -$ret=$user->fetch('', 'admin'); |
|
104 | -if (! $ret > 0) { |
|
103 | +$ret = $user->fetch('', 'admin'); |
|
104 | +if (!$ret > 0) { |
|
105 | 105 | print 'A user with login "admin" and all permissions must be created to use this script.'."\n"; |
106 | 106 | exit; |
107 | 107 | } |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
137 | -$i=0; |
|
138 | -$result=0; |
|
137 | +$i = 0; |
|
138 | +$result = 0; |
|
139 | 139 | while ($i < GEN_NUMBER_FACTURE && $result >= 0) { |
140 | 140 | $i++; |
141 | 141 | $socid = mt_rand(1, $num_thirdparties); |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | $object = new Facture($db); |
146 | 146 | $object->socid = $socids[$socid]; |
147 | - $object->date = $dates[mt_rand(1, count($dates)-1)]; |
|
147 | + $object->date = $dates[mt_rand(1, count($dates) - 1)]; |
|
148 | 148 | $object->cond_reglement_id = 3; |
149 | 149 | $object->mode_reglement_id = 3; |
150 | 150 | |
@@ -152,22 +152,22 @@ discard block |
||
152 | 152 | $fuser->fetch(mt_rand(1, 2)); |
153 | 153 | $fuser->loadRights(); |
154 | 154 | |
155 | - $result=$object->create($fuser); |
|
155 | + $result = $object->create($fuser); |
|
156 | 156 | if ($result >= 0) { |
157 | 157 | $nbp = mt_rand(2, 5); |
158 | 158 | $xnbp = 0; |
159 | 159 | while ($xnbp < $nbp) { |
160 | 160 | $prodid = mt_rand(1, $num_prods); |
161 | - $product=new Product($db); |
|
162 | - $result=$product->fetch($prodids[$prodid]); |
|
163 | - $result=$object->addline($product->description, $product->price, mt_rand(1, 5), 0, 0, 0, $prodids[$prodid], 0, '', '', 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type); |
|
161 | + $product = new Product($db); |
|
162 | + $result = $product->fetch($prodids[$prodid]); |
|
163 | + $result = $object->addline($product->description, $product->price, mt_rand(1, 5), 0, 0, 0, $prodids[$prodid], 0, '', '', 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type); |
|
164 | 164 | if ($result < 0) { |
165 | 165 | dol_print_error($db, $propal->error); |
166 | 166 | } |
167 | 167 | $xnbp++; |
168 | 168 | } |
169 | 169 | |
170 | - $result=$object->validate($fuser); |
|
170 | + $result = $object->validate($fuser); |
|
171 | 171 | if ($result) { |
172 | 172 | print " OK with ref ".$object->ref."\n"; |
173 | 173 | ; |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | * @param mixed $v Feature information of a product. |
651 | 651 | * @return bool |
652 | 652 | */ |
653 | - static function ($v) { |
|
653 | + static function($v) { |
|
654 | 654 | return !empty($v); |
655 | 655 | } |
656 | 656 | ); |
@@ -857,7 +857,7 @@ discard block |
||
857 | 857 | |
858 | 858 | if ($forced_refvar === false) { |
859 | 859 | if (isset($conf->global->PRODUIT_ATTRIBUTES_SEPARATOR)) { |
860 | - $newproduct->ref .= getDolGlobalString('PRODUIT_ATTRIBUTES_SEPARATOR') . $prodattrval->ref; |
|
860 | + $newproduct->ref .= getDolGlobalString('PRODUIT_ATTRIBUTES_SEPARATOR').$prodattrval->ref; |
|
861 | 861 | } else { |
862 | 862 | $newproduct->ref .= '_'.$prodattrval->ref; |
863 | 863 | } |
@@ -884,7 +884,7 @@ discard block |
||
884 | 884 | $productCombinationLevel->fk_price_level = $i; |
885 | 885 | $productCombinationLevel->variation_price = $price_impact[$i]; |
886 | 886 | |
887 | - $productCombinationLevel->variation_price_percentage = (bool) $price_var_percent[$i] ; |
|
887 | + $productCombinationLevel->variation_price_percentage = (bool) $price_var_percent[$i]; |
|
888 | 888 | |
889 | 889 | $newcomb->combination_price_levels[$i] = $productCombinationLevel; |
890 | 890 | } |
@@ -998,8 +998,8 @@ discard block |
||
998 | 998 | $variation_price = $combination->variation_price; |
999 | 999 | |
1000 | 1000 | if (getDolGlobalInt('PRODUIT_MULTIPRICES') && getDolGlobalInt('PRODUIT_MULTIPRICES_LIMIT') > 1) { |
1001 | - $variation_price_percentage = [ ]; |
|
1002 | - $variation_price = [ ]; |
|
1001 | + $variation_price_percentage = []; |
|
1002 | + $variation_price = []; |
|
1003 | 1003 | |
1004 | 1004 | foreach ($combination->combination_price_levels as $productCombinationLevel) { |
1005 | 1005 | $variation_price_percentage[$productCombinationLevel->fk_price_level] = $productCombinationLevel->variation_price_percentage; |
@@ -189,12 +189,12 @@ discard block |
||
189 | 189 | if (!empty($user->email)) { |
190 | 190 | $sendto = dolGetFirstLastname($user->firstname, $user->lastname)." <".$user->email.">"; |
191 | 191 | } else { |
192 | - $sendto = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL') . '" <' . getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>'; |
|
192 | + $sendto = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'" <'.getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>'; |
|
193 | 193 | } |
194 | 194 | $replyto = $sendto; |
195 | 195 | $sendtocc = ''; |
196 | 196 | if (getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL')) { |
197 | - $sendtocc = getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL') . '" <' . getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL').'>'; |
|
197 | + $sendtocc = getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL').'" <'.getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL').'>'; |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | $message = "A bank transfer of ".price2num($event->data->object->amount / 100)." ".$event->data->object->currency." should arrive in your account the ".dol_print_date($event->data->object->arrival_date, 'dayhour'); |
@@ -289,12 +289,12 @@ discard block |
||
289 | 289 | if (!empty($user->email)) { |
290 | 290 | $sendto = dolGetFirstLastname($user->firstname, $user->lastname)." <".$user->email.">"; |
291 | 291 | } else { |
292 | - $sendto = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL') . '" <' . getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>'; |
|
292 | + $sendto = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'" <'.getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>'; |
|
293 | 293 | } |
294 | 294 | $replyto = $sendto; |
295 | 295 | $sendtocc = ''; |
296 | 296 | if (getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL')) { |
297 | - $sendtocc = getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL') . '" <' . getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL').'>'; |
|
297 | + $sendtocc = getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL').'" <'.getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL').'>'; |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | $message = "A bank transfer of ".price2num($event->data->object->amount / 100)." ".$event->data->object->currency." has been done to your account the ".dol_print_date($event->data->object->arrival_date, 'dayhour'); |
@@ -339,19 +339,19 @@ discard block |
||
339 | 339 | // Called when making payment with PaymentIntent method ($conf->global->STRIPE_USE_NEW_CHECKOUT is on). |
340 | 340 | |
341 | 341 | //dol_syslog("object = ".var_export($event->data, true)); |
342 | - include_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php'; |
|
342 | + include_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; |
|
343 | 343 | global $stripearrayofkeysbyenv; |
344 | 344 | $error = 0; |
345 | 345 | $object = $event->data->object; |
346 | - $TRANSACTIONID = $object->id; // Example pi_123456789... |
|
346 | + $TRANSACTIONID = $object->id; // Example pi_123456789... |
|
347 | 347 | $ipaddress = $object->metadata->ipaddress; |
348 | 348 | $now = dol_now(); |
349 | 349 | $currencyCodeType = strtoupper($object->currency); |
350 | 350 | $paymentmethodstripeid = $object->payment_method; |
351 | 351 | $customer_id = $object->customer; |
352 | 352 | $invoice_id = ""; |
353 | - $paymentTypeCode = ""; // payment type according to Stripe |
|
354 | - $paymentTypeCodeInDolibarr = ""; // payment type according to Dolibarr |
|
353 | + $paymentTypeCode = ""; // payment type according to Stripe |
|
354 | + $paymentTypeCodeInDolibarr = ""; // payment type according to Dolibarr |
|
355 | 355 | $payment_amount = 0; |
356 | 356 | $payment_amountInDolibarr = 0; |
357 | 357 | |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | $s = new \Stripe\StripeClient($stripeacc); |
417 | 417 | |
418 | 418 | $paymentmethodstripe = $s->paymentMethods->retrieve($paymentmethodstripeid); |
419 | - $paymentTypeCode = $paymentmethodstripe->type; |
|
419 | + $paymentTypeCode = $paymentmethodstripe->type; |
|
420 | 420 | if ($paymentTypeCode == "ban" || $paymentTypeCode == "sepa_debit") { |
421 | 421 | $paymentTypeCode = "PRE"; |
422 | 422 | } elseif ($paymentTypeCode == "card") { |
@@ -442,9 +442,9 @@ discard block |
||
442 | 442 | $paiement->datepaye = $now; |
443 | 443 | $paiement->date = $now; |
444 | 444 | if ($currencyCodeType == $conf->currency) { |
445 | - $paiement->amounts = [$invoice_id => $payment_amount]; // Array with all payments dispatching with invoice id |
|
445 | + $paiement->amounts = [$invoice_id => $payment_amount]; // Array with all payments dispatching with invoice id |
|
446 | 446 | } else { |
447 | - $paiement->multicurrency_amounts = [$invoice_id => $payment_amount]; // Array with all payments dispatching |
|
447 | + $paiement->multicurrency_amounts = [$invoice_id => $payment_amount]; // Array with all payments dispatching |
|
448 | 448 | |
449 | 449 | $postactionmessages[] = 'Payment was done in a currency ('.$currencyCodeType.') other than the expected currency of company ('.$conf->currency.')'; |
450 | 450 | $ispostactionok = -1; |
@@ -467,8 +467,8 @@ discard block |
||
467 | 467 | |
468 | 468 | $paiement->num_payment = ''; |
469 | 469 | $paiement->note_public = ''; |
470 | - $paiement->note_private = 'StripeSepa payment received by IPN webhook - ' . dol_print_date($now, 'standard') . ' (TZ server) using servicestatus=' . $servicestatus . ($ipaddress ? ' from ip ' . $ipaddress : '') . ' - Transaction ID = ' . $TRANSACTIONID; |
|
471 | - $paiement->ext_payment_id = $TRANSACTIONID.':'.$customer_id.'@'.$stripearrayofkeysbyenv[$servicestatus]['publishable_key']; // May be we should store py_... instead of pi_... but we started with pi_... so we continue. |
|
470 | + $paiement->note_private = 'StripeSepa payment received by IPN webhook - '.dol_print_date($now, 'standard').' (TZ server) using servicestatus='.$servicestatus.($ipaddress ? ' from ip '.$ipaddress : '').' - Transaction ID = '.$TRANSACTIONID; |
|
471 | + $paiement->ext_payment_id = $TRANSACTIONID.':'.$customer_id.'@'.$stripearrayofkeysbyenv[$servicestatus]['publishable_key']; // May be we should store py_... instead of pi_... but we started with pi_... so we continue. |
|
472 | 472 | $paiement->ext_payment_site = $service; |
473 | 473 | |
474 | 474 | $ispaymentdone = 0; |
@@ -486,20 +486,20 @@ discard block |
||
486 | 486 | $db->begin(); |
487 | 487 | |
488 | 488 | if (!$error && !$ispaymentdone) { |
489 | - dol_syslog('* Record payment type PRE for invoice id ' . $invoice_id . '. It includes closing of invoice and regenerating document.'); |
|
489 | + dol_syslog('* Record payment type PRE for invoice id '.$invoice_id.'. It includes closing of invoice and regenerating document.'); |
|
490 | 490 | |
491 | 491 | // This include closing invoices to 'paid' (and trigger including unsuspending) and regenerating document |
492 | 492 | $paiement_id = $paiement->create($user, 1); |
493 | 493 | if ($paiement_id < 0) { |
494 | - $postactionmessages[] = $paiement->error . ($paiement->error ? ' ' : '') . implode("<br>\n", $paiement->errors); |
|
494 | + $postactionmessages[] = $paiement->error.($paiement->error ? ' ' : '').implode("<br>\n", $paiement->errors); |
|
495 | 495 | $ispostactionok = -1; |
496 | 496 | $error++; |
497 | 497 | |
498 | - dol_syslog("Failed to create the payment for invoice id " . $invoice_id); |
|
498 | + dol_syslog("Failed to create the payment for invoice id ".$invoice_id); |
|
499 | 499 | } else { |
500 | 500 | $postactionmessages[] = 'Payment created'; |
501 | 501 | |
502 | - dol_syslog("The payment has been created for invoice id " . $invoice_id); |
|
502 | + dol_syslog("The payment has been created for invoice id ".$invoice_id); |
|
503 | 503 | } |
504 | 504 | } |
505 | 505 | |
@@ -529,14 +529,14 @@ discard block |
||
529 | 529 | $label = '(CustomerInvoicePayment)'; |
530 | 530 | $result = $paiement->addPaymentToBank($user, 'payment', $label, $bankaccountid, $customer_id, ''); |
531 | 531 | if ($result < 0) { |
532 | - $postactionmessages[] = $paiement->error . ($paiement->error ? ' ' : '') . implode("<br>\n", $paiement->errors); |
|
532 | + $postactionmessages[] = $paiement->error.($paiement->error ? ' ' : '').implode("<br>\n", $paiement->errors); |
|
533 | 533 | $ispostactionok = -1; |
534 | 534 | $error++; |
535 | 535 | } else { |
536 | 536 | $postactionmessages[] = 'Bank transaction of payment created (by ipn.php file)'; |
537 | 537 | } |
538 | 538 | } else { |
539 | - $postactionmessages[] = 'Setup of bank account to use in module ' . $paymentmethod . ' was not set. No way to record the payment.'; |
|
539 | + $postactionmessages[] = 'Setup of bank account to use in module '.$paymentmethod.' was not set. No way to record the payment.'; |
|
540 | 540 | $ispostactionok = -1; |
541 | 541 | $error++; |
542 | 542 | } |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | $error++; |
702 | 702 | } |
703 | 703 | |
704 | - if (! $error) { |
|
704 | + if (!$error) { |
|
705 | 705 | $db->commit(); |
706 | 706 | } else { |
707 | 707 | $db->rollback(); |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | $companypaymentmode->card_type = $event->data->object->card->branding; |
733 | 733 | |
734 | 734 | $companypaymentmode->owner_name = $event->data->object->billing_details->name; |
735 | - $companypaymentmode->proprio = $companypaymentmode->owner_name; // We may still need this formodulebuilder because name of field is "proprio" |
|
735 | + $companypaymentmode->proprio = $companypaymentmode->owner_name; // We may still need this formodulebuilder because name of field is "proprio" |
|
736 | 736 | |
737 | 737 | $companypaymentmode->exp_date_month = (int) $event->data->object->card->exp_month; |
738 | 738 | $companypaymentmode->exp_date_year = (int) $event->data->object->card->exp_year; |
@@ -824,12 +824,12 @@ discard block |
||
824 | 824 | $paymentmethodstripeid = $object->payment_method; |
825 | 825 | $customer_id = $object->customer; |
826 | 826 | $reason = $object->reason; |
827 | - $amountdisputestripe = $object->amoutndispute; // In stripe format |
|
828 | - $amountdispute = $amountdisputestripe; // In real currency format |
|
827 | + $amountdisputestripe = $object->amoutndispute; // In stripe format |
|
828 | + $amountdispute = $amountdisputestripe; // In real currency format |
|
829 | 829 | |
830 | 830 | $invoice_id = ""; |
831 | - $paymentTypeCode = ""; // payment type according to Stripe |
|
832 | - $paymentTypeCodeInDolibarr = ""; // payment type according to Dolibarr |
|
831 | + $paymentTypeCode = ""; // payment type according to Stripe |
|
832 | + $paymentTypeCodeInDolibarr = ""; // payment type according to Dolibarr |
|
833 | 833 | $payment_amount = 0; |
834 | 834 | $payment_amountInDolibarr = 0; |
835 | 835 | |
@@ -904,7 +904,7 @@ discard block |
||
904 | 904 | $paiement->multicurrency_tx = $multicurrency_tx; // Array with all currency tx of payments dispatching |
905 | 905 | */ |
906 | 906 | $paiement->paiementid = dol_getIdFromCode($db, 'PRE', 'c_paiement', 'code', 'id', 1); |
907 | - $paiement->num_payment = $object->id; // A string like 'du_...' |
|
907 | + $paiement->num_payment = $object->id; // A string like 'du_...' |
|
908 | 908 | $paiement->note_public = 'Fund withdrawn by bank. Reason: '.$reason; |
909 | 909 | $paiement->note_private = ''; |
910 | 910 | $paiement->fk_account = $accountfrom->id; |
@@ -920,7 +920,7 @@ discard block |
||
920 | 920 | $error++; |
921 | 921 | } |
922 | 922 | |
923 | - if (! $error && $tmpinvoice->status == Facture::STATUS_CLOSED) { |
|
923 | + if (!$error && $tmpinvoice->status == Facture::STATUS_CLOSED) { |
|
924 | 924 | // Switch back the invoice to status validated |
925 | 925 | $result = $tmpinvoice->setStatut(Facture::STATUS_VALIDATED); |
926 | 926 | if ($result < 0) { |
@@ -929,7 +929,7 @@ discard block |
||
929 | 929 | } |
930 | 930 | } |
931 | 931 | |
932 | - if (! $error) { |
|
932 | + if (!$error) { |
|
933 | 933 | $paiement_id = $paiement->create($user, 0, $tmpinvoice->thirdparty); // This include regenerating documents |
934 | 934 | if ($paiement_id < 0) { |
935 | 935 | $errormsg = $paiement->error.implode(', ', $paiement->errors); |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | $this->date_end = $this->db->jdate($obj->date_end); |
588 | 588 | $this->fk_user_creat = $obj->fk_user_creat; |
589 | 589 | $this->fk_user_valid = $obj->fk_user_valid; |
590 | - $this->status = $obj->status; |
|
590 | + $this->status = $obj->status; |
|
591 | 591 | $this->progress = $obj->progress; |
592 | 592 | $this->budget_amount = $obj->budget_amount; |
593 | 593 | $this->priority = $obj->priority; |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | * @param Task $task |
723 | 723 | * @return bool |
724 | 724 | */ |
725 | - static function ($allTasksCompleted, $task) { |
|
725 | + static function($allTasksCompleted, $task) { |
|
726 | 726 | return $allTasksCompleted && $task->progress >= 100; |
727 | 727 | }, |
728 | 728 | 1 |
@@ -1352,14 +1352,14 @@ discard block |
||
1352 | 1352 | $tasks[$i]->billed = $obj->billed; |
1353 | 1353 | } |
1354 | 1354 | |
1355 | - $tasks[$i]->progress = $obj->progress; |
|
1355 | + $tasks[$i]->progress = $obj->progress; |
|
1356 | 1356 | $tasks[$i]->fk_statut = $obj->status; |
1357 | - $tasks[$i]->status = $obj->status; |
|
1357 | + $tasks[$i]->status = $obj->status; |
|
1358 | 1358 | $tasks[$i]->public = $obj->public; |
1359 | 1359 | $tasks[$i]->date_start = $this->db->jdate($obj->date_start); |
1360 | 1360 | $tasks[$i]->date_end = $this->db->jdate($obj->date_end); |
1361 | 1361 | $tasks[$i]->rang = $obj->rang; |
1362 | - $tasks[$i]->priority = $obj->priority; |
|
1362 | + $tasks[$i]->priority = $obj->priority; |
|
1363 | 1363 | |
1364 | 1364 | $tasks[$i]->socid = $obj->thirdparty_id; // For backward compatibility |
1365 | 1365 | $tasks[$i]->thirdparty_id = $obj->thirdparty_id; |
@@ -1704,7 +1704,7 @@ discard block |
||
1704 | 1704 | } |
1705 | 1705 | |
1706 | 1706 | // Update hourly rate of this time spent entry |
1707 | - $resql_thm_user = $this->db->query("SELECT thm FROM " . MAIN_DB_PREFIX . "user WHERE rowid = " . ((int) $timespent->fk_user)); |
|
1707 | + $resql_thm_user = $this->db->query("SELECT thm FROM ".MAIN_DB_PREFIX."user WHERE rowid = ".((int) $timespent->fk_user)); |
|
1708 | 1708 | if (!empty($resql_thm_user)) { |
1709 | 1709 | $obj_thm_user = $this->db->fetch_object($resql_thm_user); |
1710 | 1710 | $timespent->thm = $obj_thm_user->thm; |
@@ -1798,7 +1798,7 @@ discard block |
||
1798 | 1798 | $newobj->timespent_line_withhour = $obj->task_date_withhour; |
1799 | 1799 | $newobj->timespent_line_duration = $obj->task_duration; |
1800 | 1800 | $newobj->timespent_line_fk_user = $obj->fk_user; |
1801 | - $newobj->timespent_line_thm = $obj->thm; // hourly rate |
|
1801 | + $newobj->timespent_line_thm = $obj->thm; // hourly rate |
|
1802 | 1802 | $newobj->timespent_line_note = $obj->note; |
1803 | 1803 | |
1804 | 1804 | $arrayres[] = $newobj; |
@@ -2034,7 +2034,7 @@ discard block |
||
2034 | 2034 | $newobj->timespent_withhour = $obj->task_date_withhour; |
2035 | 2035 | $newobj->timespent_duration = $obj->task_duration; |
2036 | 2036 | $newobj->timespent_fk_user = $obj->fk_user; |
2037 | - $newobj->timespent_thm = $obj->thm; // hourly rate |
|
2037 | + $newobj->timespent_thm = $obj->thm; // hourly rate |
|
2038 | 2038 | $newobj->timespent_note = $obj->note; |
2039 | 2039 | |
2040 | 2040 | $arrayres[] = $newobj; |
@@ -2132,14 +2132,14 @@ discard block |
||
2132 | 2132 | if ($ret == 1 && (($this->timespent_old_duration != $this->timespent_duration) || getDolGlobalString('TIMESPENT_ALWAYS_UPDATE_THM'))) { |
2133 | 2133 | if ($this->timespent_old_duration != $this->timespent_duration) { |
2134 | 2134 | // Recalculate amount of time spent for task and update denormalized field |
2135 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "projet_task"; |
|
2136 | - $sql .= " SET duration_effective = (SELECT SUM(element_duration) FROM " . MAIN_DB_PREFIX . "element_time as ptt where ptt.elementtype = 'task' AND ptt.fk_element = " . ((int) $this->id) . ")"; |
|
2135 | + $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task"; |
|
2136 | + $sql .= " SET duration_effective = (SELECT SUM(element_duration) FROM ".MAIN_DB_PREFIX."element_time as ptt where ptt.elementtype = 'task' AND ptt.fk_element = ".((int) $this->id).")"; |
|
2137 | 2137 | if (isset($this->progress)) { |
2138 | - $sql .= ", progress = " . ((float) $this->progress); // Do not overwrite value if not provided |
|
2138 | + $sql .= ", progress = ".((float) $this->progress); // Do not overwrite value if not provided |
|
2139 | 2139 | } |
2140 | - $sql .= " WHERE rowid = " . ((int) $this->id); |
|
2140 | + $sql .= " WHERE rowid = ".((int) $this->id); |
|
2141 | 2141 | |
2142 | - dol_syslog(get_class($this) . "::updateTimeSpent", LOG_DEBUG); |
|
2142 | + dol_syslog(get_class($this)."::updateTimeSpent", LOG_DEBUG); |
|
2143 | 2143 | if (!$this->db->query($sql)) { |
2144 | 2144 | $this->error = $this->db->lasterror(); |
2145 | 2145 | $this->db->rollback(); |
@@ -2150,7 +2150,7 @@ discard block |
||
2150 | 2150 | // Update hourly rate of this time spent entry, but only if it was not set initially |
2151 | 2151 | $res_update = 1; |
2152 | 2152 | if (empty($timespent->thm) || getDolGlobalString('TIMESPENT_ALWAYS_UPDATE_THM')) { |
2153 | - $resql_thm_user = $this->db->query("SELECT thm FROM " . MAIN_DB_PREFIX . "user WHERE rowid = " . ((int) $timespent->fk_user)); |
|
2153 | + $resql_thm_user = $this->db->query("SELECT thm FROM ".MAIN_DB_PREFIX."user WHERE rowid = ".((int) $timespent->fk_user)); |
|
2154 | 2154 | if (!empty($resql_thm_user)) { |
2155 | 2155 | $obj_thm_user = $this->db->fetch_object($resql_thm_user); |
2156 | 2156 | $timespent->thm = $obj_thm_user->thm; |
@@ -2287,8 +2287,8 @@ discard block |
||
2287 | 2287 | |
2288 | 2288 | $defaultref = ''; |
2289 | 2289 | $obj = !getDolGlobalString('PROJECT_TASK_ADDON') ? 'mod_task_simple' : $conf->global->PROJECT_TASK_ADDON; |
2290 | - if (getDolGlobalString('PROJECT_TASK_ADDON') && is_readable(DOL_DOCUMENT_ROOT."/core/modules/project/task/" . getDolGlobalString('PROJECT_TASK_ADDON').".php")) { |
|
2291 | - require_once DOL_DOCUMENT_ROOT."/core/modules/project/task/" . getDolGlobalString('PROJECT_TASK_ADDON').'.php'; |
|
2290 | + if (getDolGlobalString('PROJECT_TASK_ADDON') && is_readable(DOL_DOCUMENT_ROOT."/core/modules/project/task/".getDolGlobalString('PROJECT_TASK_ADDON').".php")) { |
|
2291 | + require_once DOL_DOCUMENT_ROOT."/core/modules/project/task/".getDolGlobalString('PROJECT_TASK_ADDON').'.php'; |
|
2292 | 2292 | $modTask = new $obj(); |
2293 | 2293 | '@phan-var-force ModeleNumRefTask $modTask'; |
2294 | 2294 | $defaultref = $modTask->getNextValue(0, $clone_task); |
@@ -2338,7 +2338,7 @@ discard block |
||
2338 | 2338 | } |
2339 | 2339 | // End |
2340 | 2340 | if ($error) { |
2341 | - $clone_task_id = 0; // For static tool check |
|
2341 | + $clone_task_id = 0; // For static tool check |
|
2342 | 2342 | } else { |
2343 | 2343 | $clone_task_id = $clone_task->id; |
2344 | 2344 | $clone_task_ref = $clone_task->ref; |
@@ -2778,7 +2778,7 @@ discard block |
||
2778 | 2778 | global $langs, $hookmanager, $user, $action; |
2779 | 2779 | |
2780 | 2780 | $error = 0; |
2781 | - $task_origin = new Task($this->db); // The thirdparty that we will delete |
|
2781 | + $task_origin = new Task($this->db); // The thirdparty that we will delete |
|
2782 | 2782 | |
2783 | 2783 | dol_syslog("mergeTask merge task id=".$task_origin_id." (will be deleted) into the task id=".$this->id); |
2784 | 2784 |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | $action = GETPOST('action', 'aZ09'); |
60 | 60 | $value = GETPOST('value', 'alpha'); |
61 | -$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php |
|
61 | +$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php |
|
62 | 62 | |
63 | 63 | $label = GETPOST('label', 'alpha'); |
64 | 64 | $scandir = GETPOST('scan_dir', 'alpha'); |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | if (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { |
612 | 612 | print '<tr class="oddeven">'; |
613 | 613 | print '<td>'.$langs->trans("MultiPricesNumPrices").'</td>'; |
614 | - print '<td class="right"><input size="3" type="text" class="flat right" name="value_PRODUIT_MULTIPRICES_LIMIT" value="' . getDolGlobalString('PRODUIT_MULTIPRICES_LIMIT').'"></td>'; |
|
614 | + print '<td class="right"><input size="3" type="text" class="flat right" name="value_PRODUIT_MULTIPRICES_LIMIT" value="'.getDolGlobalString('PRODUIT_MULTIPRICES_LIMIT').'"></td>'; |
|
615 | 615 | print '</tr>'; |
616 | 616 | } |
617 | 617 | |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | |
688 | 688 | print '<tr class="oddeven">'; |
689 | 689 | print '<td>'.$langs->trans("NumberOfProductShowInSelect").'</td>'; |
690 | -print '<td class="right"><input size="3" type="text" class="flat" name="value_PRODUIT_LIMIT_SIZE" value="' . getDolGlobalString('PRODUIT_LIMIT_SIZE', 1000).'"></td>'; |
|
690 | +print '<td class="right"><input size="3" type="text" class="flat" name="value_PRODUIT_LIMIT_SIZE" value="'.getDolGlobalString('PRODUIT_LIMIT_SIZE', 1000).'"></td>'; |
|
691 | 691 | print '</tr>'; |
692 | 692 | |
693 | 693 |
@@ -180,8 +180,8 @@ discard block |
||
180 | 180 | if (empty($reshook) && $action == 'setsocid' && $permissiontoaddmember) { |
181 | 181 | $error = 0; |
182 | 182 | if (GETPOSTINT('socid') != $object->socid) { // If link differs from currently in database |
183 | - $sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "adherent"; |
|
184 | - $sql .= " WHERE fk_soc = " . ((int) GETPOSTINT('socid')); |
|
183 | + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."adherent"; |
|
184 | + $sql .= " WHERE fk_soc = ".((int) GETPOSTINT('socid')); |
|
185 | 185 | $resql = $db->query($sql); |
186 | 186 | if ($resql) { |
187 | 187 | $obj = $db->fetch_object($resql); |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | //include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; |
467 | 467 | |
468 | 468 | |
469 | -if (! ($object->id > 0)) { |
|
469 | +if (!($object->id > 0)) { |
|
470 | 470 | $langs->load("errors"); |
471 | 471 | print $langs->trans("ErrorRecordNotFound"); |
472 | 472 | } |
@@ -1019,7 +1019,7 @@ discard block |
||
1019 | 1019 | if ($adht->subscription) { |
1020 | 1020 | // Amount |
1021 | 1021 | print '<tr><td class="fieldrequired">'.$langs->trans("Amount").'</td>'; |
1022 | - print '<td><input autofocus class="width50" type="text" name="subscription" value="'.(GETPOSTISSET('subscription') ? GETPOST('subscription') : (is_null($adht->amount) ? '' : price($adht->amount, 0, '', 0))).'"> '.$langs->trans("Currency".$conf->currency) .'</td></tr>'; |
|
1022 | + print '<td><input autofocus class="width50" type="text" name="subscription" value="'.(GETPOSTISSET('subscription') ? GETPOST('subscription') : (is_null($adht->amount) ? '' : price($adht->amount, 0, '', 0))).'"> '.$langs->trans("Currency".$conf->currency).'</td></tr>'; |
|
1023 | 1023 | |
1024 | 1024 | // Label |
1025 | 1025 | print '<tr><td>'.$langs->trans("Label").'</td>'; |
@@ -76,14 +76,14 @@ |
||
76 | 76 | |
77 | 77 | $newsList .= '<div style="display: flex; align-items: flex-start; justify-content: flex-start; width: 100%; max-width: 800px; margin-top: 20px;margin-bottom: 50px; padding: 20px;"> |
78 | 78 | <div style="flex-grow: 1; margin-right: 30px; max-width: 600px; margin-left: 100px;"> |
79 | - <h2 style="margin: 0; font-size: 1.5em;">' . htmlentities(empty($post['title']) ? '' : $post['title']) . '</h2> |
|
80 | - <p style="margin: 10px 0; color: #555;">' . htmlentities(empty($post['description']) ? '' : $post['description']) . '</p> |
|
81 | - <span style="display: block; margin-bottom: 5px; color: #888;">Created By: <strong>' . htmlentities(empty($post['user_fullname']) ? '' : $post['user_fullname']) . '</strong></span> |
|
79 | + <h2 style="margin: 0; font-size: 1.5em;">' . htmlentities(empty($post['title']) ? '' : $post['title']).'</h2> |
|
80 | + <p style="margin: 10px 0; color: #555;">' . htmlentities(empty($post['description']) ? '' : $post['description']).'</p> |
|
81 | + <span style="display: block; margin-bottom: 5px; color: #888;">Created By: <strong>' . htmlentities(empty($post['user_fullname']) ? '' : $post['user_fullname']).'</strong></span> |
|
82 | 82 | <br> |
83 | - <span style="display: block; color: #888;">' . dol_print_date((empty($post['date_creation']) ? dol_now() : $post['date_creation']), 'daytext', 'tzserver', $langs) . '</span> |
|
83 | + <span style="display: block; color: #888;">' . dol_print_date((empty($post['date_creation']) ? dol_now() : $post['date_creation']), 'daytext', 'tzserver', $langs).'</span> |
|
84 | 84 | </div> |
85 | 85 | <div style="flex-shrink: 0; margin-left: 100px; float: right;"> |
86 | - ' . (!empty($post['image']) ? '<img alt="Image" width="130px" height="130px" style="border-radius: 10px;" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=medias&file=' . htmlentities($post['image']) . '">' : '<img alt="Gray rectangle" width="130px" height="130px" style="border-radius: 10px;" src="__GRAY_RECTANGLE__">') . ' |
|
86 | + ' . (!empty($post['image']) ? '<img alt="Image" width="130px" height="130px" style="border-radius: 10px;" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file='.htmlentities($post['image']).'">' : '<img alt="Gray rectangle" width="130px" height="130px" style="border-radius: 10px;" src="__GRAY_RECTANGLE__">').' |
|
87 | 87 | </div> |
88 | 88 | </div>'; |
89 | 89 | } |
@@ -51,7 +51,7 @@ |
||
51 | 51 | case 'sellist': |
52 | 52 | $tmp = ''; |
53 | 53 | $tmpparam = jsonOrUnserialize($obj->param); // $tmp may be array 'options' => array 'c_currencies:code_iso:code_iso' => null |
54 | - if (is_array($tmpparam) && array_key_exists('options', $tmpparam) && $tmpparam['options'] && is_array($tmpparam['options'])) { |
|
54 | + if (is_array($tmpparam) && array_key_exists('options', $tmpparam) && $tmpparam['options'] && is_array($tmpparam['options'])) { |
|
55 | 55 | $tmpkeys = array_keys($tmpparam['options']); |
56 | 56 | $tmp = (string) array_shift($tmpkeys); |
57 | 57 | } |
@@ -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 | |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | if (!empty($conf->mycompany->multidir_output[$object->entity])) { |
365 | 365 | $logodir = $conf->mycompany->multidir_output[$object->entity]; |
366 | 366 | } |
367 | - $pagecount = $pdf->setSourceFile($logodir.'/' . getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')); |
|
367 | + $pagecount = $pdf->setSourceFile($logodir.'/'.getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')); |
|
368 | 368 | $tplidx = $pdf->importPage(1); |
369 | 369 | } |
370 | 370 | |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | // $pdf->GetY() here can't be used. It is bottom of the second address box but first one may be higher |
462 | 462 | |
463 | 463 | // $this->tab_top is y where we must continue content (90 = 42 + 48: 42 is height of logo and ref, 48 is address blocks) |
464 | - $this->tab_top = 90 + $top_shift + $shipp_shift; // top_shift is an addition for linked objects or addons (0 in most cases) |
|
464 | + $this->tab_top = 90 + $top_shift + $shipp_shift; // top_shift is an addition for linked objects or addons (0 in most cases) |
|
465 | 465 | $this->tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10); |
466 | 466 | |
467 | 467 | // You can add more thing under header here, if you increase $extra_under_address_shift too. |
@@ -847,7 +847,7 @@ discard block |
||
847 | 847 | $extrafieldValue = $this->getExtrafieldContent($object->lines[$i], $extrafieldColKey, $outputlangs); |
848 | 848 | $this->printStdColumnContent($pdf, $curY, $extrafieldColKey, $extrafieldValue); |
849 | 849 | |
850 | - $this->setAfterColsLinePositionsData('options_' . $extrafieldColKey, $pdf->GetY(), $pdf->getPage()); |
|
850 | + $this->setAfterColsLinePositionsData('options_'.$extrafieldColKey, $pdf->GetY(), $pdf->getPage()); |
|
851 | 851 | } |
852 | 852 | } |
853 | 853 | } |
@@ -937,11 +937,11 @@ discard block |
||
937 | 937 | if (!isset($this->tva[$vatrate])) { |
938 | 938 | $this->tva[$vatrate] = 0; |
939 | 939 | } |
940 | - $this->tva[$vatrate] += $tvaligne; // ->tva is abandoned, we use now ->tva_array that is more complete |
|
940 | + $this->tva[$vatrate] += $tvaligne; // ->tva is abandoned, we use now ->tva_array that is more complete |
|
941 | 941 | $vatcode = $object->lines[$i]->vat_src_code; |
942 | 942 | if (getDolGlobalInt('PDF_INVOICE_SHOW_VAT_ANALYSIS')) { |
943 | 943 | if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['tot_ht'])) { |
944 | - $this->tva_array[$vatrate . ($vatcode ? ' (' . $vatcode . ')' : '')]['tot_ht'] = 0; |
|
944 | + $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['tot_ht'] = 0; |
|
945 | 945 | } |
946 | 946 | $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); |
947 | 947 | } else { |
@@ -1051,7 +1051,7 @@ discard block |
||
1051 | 1051 | |
1052 | 1052 | // Add number of pages in footer |
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')) { |
@@ -1305,7 +1305,7 @@ discard block |
||
1305 | 1305 | foreach ($this->tva_array as $tvakey => $tvaval) { |
1306 | 1306 | $pdf->SetFont('', '', $default_font_size - 2); |
1307 | 1307 | $pdf->SetXY($this->marge_gauche, $posy); |
1308 | - $titre = round((float) $tvakey, 2) . "%"; |
|
1308 | + $titre = round((float) $tvakey, 2)."%"; |
|
1309 | 1309 | $pdf->MultiCell(25, 4, $titre, 0, 'L'); |
1310 | 1310 | |
1311 | 1311 | $pdf->SetFont('', '', $default_font_size - 2); |
@@ -1346,8 +1346,8 @@ discard block |
||
1346 | 1346 | $posy = $pdf->GetY() + 4; |
1347 | 1347 | } |
1348 | 1348 | |
1349 | - $posxval = 52; // Position of values of properties shown on left side |
|
1350 | - $posxend = 110; // End of x for text on left side |
|
1349 | + $posxval = 52; // Position of values of properties shown on left side |
|
1350 | + $posxend = 110; // End of x for text on left side |
|
1351 | 1351 | if ($this->page_largeur < 210) { // To work with US executive format |
1352 | 1352 | $posxend -= 10; |
1353 | 1353 | } |
@@ -1377,7 +1377,7 @@ discard block |
||
1377 | 1377 | |
1378 | 1378 | $pdf->SetFont('', '', $default_font_size - 2); |
1379 | 1379 | $pdf->SetXY($posxval, $posy); |
1380 | - $categoryOfOperationLabel = $outputlangs->transnoentities("MentionCategoryOfOperations" . $this->categoryOfOperation); |
|
1380 | + $categoryOfOperationLabel = $outputlangs->transnoentities("MentionCategoryOfOperations".$this->categoryOfOperation); |
|
1381 | 1381 | $pdf->MultiCell($posxend - $posxval, 4, $categoryOfOperationLabel, 0, 'L'); |
1382 | 1382 | |
1383 | 1383 | $posy = $pdf->GetY() + 3; // for 2 lines |
@@ -1555,7 +1555,7 @@ discard block |
||
1555 | 1555 | include_once DOL_DOCUMENT_ROOT.'/core/lib/functions_be.lib.php'; |
1556 | 1556 | $invoicePaymentKey = dolBECalculateStructuredCommunication($object->ref, $object->type); |
1557 | 1557 | |
1558 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities('StructuredCommunication').": " . $outputlangs->convToOutputCharset($invoicePaymentKey), 0, 'L', 0); |
|
1558 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities('StructuredCommunication').": ".$outputlangs->convToOutputCharset($invoicePaymentKey), 0, 'L', 0); |
|
1559 | 1559 | } |
1560 | 1560 | } |
1561 | 1561 | } |
@@ -2177,7 +2177,7 @@ discard block |
||
2177 | 2177 | if (empty($hidetop)) { |
2178 | 2178 | // Show category of operations |
2179 | 2179 | if (getDolGlobalInt('INVOICE_CATEGORY_OF_OPERATION') == 1 && $this->categoryOfOperation >= 0) { |
2180 | - $categoryOfOperations = $outputlangs->transnoentities("MentionCategoryOfOperations") . ' : ' . $outputlangs->transnoentities("MentionCategoryOfOperations" . $this->categoryOfOperation); |
|
2180 | + $categoryOfOperations = $outputlangs->transnoentities("MentionCategoryOfOperations").' : '.$outputlangs->transnoentities("MentionCategoryOfOperations".$this->categoryOfOperation); |
|
2181 | 2181 | $pdf->SetXY($this->marge_gauche, $tab_top - 4); |
2182 | 2182 | $pdf->MultiCell(($pdf->GetStringWidth($categoryOfOperations)) + 4, 2, $categoryOfOperations); |
2183 | 2183 | } |
@@ -2293,7 +2293,7 @@ discard block |
||
2293 | 2293 | } |
2294 | 2294 | if ($this->situationinvoice) { |
2295 | 2295 | $langs->loadLangs(array("other")); |
2296 | - $title = $outputlangs->transnoentities("PDFInvoiceSituation") . " " . $outputlangs->transnoentities("NumberingShort") . $object->situation_counter . " -"; |
|
2296 | + $title = $outputlangs->transnoentities("PDFInvoiceSituation")." ".$outputlangs->transnoentities("NumberingShort").$object->situation_counter." -"; |
|
2297 | 2297 | } |
2298 | 2298 | if (getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE') && is_object($outputlangsbis)) { |
2299 | 2299 | $title .= ' - '; |
@@ -2583,7 +2583,7 @@ discard block |
||
2583 | 2583 | if (!empty($carac_client_shipping)) { |
2584 | 2584 | $posy += $hautcadre; |
2585 | 2585 | |
2586 | - $hautcadre -= 10; // Height for the shipping address does not need to be as high as main box |
|
2586 | + $hautcadre -= 10; // Height for the shipping address does not need to be as high as main box |
|
2587 | 2587 | |
2588 | 2588 | // Show shipping frame |
2589 | 2589 | $pdf->SetXY($posx + 2, $posy - 5); |