diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 710443c9bad..11b28b85cb9 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -863,7 +863,7 @@ class AccountingAccount extends CommonObject if (!empty($buyer->code_compta_product)) { $code_t = $buyer->code_compta_product; $suggestedid = $accountingAccount['thirdparty']; - $suggestedaccountingaccountfor = 'thridparty'; + $suggestedaccountingaccountfor = 'thirdparty'; } } diff --git a/htdocs/admin/oauthlogintokens.php b/htdocs/admin/oauthlogintokens.php index 2a5f74eabd6..c157a21caff 100644 --- a/htdocs/admin/oauthlogintokens.php +++ b/htdocs/admin/oauthlogintokens.php @@ -218,7 +218,6 @@ if ($mode == 'setup' && $user->admin) { $tokenobj = null; // Token require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php'; - require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php'; // Dolibarr storage $storage = new DoliStorage($db, $conf); try { diff --git a/htdocs/admin/receiptprinter.php b/htdocs/admin/receiptprinter.php index ac136af0c61..53f0cd9f7f0 100644 --- a/htdocs/admin/receiptprinter.php +++ b/htdocs/admin/receiptprinter.php @@ -183,8 +183,8 @@ if ($action == 'testtemplate' && $user->admin) { // test require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $object = new Facture($db); - //$object->initAsSpecimen(); - $object->fetch(18); + $object->initAsSpecimen(); + //$object->fetch(18); //var_dump($object->lines); $ret = $printer->sendToPrinter($object, $templateid, 1); if ($ret == 0) { diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 3d7d1d38b9a..f8f6f6a9545 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -883,8 +883,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { //Default language if (!empty($conf->global->MAIN_MULTILANGS)) { print '
| '.$langs->trans("UseProductSupplierPackaging").' | '; + print ''.$form->textwithpicto($langs->trans("UseProductSupplierPackaging"), $langs->trans("PackagingForThisProductDesc")).' | '; print ''; print ajax_constantonoff("PRODUCT_USE_SUPPLIER_PACKAGING", array(), $conf->entity, 0, 0, 0, 0); //print $form->selectyesno("activate_useProdSupplierPackaging", (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING) ? $conf->global->PRODUCT_USE_SUPPLIER_PACKAGING : 0), 1); diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index d0a51c3d9de..ed43f5f8f5e 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4791,9 +4791,10 @@ class Product extends CommonObject * @param int $id Id of product to search childs of * @param int $firstlevelonly Return only direct child * @param int $level Level of recursing call (start to 1) + * @param array $parents Array of all parents of $id * @return array Return array(prodid=>array(0=prodid, 1=>qty, 2=>product type, 3=>label, 4=>incdec, 5=>product ref) */ - public function getChildsArbo($id, $firstlevelonly = 0, $level = 1) + public function getChildsArbo($id, $firstlevelonly = 0, $level = 1, $parents = array()) { global $alreadyfound; @@ -4811,7 +4812,7 @@ class Product extends CommonObject $sql .= " AND pa.fk_product_fils <> ".((int) $id); // This should not happens, it is to avoid infinite loop if it happens $sql.= " ORDER BY pa.rang"; - dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level, LOG_DEBUG); + dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level. ' parents='.$parents, LOG_DEBUG); if ($level == 1) { $alreadyfound = array($id=>1); // We init array of found object to start of tree, so if we found it later (should not happened), we stop immediatly @@ -4827,7 +4828,9 @@ class Product extends CommonObject while ($rec = $this->db->fetch_array($res)) { if (!empty($alreadyfound[$rec['rowid']])) { dol_syslog(get_class($this).'::getChildsArbo the product id='.$rec['rowid'].' was already found at a higher level in tree. We discard to avoid infinite loop', LOG_WARNING); - continue; + if (in_array($rec['id'], $parents)) { + continue; // We discard this child if it is already found at a higher level in tree in the same branch. + } } $alreadyfound[$rec['rowid']] = 1; $prods[$rec['rowid']] = array( @@ -4843,7 +4846,7 @@ class Product extends CommonObject //$prods[$this->db->escape($rec['label'])]= array(0=>$rec['id'],1=>$rec['qty'],2=>$rec['fk_product_type']); //$prods[$this->db->escape($rec['label'])]= array(0=>$rec['id'],1=>$rec['qty']); if (empty($firstlevelonly)) { - $listofchilds = $this->getChildsArbo($rec['rowid'], 0, $level + 1); + $listofchilds = $this->getChildsArbo($rec['rowid'], 0, $level + 1, array_push($parents, $rec['rowid'])); foreach ($listofchilds as $keyChild => $valueChild) { $prods[$rec['rowid']]['childs'][$keyChild] = $valueChild; } diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 9dfc90b86a4..28e587b3576 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -549,7 +549,7 @@ if ($id > 0 || $ref) { print ' | ||
| '.$form->textwithpicto($langs->trans("PackagingForThisProduct"), $langs->trans("PackagingForThisProductDesc")).' | '; diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index 12cc1606635..503ba97b392 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -139,7 +139,7 @@ if ($source == 'proposal') { $securekeyseed = $conf->global->PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN; } -if (!dol_verifyHash($securekeyseed.$type.$ref, $SECUREKEY, '0')) { +if (!dol_verifyHash($securekeyseed.$type.$ref.(empty($conf->multicompany->enabled) ? '' : $entity), $SECUREKEY, '0')) { http_response_code(403); print 'Bad value for securitykey. Value provided '.dol_escape_htmltag($SECUREKEY).' does not match expected value for ref='.dol_escape_htmltag($ref); exit(-1); @@ -293,7 +293,6 @@ if ($source == 'proposal') { $result = $object->fetch_thirdparty($object->socid); // Creditor - print '||||
| '.$langs->trans("Creditor"); print ' | '; print img_picto('', 'company', 'class="pictofixedwidth"'); @@ -302,7 +301,6 @@ if ($source == 'proposal') { print ' | |||
| '.$langs->trans("ThirdParty"); print ' | '; print img_picto('', 'company', 'class="pictofixedwidth"'); @@ -310,14 +308,12 @@ if ($source == 'proposal') { print ' | |||
| '.$langs->trans("Amount"); print ' | '; print ''.price($object->total_ttc, 0, $langs, 1, -1, -1, $conf->currency).''; print ' | |||
| '.$langs->trans("Designation"); print ' | '.$text;
diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php
index b61a2e22a06..14d455b5496 100644
--- a/htdocs/public/payment/newpayment.php
+++ b/htdocs/public/payment/newpayment.php
@@ -1353,7 +1353,7 @@ if ($source == 'contractline') {
// Object
$text = ''.$langs->trans("PaymentRenewContractId", $contract->ref, $contractline->ref).'';
- if ($contractline->fk_product) {
+ if ($contractline->fk_product > 0) {
$contractline->fetch_product();
$text .= ' '.$contractline->product->ref.($contractline->product->label ? ' - '.$contractline->product->label : ''); } @@ -1364,8 +1364,8 @@ if ($source == 'contractline') { // $text.=' '.$langs->trans("DateEndPlanned").': '; // $text.=dol_print_date($contractline->date_fin_validite); //} - if ($contractline->date_fin_validite) { - $text .= ' '.$langs->trans("ExpiredSince").': '.dol_print_date($contractline->date_fin_validite); + if ($contractline->date_end) { + $text .= ' '.$langs->trans("ExpiredSince").': '.dol_print_date($contractline->date_end); } if (GETPOST('desc', 'alpha')) { $text = ''.$langs->trans(GETPOST('desc', 'alpha')).''; diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 2245392f7ca..f55f1c37867 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -3144,7 +3144,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } // Subsidiaries list - if (empty($conf->global->SOCIETE_DISABLE_SUBSIDIARIES)) { + if (!empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY) && empty($conf->global->SOCIETE_DISABLE_SHOW_SUBSIDIARIES)) { $result = show_subsidiaries($conf, $langs, $db, $object); } diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index cb7e71f8356..13dffc545aa 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -4,6 +4,7 @@ * Copyright (C) 2018 Laurent Destailleur '.$langs->trans('ThirdParty').' '; - if ($action != 'editcustomer' && $object->fk_status < 8 && !$user->socid && $user->rights->ticket->write) { + if ($action != 'editcustomer' && $object->status < 8 && !$user->socid && $user->rights->ticket->write) { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('Edit'), 0).' : '; } if ($action == 'editcustomer') { @@ -1058,7 +1059,7 @@ if ($action == 'create' || $action == 'presend') { print ' ';
print ' |
|