diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php index 1d800e1eaca..3bb551a3bb1 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -45,6 +45,9 @@ $action = GETPOST('action', 'aZ09'); if ($user->socid) { $socid = $user->socid; } +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('ordercontact', 'globalcard')); + $result = restrictedArea($user, 'commande', $id, ''); $hookmanager->initHooks(array('ordercontactcard', 'globalcard')); diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index c354e9f34ec..097e6a14eb3 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -80,6 +80,10 @@ $permissiontoadd = $usercancreate; if ($user->socid) { $socid = $user->socid; } + +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('orderdocument', 'globalcard')); + $result = restrictedArea($user, 'commande', $id, ''); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 8a4fea0575f..b04abd1ad4d 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -9497,7 +9497,7 @@ abstract class CommonObject foreach ($this->fields as $field => $info) { if ($this->isDate($info)) { - if (is_null($obj->$field) || $obj->$field === '' || $obj->$field === '0000-00-00 00:00:00' || $obj->$field === '1000-01-01 00:00:00') { + if (!isset($obj->$field) || is_null($obj->$field) || $obj->$field === '' || $obj->$field === '0000-00-00 00:00:00' || $obj->$field === '1000-01-01 00:00:00') { $this->$field = ''; } else { $this->$field = $db->jdate($obj->$field); @@ -9513,7 +9513,7 @@ abstract class CommonObject $this->$field = (float) $obj->$field; } } else { - if (!is_null($obj->$field) || (isset($info['notnull']) && $info['notnull'] == 1)) { + if (isset($obj->$field) && !is_null($obj->$field) || (isset($info['notnull']) && $info['notnull'] == 1)) { $this->$field = (int) $obj->$field; } else { $this->$field = null; @@ -9528,7 +9528,7 @@ abstract class CommonObject $this->$field = (float) $obj->$field; } } else { - if (!is_null($obj->$field) || (isset($info['notnull']) && $info['notnull'] == 1)) { + if (isset($obj->$field) && !is_null($obj->$field) || (isset($info['notnull']) && $info['notnull'] == 1)) { $this->$field = (float) $obj->$field; } else { $this->$field = null; diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 7295ee84886..ab60cdf5588 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -116,7 +116,7 @@ class ExtraFields * * @param string $attrname Code of attribute * @param string $label label of attribute - * @param string $type Type of attribute ('boolean','int','varchar','text','html','date','datehour','price', 'pricecy', 'phone','mail','password','url','select','checkbox','separate',...) + * @param string $type Type of attribute ('boolean','int','varchar','text','html','date','datetime','price', 'pricecy', 'phone','mail','password','url','select','checkbox','separate',...) * @param int $pos Position of attribute * @param string $size Size/length definition of attribute ('5', '24,8', ...). For float, it contains 2 numeric separated with a comma. * @param string $elementtype Element type. Same value than object->table_element (Example 'member', 'product', 'thirdparty', ...) @@ -185,7 +185,7 @@ class ExtraFields * This is a private method. For public method, use addExtraField. * * @param string $attrname code of attribute - * @param string $type Type of attribute ('boolean', 'int', 'varchar', 'text', 'html', 'date', 'datehour','price','pricecy','phone','mail','password','url','select','checkbox', ...) + * @param string $type Type of attribute ('boolean', 'int', 'varchar', 'text', 'html', 'date', 'datetime', 'price', 'pricecy', 'phone', 'mail', 'password', 'url', 'select', 'checkbox', ...) * @param string $length Size/length of attribute ('5', '24,8', ...) * @param string $elementtype Element type ('member', 'product', 'thirdparty', 'contact', ...) * @param int $unique Is field unique or not @@ -281,7 +281,7 @@ class ExtraFields * * @param string $attrname code of attribute * @param string $label label of attribute - * @param string $type Type of attribute ('int', 'varchar', 'text', 'html', 'date', 'datehour', 'float') + * @param string $type Type of attribute ('int', 'varchar', 'text', 'html', 'date', 'datehour', 'float') * @param int $pos Position of attribute * @param string $size Size/length of attribute ('5', '24,8', ...) * @param string $elementtype Element type ('member', 'product', 'thirdparty', ...) @@ -529,7 +529,7 @@ class ExtraFields * * @param string $attrname Name of attribute * @param string $label Label of attribute - * @param string $type Type of attribute ('boolean', 'int', 'varchar', 'text', 'html', 'date', 'datehour','price','phone','mail','password','url','select','checkbox', ...) + * @param string $type Type of attribute ('boolean', 'int', 'varchar', 'text', 'html', 'date', 'datetime','price','phone','mail','password','url','select','checkbox', ...) * @param int $length Length of attribute * @param string $elementtype Element type ('member', 'product', 'thirdparty', 'contact', ...) * @param int $unique Is field unique or not diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index ca5b93994e8..bb3fdac5eb3 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -534,6 +534,8 @@ class FactureFournisseurRec extends CommonInvoice $sql .= " auto_validate = ". (!empty($this->auto_validate) ? ((int) $this->auto_validate) : 0); $sql .= " WHERE rowid = ". (int) $this->id; + $this->db->begin(); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -991,7 +993,7 @@ class FactureFournisseurRec extends CommonInvoice $sql .= ', fk_user_author'; $sql .= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc'; $sql .= ') VALUES ('; - $sql .= ' ' . (int) $facid; // source supplier invoie id + $sql .= ' ' . (int) $facid; // source supplier invoice id $sql .= ', ' . (!empty($fk_product) ? "'" . $this->db->escape($fk_product) . "'" : 'null'); $sql .= ', ' . (!empty($ref) ? "'" . $this->db->escape($ref) . "'" : 'null'); $sql .= ', ' . (!empty($label) ? "'" . $this->db->escape($label) . "'" : 'null'); @@ -2197,7 +2199,7 @@ class FactureFournisseurLigneRec extends CommonObjectLine $sql .= ', special_code =' . (int) $this->special_code; $sql .= ', rang = ' . (int) $this->rang; $sql .= ', fk_unit = ' .($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'" : 'null'); - $sql .= ', fk_user_modif = ' . (int) $user; + $sql .= ', fk_user_modif = ' . (int) $user->id; $sql .= ' WHERE rowid = ' . (int) $this->id; $this->db->begin(); diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index 441e0d79bf7..e232f34aa1c 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -172,7 +172,7 @@ if (empty($reshook)) { $res = $object->add_object_linked('mo', $mo_parent->id); } - header("Location: ".dol_buildpath('/mrp/mo_card.php?id='.((int) $moline->fk_mo), 1)); + header("Location: ".dol_buildpath('/mrp/mo_card.php?id='.((int) $mo_parent->id), 1)); exit; } elseif ($action == 'confirm_cancel' && $confirm == 'yes' && !empty($permissiontoadd)) { $also_cancel_consumed_and_produced_lines = (GETPOST('alsoCancelConsumedAndProducedLines', 'alpha') ? 1 : 0); diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index 7495c44d4a0..1a760721ad6 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -361,9 +361,13 @@ if ($source == 'proposal') { print ''."\n"; // Amount + $amount = ''.$langs->trans("Amount"); $amount .= ''; $amount .= ''.price($object->total_ttc, 0, $langs, 1, -1, -1, $conf->currency).''; + if ($object->multicurrency_code != $conf->currency) { + $amount .= ' ('.price($object->multicurrency_total_ttc, 0, $langs, 1, -1, -1, $object->multicurrency_code).')'; + } $amount .= ''."\n"; // Call Hook amountPropalSign diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 135bb5b04d8..f1b049cf3d4 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -376,8 +376,18 @@ function LoadProducts(position, issubcat) { } ?> if (data[parseInt(idata)]['price_formated']) { - $("#proprice"+ishow).attr("class", "productprice"); - $("#proprice"+ishow).html(data[parseInt(idata)]['price_ttc_formated']); + $("#proprice" + ishow).attr("class", "productprice"); + + $("#proprice" + ishow).html(data[parseInt(idata)]['price_formated']); + + $("#proprice" + ishow).html(data[parseInt(idata)]['price_ttc_formated']); + } console.log("#prodiv"+ishow+".data(rowid)="+data[idata]['id']); console.log($("#prodiv"+ishow)); @@ -463,8 +473,18 @@ function MoreProducts(moreorless) { $("#probutton"+ishow).html(data[parseInt(idata)]['label']); $("#probutton"+ishow).show(); if (data[parseInt(idata)]['price_formated']) { - $("#proprice"+ishow).attr("class", "productprice"); - $("#proprice"+ishow).html(data[parseInt(idata)]['price_ttc_formated']); + $("#proprice" + ishow).attr("class", "productprice"); + + $("#proprice" + ishow).html(data[parseInt(idata)]['price_formated']); + + $("#proprice" + ishow).html(data[parseInt(idata)]['price_ttc_formated']); + } $("#proimg"+ishow).attr("src","genimg/index.php?query=pro&id="+data[idata]['id']); $("#prodiv"+ishow).data("rowid",data[idata]['id']); @@ -683,7 +703,17 @@ function Search2(keyCodeForEnter, moreorless) { $("#probutton" + i).show(); if (data[i]['price_formated']) { $("#proprice" + i).attr("class", "productprice"); - $("#proprice" + i).html(data[i]['price_ttc_formated']); + + $("#proprice" + i).html(data[i]['price_formated']); + + $("#proprice" + i).html(data[i]['price_ttc_formated']); + } $("#proimg" + i).attr("title", titlestring); if( undefined !== data[i]['img']) { diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 34446fbe3a0..fa260428341 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -293,6 +293,10 @@ if (empty($reshook)) { if ($pay != "delayed") { $payment->create($user); $payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', ''); + if ($res < 0) { + $error++; + dol_htmloutput_errors($langs->trans('ErrorNoPaymentDefined'), $payment->errors, 1); + } $remaintopay = $invoice->getRemainToPay(); // Recalculate remain to pay after the payment is recorded } elseif (getDolGlobalInt("TAKEPOS_DELAYED_TERMS")) { $invoice->setPaymentTerms(getDolGlobalInt("TAKEPOS_DELAYED_TERMS"));