diff --git a/htdocs/admin/pdf_other.php b/htdocs/admin/pdf_other.php index 95a84ede1ce..e9103da1111 100644 --- a/htdocs/admin/pdf_other.php +++ b/htdocs/admin/pdf_other.php @@ -541,7 +541,7 @@ if (isModEnabled('invoice')) { print ajax_constantonoff('PDF_INVOICE_SHOW_VAT_ANALYSIS'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("PDF_INVOICE_SHOW_VAT_ANALYSIS", $arrval, $conf->global->PDF_INVOICE_SHOW_VAT_ANALYSIS); + print $form->selectarray("PDF_INVOICE_SHOW_VAT_ANALYSIS", $arrval, getDolGlobalInt('PDF_INVOICE_SHOW_VAT_ANALYSIS')); } print ''; @@ -553,7 +553,7 @@ if (isModEnabled('invoice')) { print ajax_constantonoff('PDF_INVOICE_SHOW_BALANCE_SUMMARY'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("PDF_INVOICE_SHOW_BALANCE_SUMMARY", $arrval, $conf->global->PDF_INVOICE_SHOW_BALANCE_SUMMARY); + print $form->selectarray("PDF_INVOICE_SHOW_BALANCE_SUMMARY", $arrval, getDolGlobalInt('PDF_INVOICE_SHOW_BALANCE_SUMMARY')); } print ''; @@ -565,7 +565,7 @@ if (isModEnabled('invoice')) { print ajax_constantonoff('SUPPLIER_PROPOSAL_ADD_BILLING_CONTACT'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("SUPPLIER_PROPOSAL_ADD_BILLING_CONTACT", $arrval, $conf->global->SUPPLIER_PROPOSAL_ADD_BILLING_CONTACT); + print $form->selectarray("SUPPLIER_PROPOSAL_ADD_BILLING_CONTACT", $arrval, getDolGlobalInt('SUPPLIER_PROPOSAL_ADD_BILLING_CONTACT')); } print ''; */ diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 0785c0da166..d291eafbfe6 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -857,6 +857,7 @@ class Facture extends CommonInvoice $newinvoiceline->fk_facture = $this->id; $newinvoiceline->origin = $this->lines[$i]->element; + $newinvoiceline->origin_type = $this->lines[$i]->element; $newinvoiceline->origin_id = $this->lines[$i]->id; // Auto set date of service ? @@ -4319,25 +4320,25 @@ class Facture extends CommonInvoice return -3; } } - } - $localtaxes_type = getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc); - - if (getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING')) { - $tmpproduct = new Product($this->db); - $result = $tmpproduct->fetch($fk_product); - if (abs($qty) < $tmpproduct->packaging) { - $qty = (float) $tmpproduct->packaging; - setEventMessages($langs->trans('QtyRecalculatedWithPackaging'), null, 'mesgs'); - } else { - if (!empty($tmpproduct->packaging) && $qty > $tmpproduct->packaging) { - $coeff = intval(abs($qty) / $tmpproduct->packaging) + 1; - $qty = price2num((float) $tmpproduct->packaging * $coeff, 'MS'); + if (getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING')) { + $tmpproduct = new Product($this->db); + $result = $tmpproduct->fetch($fk_product); + if (abs($qty) < $tmpproduct->packaging) { + $qty = (float) $tmpproduct->packaging; setEventMessages($langs->trans('QtyRecalculatedWithPackaging'), null, 'mesgs'); + } else { + if (!empty($tmpproduct->packaging) && $qty > $tmpproduct->packaging) { + $coeff = intval(abs($qty) / $tmpproduct->packaging) + 1; + $qty = price2num((float) $tmpproduct->packaging * $coeff, 'MS'); + setEventMessages($langs->trans('QtyRecalculatedWithPackaging'), null, 'mesgs'); + } } } } + $localtaxes_type = getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc); + // Clean vat code $reg = array(); $vat_src_code = ''; diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 5caabaf0156..899519edcee 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -705,9 +705,9 @@ class Conf extends stdClass if (!isset($this->global->FACTURE_TVAOPTION)) { $this->global->FACTURE_TVAOPTION = 1; } - if (!isset($this->global->FAC_FORCE_DATE_VALIDATION)) { - $this->global->FAC_FORCE_DATE_VALIDATION = 1; - } + /*if (!isset($this->global->INVOICE_CHECK_POSTERIOR_DATE)) { + $this->global->INVOICE_CHECK_POSTERIOR_DATE = 1; + }*/ // Variable globales LDAP if (empty($this->global->LDAP_FIELD_FULLNAME)) { diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 68923e65fec..2133155550b 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -782,10 +782,11 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof * @param string $htmlname Name of HTML component. Keep '' or use a different value if you need to use this component several time on the same page for the same field. * @param int $forcenojs Force the component to work as link post (without javascript) instead of ajax call * @param string $moreparam When $forcenojs=1 then we can add more parameters to the backtopage URL. String must url encoded. Example: 'abc=def&fgh=ijk' + * @param int $readonly Use 1 if button not allowed. * @return string html for button on/off * @see ajax_constantonoff() to update that value of a constant */ -function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input = array(), $morecss = '', $htmlname = '', $forcenojs = 0, $moreparam = '') +function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input = array(), $morecss = '', $htmlname = '', $forcenojs = 0, $moreparam = '', $readonly = 0) { global $conf, $langs; @@ -795,7 +796,7 @@ function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input = $out = ''; - if (!empty($conf->use_javascript_ajax) && empty($forcenojs)) { + if (!empty($conf->use_javascript_ajax) && empty($forcenojs) && empty($readonly)) { $out .= '