diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 3a0961cb6d1..9b987cb603c 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -4597,6 +4597,9 @@ class OrderLine extends CommonOrderLine if (empty($this->remise_percent)) { $this->remise_percent = 0; } + if (empty($this->remise)) { + $this->remise = 0; + } if (empty($this->info_bits)) { $this->info_bits = 0; } diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index abf30f2f3ee..7c136f446d9 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -1288,7 +1288,8 @@ abstract class CommonDocGenerator } $extrafields = $this->extrafieldsCache; - $extrafieldOutputContent = $extrafields->showOutputField($extrafieldKey, $object->array_options[$extrafieldOptionsKey], '', $object->table_element); + $extrafieldOutputContent = ''; + if (isset($object->array_options[$extrafieldOptionsKey])) $extrafieldOutputContent = $extrafields->showOutputField($extrafieldKey, $object->array_options[$extrafieldOptionsKey], '', $object->table_element); // TODO : allow showOutputField to be pdf public friendly, ex: in a link to object, clean getNomUrl to remove link and images... like a getName methode ... if ($extrafields->attributes[$object->table_element]['type'][$extrafieldKey] == 'link') { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e9c1dbc546a..8920445508a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8047,7 +8047,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__AMOUNT_TEXT__'] = is_object($object) ? dol_convertToWord($object->total_ttc, $outputlangs, '', true) : ''; $substitutionarray['__AMOUNT_TEXTCURRENCY__'] = is_object($object) ? dol_convertToWord($object->total_ttc, $outputlangs, $conf->currency, true) : ''; - $substitutionarray['__AMOUNT_REMAIN__'] = is_object($object) ? $object->total_ttc - $already_payed_all : ''; + $substitutionarray['__AMOUNT_REMAIN__'] = is_object($object) ? price2num($object->total_ttc - $already_payed_all, 'MT') : ''; $substitutionarray['__AMOUNT_VAT__'] = is_object($object) ? (isset($object->total_vat) ? $object->total_vat : $object->total_tva) : ''; $substitutionarray['__AMOUNT_VAT_TEXT__'] = is_object($object) ? (isset($object->total_vat) ? dol_convertToWord($object->total_vat, $outputlangs, '', true) : dol_convertToWord($object->total_tva, $outputlangs, '', true)) : ''; diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index b2b6424f5ed..237aa4305bf 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -832,7 +832,7 @@ class pdf_espadon extends ModelePdfExpedition $totalToShip = $tmparray['toship']; // Set trueVolume and volume_units not currently stored into database if ($object->trueWidth && $object->trueHeight && $object->trueDepth) { - $object->trueVolume = price(($object->trueWidth * $object->trueHeight * $object->trueDepth), 0, $outputlangs, 0, 0); + $object->trueVolume = $object->trueWidth * $object->trueHeight * $object->trueDepth; $object->volume_units = $object->size_units * 3; } diff --git a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php index 226c9dc6efa..2fdf9828aff 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -567,7 +567,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders // Total HT line if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN)) { - $total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs); + $total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails); $pdf->SetXY($this->postotalht, $curY); $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3, $total_excl_tax, 0, 'R', 0); } diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php index 84b051d24f3..2393524e572 100644 --- a/htdocs/core/tpl/card_presend.tpl.php +++ b/htdocs/core/tpl/card_presend.tpl.php @@ -40,7 +40,7 @@ if ($action == 'presend') { $titreform = 'SendMail'; $object->fetch_projet(); - + if (!isset($file)) $file = null; $ref = dol_sanitizeFileName($object->ref); if (!in_array($object->element, array('user', 'member'))) { //$fileparams['fullname'] can be filled from the card @@ -57,7 +57,7 @@ if ($action == 'presend') { } } - $file = $fileparams['fullname']; + $file = isset($fileparams['fullname'])?$fileparams['fullname']:null; } // Define output language diff --git a/htdocs/don/card.php b/htdocs/don/card.php index 459c892a1d9..ec22c82543f 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -52,7 +52,7 @@ $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); - +$socid = GETPOST('socid', 'int'); $amount = price2num(GETPOST('amount', 'alphanohtml'), 'MT'); $donation_date = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); $projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0); @@ -63,6 +63,13 @@ if ($id > 0 || $ref) { $object->fetch($id, $ref); } +if (!empty($socid) && $socid > 0) { + $soc = new Societe($db); + if ($socid > 0) { + $soc->fetch($socid); + } +} + $extrafields = new ExtraFields($db); // fetch optionals attributes and labels diff --git a/htdocs/don/list.php b/htdocs/don/list.php index 1e96277025d..eb487be4768 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -60,6 +60,7 @@ $search_status = (GETPOST("search_status", 'intcomma') != '') ? GETPOST("search_ $search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $search_ref = GETPOST('search_ref', 'alpha'); $search_company = GETPOST('search_company', 'alpha'); +$search_thirdparty = GETPOST('search_thirdparty', 'alpha'); $search_name = GETPOST('search_name', 'alpha'); $search_amount = GETPOST('search_amount', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha'); @@ -72,6 +73,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_all = ""; $search_ref = ""; $search_company = ""; + $search_thirdparty = ""; $search_name = ""; $search_amount = ""; $search_status = ''; diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index ab7b13aba90..cf1a570f04f 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -240,12 +240,9 @@ class EcmFiles extends CommonObject } // If ref not defined - $ref = ''; - if (!empty($this->ref)) { - $ref = $this->ref; - } else { + if (empty($this->ref)) { include_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php'; - $ref = dol_hash($this->filepath.'/'.$this->filename, 3); + $this->ref = dol_hash($this->filepath.'/'.$this->filename, 3); } $maxposition = 0; @@ -300,7 +297,7 @@ class EcmFiles extends CommonObject $sql .= 'src_object_type,'; $sql .= 'src_object_id'; $sql .= ') VALUES ('; - $sql .= " '".$this->db->escape($ref)."', "; + $sql .= " '".$this->db->escape($this->ref)."', "; $sql .= ' '.(!isset($this->label) ? 'NULL' : "'".$this->db->escape($this->label)."'").','; $sql .= ' '.(!isset($this->share) ? 'NULL' : "'".$this->db->escape($this->share)."'").','; $sql .= ' '.((int) $this->entity).','; diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index 9c149cb5f92..8964213f83d 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -1331,7 +1331,7 @@ class FactureFournisseurRec extends CommonInvoice // We refresh the object in order to have all necessary data (like date_lim_reglement) $new_fac_fourn->fetch($new_fac_fourn->id); $result = $new_fac_fourn->generateDocument($facturerec->model_pdf, $langs); - if ($result <= 0) { + if ($result < 0) { $this->errors = $new_fac_fourn->errors; $this->error = $new_fac_fourn->error; $error++; diff --git a/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php b/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php index 192a39c9b06..e2e9fb5f899 100644 --- a/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php @@ -46,7 +46,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { ?> trans("SupplierOrder"); ?> - trans("ShowOrder"), "order").' '.$objectlink->ref; ?> + getNomUrl(1); ?> ref_supplier; ?> date, 'day'); ?> rights->margins->read->all) { + $agentid = GETPOST('agentid', 'int'); +} else { + $agentid = $user->id; +} if (!$sortfield) { if ($agentid > 0) { $sortfield = "s.nom"; @@ -74,11 +79,6 @@ if (!empty($enddatemonth)) { } // Security check -if ($user->rights->margins->read->all) { - $agentid = GETPOST('agentid', 'int'); -} else { - $agentid = $user->id; -} $result = restrictedArea($user, 'margins'); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context @@ -317,7 +317,8 @@ if ($result) { $sortfield = 'name'; } $group_list = dol_sort_array($group_list, $sortfield, $sortorder); - + $cumul_achat = 0; + $cumul_vente = 0; foreach ($group_list as $group_id => $group_array) { $pa = $group_array['buying_price']; $pv = $group_array['selling_price']; diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index c4b2d502d3d..4f2b91a51e7 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1033,6 +1033,7 @@ if ($source == 'order') { $amount = price2num($amount); } + $tag = ''; if (GETPOST('fulltag', 'alpha')) { $fulltag = GETPOST('fulltag', 'alpha'); } else { diff --git a/htdocs/public/payment/paymentko.php b/htdocs/public/payment/paymentko.php index 2504260cbc5..4174267a769 100644 --- a/htdocs/public/payment/paymentko.php +++ b/htdocs/public/payment/paymentko.php @@ -174,7 +174,7 @@ if (!empty($_SESSION['ipaddress'])) { // To avoid to make action twice $companylangs->setDefaultLang($mysoc->default_lang); $companylangs->loadLangs(array('main', 'members', 'bills', 'paypal', 'paybox')); - $from = $conf->global->MAILING_EMAIL_FROM; + $from = !empty($conf->global->MAILING_EMAIL_FROM) ? $conf->global->MAILING_EMAIL_FROM : getDolGlobalString("MAIN_MAIL_EMAIL_FROM"); $sendto = $sendemail; $urlback = $_SERVER["REQUEST_URI"]; diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 3bfdfc5f089..4a13de1ef7f 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -1327,7 +1327,9 @@ if ($ispaymentok) { if ($attendeetovalidate->email_company && $attendeetovalidate->email_company != $thirdparty->email) { $cc = ($cc ? ', ' : '').$attendeetovalidate->email_company; } - $from = $conf->global->MAILING_EMAIL_FROM; + + $from = !empty($conf->global->MAILING_EMAIL_FROM) ? $conf->global->MAILING_EMAIL_FROM : getDolGlobalString("MAIN_MAIL_EMAIL_FROM"); + $urlback = $_SERVER["REQUEST_URI"]; $ishtml = dol_textishtml($texttosend); // May contain urls @@ -1628,7 +1630,7 @@ if ($ispaymentok) { $companylangs->loadLangs(array('main', 'members', 'bills', 'paypal', 'paybox')); $sendto = $sendemail; - $from = $conf->global->MAILING_EMAIL_FROM; + $from = !empty($conf->global->MAILING_EMAIL_FROM) ? $conf->global->MAILING_EMAIL_FROM : getDolGlobalString("MAIN_MAIL_EMAIL_FROM"); // Define $urlwithroot $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file @@ -1756,7 +1758,7 @@ if ($ispaymentok) { $companylangs->loadLangs(array('main', 'members', 'bills', 'paypal', 'paybox')); $sendto = $sendemail; - $from = $conf->global->MAILING_EMAIL_FROM; + $from = !empty($conf->global->MAILING_EMAIL_FROM) ? $conf->global->MAILING_EMAIL_FROM : getDolGlobalString("MAIN_MAIL_EMAIL_FROM"); // Define $urlwithroot $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file