@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $search_multicurrency_montant_ht = GETPOST('search_multicurrency_montant_ht', 'alpha'); |
| 84 | 84 | $search_multicurrency_montant_vat = GETPOST('search_multicurrency_montant_vat', 'alpha'); |
| 85 | 85 | $search_multicurrency_montant_ttc = GETPOST('search_multicurrency_montant_ttc', 'alpha'); |
| 86 | -$search_status = GETPOST('search_status', 'intcomma'); // Can be '' or a numeric |
|
| 86 | +$search_status = GETPOST('search_status', 'intcomma'); // Can be '' or a numeric |
|
| 87 | 87 | $search_paymentmode = GETPOSTINT('search_paymentmode'); |
| 88 | 88 | $search_paymentcond = GETPOSTINT('search_paymentcond'); |
| 89 | 89 | $search_town = GETPOST('search_town', 'alpha'); |
@@ -618,16 +618,16 @@ discard block |
||
| 618 | 618 | $sql .= " AND f.fk_cond_reglement = ".((int) $search_paymentcond); |
| 619 | 619 | } |
| 620 | 620 | if ($search_date_start) { |
| 621 | - $sql .= " AND f.datef >= '" . $db->idate($search_date_start) . "'"; |
|
| 621 | + $sql .= " AND f.datef >= '".$db->idate($search_date_start)."'"; |
|
| 622 | 622 | } |
| 623 | 623 | if ($search_date_end) { |
| 624 | - $sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'"; |
|
| 624 | + $sql .= " AND f.datef <= '".$db->idate($search_date_end)."'"; |
|
| 625 | 625 | } |
| 626 | 626 | if ($search_datelimit_start) { |
| 627 | - $sql .= " AND f.date_lim_reglement >= '" . $db->idate($search_datelimit_start) . "'"; |
|
| 627 | + $sql .= " AND f.date_lim_reglement >= '".$db->idate($search_datelimit_start)."'"; |
|
| 628 | 628 | } |
| 629 | 629 | if ($search_datelimit_end) { |
| 630 | - $sql .= " AND f.date_lim_reglement <= '" . $db->idate($search_datelimit_end) . "'"; |
|
| 630 | + $sql .= " AND f.date_lim_reglement <= '".$db->idate($search_datelimit_end)."'"; |
|
| 631 | 631 | } |
| 632 | 632 | if ($option == 'late') { |
| 633 | 633 | $sql .= " AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->fournisseur->warning_delay)."'"; |
@@ -656,7 +656,7 @@ discard block |
||
| 656 | 656 | if ($searchCategorySupplierOperator == 0) { |
| 657 | 657 | $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).")"; |
| 658 | 658 | } else { |
| 659 | - $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategorySupplier); |
|
| 659 | + $listofcategoryid .= ($listofcategoryid ? ', ' : '').((int) $searchCategorySupplier); |
|
| 660 | 660 | } |
| 661 | 661 | } |
| 662 | 662 | } |
@@ -686,7 +686,7 @@ discard block |
||
| 686 | 686 | if ($searchCategoryProductOperator == 0) { |
| 687 | 687 | $searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."facture_fourn_det as fd WHERE fd.fk_facture_fourn = f.rowid AND p.rowid = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).")"; |
| 688 | 688 | } else { |
| 689 | - $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryProduct); |
|
| 689 | + $listofcategoryid .= ($listofcategoryid ? ', ' : '').((int) $searchCategoryProduct); |
|
| 690 | 690 | } |
| 691 | 691 | } |
| 692 | 692 | } |
@@ -1503,11 +1503,11 @@ discard block |
||
| 1503 | 1503 | $totalarray = array(); |
| 1504 | 1504 | $totalarray['nbfield'] = 0; |
| 1505 | 1505 | $totalarray['val'] = array(); |
| 1506 | -$totalarray['val']['f.total_ht']=0; |
|
| 1507 | -$totalarray['val']['f.total_vat']=0; |
|
| 1508 | -$totalarray['val']['f.total_localtax1']=0; |
|
| 1509 | -$totalarray['val']['f.total_localtax1']=0; |
|
| 1510 | -$totalarray['val']['f.total_ttc']=0; |
|
| 1506 | +$totalarray['val']['f.total_ht'] = 0; |
|
| 1507 | +$totalarray['val']['f.total_vat'] = 0; |
|
| 1508 | +$totalarray['val']['f.total_localtax1'] = 0; |
|
| 1509 | +$totalarray['val']['f.total_localtax1'] = 0; |
|
| 1510 | +$totalarray['val']['f.total_ttc'] = 0; |
|
| 1511 | 1511 | $imaxinloop = ($limit ? min($num, $limit) : $num); |
| 1512 | 1512 | while ($i < $imaxinloop) { |
| 1513 | 1513 | $obj = $db->fetch_object($resql); |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | $disablejs = 0; |
| 70 | 70 | $disablehead = 0; |
| 71 | 71 | |
| 72 | -$head='<link rel="stylesheet" href="css/pos.css.php">'; |
|
| 72 | +$head = '<link rel="stylesheet" href="css/pos.css.php">'; |
|
| 73 | 73 | if (getDolGlobalInt('TAKEPOS_COLOR_THEME') == 1) { |
| 74 | 74 | $head .= '<link rel="stylesheet" href="css/colorful.css">'; |
| 75 | 75 | } |
@@ -526,7 +526,7 @@ discard block |
||
| 526 | 526 | if (isModEnabled('multicurrency') && $_SESSION["takeposcustomercurrency"] != "" && $conf->currency != $_SESSION["takeposcustomercurrency"]) { |
| 527 | 527 | //Only show customer currency if multicurrency module is enabled, if currency selected and if this currency selected is not the same as main currency |
| 528 | 528 | $showothercurrency = 1; |
| 529 | - include_once DOL_DOCUMENT_ROOT . '/multicurrency/class/multicurrency.class.php'; |
|
| 529 | + include_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php'; |
|
| 530 | 530 | $multicurrency = new MultiCurrency($db); |
| 531 | 531 | $multicurrency->fetch(0, $_SESSION["takeposcustomercurrency"]); |
| 532 | 532 | } |
@@ -537,7 +537,7 @@ discard block |
||
| 537 | 537 | <span class="takepospay colorwhite"><?php echo $langs->trans('TotalTTC'); ?>: <span id="totaldisplay" class="colorwhite"><?php |
| 538 | 538 | echo price($invoice->total_ttc, 1, '', 1, -1, -1, $conf->currency); |
| 539 | 539 | if ($showothercurrency) { |
| 540 | - print ' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' . price($invoice->total_ht * $multicurrency->rate->rate) . ' ' . $_SESSION["takeposcustomercurrency"] . ')</span>'; |
|
| 540 | + print ' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">('.price($invoice->total_ht * $multicurrency->rate->rate).' '.$_SESSION["takeposcustomercurrency"].')</span>'; |
|
| 541 | 541 | } |
| 542 | 542 | ?></span></span> |
| 543 | 543 | </div> |
@@ -546,7 +546,7 @@ discard block |
||
| 546 | 546 | <span class="takepospay colorwhite"><?php echo $langs->trans('RemainToPay'); ?>: <span id="remaintopaydisplay" class="colorwhite"><?php |
| 547 | 547 | echo price($remaintopay, 1, '', 1, -1, -1, $invoice->multicurrency_code); |
| 548 | 548 | if ($showothercurrency) { |
| 549 | - print ' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' . price($remaintopay * $multicurrency->rate->rate) . ' ' . $_SESSION["takeposcustomercurrency"] . ')</span>'; |
|
| 549 | + print ' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">('.price($remaintopay * $multicurrency->rate->rate).' '.$_SESSION["takeposcustomercurrency"].')</span>'; |
|
| 550 | 550 | } |
| 551 | 551 | ?></span></span> |
| 552 | 552 | </div> |
@@ -555,7 +555,7 @@ discard block |
||
| 555 | 555 | <span class="takepospay colorwhite"><?php echo $langs->trans("Received"); ?>: <span class="change1 colorred"><?php |
| 556 | 556 | echo price(0, 1, '', 1, -1, -1, $invoice->multicurrency_code); |
| 557 | 557 | if ($showothercurrency) { |
| 558 | - print ' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' . price(0 * $multicurrency->rate->rate) . ' ' . $_SESSION["takeposcustomercurrency"] . ')</span>'; |
|
| 558 | + print ' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">('.price(0 * $multicurrency->rate->rate).' '.$_SESSION["takeposcustomercurrency"].')</span>'; |
|
| 559 | 559 | } |
| 560 | 560 | ?></span><input type="hidden" id="change1" class="change1" value="0"></span> |
| 561 | 561 | </div> |
@@ -563,7 +563,7 @@ discard block |
||
| 563 | 563 | <span class="takepospay colorwhite"><?php echo $langs->trans("Change"); ?>: <span class="change2 colorwhite"><?php |
| 564 | 564 | echo price(0, 1, '', 1, -1, -1, $invoice->multicurrency_code); |
| 565 | 565 | if ($showothercurrency) { |
| 566 | - print ' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' . price(0 * $multicurrency->rate->rate) . ' ' . $_SESSION["takeposcustomercurrency"] . ')</span>'; |
|
| 566 | + print ' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">('.price(0 * $multicurrency->rate->rate).' '.$_SESSION["takeposcustomercurrency"].')</span>'; |
|
| 567 | 567 | } |
| 568 | 568 | ?></span><input type="hidden" id="change2" class="change2" value="0"></span> |
| 569 | 569 | </div> |
@@ -748,7 +748,7 @@ discard block |
||
| 748 | 748 | |
| 749 | 749 | <?php |
| 750 | 750 | // Add code from hooks |
| 751 | -$parameters=array(); |
|
| 751 | +$parameters = array(); |
|
| 752 | 752 | $hookmanager->executeHooks('completePayment', $parameters, $invoice); |
| 753 | 753 | print $hookmanager->resPrint; |
| 754 | 754 | ?> |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | $search_status = GETPOST('search_status') ? GETPOST('search_status', 'alpha') : 'opened'; // 'all' or '' means 'opened' |
| 61 | 61 | $optioncss = GETPOST('optioncss', 'alpha'); |
| 62 | 62 | |
| 63 | -$search_category_list =""; |
|
| 63 | +$search_category_list = ""; |
|
| 64 | 64 | if (isModEnabled('category')) { |
| 65 | 65 | $search_category_list = GETPOST("search_category_".Categorie::TYPE_ACCOUNT."_list", "array"); |
| 66 | 66 | } |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | if (empty($reshook)) { |
| 160 | - include DOL_DOCUMENT_ROOT . '/core/actions_changeselectedfields.inc.php'; |
|
| 160 | + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; |
|
| 161 | 161 | |
| 162 | 162 | // Purge search criteria |
| 163 | 163 | if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | $objectclass = 'Account'; |
| 173 | 173 | $objectlabel = 'FinancialAccount'; |
| 174 | 174 | $uploaddir = $conf->banque->dir_output; |
| 175 | - include DOL_DOCUMENT_ROOT . '/core/actions_massactions.inc.php'; |
|
| 175 | + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | /* |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | if ($searchCategoryBankOperator == 0) { |
| 239 | 239 | $searchCategoryBankSqlList[] = " EXISTS (SELECT ck.fk_account FROM ".MAIN_DB_PREFIX."categorie_account as ck WHERE b.rowid = ck.fk_account AND ck.fk_categorie = ".((int) $searchCategoryBank).")"; |
| 240 | 240 | } else { |
| 241 | - $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryBank); |
|
| 241 | + $listofcategoryid .= ($listofcategoryid ? ', ' : '').((int) $searchCategoryBank); |
|
| 242 | 242 | } |
| 243 | 243 | } |
| 244 | 244 | } |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | if (isModEnabled('category') && $user->hasRight('banque', 'modifier')) { |
| 357 | 357 | $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag"); |
| 358 | 358 | } |
| 359 | -if (in_array($massaction, array('presend', 'predelete','preaffecttag'))) { |
|
| 359 | +if (in_array($massaction, array('presend', 'predelete', 'preaffecttag'))) { |
|
| 360 | 360 | $arrayofmassactions = array(); |
| 361 | 361 | } |
| 362 | 362 | $massactionbutton = $form->selectMassAction('', $arrayofmassactions); |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | $search_firstname = GETPOST("search_firstname", 'alphanohtml'); |
| 63 | 63 | $search_email = GETPOST("search_email", 'alphanohtml'); |
| 64 | 64 | $search_other = GETPOST("search_other", 'alphanohtml'); |
| 65 | -$search_dest_status = GETPOST('search_dest_status'); // Must be '' if not set, so do not use GETPOSTINT here. |
|
| 65 | +$search_dest_status = GETPOST('search_dest_status'); // Must be '' if not set, so do not use GETPOSTINT here. |
|
| 66 | 66 | |
| 67 | 67 | // Search modules dirs |
| 68 | 68 | $modulesdir = dolGetModulesDirs('/mailings'); |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | } |
| 362 | 362 | } |
| 363 | 363 | if (empty($nbemail)) { |
| 364 | - $nbemail .= ' '.img_warning($langs->trans('ToAddRecipientsChooseHere'));//.' <span class="warning">'.$langs->trans("NoTargetYet").'</span>'; |
|
| 364 | + $nbemail .= ' '.img_warning($langs->trans('ToAddRecipientsChooseHere')); //.' <span class="warning">'.$langs->trans("NoTargetYet").'</span>'; |
|
| 365 | 365 | } |
| 366 | 366 | if ($text) { |
| 367 | 367 | print $form->textwithpicto($nbemail, $text, 1, 'warning'); |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | } |
| 440 | 440 | print '</div>'; |
| 441 | 441 | print '<div class="tagtd"> </div>'; |
| 442 | - print '</div>'; // End tr |
|
| 442 | + print '</div>'; // End tr |
|
| 443 | 443 | |
| 444 | 444 | clearstatcache(); |
| 445 | 445 | |
@@ -510,12 +510,12 @@ discard block |
||
| 510 | 510 | } |
| 511 | 511 | print img_object($langs->trans("EmailingTargetSelector").': '.get_class($obj), $obj->picto, 'class="valignmiddle width25 size15x"'); |
| 512 | 512 | print '</div>'; |
| 513 | - print '<div class="tagtd valignmiddle">'; // style="height: 4em" |
|
| 513 | + print '<div class="tagtd valignmiddle">'; // style="height: 4em" |
|
| 514 | 514 | print $obj->getDesc(); |
| 515 | 515 | print '</div>'; |
| 516 | 516 | |
| 517 | 517 | try { |
| 518 | - $obj->evenunsubscribe = $object->evenunsubscribe; // Set flag to include/exclude email that has opt-out. |
|
| 518 | + $obj->evenunsubscribe = $object->evenunsubscribe; // Set flag to include/exclude email that has opt-out. |
|
| 519 | 519 | |
| 520 | 520 | $nbofrecipient = $obj->getNbOfRecipients(''); |
| 521 | 521 | } catch (Exception $e) { |
@@ -568,7 +568,7 @@ discard block |
||
| 568 | 568 | $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
| 569 | 569 | print $hookmanager->resPrint; |
| 570 | 570 | |
| 571 | - print '</div>'; // End table |
|
| 571 | + print '</div>'; // End table |
|
| 572 | 572 | print '</div>'; |
| 573 | 573 | |
| 574 | 574 | print '<br>'; |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,), |
| 120 | 120 | 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>1010), |
| 121 | 121 | 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>2, 'position'=>1000, 'default'=>0, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated', '2'=>'InProgress', '3'=>'StatusMOProduced', '9'=>'Canceled')), |
| 122 | - 'fk_parent_line' => array('type'=>'integer:MoLine:mrp/class/mo.class.php', 'label'=>'ParentMo', 'enabled'=>1, 'visible'=>0, 'position'=>1020, 'default'=>0, 'notnull'=>0, 'index'=>1,'showoncombobox'=>0), |
|
| 122 | + 'fk_parent_line' => array('type'=>'integer:MoLine:mrp/class/mo.class.php', 'label'=>'ParentMo', 'enabled'=>1, 'visible'=>0, 'position'=>1020, 'default'=>0, 'notnull'=>0, 'index'=>1, 'showoncombobox'=>0), |
|
| 123 | 123 | ); |
| 124 | 124 | public $rowid; |
| 125 | 125 | public $entity; |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | if (!$error) { |
| 331 | - $result = $this->createProduction($user, $notrigger); // Insert lines from BOM |
|
| 331 | + $result = $this->createProduction($user, $notrigger); // Insert lines from BOM |
|
| 332 | 332 | if ($result <= 0) { |
| 333 | 333 | $error++; |
| 334 | 334 | } |
@@ -808,7 +808,7 @@ discard block |
||
| 808 | 808 | $oldQty = $this->oldQty; |
| 809 | 809 | $newQty = $this->qty; |
| 810 | 810 | if ($newQty != $oldQty && !empty($this->oldQty)) { |
| 811 | - $sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "mrp_production WHERE fk_mo = " . (int) $this->id; |
|
| 811 | + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."mrp_production WHERE fk_mo = ".(int) $this->id; |
|
| 812 | 812 | $resql = $this->db->query($sql); |
| 813 | 813 | if ($resql) { |
| 814 | 814 | while ($obj = $this->db->fetch_object($resql)) { |
@@ -897,7 +897,7 @@ discard block |
||
| 897 | 897 | } |
| 898 | 898 | $productstatic = new Product($this->db); |
| 899 | 899 | |
| 900 | - $arrayoflines = $this->fetchLinesLinked('consumed', $idline); // Get lines consumed under the one to delete |
|
| 900 | + $arrayoflines = $this->fetchLinesLinked('consumed', $idline); // Get lines consumed under the one to delete |
|
| 901 | 901 | |
| 902 | 902 | $result = 0; |
| 903 | 903 | |
@@ -1000,7 +1000,7 @@ discard block |
||
| 1000 | 1000 | if (getDolGlobalString('MRP_MO_ADDON')) { |
| 1001 | 1001 | $mybool = false; |
| 1002 | 1002 | |
| 1003 | - $file = getDolGlobalString('MRP_MO_ADDON') . ".php"; |
|
| 1003 | + $file = getDolGlobalString('MRP_MO_ADDON').".php"; |
|
| 1004 | 1004 | $classname = getDolGlobalString('MRP_MO_ADDON'); |
| 1005 | 1005 | |
| 1006 | 1006 | // Include file with class |
@@ -1273,8 +1273,8 @@ discard block |
||
| 1273 | 1273 | return 1; |
| 1274 | 1274 | } |
| 1275 | 1275 | |
| 1276 | - require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
|
| 1277 | - require_once DOL_DOCUMENT_ROOT . '/product/stock/class/mouvementstock.class.php'; |
|
| 1276 | + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
|
| 1277 | + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; |
|
| 1278 | 1278 | $error = 0; |
| 1279 | 1279 | $langs->load('stocks'); |
| 1280 | 1280 | |
@@ -1396,13 +1396,13 @@ discard block |
||
| 1396 | 1396 | $datas['qty'] = '<br><b>'.$langs->trans('QtyToProduce').':</b> '.$this->qty; |
| 1397 | 1397 | } |
| 1398 | 1398 | if (!$nofetch && isset($this->fk_product)) { |
| 1399 | - require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
|
| 1399 | + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
|
| 1400 | 1400 | $product = new Product($this->db); |
| 1401 | 1401 | $product->fetch($this->fk_product); |
| 1402 | 1402 | $datas['product'] = '<br><b>'.$langs->trans('Product').':</b> '.$product->getNomUrl(1, '', 0, -1, 1); |
| 1403 | 1403 | } |
| 1404 | 1404 | if (!$nofetch && isset($this->fk_warehouse)) { |
| 1405 | - require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php'; |
|
| 1405 | + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; |
|
| 1406 | 1406 | $warehouse = new Entrepot($this->db); |
| 1407 | 1407 | $warehouse->fetch($this->fk_warehouse); |
| 1408 | 1408 | $datas['warehouse'] = '<br><b>'.$langs->trans('WarehouseForProduction').':</b> '.$warehouse->getNomUrl(1, '', 0, 1); |
@@ -1814,7 +1814,7 @@ discard block |
||
| 1814 | 1814 | $this->tpl['disable_stock_change'] = $line->disable_stock_change; |
| 1815 | 1815 | $this->tpl['efficiency'] = $line->efficiency; |
| 1816 | 1816 | |
| 1817 | - global $conf; // used into template |
|
| 1817 | + global $conf; // used into template |
|
| 1818 | 1818 | $res = include DOL_DOCUMENT_ROOT.'/mrp/tpl/originproductline.tpl.php'; |
| 1819 | 1819 | } |
| 1820 | 1820 | |
@@ -1845,9 +1845,9 @@ discard block |
||
| 1845 | 1845 | $error = 0; |
| 1846 | 1846 | |
| 1847 | 1847 | $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."mrp_mo as mo_child"; |
| 1848 | - $sql.= " WHERE fk_parent_line IN "; |
|
| 1849 | - $sql.= " (SELECT rowid FROM ".MAIN_DB_PREFIX."mrp_production as line_parent"; |
|
| 1850 | - $sql.= " WHERE fk_mo=".((int) $this->id).")"; |
|
| 1848 | + $sql .= " WHERE fk_parent_line IN "; |
|
| 1849 | + $sql .= " (SELECT rowid FROM ".MAIN_DB_PREFIX."mrp_production as line_parent"; |
|
| 1850 | + $sql .= " WHERE fk_mo=".((int) $this->id).")"; |
|
| 1851 | 1851 | |
| 1852 | 1852 | $resql = $this->db->query($sql); |
| 1853 | 1853 | |
@@ -1931,8 +1931,8 @@ discard block |
||
| 1931 | 1931 | $error = 0; |
| 1932 | 1932 | |
| 1933 | 1933 | $sql = "SELECT lineparent.fk_mo as id_moparent FROM ".MAIN_DB_PREFIX."mrp_mo as mo"; |
| 1934 | - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."mrp_production lineparent ON mo.fk_parent_line = lineparent.rowid"; |
|
| 1935 | - $sql.= " WHERE mo.rowid = ".((int) $this->id); |
|
| 1934 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."mrp_production lineparent ON mo.fk_parent_line = lineparent.rowid"; |
|
| 1935 | + $sql .= " WHERE mo.rowid = ".((int) $this->id); |
|
| 1936 | 1936 | |
| 1937 | 1937 | $resql = $this->db->query($sql); |
| 1938 | 1938 | |
@@ -93,9 +93,9 @@ discard block |
||
| 93 | 93 | */ |
| 94 | 94 | public $revenuestamp; |
| 95 | 95 | |
| 96 | - public $totalpaid; // duplicate with sumpayed |
|
| 97 | - public $totaldeposits; // duplicate with sumdeposit |
|
| 98 | - public $totalcreditnotes; // duplicate with sumcreditnote |
|
| 96 | + public $totalpaid; // duplicate with sumpayed |
|
| 97 | + public $totaldeposits; // duplicate with sumdeposit |
|
| 98 | + public $totalcreditnotes; // duplicate with sumcreditnote |
|
| 99 | 99 | |
| 100 | 100 | public $sumpayed; |
| 101 | 101 | public $sumpayed_multicurrency; |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | $sharedentity = 'facture_fourn'; |
| 461 | 461 | } |
| 462 | 462 | |
| 463 | - $sql = "SELECT p.ref, pf.amount, pf.multicurrency_amount, p.fk_paiement, p.datep, p.num_paiement as num, t.code".$field3 . $field4; |
|
| 463 | + $sql = "SELECT p.ref, pf.amount, pf.multicurrency_amount, p.fk_paiement, p.datep, p.num_paiement as num, t.code".$field3.$field4; |
|
| 464 | 464 | $sql .= " FROM ".$this->db->prefix().$table." as pf, ".$this->db->prefix().$table2." as p, ".$this->db->prefix()."c_paiement as t"; |
| 465 | 465 | $sql .= " WHERE pf.".$field." = ".((int) $this->id); |
| 466 | 466 | $sql .= " AND pf.".$field2." = p.rowid"; |
@@ -701,12 +701,12 @@ discard block |
||
| 701 | 701 | { |
| 702 | 702 | $subtypeLabel = ''; |
| 703 | 703 | if ($table === 'facture' || $table === 'facture_fourn') { |
| 704 | - $sql = "SELECT s.label FROM " . $this->db->prefix() . $table . " AS f"; |
|
| 705 | - $sql .= " INNER JOIN " . $this->db->prefix() . "c_invoice_subtype AS s ON f.subtype = s.rowid"; |
|
| 704 | + $sql = "SELECT s.label FROM ".$this->db->prefix().$table." AS f"; |
|
| 705 | + $sql .= " INNER JOIN ".$this->db->prefix()."c_invoice_subtype AS s ON f.subtype = s.rowid"; |
|
| 706 | 706 | $sql .= " WHERE f.ref = '".$this->db->escape($this->ref)."'"; |
| 707 | 707 | } elseif ($table === 'facture_rec' || $table === 'facture_fourn_rec') { |
| 708 | - $sql = "SELECT s.label FROM " . $this->db->prefix() . $table . " AS f"; |
|
| 709 | - $sql .= " INNER JOIN " . $this->db->prefix() . "c_invoice_subtype AS s ON f.subtype = s.rowid"; |
|
| 708 | + $sql = "SELECT s.label FROM ".$this->db->prefix().$table." AS f"; |
|
| 709 | + $sql .= " INNER JOIN ".$this->db->prefix()."c_invoice_subtype AS s ON f.subtype = s.rowid"; |
|
| 710 | 710 | $sql .= " WHERE f.titre = '".$this->db->escape($this->title)."'"; |
| 711 | 711 | } else { |
| 712 | 712 | return -1; |
@@ -738,10 +738,10 @@ discard block |
||
| 738 | 738 | $effs = array(); |
| 739 | 739 | |
| 740 | 740 | $sql = "SELECT rowid, code, label as label"; |
| 741 | - $sql .= " FROM " . MAIN_DB_PREFIX . 'c_invoice_subtype'; |
|
| 741 | + $sql .= " FROM ".MAIN_DB_PREFIX.'c_invoice_subtype'; |
|
| 742 | 742 | $sql .= " WHERE active = 1 AND fk_country = ".((int) $mysoc->country_id)." AND entity IN(".getEntity('c_invoice_subtype').")"; |
| 743 | 743 | $sql .= " ORDER by rowid, code"; |
| 744 | - dol_syslog(get_class($this) . '::getArrayOfInvoiceSubtypes', LOG_DEBUG); |
|
| 744 | + dol_syslog(get_class($this).'::getArrayOfInvoiceSubtypes', LOG_DEBUG); |
|
| 745 | 745 | $resql = $this->db->query($sql); |
| 746 | 746 | if ($resql) { |
| 747 | 747 | $num = $this->db->num_rows($resql); |
@@ -1133,7 +1133,7 @@ discard block |
||
| 1133 | 1133 | if ($this->status > self::STATUS_DRAFT && $this->paye == 0) { |
| 1134 | 1134 | // Get the default payment mode for BAN payment of the third party |
| 1135 | 1135 | require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; |
| 1136 | - $bac = new CompanyBankAccount($this->db); // table societe_rib |
|
| 1136 | + $bac = new CompanyBankAccount($this->db); // table societe_rib |
|
| 1137 | 1137 | $result = $bac->fetch(0, $this->socid, 1, 'ban'); |
| 1138 | 1138 | if ($result <= 0 || empty($bac->id)) { |
| 1139 | 1139 | $this->error = $langs->trans("ThirdpartyHasNoDefaultBanAccount"); |
@@ -1147,16 +1147,16 @@ discard block |
||
| 1147 | 1147 | $sql .= " FROM ".$this->db->prefix()."prelevement_demande"; |
| 1148 | 1148 | $sql .= " WHERE rowid = ".((int) $did); |
| 1149 | 1149 | if ($type != 'bank-transfer' && $type != 'credit-transfer') { |
| 1150 | - $sql .= " AND fk_facture = ".((int) $this->id); // Add a protection to not pay another invoice than current one |
|
| 1150 | + $sql .= " AND fk_facture = ".((int) $this->id); // Add a protection to not pay another invoice than current one |
|
| 1151 | 1151 | } |
| 1152 | 1152 | if ($type != 'direct-debit') { |
| 1153 | 1153 | if ($sourcetype == 'salary') { |
| 1154 | - $sql .= " AND fk_salary = ".((int) $this->id); // Add a protection to not pay another salary than current one |
|
| 1154 | + $sql .= " AND fk_salary = ".((int) $this->id); // Add a protection to not pay another salary than current one |
|
| 1155 | 1155 | } else { |
| 1156 | - $sql .= " AND fk_facture_fourn = ".((int) $this->id); // Add a protection to not pay another invoice than current one |
|
| 1156 | + $sql .= " AND fk_facture_fourn = ".((int) $this->id); // Add a protection to not pay another invoice than current one |
|
| 1157 | 1157 | } |
| 1158 | 1158 | } |
| 1159 | - $sql .= " AND traite = 0"; // To not process payment request that were already converted into a direct debit or credit transfer order (Note: fk_prelevement_bons is also empty when traite = 0) |
|
| 1159 | + $sql .= " AND traite = 0"; // To not process payment request that were already converted into a direct debit or credit transfer order (Note: fk_prelevement_bons is also empty when traite = 0) |
|
| 1160 | 1160 | |
| 1161 | 1161 | dol_syslog(get_class($this)."::makeStripeSepaRequest load requests to process", LOG_DEBUG); |
| 1162 | 1162 | $resql = $this->db->query($sql); |
@@ -1172,7 +1172,7 @@ discard block |
||
| 1172 | 1172 | |
| 1173 | 1173 | if (is_numeric($amount) && $amount != 0) { |
| 1174 | 1174 | require_once DOL_DOCUMENT_ROOT.'/societe/class/companypaymentmode.class.php'; |
| 1175 | - $companypaymentmode = new CompanyPaymentMode($this->db); // table societe_rib |
|
| 1175 | + $companypaymentmode = new CompanyPaymentMode($this->db); // table societe_rib |
|
| 1176 | 1176 | $companypaymentmode->fetch($bac->id); |
| 1177 | 1177 | |
| 1178 | 1178 | $this->stripechargedone = 0; |
@@ -1182,11 +1182,11 @@ discard block |
||
| 1182 | 1182 | |
| 1183 | 1183 | $currency = $conf->currency; |
| 1184 | 1184 | |
| 1185 | - $errorforinvoice = 0; // We reset the $errorforinvoice at each invoice loop |
|
| 1185 | + $errorforinvoice = 0; // We reset the $errorforinvoice at each invoice loop |
|
| 1186 | 1186 | |
| 1187 | 1187 | $this->fetch_thirdparty(); |
| 1188 | 1188 | |
| 1189 | - dol_syslog("makeStripeSepaRequest Process payment request amount=".$amount." thirdparty_id=" . $this->thirdparty->id . ", thirdparty_name=" . $this->thirdparty->name . " ban id=" . $bac->id, LOG_DEBUG); |
|
| 1189 | + dol_syslog("makeStripeSepaRequest Process payment request amount=".$amount." thirdparty_id=".$this->thirdparty->id.", thirdparty_name=".$this->thirdparty->name." ban id=".$bac->id, LOG_DEBUG); |
|
| 1190 | 1190 | |
| 1191 | 1191 | //$alreadypayed = $this->getSommePaiement(); |
| 1192 | 1192 | //$amount_credit_notes_included = $this->getSumCreditNotesUsed(); |
@@ -1201,7 +1201,7 @@ discard block |
||
| 1201 | 1201 | $amountstripe = $amountstripe * 100; |
| 1202 | 1202 | } |
| 1203 | 1203 | |
| 1204 | - $fk_bank_account = getDolGlobalInt('STRIPE_BANK_ACCOUNT_FOR_PAYMENTS'); // Bank account used for SEPA direct debit or credit transfer. Must be the Stripe account in Dolibarr. |
|
| 1204 | + $fk_bank_account = getDolGlobalInt('STRIPE_BANK_ACCOUNT_FOR_PAYMENTS'); // Bank account used for SEPA direct debit or credit transfer. Must be the Stripe account in Dolibarr. |
|
| 1205 | 1205 | if (!($fk_bank_account > 0)) { |
| 1206 | 1206 | $error++; |
| 1207 | 1207 | $errorforinvoice++; |
@@ -1257,44 +1257,44 @@ discard block |
||
| 1257 | 1257 | } |
| 1258 | 1258 | |
| 1259 | 1259 | //var_dump($companypaymentmode); |
| 1260 | - dol_syslog("makeStripeSepaRequest We will try to pay with companypaymentmodeid=" . $companypaymentmode->id . " stripe_card_ref=" . $companypaymentmode->stripe_card_ref . " mode=" . $companypaymentmode->status, LOG_DEBUG); |
|
| 1260 | + dol_syslog("makeStripeSepaRequest We will try to pay with companypaymentmodeid=".$companypaymentmode->id." stripe_card_ref=".$companypaymentmode->stripe_card_ref." mode=".$companypaymentmode->status, LOG_DEBUG); |
|
| 1261 | 1261 | |
| 1262 | 1262 | $thirdparty = new Societe($this->db); |
| 1263 | 1263 | $resultthirdparty = $thirdparty->fetch($this->socid); |
| 1264 | 1264 | |
| 1265 | - include_once DOL_DOCUMENT_ROOT . '/stripe/class/stripe.class.php'; // This include the include of htdocs/stripe/config.php |
|
| 1265 | + include_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; // This include the include of htdocs/stripe/config.php |
|
| 1266 | 1266 | // So it inits or erases the $stripearrayofkeysbyenv |
| 1267 | 1267 | $stripe = new Stripe($this->db); |
| 1268 | 1268 | |
| 1269 | 1269 | if (empty($savstripearrayofkeysbyenv)) { |
| 1270 | 1270 | $savstripearrayofkeysbyenv = $stripearrayofkeysbyenv; |
| 1271 | 1271 | } |
| 1272 | - dol_syslog("makeStripeSepaRequest Current Stripe environment is " . $stripearrayofkeysbyenv[$servicestatus]['publishable_key']); |
|
| 1272 | + dol_syslog("makeStripeSepaRequest Current Stripe environment is ".$stripearrayofkeysbyenv[$servicestatus]['publishable_key']); |
|
| 1273 | 1273 | dol_syslog("makeStripeSepaRequest Current Saved Stripe environment is ".$savstripearrayofkeysbyenv[$servicestatus]['publishable_key']); |
| 1274 | 1274 | |
| 1275 | 1275 | $foundalternativestripeaccount = ''; |
| 1276 | 1276 | |
| 1277 | 1277 | // Force stripe to another value (by default this value is empty) |
| 1278 | - if (! empty($forcestripe)) { |
|
| 1278 | + if (!empty($forcestripe)) { |
|
| 1279 | 1279 | dol_syslog("makeStripeSepaRequest A dedicated stripe account was forced, so we switch to it."); |
| 1280 | 1280 | |
| 1281 | 1281 | $tmparray = explode('@', $forcestripe); |
| 1282 | - if (! empty($tmparray[1])) { |
|
| 1282 | + if (!empty($tmparray[1])) { |
|
| 1283 | 1283 | $tmparray2 = explode(':', $tmparray[1]); |
| 1284 | - if (! empty($tmparray2[1])) { |
|
| 1284 | + if (!empty($tmparray2[1])) { |
|
| 1285 | 1285 | $stripearrayofkeysbyenv[$servicestatus]["publishable_key"] = $tmparray2[0]; |
| 1286 | 1286 | $stripearrayofkeysbyenv[$servicestatus]["secret_key"] = $tmparray2[1]; |
| 1287 | 1287 | |
| 1288 | 1288 | $stripearrayofkeys = $stripearrayofkeysbyenv[$servicestatus]; |
| 1289 | 1289 | \Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']); |
| 1290 | 1290 | |
| 1291 | - $foundalternativestripeaccount = $tmparray[0]; // Store the customer id |
|
| 1291 | + $foundalternativestripeaccount = $tmparray[0]; // Store the customer id |
|
| 1292 | 1292 | |
| 1293 | 1293 | dol_syslog("makeStripeSepaRequest We use now customer=".$foundalternativestripeaccount." publishable_key=".$stripearrayofkeys['publishable_key'], LOG_DEBUG); |
| 1294 | 1294 | } |
| 1295 | 1295 | } |
| 1296 | 1296 | |
| 1297 | - if (! $foundalternativestripeaccount) { |
|
| 1297 | + if (!$foundalternativestripeaccount) { |
|
| 1298 | 1298 | $stripearrayofkeysbyenv = $savstripearrayofkeysbyenv; |
| 1299 | 1299 | |
| 1300 | 1300 | $stripearrayofkeys = $savstripearrayofkeysbyenv[$servicestatus]; |
@@ -1309,7 +1309,7 @@ discard block |
||
| 1309 | 1309 | dol_syslog("makeStripeSepaRequest No dedicated Stripe Account requested, so we use global one, so ".$stripearrayofkeys['publishable_key'], LOG_DEBUG); |
| 1310 | 1310 | } |
| 1311 | 1311 | |
| 1312 | - $stripeacc = $stripe->getStripeAccount($service, $this->socid); // Get Stripe OAuth connect account if it exists (no network access here) |
|
| 1312 | + $stripeacc = $stripe->getStripeAccount($service, $this->socid); // Get Stripe OAuth connect account if it exists (no network access here) |
|
| 1313 | 1313 | |
| 1314 | 1314 | if ($foundalternativestripeaccount) { |
| 1315 | 1315 | if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage |
@@ -1319,7 +1319,7 @@ discard block |
||
| 1319 | 1319 | } |
| 1320 | 1320 | } else { |
| 1321 | 1321 | $customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 0); |
| 1322 | - if (empty($customer) && ! empty($stripe->error)) { |
|
| 1322 | + if (empty($customer) && !empty($stripe->error)) { |
|
| 1323 | 1323 | $this->errors[] = $stripe->error; |
| 1324 | 1324 | } |
| 1325 | 1325 | /*if (!empty($customer) && empty($customer->sources)) { |
@@ -1346,15 +1346,15 @@ discard block |
||
| 1346 | 1346 | } |
| 1347 | 1347 | |
| 1348 | 1348 | if ($stripecard) { // Can be src_... (for sepa) or pm_... (new card mode). Note that card_... (old card mode) should not happen here. |
| 1349 | - $FULLTAG = 'DID='.$did.'-INV=' . $this->id . '-CUS=' . $thirdparty->id; |
|
| 1350 | - $description = 'Stripe payment from makeStripeSepaRequest: ' . $FULLTAG . ' did='.$did.' ref=' . $this->ref; |
|
| 1349 | + $FULLTAG = 'DID='.$did.'-INV='.$this->id.'-CUS='.$thirdparty->id; |
|
| 1350 | + $description = 'Stripe payment from makeStripeSepaRequest: '.$FULLTAG.' did='.$did.' ref='.$this->ref; |
|
| 1351 | 1351 | |
| 1352 | 1352 | $stripefailurecode = ''; |
| 1353 | 1353 | $stripefailuremessage = ''; |
| 1354 | 1354 | $stripefailuredeclinecode = ''; |
| 1355 | 1355 | |
| 1356 | 1356 | // Using new SCA method |
| 1357 | - dol_syslog("* Create payment on SEPA " . $stripecard->id . ", amounttopay=" . $amounttopay . ", amountstripe=" . $amountstripe . ", FULLTAG=" . $FULLTAG, LOG_DEBUG); |
|
| 1357 | + dol_syslog("* Create payment on SEPA ".$stripecard->id.", amounttopay=".$amounttopay.", amountstripe=".$amountstripe.", FULLTAG=".$FULLTAG, LOG_DEBUG); |
|
| 1358 | 1358 | |
| 1359 | 1359 | // Create payment intent and charge payment (confirmnow = true) |
| 1360 | 1360 | $paymentintent = $stripe->getPaymentIntent($amounttopay, $currency, $FULLTAG, $description, $this, $customer->id, $stripeacc, $servicestatus, 0, 'automatic', true, $stripecard->id, 1, 1, $did); |
@@ -1375,7 +1375,7 @@ discard block |
||
| 1375 | 1375 | $charge->failure_message = $stripe->error; |
| 1376 | 1376 | $charge->failure_declinecode = $stripe->declinecode; |
| 1377 | 1377 | $stripefailurecode = $stripe->code; |
| 1378 | - $stripefailuremessage = 'Action required. Contact the support at ';// . $conf->global->SELLYOURSAAS_MAIN_EMAIL; |
|
| 1378 | + $stripefailuremessage = 'Action required. Contact the support at '; // . $conf->global->SELLYOURSAAS_MAIN_EMAIL; |
|
| 1379 | 1379 | $stripefailuredeclinecode = $stripe->declinecode; |
| 1380 | 1380 | } else { |
| 1381 | 1381 | dol_syslog(var_export($paymentintent, true), LOG_DEBUG); |
@@ -1396,7 +1396,7 @@ discard block |
||
| 1396 | 1396 | |
| 1397 | 1397 | // Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...) |
| 1398 | 1398 | if (empty($charge) || $charge->status == 'failed') { |
| 1399 | - dol_syslog('Failed to charge payment mode ' . $stripecard->id . ' stripefailurecode=' . $stripefailurecode . ' stripefailuremessage=' . $stripefailuremessage . ' stripefailuredeclinecode=' . $stripefailuredeclinecode, LOG_WARNING); |
|
| 1399 | + dol_syslog('Failed to charge payment mode '.$stripecard->id.' stripefailurecode='.$stripefailurecode.' stripefailuremessage='.$stripefailuremessage.' stripefailuredeclinecode='.$stripefailuredeclinecode, LOG_WARNING); |
|
| 1400 | 1400 | |
| 1401 | 1401 | // Save a stripe payment was in error |
| 1402 | 1402 | $this->stripechargeerror++; |
@@ -1409,8 +1409,8 @@ discard block |
||
| 1409 | 1409 | $errauthenticationmessage = $langs->trans("ErrSCAAuthentication"); |
| 1410 | 1410 | $errmsg = $errauthenticationmessage; |
| 1411 | 1411 | } elseif (in_array($stripefailuredeclinecode, ['insufficient_funds', 'generic_decline'])) { |
| 1412 | - $errmsg .= ': ' . $charge->failure_code; |
|
| 1413 | - $errmsg .= ($charge->failure_message ? ' - ' : '') . ' ' . $charge->failure_message; |
|
| 1412 | + $errmsg .= ': '.$charge->failure_code; |
|
| 1413 | + $errmsg .= ($charge->failure_message ? ' - ' : '').' '.$charge->failure_message; |
|
| 1414 | 1414 | if (empty($stripefailurecode)) { |
| 1415 | 1415 | $stripefailurecode = $charge->failure_code; |
| 1416 | 1416 | } |
@@ -1418,8 +1418,8 @@ discard block |
||
| 1418 | 1418 | $stripefailuremessage = $charge->failure_message; |
| 1419 | 1419 | } |
| 1420 | 1420 | } else { |
| 1421 | - $errmsg .= ': failure_code=' . $charge->failure_code; |
|
| 1422 | - $errmsg .= ($charge->failure_message ? ' - ' : '') . ' failure_message=' . $charge->failure_message; |
|
| 1421 | + $errmsg .= ': failure_code='.$charge->failure_code; |
|
| 1422 | + $errmsg .= ($charge->failure_message ? ' - ' : '').' failure_message='.$charge->failure_message; |
|
| 1423 | 1423 | if (empty($stripefailurecode)) { |
| 1424 | 1424 | $stripefailurecode = $charge->failure_code; |
| 1425 | 1425 | } |
@@ -1428,24 +1428,24 @@ discard block |
||
| 1428 | 1428 | } |
| 1429 | 1429 | } |
| 1430 | 1430 | } else { |
| 1431 | - $errmsg .= ': ' . $stripefailurecode . ' - ' . $stripefailuremessage; |
|
| 1432 | - $errmsg .= ($stripefailuredeclinecode ? ' - ' . $stripefailuredeclinecode : ''); |
|
| 1431 | + $errmsg .= ': '.$stripefailurecode.' - '.$stripefailuremessage; |
|
| 1432 | + $errmsg .= ($stripefailuredeclinecode ? ' - '.$stripefailuredeclinecode : ''); |
|
| 1433 | 1433 | } |
| 1434 | 1434 | |
| 1435 | - $description = 'Stripe payment ERROR from makeStripeSepaRequest: ' . $FULLTAG; |
|
| 1436 | - $postactionmessages[] = $errmsg . ' (' . $stripearrayofkeys['publishable_key'] . ')'; |
|
| 1435 | + $description = 'Stripe payment ERROR from makeStripeSepaRequest: '.$FULLTAG; |
|
| 1436 | + $postactionmessages[] = $errmsg.' ('.$stripearrayofkeys['publishable_key'].')'; |
|
| 1437 | 1437 | $this->errors[] = $errmsg; |
| 1438 | 1438 | } else { |
| 1439 | 1439 | dol_syslog('Successfuly request '.$type.' '.$stripecard->id); |
| 1440 | 1440 | |
| 1441 | - $postactionmessages[] = 'Success to request '.$type.' (' . $charge->id . ' with ' . $stripearrayofkeys['publishable_key'] . ')'; |
|
| 1441 | + $postactionmessages[] = 'Success to request '.$type.' ('.$charge->id.' with '.$stripearrayofkeys['publishable_key'].')'; |
|
| 1442 | 1442 | |
| 1443 | 1443 | // Save a stripe payment was done in real life so later we will be able to force a commit on recorded payments |
| 1444 | 1444 | // even if in batch mode (method doTakePaymentStripe), we will always make all action in one transaction with a forced commit. |
| 1445 | 1445 | $this->stripechargedone++; |
| 1446 | 1446 | |
| 1447 | 1447 | // Default description used for label of event. Will be overwrite by another value later. |
| 1448 | - $description = 'Stripe payment request OK (' . $charge->id . ') from makeStripeSepaRequest: ' . $FULLTAG; |
|
| 1448 | + $description = 'Stripe payment request OK ('.$charge->id.') from makeStripeSepaRequest: '.$FULLTAG; |
|
| 1449 | 1449 | } |
| 1450 | 1450 | |
| 1451 | 1451 | $object = $this; |
@@ -1454,8 +1454,8 @@ discard block |
||
| 1454 | 1454 | if (empty($charge) || $charge->status == 'failed') { |
| 1455 | 1455 | $actioncode = 'PAYMENT_STRIPE_KO'; |
| 1456 | 1456 | $extraparams = $stripefailurecode; |
| 1457 | - $extraparams .= (($extraparams && $stripefailuremessage) ? ' - ' : '') . $stripefailuremessage; |
|
| 1458 | - $extraparams .= (($extraparams && $stripefailuredeclinecode) ? ' - ' : '') . $stripefailuredeclinecode; |
|
| 1457 | + $extraparams .= (($extraparams && $stripefailuremessage) ? ' - ' : '').$stripefailuremessage; |
|
| 1458 | + $extraparams .= (($extraparams && $stripefailuredeclinecode) ? ' - ' : '').$stripefailuredeclinecode; |
|
| 1459 | 1459 | } else { |
| 1460 | 1460 | $actioncode = 'PAYMENT_STRIPE_OK'; |
| 1461 | 1461 | $extraparams = ''; |
@@ -1463,13 +1463,13 @@ discard block |
||
| 1463 | 1463 | } else { |
| 1464 | 1464 | $error++; |
| 1465 | 1465 | $errorforinvoice++; |
| 1466 | - dol_syslog("No ban payment method found for this stripe customer " . $customer->id, LOG_WARNING); |
|
| 1467 | - $this->errors[] = 'Failed to get direct debit payment method for stripe customer = ' . $customer->id; |
|
| 1466 | + dol_syslog("No ban payment method found for this stripe customer ".$customer->id, LOG_WARNING); |
|
| 1467 | + $this->errors[] = 'Failed to get direct debit payment method for stripe customer = '.$customer->id; |
|
| 1468 | 1468 | |
| 1469 | 1469 | $description = 'Failed to find or use the payment mode - no ban defined for the thirdparty account'; |
| 1470 | 1470 | $stripefailurecode = 'BADPAYMENTMODE'; |
| 1471 | 1471 | $stripefailuremessage = 'Failed to find or use the payment mode - no ban defined for the thirdparty account'; |
| 1472 | - $postactionmessages[] = $description . ' (' . $stripearrayofkeys['publishable_key'] . ')'; |
|
| 1472 | + $postactionmessages[] = $description.' ('.$stripearrayofkeys['publishable_key'].')'; |
|
| 1473 | 1473 | |
| 1474 | 1474 | $object = $this; |
| 1475 | 1475 | |
@@ -1489,11 +1489,11 @@ discard block |
||
| 1489 | 1489 | } |
| 1490 | 1490 | } else { // Else of the if ($resultthirdparty > 0 && ! empty($customer)) { |
| 1491 | 1491 | if ($resultthirdparty <= 0) { |
| 1492 | - dol_syslog('SellYourSaasUtils Failed to load customer for thirdparty_id = ' . $thirdparty->id, LOG_WARNING); |
|
| 1493 | - $this->errors[] = 'Failed to load Stripe account for thirdparty_id = ' . $thirdparty->id; |
|
| 1492 | + dol_syslog('SellYourSaasUtils Failed to load customer for thirdparty_id = '.$thirdparty->id, LOG_WARNING); |
|
| 1493 | + $this->errors[] = 'Failed to load Stripe account for thirdparty_id = '.$thirdparty->id; |
|
| 1494 | 1494 | } else { // $customer stripe not found |
| 1495 | - dol_syslog('SellYourSaasUtils Failed to get Stripe customer id for thirdparty_id = ' . $thirdparty->id . " in mode " . $servicestatus . " in Stripe env " . $stripearrayofkeysbyenv[$servicestatus]['publishable_key'], LOG_WARNING); |
|
| 1496 | - $this->errors[] = 'Failed to get Stripe account id for thirdparty_id = ' . $thirdparty->id . " in mode " . $servicestatus . " in Stripe env " . $stripearrayofkeysbyenv[$servicestatus]['publishable_key']; |
|
| 1495 | + dol_syslog('SellYourSaasUtils Failed to get Stripe customer id for thirdparty_id = '.$thirdparty->id." in mode ".$servicestatus." in Stripe env ".$stripearrayofkeysbyenv[$servicestatus]['publishable_key'], LOG_WARNING); |
|
| 1496 | + $this->errors[] = 'Failed to get Stripe account id for thirdparty_id = '.$thirdparty->id." in mode ".$servicestatus." in Stripe env ".$stripearrayofkeysbyenv[$servicestatus]['publishable_key']; |
|
| 1497 | 1497 | } |
| 1498 | 1498 | $error++; |
| 1499 | 1499 | $errorforinvoice++; |
@@ -1510,24 +1510,24 @@ discard block |
||
| 1510 | 1510 | } |
| 1511 | 1511 | |
| 1512 | 1512 | if ($description) { |
| 1513 | - dol_syslog("* Record event for credit transfer or direct debit request result - " . $description); |
|
| 1513 | + dol_syslog("* Record event for credit transfer or direct debit request result - ".$description); |
|
| 1514 | 1514 | require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; |
| 1515 | 1515 | |
| 1516 | 1516 | // Insert record of payment (success or error) |
| 1517 | 1517 | $actioncomm = new ActionComm($this->db); |
| 1518 | 1518 | |
| 1519 | - $actioncomm->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) |
|
| 1520 | - $actioncomm->code = 'AC_' . $actioncode; |
|
| 1519 | + $actioncomm->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) |
|
| 1520 | + $actioncomm->code = 'AC_'.$actioncode; |
|
| 1521 | 1521 | $actioncomm->label = $description; |
| 1522 | 1522 | $actioncomm->note_private = implode(",\n", $postactionmessages); |
| 1523 | 1523 | $actioncomm->fk_project = $this->fk_project; |
| 1524 | 1524 | $actioncomm->datep = $now; |
| 1525 | 1525 | $actioncomm->datef = $now; |
| 1526 | - $actioncomm->percentage = -1; // Not applicable |
|
| 1526 | + $actioncomm->percentage = -1; // Not applicable |
|
| 1527 | 1527 | $actioncomm->socid = $thirdparty->id; |
| 1528 | 1528 | $actioncomm->contactid = 0; |
| 1529 | - $actioncomm->authorid = $user->id; // User saving action |
|
| 1530 | - $actioncomm->userownerid = $user->id; // Owner of action |
|
| 1529 | + $actioncomm->authorid = $user->id; // User saving action |
|
| 1530 | + $actioncomm->userownerid = $user->id; // Owner of action |
|
| 1531 | 1531 | // Fields when action is a real email (content is already into note) |
| 1532 | 1532 | /*$actioncomm->email_msgid = $object->email_msgid; |
| 1533 | 1533 | $actioncomm->email_from = $object->email_from; |
@@ -1549,14 +1549,14 @@ discard block |
||
| 1549 | 1549 | } catch (Exception $e) { |
| 1550 | 1550 | $error++; |
| 1551 | 1551 | $errorforinvoice++; |
| 1552 | - dol_syslog('Error ' . $e->getMessage(), LOG_ERR); |
|
| 1553 | - $this->errors[] = 'Error ' . $e->getMessage(); |
|
| 1552 | + dol_syslog('Error '.$e->getMessage(), LOG_ERR); |
|
| 1553 | + $this->errors[] = 'Error '.$e->getMessage(); |
|
| 1554 | 1554 | } |
| 1555 | 1555 | } else { // If remain to pay is null |
| 1556 | 1556 | $error++; |
| 1557 | 1557 | $errorforinvoice++; |
| 1558 | - dol_syslog("Remain to pay is null for the invoice " . $this->id . " " . $this->ref . ". Why is the invoice not classified 'Paid' ?", LOG_WARNING); |
|
| 1559 | - $this->errors[] = "Remain to pay is null for the invoice " . $this->id . " " . $this->ref . ". Why is the invoice not classified 'Paid' ?"; |
|
| 1558 | + dol_syslog("Remain to pay is null for the invoice ".$this->id." ".$this->ref.". Why is the invoice not classified 'Paid' ?", LOG_WARNING); |
|
| 1559 | + $this->errors[] = "Remain to pay is null for the invoice ".$this->id." ".$this->ref.". Why is the invoice not classified 'Paid' ?"; |
|
| 1560 | 1560 | } |
| 1561 | 1561 | } |
| 1562 | 1562 | |
@@ -1696,10 +1696,10 @@ discard block |
||
| 1696 | 1696 | $s .= pack('C1', 3).pack('C1', strlen($datestring)).$datestring; |
| 1697 | 1697 | $s .= pack('C1', 4).pack('C1', strlen($pricewithtaxstring)).$pricewithtaxstring; |
| 1698 | 1698 | $s .= pack('C1', 5).pack('C1', strlen($pricetaxstring)).$pricetaxstring; |
| 1699 | - $s .= ''; // Hash of xml invoice |
|
| 1700 | - $s .= ''; // ecda signature |
|
| 1701 | - $s .= ''; // ecda public key |
|
| 1702 | - $s .= ''; // ecda signature of public key stamp |
|
| 1699 | + $s .= ''; // Hash of xml invoice |
|
| 1700 | + $s .= ''; // ecda signature |
|
| 1701 | + $s .= ''; // ecda public key |
|
| 1702 | + $s .= ''; // ecda signature of public key stamp |
|
| 1703 | 1703 | |
| 1704 | 1704 | $s = base64_encode($s); |
| 1705 | 1705 | |
@@ -1767,8 +1767,8 @@ discard block |
||
| 1767 | 1767 | $s .= "S\n"; |
| 1768 | 1768 | $s .= dol_trunc($bankaccount->proprio, 70, 'right', 'UTF-8', 1)."\n"; |
| 1769 | 1769 | $addresslinearray = explode("\n", $bankaccount->owner_address); |
| 1770 | - $s .= dol_trunc(empty($addresslinearray[1]) ? '' : $addresslinearray[1], 70, 'right', 'UTF-8', 1)."\n"; // address line 1 |
|
| 1771 | - $s .= dol_trunc(empty($addresslinearray[2]) ? '' : $addresslinearray[2], 70, 'right', 'UTF-8', 1)."\n"; // address line 2 |
|
| 1770 | + $s .= dol_trunc(empty($addresslinearray[1]) ? '' : $addresslinearray[1], 70, 'right', 'UTF-8', 1)."\n"; // address line 1 |
|
| 1771 | + $s .= dol_trunc(empty($addresslinearray[2]) ? '' : $addresslinearray[2], 70, 'right', 'UTF-8', 1)."\n"; // address line 2 |
|
| 1772 | 1772 | /*$s .= dol_trunc($mysoc->zip, 16, 'right', 'UTF-8', 1)."\n"; |
| 1773 | 1773 | $s .= dol_trunc($mysoc->town, 35, 'right', 'UTF-8', 1)."\n"; |
| 1774 | 1774 | $s .= dol_trunc($mysoc->country_code, 2, 'right', 'UTF-8', 1)."\n";*/ |
@@ -1776,8 +1776,8 @@ discard block |
||
| 1776 | 1776 | $s .= "S\n"; |
| 1777 | 1777 | $s .= dol_trunc($mysoc->name, 70, 'right', 'UTF-8', 1)."\n"; |
| 1778 | 1778 | $addresslinearray = explode("\n", $mysoc->address); |
| 1779 | - $s .= dol_trunc(empty($addresslinearray[1]) ? '' : $addresslinearray[1], 70, 'right', 'UTF-8', 1)."\n"; // address line 1 |
|
| 1780 | - $s .= dol_trunc(empty($addresslinearray[2]) ? '' : $addresslinearray[2], 70, 'right', 'UTF-8', 1)."\n"; // address line 2 |
|
| 1779 | + $s .= dol_trunc(empty($addresslinearray[1]) ? '' : $addresslinearray[1], 70, 'right', 'UTF-8', 1)."\n"; // address line 1 |
|
| 1780 | + $s .= dol_trunc(empty($addresslinearray[2]) ? '' : $addresslinearray[2], 70, 'right', 'UTF-8', 1)."\n"; // address line 2 |
|
| 1781 | 1781 | $s .= dol_trunc($mysoc->zip, 16, 'right', 'UTF-8', 1)."\n"; |
| 1782 | 1782 | $s .= dol_trunc($mysoc->town, 35, 'right', 'UTF-8', 1)."\n"; |
| 1783 | 1783 | $s .= dol_trunc($mysoc->country_code, 2, 'right', 'UTF-8', 1)."\n"; |
@@ -1797,14 +1797,14 @@ discard block |
||
| 1797 | 1797 | $s .= "S\n"; |
| 1798 | 1798 | $s .= dol_trunc($this->thirdparty->name, 70, 'right', 'UTF-8', 1)."\n"; |
| 1799 | 1799 | $addresslinearray = explode("\n", $this->thirdparty->address); |
| 1800 | - $s .= dol_trunc(empty($addresslinearray[1]) ? '' : $addresslinearray[1], 70, 'right', 'UTF-8', 1)."\n"; // address line 1 |
|
| 1801 | - $s .= dol_trunc(empty($addresslinearray[2]) ? '' : $addresslinearray[2], 70, 'right', 'UTF-8', 1)."\n"; // address line 2 |
|
| 1800 | + $s .= dol_trunc(empty($addresslinearray[1]) ? '' : $addresslinearray[1], 70, 'right', 'UTF-8', 1)."\n"; // address line 1 |
|
| 1801 | + $s .= dol_trunc(empty($addresslinearray[2]) ? '' : $addresslinearray[2], 70, 'right', 'UTF-8', 1)."\n"; // address line 2 |
|
| 1802 | 1802 | $s .= dol_trunc($this->thirdparty->zip, 16, 'right', 'UTF-8', 1)."\n"; |
| 1803 | 1803 | $s .= dol_trunc($this->thirdparty->town, 35, 'right', 'UTF-8', 1)."\n"; |
| 1804 | 1804 | $s .= dol_trunc($this->thirdparty->country_code, 2, 'right', 'UTF-8', 1)."\n"; |
| 1805 | 1805 | // ID of payment |
| 1806 | - $s .= "NON\n"; // NON or QRR |
|
| 1807 | - $s .= "\n"; // QR Code reference if previous field is QRR |
|
| 1806 | + $s .= "NON\n"; // NON or QRR |
|
| 1807 | + $s .= "\n"; // QR Code reference if previous field is QRR |
|
| 1808 | 1808 | // Free text |
| 1809 | 1809 | if ($complementaryinfo) { |
| 1810 | 1810 | $s .= $complementaryinfo."\n"; |
@@ -27,9 +27,9 @@ discard block |
||
| 27 | 27 | global $conf, $user, $langs, $db; |
| 28 | 28 | //define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver |
| 29 | 29 | //require_once 'PHPUnit/Autoload.php'; |
| 30 | -require_once dirname(__FILE__) . '/../../htdocs/master.inc.php'; |
|
| 31 | -require_once dirname(__FILE__) . '/../../htdocs/core/class/CMailFile.class.php'; |
|
| 32 | -require_once dirname(__FILE__) . '/../../htdocs/core/lib/files.lib.php'; |
|
| 30 | +require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; |
|
| 31 | +require_once dirname(__FILE__).'/../../htdocs/core/class/CMailFile.class.php'; |
|
| 32 | +require_once dirname(__FILE__).'/../../htdocs/core/lib/files.lib.php'; |
|
| 33 | 33 | require_once dirname(__FILE__).'/CommonClassTest.class.php'; |
| 34 | 34 | |
| 35 | 35 | if (empty($user->id)) { |
@@ -65,8 +65,8 @@ discard block |
||
| 65 | 65 | $localobject = new CMailFile('Test', '[email protected]', '[email protected]', 'Message txt', array(), array(), array(), '', '', 1, 0); |
| 66 | 66 | |
| 67 | 67 | $result = $localobject->sendfile(); |
| 68 | - print __METHOD__ . " result=" . $result . "\n"; |
|
| 69 | - $this->assertFalse($result); // False because mail send disabled |
|
| 68 | + print __METHOD__." result=".$result."\n"; |
|
| 69 | + $this->assertFalse($result); // False because mail send disabled |
|
| 70 | 70 | |
| 71 | 71 | return $result; |
| 72 | 72 | } |
@@ -88,42 +88,42 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | $src = 'John Doe <[email protected]>'; |
| 90 | 90 | $result = $localobject->getValidAddress($src, 0); |
| 91 | - print __METHOD__ . " result=" . $result . "\n"; |
|
| 91 | + print __METHOD__." result=".$result."\n"; |
|
| 92 | 92 | $this->assertEquals($result, 'John Doe <[email protected]>'); |
| 93 | 93 | |
| 94 | 94 | $src = 'John Doe <[email protected]>'; |
| 95 | 95 | $result = $localobject->getValidAddress($src, 1); |
| 96 | - print __METHOD__ . " result=" . $result . "\n"; |
|
| 96 | + print __METHOD__." result=".$result."\n"; |
|
| 97 | 97 | $this->assertEquals($result, '<[email protected]>'); |
| 98 | 98 | |
| 99 | 99 | $src = 'John Doe <[email protected]>'; |
| 100 | 100 | $result = $localobject->getValidAddress($src, 2); |
| 101 | - print __METHOD__ . " result=" . $result . "\n"; |
|
| 101 | + print __METHOD__." result=".$result."\n"; |
|
| 102 | 102 | $this->assertEquals($result, '[email protected]'); |
| 103 | 103 | |
| 104 | 104 | $src = 'John Doe <[email protected]>'; |
| 105 | 105 | $result = $localobject->getValidAddress($src, 3, 0); |
| 106 | - print __METHOD__ . " result=" . $result . "\n"; |
|
| 106 | + print __METHOD__." result=".$result."\n"; |
|
| 107 | 107 | $this->assertEquals($result, '"John Doe" <[email protected]>'); |
| 108 | 108 | |
| 109 | 109 | $src = 'John Doe <[email protected]>'; |
| 110 | 110 | $result = $localobject->getValidAddress($src, 3, 1); |
| 111 | - print __METHOD__ . " result=" . $result . "\n"; |
|
| 111 | + print __METHOD__." result=".$result."\n"; |
|
| 112 | 112 | $this->assertEquals($result, '"=?UTF-8?B?Sm9obiBEb2U=?=" <[email protected]>'); |
| 113 | 113 | |
| 114 | 114 | $src = 'John Doe <[email protected]>'; |
| 115 | 115 | $result = $localobject->getValidAddress($src, 4); |
| 116 | - print __METHOD__ . " result=" . $result . "\n"; |
|
| 116 | + print __METHOD__." result=".$result."\n"; |
|
| 117 | 117 | $this->assertEquals($result, 'John Doe'); |
| 118 | 118 | |
| 119 | 119 | $src = 'John Doe <[email protected]>, John Doe2 <[email protected]>, John Doe3 <[email protected]>'; |
| 120 | 120 | $result = $localobject->getValidAddress($src, 4); |
| 121 | - print __METHOD__ . " result=" . $result . "\n"; |
|
| 121 | + print __METHOD__." result=".$result."\n"; |
|
| 122 | 122 | $this->assertEquals($result, 'John Doe,John Doe2,John Doe3'); |
| 123 | 123 | |
| 124 | 124 | $src = 'John Doe <[email protected]>, John Doe2 <[email protected]>, John Doe3 <[email protected]>'; |
| 125 | 125 | $result = $localobject->getValidAddress($src, 4, 0, 2); |
| 126 | - print __METHOD__ . " result=" . $result . "\n"; |
|
| 126 | + print __METHOD__." result=".$result."\n"; |
|
| 127 | 127 | $this->assertEquals($result, 'John Doe,John Doe2...'); |
| 128 | 128 | |
| 129 | 129 | return $result; |
@@ -146,9 +146,9 @@ discard block |
||
| 146 | 146 | $conf->global->MAIN_MAIL_ADD_INLINE_IMAGES_IF_IN_MEDIAS = 1; |
| 147 | 147 | $conf->global->MAIN_MAIL_ADD_INLINE_IMAGES_IF_DATA = 1; |
| 148 | 148 | |
| 149 | - dol_delete_dir_recursive(DOL_DATA_ROOT . '/medias/image'); |
|
| 150 | - dol_mkdir(DOL_DATA_ROOT . '/medias/image'); |
|
| 151 | - dol_copy(dirname(__FILE__) . '/img250x20.png', DOL_DATA_ROOT . '/medias/image/img250x20.png'); |
|
| 149 | + dol_delete_dir_recursive(DOL_DATA_ROOT.'/medias/image'); |
|
| 150 | + dol_mkdir(DOL_DATA_ROOT.'/medias/image'); |
|
| 151 | + dol_copy(dirname(__FILE__).'/img250x20.png', DOL_DATA_ROOT.'/medias/image/img250x20.png'); |
|
| 152 | 152 | |
| 153 | 153 | $msg = '<html><body>'; |
| 154 | 154 | $msg .= '<img alt="" src="/viewimage.php?modulepart=medias&entity=1&file=image/img250x20.png" style="height:39px; width:150px" />'; |
@@ -159,31 +159,31 @@ discard block |
||
| 159 | 159 | $localobject = new CMailFile('Test', '[email protected]', '[email protected]', $msg, array(), array(), array(), '', '', 0, -1, '', '', '', '', 'standard', '', $tmp_dir); |
| 160 | 160 | |
| 161 | 161 | $result = count($localobject->html_images); |
| 162 | - print __METHOD__ . " result count image detected in the mail=" . $result . "\n"; |
|
| 162 | + print __METHOD__." result count image detected in the mail=".$result."\n"; |
|
| 163 | 163 | $this->assertEquals($result, 2); |
| 164 | 164 | |
| 165 | 165 | |
| 166 | 166 | foreach ($localobject->html_images as $i => $val) { |
| 167 | 167 | if ($localobject->html_images[$i]) { |
| 168 | 168 | if (preg_match('/img250x20\.png/i', $localobject->html_images[$i]['fullpath'])) { |
| 169 | - print __METHOD__ . " content type must be image png =" . $localobject->html_images[$i]['content_type'] . "\n"; |
|
| 169 | + print __METHOD__." content type must be image png =".$localobject->html_images[$i]['content_type']."\n"; |
|
| 170 | 170 | $this->assertEquals($localobject->html_images[$i]['content_type'], 'image/png'); |
| 171 | 171 | |
| 172 | - print __METHOD__ . " type must be cidfromurl =" . $localobject->html_images[$i]['type'] . "\n"; |
|
| 172 | + print __METHOD__." type must be cidfromurl =".$localobject->html_images[$i]['type']."\n"; |
|
| 173 | 173 | $this->assertEquals($localobject->html_images[$i]['type'], 'cidfromurl'); |
| 174 | 174 | |
| 175 | 175 | $fileSize = 9744; |
| 176 | - print __METHOD__ . " File size must be =" . $fileSize . "\n"; |
|
| 176 | + print __METHOD__." File size must be =".$fileSize."\n"; |
|
| 177 | 177 | $this->assertEquals(dol_filesize($localobject->html_images[$i]['fullpath']), $fileSize); |
| 178 | 178 | } elseif (preg_match('/\.png/i', $localobject->html_images[$i]['fullpath'])) { |
| 179 | - print __METHOD__ . " content type must be image png =" . $localobject->html_images[$i]['content_type'] . "\n"; |
|
| 179 | + print __METHOD__." content type must be image png =".$localobject->html_images[$i]['content_type']."\n"; |
|
| 180 | 180 | $this->assertEquals($localobject->html_images[$i]['content_type'], 'image/png'); |
| 181 | 181 | |
| 182 | - print __METHOD__ . " type must be cidfromdata =" . $localobject->html_images[$i]['type'] . "\n"; |
|
| 182 | + print __METHOD__." type must be cidfromdata =".$localobject->html_images[$i]['type']."\n"; |
|
| 183 | 183 | $this->assertEquals($localobject->html_images[$i]['type'], 'cidfromdata'); |
| 184 | 184 | |
| 185 | 185 | $fileSize = 85; |
| 186 | - print __METHOD__ . " File size must be =" . $fileSize . "\n"; |
|
| 186 | + print __METHOD__." File size must be =".$fileSize."\n"; |
|
| 187 | 187 | $this->assertEquals(dol_filesize($localobject->html_images[$i]['fullpath']), $fileSize); |
| 188 | 188 | } |
| 189 | 189 | } |
@@ -24,32 +24,32 @@ discard block |
||
| 24 | 24 | * \remarks To run this script as CLI: phpunit filename.php |
| 25 | 25 | */ |
| 26 | 26 | |
| 27 | -global $conf,$user,$langs,$db; |
|
| 27 | +global $conf, $user, $langs, $db; |
|
| 28 | 28 | //define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver |
| 29 | 29 | //require_once 'PHPUnit/Autoload.php'; |
| 30 | 30 | |
| 31 | -if (! defined('NOREQUIRESOC')) { |
|
| 31 | +if (!defined('NOREQUIRESOC')) { |
|
| 32 | 32 | define('NOREQUIRESOC', '1'); |
| 33 | 33 | } |
| 34 | -if (! defined('NOCSRFCHECK')) { |
|
| 34 | +if (!defined('NOCSRFCHECK')) { |
|
| 35 | 35 | define('NOCSRFCHECK', '1'); |
| 36 | 36 | } |
| 37 | -if (! defined('NOTOKENRENEWAL')) { |
|
| 37 | +if (!defined('NOTOKENRENEWAL')) { |
|
| 38 | 38 | define('NOTOKENRENEWAL', '1'); |
| 39 | 39 | } |
| 40 | -if (! defined('NOREQUIREMENU')) { |
|
| 40 | +if (!defined('NOREQUIREMENU')) { |
|
| 41 | 41 | define('NOREQUIREMENU', '1'); // If there is no menu to show |
| 42 | 42 | } |
| 43 | -if (! defined('NOREQUIREHTML')) { |
|
| 43 | +if (!defined('NOREQUIREHTML')) { |
|
| 44 | 44 | define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php |
| 45 | 45 | } |
| 46 | -if (! defined('NOREQUIREAJAX')) { |
|
| 46 | +if (!defined('NOREQUIREAJAX')) { |
|
| 47 | 47 | define('NOREQUIREAJAX', '1'); |
| 48 | 48 | } |
| 49 | -if (! defined("NOLOGIN")) { |
|
| 50 | - define("NOLOGIN", '1'); // If this page is public (can be called outside logged session) |
|
| 49 | +if (!defined("NOLOGIN")) { |
|
| 50 | + define("NOLOGIN", '1'); // If this page is public (can be called outside logged session) |
|
| 51 | 51 | } |
| 52 | -if (! defined("NOSESSION")) { |
|
| 52 | +if (!defined("NOSESSION")) { |
|
| 53 | 53 | define("NOSESSION", '1'); |
| 54 | 54 | } |
| 55 | 55 | |
@@ -227,8 +227,8 @@ discard block |
||
| 227 | 227 | $result = testSqlAndScriptInject($test, 0); |
| 228 | 228 | $this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject eee'); |
| 229 | 229 | |
| 230 | - $test = "<IMG SRC=\"jav\tascript:alert('XSS');\">"; // Is locked by some browser like chrome because the default directive no-referrer-when-downgrade is sent when requesting the SRC and then refused because of browser protection on img src load without referrer. |
|
| 231 | - $test = "<IMG SRC=\"jav
ascript:alert('XSS');\">"; // Same |
|
| 230 | + $test = "<IMG SRC=\"jav\tascript:alert('XSS');\">"; // Is locked by some browser like chrome because the default directive no-referrer-when-downgrade is sent when requesting the SRC and then refused because of browser protection on img src load without referrer. |
|
| 231 | + $test = "<IMG SRC=\"jav
ascript:alert('XSS');\">"; // Same |
|
| 232 | 232 | |
| 233 | 233 | $test = '<SCRIPT/XSS SRC="http://xss.rocks/xss.js"></SCRIPT>'; |
| 234 | 234 | $result = testSqlAndScriptInject($test, 0); |
@@ -262,21 +262,21 @@ discard block |
||
| 262 | 262 | $result = testSqlAndScriptInject($test, 0); |
| 263 | 263 | $this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject lll'); |
| 264 | 264 | |
| 265 | - $test = '<a onscrollend=alert(1) style="display:block;overflow:auto;border:1px+dashed;width:500px;height:100px;"><br><br><br><br><br><span+id=x>test</span></a>'; // Add the char %F6 into the variable |
|
| 265 | + $test = '<a onscrollend=alert(1) style="display:block;overflow:auto;border:1px+dashed;width:500px;height:100px;"><br><br><br><br><br><span+id=x>test</span></a>'; // Add the char %F6 into the variable |
|
| 266 | 266 | $result = testSqlAndScriptInject($test, 0); |
| 267 | 267 | //print "test=".$test." result=".$result."\n"; |
| 268 | 268 | $this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject mmm'); |
| 269 | 269 | |
| 270 | 270 | |
| 271 | 271 | $test = "Text with ' encoded with the numeric html entity converted into text entity ' (like when submitted by CKEditor)"; |
| 272 | - $result = testSqlAndScriptInject($test, 0); // result must be 0 |
|
| 272 | + $result = testSqlAndScriptInject($test, 0); // result must be 0 |
|
| 273 | 273 | $this->assertEquals(0, $result, 'Error on testSqlAndScriptInject mmm, result should be 0 and is not'); |
| 274 | 274 | |
| 275 | 275 | $test = '<a href="j	a	v	asc
ri	pt:(a	l	e	r	t	(document.cookie))">XSS</a>'; |
| 276 | 276 | $result = testSqlAndScriptInject($test, 0); |
| 277 | 277 | $this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject nnn, result should be >= 1 and is not'); |
| 278 | 278 | |
| 279 | - $test = "/dolibarr/htdocs/index.php/".chr('246')."abc"; // Add the char %F6 into the variable |
|
| 279 | + $test = "/dolibarr/htdocs/index.php/".chr('246')."abc"; // Add the char %F6 into the variable |
|
| 280 | 280 | $result = testSqlAndScriptInject($test, 2); |
| 281 | 281 | //print "test=".$test." result=".$result."\n"; |
| 282 | 282 | $this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject with a non valid UTF8 char'); |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | */ |
| 290 | 290 | public function testGETPOST() |
| 291 | 291 | { |
| 292 | - global $conf,$user,$langs,$db; |
|
| 292 | + global $conf, $user, $langs, $db; |
|
| 293 | 293 | $conf = $this->savconf; |
| 294 | 294 | $user = $this->savuser; |
| 295 | 295 | $langs = $this->savlangs; |
@@ -306,18 +306,18 @@ discard block |
||
| 306 | 306 | $_GET["param1"] = "222"; |
| 307 | 307 | $_POST["param1"] = "333"; |
| 308 | 308 | $_GET["param2"] = 'a/b#e(pr)qq-rr\cc'; |
| 309 | - $_GET["param3"] = '"na/b#e(pr)qq-rr\cc'; // Same than param2 + " and n |
|
| 309 | + $_GET["param3"] = '"na/b#e(pr)qq-rr\cc'; // Same than param2 + " and n |
|
| 310 | 310 | $_GET["param4a"] = '../../dir'; |
| 311 | 311 | $_GET["param4b"] = '..\..\dirwindows'; |
| 312 | 312 | $_GET["param5"] = "a_1-b"; |
| 313 | 313 | $_POST["param6"] = ""><svg onload='console.log("123")'>"; |
| 314 | 314 | $_POST["param6b"] = '<<<../>../>../svg><<<../>../>../animate =alert(1)>abc'; |
| 315 | 315 | $_GET["param7"] = '"c:\this is a path~1\aaan &#x110;" abc<bad>def</bad>'; |
| 316 | - $_POST["param8a"] = "Hacker<svg onload='console.log("123")'"; // html tag is not closed so it is not detected as html tag but is still harmfull |
|
| 317 | - $_POST['param8b'] = '<img src=x onerror=alert(document.location) t='; // this is html obfuscated by non closing tag |
|
| 316 | + $_POST["param8a"] = "Hacker<svg onload='console.log("123")'"; // html tag is not closed so it is not detected as html tag but is still harmfull |
|
| 317 | + $_POST['param8b'] = '<img src=x onerror=alert(document.location) t='; // this is html obfuscated by non closing tag |
|
| 318 | 318 | $_POST['param8c'] = '< with space after is ok'; |
| 319 | 319 | $_POST['param8d'] = '<abc123 is html to clean'; |
| 320 | - $_POST['param8e'] = '<123abc is not html to clean'; // other similar case: '<2021-12-12' |
|
| 320 | + $_POST['param8e'] = '<123abc is not html to clean'; // other similar case: '<2021-12-12' |
|
| 321 | 321 | $_POST['param8f'] = 'abc<<svg <><<animate onbegin=alert(document.domain) a'; |
| 322 | 322 | $_POST["param9"] = 'is_object($object) ? ($object->id < 10 ? round($object->id / 2, 2) : (2 * $user->id) * (int) substr($mysoc->zip, 1, 2)) : \'objnotdefined\''; |
| 323 | 323 | $_POST["param10"] = 'is_object($object) ? ($object->id < 10 ? round($object->id / 2, 2) : (2 * $user->id) * (int) substr($mysoc->zip, 1, 2)) : \'<abc>objnotdefined\''; |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | |
| 338 | 338 | |
| 339 | 339 | |
| 340 | - $result = GETPOST('id', 'int'); // Must return nothing |
|
| 340 | + $result = GETPOST('id', 'int'); // Must return nothing |
|
| 341 | 341 | print __METHOD__." result=".$result."\n"; |
| 342 | 342 | $this->assertEquals('', $result); |
| 343 | 343 | |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | |
| 352 | 352 | // Test with alpha |
| 353 | 353 | |
| 354 | - $result = GETPOST("param0", 'alpha'); // a simple format, so " completely removed |
|
| 354 | + $result = GETPOST("param0", 'alpha'); // a simple format, so " completely removed |
|
| 355 | 355 | $resultexpected = 'A real string with aaa and and \' and & inside content'; |
| 356 | 356 | print __METHOD__." result=".$result."\n"; |
| 357 | 357 | $this->assertEquals($resultexpected, $result, 'Test on param0'); |
@@ -360,15 +360,15 @@ discard block |
||
| 360 | 360 | print __METHOD__." result=".$result."\n"; |
| 361 | 361 | $this->assertEquals($result, $_GET["param2"], 'Test on param2'); |
| 362 | 362 | |
| 363 | - $result = GETPOST("param3", 'alpha'); // Must return string sanitized from char " |
|
| 363 | + $result = GETPOST("param3", 'alpha'); // Must return string sanitized from char " |
|
| 364 | 364 | print __METHOD__." result=".$result."\n"; |
| 365 | 365 | $this->assertEquals($result, 'na/b#e(pr)qq-rr\cc', 'Test on param3'); |
| 366 | 366 | |
| 367 | - $result = GETPOST("param4a", 'alpha'); // Must return string sanitized from ../ |
|
| 367 | + $result = GETPOST("param4a", 'alpha'); // Must return string sanitized from ../ |
|
| 368 | 368 | print __METHOD__." result=".$result."\n"; |
| 369 | 369 | $this->assertEquals($result, 'dir'); |
| 370 | 370 | |
| 371 | - $result = GETPOST("param4b", 'alpha'); // Must return string sanitized from ../ |
|
| 371 | + $result = GETPOST("param4b", 'alpha'); // Must return string sanitized from ../ |
|
| 372 | 372 | print __METHOD__." result=".$result."\n"; |
| 373 | 373 | $this->assertEquals($result, 'dirwindows'); |
| 374 | 374 | |
@@ -378,19 +378,19 @@ discard block |
||
| 378 | 378 | print __METHOD__." result=".$result."\n"; |
| 379 | 379 | $this->assertEquals($result, $_GET["param1"]); |
| 380 | 380 | |
| 381 | - $result = GETPOST("param2", 'aZ09'); // Must return '' as string contains car not in aZ09 definition |
|
| 381 | + $result = GETPOST("param2", 'aZ09'); // Must return '' as string contains car not in aZ09 definition |
|
| 382 | 382 | print __METHOD__." result=".$result."\n"; |
| 383 | 383 | $this->assertEquals($result, ''); |
| 384 | 384 | |
| 385 | - $result = GETPOST("param3", 'aZ09'); // Must return '' as string contains car not in aZ09 definition |
|
| 385 | + $result = GETPOST("param3", 'aZ09'); // Must return '' as string contains car not in aZ09 definition |
|
| 386 | 386 | print __METHOD__." result=".$result."\n"; |
| 387 | 387 | $this->assertEquals($result, ''); |
| 388 | 388 | |
| 389 | - $result = GETPOST("param4a", 'aZ09'); // Must return '' as string contains car not in aZ09 definition |
|
| 389 | + $result = GETPOST("param4a", 'aZ09'); // Must return '' as string contains car not in aZ09 definition |
|
| 390 | 390 | print __METHOD__." result=".$result."\n"; |
| 391 | 391 | $this->assertEquals('', $result); |
| 392 | 392 | |
| 393 | - $result = GETPOST("param4b", 'aZ09'); // Must return '' as string contains car not in aZ09 definition |
|
| 393 | + $result = GETPOST("param4b", 'aZ09'); // Must return '' as string contains car not in aZ09 definition |
|
| 394 | 394 | print __METHOD__." result=".$result."\n"; |
| 395 | 395 | $this->assertEquals('', $result); |
| 396 | 396 | |
@@ -501,9 +501,9 @@ discard block |
||
| 501 | 501 | print __METHOD__." result=".$result."\n"; |
| 502 | 502 | $this->assertEquals("Text with ' encoded with the numeric html entity converted into text entity ' (like when submitted by CKEditor)", $result, 'Test 14'); |
| 503 | 503 | |
| 504 | - $result = GETPOST("param15", 'restricthtml'); // param15 = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string |
|
| 504 | + $result = GETPOST("param15", 'restricthtml'); // param15 = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string |
|
| 505 | 505 | print __METHOD__." result=".$result."\n"; |
| 506 | - $this->assertEquals("<img onerror=alert(document.domain) src=>0xbeefed", $result, 'Test 15'); // The GETPOST return a harmull string |
|
| 506 | + $this->assertEquals("<img onerror=alert(document.domain) src=>0xbeefed", $result, 'Test 15'); // The GETPOST return a harmull string |
|
| 507 | 507 | |
| 508 | 508 | $result = GETPOST("param19", 'restricthtml'); |
| 509 | 509 | print __METHOD__." result=".$result."\n"; |
@@ -520,17 +520,17 @@ discard block |
||
| 520 | 520 | print __METHOD__." result for param0=".$result."\n"; |
| 521 | 521 | $this->assertEquals($resultexpected, $result, 'Test on param0'); |
| 522 | 522 | |
| 523 | - $result = GETPOST("param15", 'restricthtml'); // param15 = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string |
|
| 523 | + $result = GETPOST("param15", 'restricthtml'); // param15 = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string |
|
| 524 | 524 | print __METHOD__." result for param15=".$result."\n"; |
| 525 | 525 | //$this->assertEquals('InvalidHTMLStringCantBeCleaned', $result, 'Test 15b'); // With some PHP and libxml version, we got this result when parsing invalid HTML, but ... |
| 526 | 526 | //$this->assertEquals('<img onerror> src=>0xbeefed', $result, 'Test 15b'); // ... on other PHP and libxml versions, we got a HTML that has been cleaned |
| 527 | 527 | |
| 528 | - $result = GETPOST("param6", 'restricthtml'); // param6 = ""><svg onload='console.log("123")'>" |
|
| 528 | + $result = GETPOST("param6", 'restricthtml'); // param6 = ""><svg onload='console.log("123")'>" |
|
| 529 | 529 | print __METHOD__." result for param6=".$result." - before=".$_POST["param6"]."\n"; |
| 530 | 530 | //$this->assertEquals('InvalidHTMLStringCantBeCleaned', $result, 'Test 15b'); // With some PHP and libxml version, we got this result when parsing invalid HTML, but ... |
| 531 | 531 | //$this->assertEquals('">', $result); // ... on other PHP and libxml versions, we got a HTML that has been cleaned |
| 532 | 532 | |
| 533 | - $result = GETPOST("param7", 'restricthtml'); // param7 = "c:\this is a path~1\aaan &#x110;" abc<bad>def</bad> |
|
| 533 | + $result = GETPOST("param7", 'restricthtml'); // param7 = "c:\this is a path~1\aaan &#x110;" abc<bad>def</bad> |
|
| 534 | 534 | print __METHOD__." result param7 = ".$result."\n"; |
| 535 | 535 | //$this->assertEquals('InvalidHTMLStringCantBeCleaned', $result, 'Test 15b'); // With some PHP and libxml version, we got this result when parsing invalid HTML, but ... |
| 536 | 536 | //$this->assertEquals('"c:\this is a path~1\aaan 110;" abcdef', $result); // ... on other PHP and libxml versions, we got a HTML that has been cleaned |
@@ -547,7 +547,7 @@ discard block |
||
| 547 | 547 | print __METHOD__." result for param0=".$result."\n"; |
| 548 | 548 | $this->assertEquals($resultexpected, $result, 'Test on param0'); |
| 549 | 549 | |
| 550 | - $result = GETPOST("param15", 'restricthtml'); // param15 = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string |
|
| 550 | + $result = GETPOST("param15", 'restricthtml'); // param15 = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string |
|
| 551 | 551 | print __METHOD__." result=".$result."\n"; |
| 552 | 552 | |
| 553 | 553 | $result = GETPOST("param6", 'restricthtml'); |
@@ -571,7 +571,7 @@ discard block |
||
| 571 | 571 | print __METHOD__." result for param0=".$result."\n"; |
| 572 | 572 | $this->assertEquals($resultexpected, $result, 'Test on param0'); |
| 573 | 573 | |
| 574 | - $result = GETPOST("param15", 'restricthtml'); // param15 = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string |
|
| 574 | + $result = GETPOST("param15", 'restricthtml'); // param15 = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string |
|
| 575 | 575 | print __METHOD__." result=".$result."\n"; |
| 576 | 576 | |
| 577 | 577 | $result = GETPOST("param6", 'restricthtml'); |
@@ -784,21 +784,21 @@ discard block |
||
| 784 | 784 | { |
| 785 | 785 | global $conf; |
| 786 | 786 | |
| 787 | - $genpass1 = getRandomPassword(true); // Should be a string return by dol_hash (if no option set, will be md5) |
|
| 787 | + $genpass1 = getRandomPassword(true); // Should be a string return by dol_hash (if no option set, will be md5) |
|
| 788 | 788 | print __METHOD__." genpass1=".$genpass1."\n"; |
| 789 | 789 | $this->assertEquals(strlen($genpass1), 32); |
| 790 | 790 | |
| 791 | - $genpass1 = getRandomPassword(true, array('I')); // Should be a string return by dol_hash (if no option set, will be md5) |
|
| 791 | + $genpass1 = getRandomPassword(true, array('I')); // Should be a string return by dol_hash (if no option set, will be md5) |
|
| 792 | 792 | print __METHOD__." genpass1=".$genpass1."\n"; |
| 793 | 793 | $this->assertEquals(strlen($genpass1), 32); |
| 794 | 794 | |
| 795 | 795 | $conf->global->USER_PASSWORD_GENERATED = 'None'; |
| 796 | - $genpass2 = getRandomPassword(false); // Should return an empty string |
|
| 796 | + $genpass2 = getRandomPassword(false); // Should return an empty string |
|
| 797 | 797 | print __METHOD__." genpass2=".$genpass2."\n"; |
| 798 | 798 | $this->assertEquals($genpass2, ''); |
| 799 | 799 | |
| 800 | 800 | $conf->global->USER_PASSWORD_GENERATED = 'Standard'; |
| 801 | - $genpass3 = getRandomPassword(false); // Should return a password of 12 chars |
|
| 801 | + $genpass3 = getRandomPassword(false); // Should return a password of 12 chars |
|
| 802 | 802 | print __METHOD__." genpass3=".$genpass3."\n"; |
| 803 | 803 | $this->assertEquals(strlen($genpass3), 12); |
| 804 | 804 | |
@@ -812,7 +812,7 @@ discard block |
||
| 812 | 812 | */ |
| 813 | 813 | public function testRestrictedArea() |
| 814 | 814 | { |
| 815 | - global $conf,$user,$langs,$db; |
|
| 815 | + global $conf, $user, $langs, $db; |
|
| 816 | 816 | $conf = $this->savconf; |
| 817 | 817 | $user = $this->savuser; |
| 818 | 818 | $langs = $this->savlangs; |
@@ -843,40 +843,40 @@ discard block |
||
| 843 | 843 | $tmpvar = preg_match('/not supported/', $tmp['curl_error_msg']); |
| 844 | 844 | $this->assertEquals(1, $tmpvar, "Did not find the /not supported/ in getURLContent error message. We should."); |
| 845 | 845 | |
| 846 | - $url = 'https://www.dolibarr.fr'; // This is a redirect 301 page |
|
| 847 | - $tmp = getURLContent($url, 'GET', '', 0); // We do NOT follow |
|
| 846 | + $url = 'https://www.dolibarr.fr'; // This is a redirect 301 page |
|
| 847 | + $tmp = getURLContent($url, 'GET', '', 0); // We do NOT follow |
|
| 848 | 848 | print __METHOD__." url=".$url."\n"; |
| 849 | 849 | $this->assertEquals(301, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url 301 response'); |
| 850 | 850 | |
| 851 | - $url = 'https://www.dolibarr.fr'; // This is a redirect 301 page |
|
| 852 | - $tmp = getURLContent($url); // We DO follow a page with return 300 so result should be 200 |
|
| 851 | + $url = 'https://www.dolibarr.fr'; // This is a redirect 301 page |
|
| 852 | + $tmp = getURLContent($url); // We DO follow a page with return 300 so result should be 200 |
|
| 853 | 853 | print __METHOD__." url=".$url."\n"; |
| 854 | 854 | $this->assertEquals(200, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url 301 with a follow -> 200 but we get '.(empty($tmp['http_code']) ? 0 : $tmp['http_code'])); |
| 855 | 855 | |
| 856 | 856 | $url = 'http://localhost'; |
| 857 | - $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
| 857 | + $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
| 858 | 858 | print __METHOD__." url=".$url."\n"; |
| 859 | - $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that resolves to a local URL'); // Test we receive an error because localtest.me is not an external URL |
|
| 859 | + $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that resolves to a local URL'); // Test we receive an error because localtest.me is not an external URL |
|
| 860 | 860 | |
| 861 | 861 | $url = 'http://127.0.0.1'; |
| 862 | - $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
| 862 | + $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
| 863 | 863 | print __METHOD__." url=".$url."\n"; |
| 864 | - $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.0.1 is not an external URL |
|
| 864 | + $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.0.1 is not an external URL |
|
| 865 | 865 | |
| 866 | 866 | $url = 'http://127.0.2.1'; |
| 867 | - $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
| 867 | + $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
| 868 | 868 | print __METHOD__." url=".$url."\n"; |
| 869 | - $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.2.1 is not an external URL |
|
| 869 | + $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.2.1 is not an external URL |
|
| 870 | 870 | |
| 871 | 871 | $url = 'https://169.254.0.1'; |
| 872 | - $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
| 872 | + $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
| 873 | 873 | print __METHOD__." url=".$url."\n"; |
| 874 | - $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 169.254.0.1 is not an external URL |
|
| 874 | + $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 169.254.0.1 is not an external URL |
|
| 875 | 875 | |
| 876 | 876 | $url = 'http://[::1]'; |
| 877 | - $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
| 877 | + $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
| 878 | 878 | print __METHOD__." url=".$url."\n"; |
| 879 | - $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because [::1] is not an external URL |
|
| 879 | + $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because [::1] is not an external URL |
|
| 880 | 880 | |
| 881 | 881 | /*$url = 'localtest.me'; |
| 882 | 882 | $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
@@ -885,9 +885,9 @@ discard block |
||
| 885 | 885 | */ |
| 886 | 886 | |
| 887 | 887 | $url = 'http://192.0.0.192'; |
| 888 | - $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL but on an IP in blacklist |
|
| 888 | + $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL but on an IP in blacklist |
|
| 889 | 889 | print __METHOD__." url=".$url." tmp['http_code'] = ".(empty($tmp['http_code']) ? 0 : $tmp['http_code'])."\n"; |
| 890 | - $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Access should be refused and was not'); // Test we receive an error because ip is in blacklist |
|
| 890 | + $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Access should be refused and was not'); // Test we receive an error because ip is in blacklist |
|
| 891 | 891 | |
| 892 | 892 | return 0; |
| 893 | 893 | } |
@@ -899,7 +899,7 @@ discard block |
||
| 899 | 899 | */ |
| 900 | 900 | public function testDolSanitizeUrl() |
| 901 | 901 | { |
| 902 | - global $conf,$user,$langs,$db; |
|
| 902 | + global $conf, $user, $langs, $db; |
|
| 903 | 903 | $conf = $this->savconf; |
| 904 | 904 | $user = $this->savuser; |
| 905 | 905 | $langs = $this->savlangs; |
@@ -925,7 +925,7 @@ discard block |
||
| 925 | 925 | */ |
| 926 | 926 | public function testDolSanitizeEmail() |
| 927 | 927 | { |
| 928 | - global $conf,$user,$langs,$db; |
|
| 928 | + global $conf, $user, $langs, $db; |
|
| 929 | 929 | $conf = $this->savconf; |
| 930 | 930 | $user = $this->savuser; |
| 931 | 931 | $langs = $this->savlangs; |
@@ -955,7 +955,7 @@ discard block |
||
| 955 | 955 | */ |
| 956 | 956 | public function testDolSanitizeFileName() |
| 957 | 957 | { |
| 958 | - global $conf,$user,$langs,$db; |
|
| 958 | + global $conf, $user, $langs, $db; |
|
| 959 | 959 | $conf = $this->savconf; |
| 960 | 960 | $user = $this->savuser; |
| 961 | 961 | $langs = $this->savlangs; |
@@ -978,7 +978,7 @@ discard block |
||
| 978 | 978 | */ |
| 979 | 979 | public function testDolEval() |
| 980 | 980 | { |
| 981 | - global $conf,$user,$langs,$db; |
|
| 981 | + global $conf, $user, $langs, $db; |
|
| 982 | 982 | $conf = $this->savconf; |
| 983 | 983 | $user = $this->savuser; |
| 984 | 984 | $langs = $this->savlangs; |
@@ -988,7 +988,7 @@ discard block |
||
| 988 | 988 | include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
| 989 | 989 | include_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; |
| 990 | 990 | |
| 991 | - $result=dol_eval('1==1', 1, 0); |
|
| 991 | + $result = dol_eval('1==1', 1, 0); |
|
| 992 | 992 | print "result1 = ".$result."\n"; |
| 993 | 993 | $this->assertTrue($result); |
| 994 | 994 | |
@@ -1063,7 +1063,7 @@ discard block |
||
| 1063 | 1063 | print "result13 = ".$result."\n"; |
| 1064 | 1064 | $this->assertEquals('358080.38', $result); |
| 1065 | 1065 | |
| 1066 | - global $leftmenu; // Used into strings to eval |
|
| 1066 | + global $leftmenu; // Used into strings to eval |
|
| 1067 | 1067 | |
| 1068 | 1068 | $leftmenu = 'AAA'; |
| 1069 | 1069 | $result = dol_eval('$conf->currency && preg_match(\'/^(AAA|BBB)/\',$leftmenu)', 1, 1, '1'); |
@@ -1091,7 +1091,7 @@ discard block |
||
| 1091 | 1091 | print "result17 = ".$result."\n"; |
| 1092 | 1092 | $this->assertTrue($result); |
| 1093 | 1093 | |
| 1094 | - $result = dol_eval('1 && getDolGlobalInt("doesnotexist1") && $conf->global->MAIN_FEATURES_LEVEL', 1, 0); // Should return false and not a 'Bad string syntax to evaluate ...' |
|
| 1094 | + $result = dol_eval('1 && getDolGlobalInt("doesnotexist1") && $conf->global->MAIN_FEATURES_LEVEL', 1, 0); // Should return false and not a 'Bad string syntax to evaluate ...' |
|
| 1095 | 1095 | print "result18 = ".$result."\n"; |
| 1096 | 1096 | $this->assertFalse($result); |
| 1097 | 1097 | |
@@ -1118,12 +1118,12 @@ discard block |
||
| 1118 | 1118 | global $conf; |
| 1119 | 1119 | |
| 1120 | 1120 | // Set options for cleaning data |
| 1121 | - $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0; // disabled, does not work on HTML5 and some libxml versions |
|
| 1121 | + $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0; // disabled, does not work on HTML5 and some libxml versions |
|
| 1122 | 1122 | // Enabled option MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY if possible |
| 1123 | 1123 | if (extension_loaded('tidy') && class_exists("tidy")) { |
| 1124 | 1124 | $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 1; |
| 1125 | 1125 | } |
| 1126 | - $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0; // disabled, does not work on HTML5 and some libxml versions |
|
| 1126 | + $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0; // disabled, does not work on HTML5 and some libxml versions |
|
| 1127 | 1127 | |
| 1128 | 1128 | |
| 1129 | 1129 | |
@@ -1136,7 +1136,7 @@ discard block |
||
| 1136 | 1136 | //$result = dol_escape_htmltag(dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($stringtotest), 1, 1, 1, 0)), 1, 1, 'common', 0, 1); |
| 1137 | 1137 | $result = dolPrintHTML($stringtotest); |
| 1138 | 1138 | print __METHOD__." result=".$result."\n"; |
| 1139 | - $this->assertEquals($stringfixed, $result, 'Error'); // Expected '' because should failed because login 'auto' does not exists |
|
| 1139 | + $this->assertEquals($stringfixed, $result, 'Error'); // Expected '' because should failed because login 'auto' does not exists |
|
| 1140 | 1140 | |
| 1141 | 1141 | |
| 1142 | 1142 | // For a string that is already HTML (contains HTML tags) with special tags but badly formatted |
@@ -1193,16 +1193,16 @@ discard block |
||
| 1193 | 1193 | print __METHOD__." login=".$login."\n"; |
| 1194 | 1194 | $this->assertEquals($login, ''); |
| 1195 | 1195 | |
| 1196 | - $login = checkLoginPassEntity('admin', 'admin', 1, array('dolibarr')); // Should works because admin/admin exists |
|
| 1196 | + $login = checkLoginPassEntity('admin', 'admin', 1, array('dolibarr')); // Should works because admin/admin exists |
|
| 1197 | 1197 | print __METHOD__." login=".$login."\n"; |
| 1198 | 1198 | $this->assertEquals($login, 'admin', 'The test to check if pass of user "admin" is "admin" has failed'); |
| 1199 | 1199 | |
| 1200 | - $login = checkLoginPassEntity('admin', 'admin', 1, array('http','dolibarr')); // Should work because of second authentication method |
|
| 1200 | + $login = checkLoginPassEntity('admin', 'admin', 1, array('http', 'dolibarr')); // Should work because of second authentication method |
|
| 1201 | 1201 | print __METHOD__." login=".$login."\n"; |
| 1202 | 1202 | $this->assertEquals($login, 'admin'); |
| 1203 | 1203 | |
| 1204 | 1204 | $login = checkLoginPassEntity('admin', 'admin', 1, array('forceuser')); |
| 1205 | 1205 | print __METHOD__." login=".$login."\n"; |
| 1206 | - $this->assertEquals('', $login, 'Error'); // Expected '' because should failed because login 'auto' does not exists |
|
| 1206 | + $this->assertEquals('', $login, 'Error'); // Expected '' because should failed because login 'auto' does not exists |
|
| 1207 | 1207 | } |
| 1208 | 1208 | } |