diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 29f825ea10f29fbe0d40b511ae1adaa8adc3d5c7..fc2916912a5553aa76e452907e2bf30e4f1e5af0 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -943,8 +943,8 @@ if (empty($reshook)) // Define vat_rate $vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); $vat_rate = str_replace('*', '', $vat_rate); - $localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty); - $localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty); + $localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty, $mysoc); + $localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty, $mysoc); $pu_ht = GETPOST('price_ht'); // Add buying price diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 34b9630ef8d8822fd565f237c0c30bf5f282a8ef..af46db14d9a4afd37ec47e1a8ffb7928f2b175e9 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -590,7 +590,7 @@ class Propal extends CommonObject { global $mysoc; - dol_syslog(get_class($this)."::updateLine $rowid, $pu, $qty, $remise_percent, $txtva, $desc, $price_base_type, $info_bits"); + dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise_percent=$remise_percent, txtva=$txtva, desc=$desc, price_base_type=$price_base_type, info_bits=$info_bits, special_code=$special_code, fk_parent_line=$fk_parent_line, pa_ht=$a_ht, type=$type, date_start=$date_start, date_end=$date_end"); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; // Clean parameters @@ -615,7 +615,7 @@ class Propal extends CommonObject $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty,$mysoc); - $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type,'', $localtaxes_type); + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; @@ -709,7 +709,8 @@ class Propal extends CommonObject } else { - $this->error=$this->db->error(); + $this->error=$this->line->error; + $this->db->rollback(); return -1; } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index a4d6d8d3a37431e17ac5366df912861d01d52faa..1c0c72f07e5baca4bed2f5c096fa830a34b2f65b 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -545,7 +545,8 @@ if (empty($reshook)) } // Add a new line - else if ($action == 'addline' && $user->rights->commande->creer) { + else if ($action == 'addline' && $user->rights->commande->creer) + { $langs->load('errors'); $error = 0; @@ -805,7 +806,7 @@ if (empty($reshook)) /* * Update a line */ - else if ($action == 'updateline' && $user->rights->commande->creer && GETPOST('save') == $langs->trans('Save')) + else if ($action == 'updateline' && $user->rights->commande->creer && GETPOST('save')) { // Clean parameters $date_start=''; @@ -821,10 +822,10 @@ if (empty($reshook)) if (preg_match('/\*/', $vat_rate)) $info_bits |= 0x01; - // Define vat_rate + // Define vat_rate $vat_rate = str_replace('*', '', $vat_rate); - $localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty); - $localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty); + $localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty, $mysoc); + $localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty, $mysoc); // Add buying price $fournprice = (GETPOST('fournprice') ? GETPOST('fournprice') : ''); @@ -841,6 +842,10 @@ if (empty($reshook)) } } + // Define special_code for special lines + $special_code=GETPOST('special_code'); + if (! GETPOST('qty')) $special_code=3; + // Check minimum price $productid = GETPOST('productid', 'int'); if (! empty($productid)) { @@ -871,7 +876,7 @@ if (empty($reshook)) } if (! $error) { - $result = $object->updateline(GETPOST('lineid'), $description, $pu_ht, GETPOST('qty'), GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $date_start, $date_end, $type, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, 0, $array_options, GETPOST('units')); + $result = $object->updateline(GETPOST('lineid'), $description, $pu_ht, GETPOST('qty'), GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $date_start, $date_end, $type, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, GETPOST('units')); if ($result >= 0) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 333a68166a1b291ca0c5bfba7b6b6b2ff5d09d45..96e41962f9bb6cedc39fab1a323f13654fc52702 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2436,7 +2436,7 @@ class Commande extends CommonOrder { global $conf, $mysoc; - dol_syslog(get_class($this)."::updateline $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $date_start, $date_end, $type"); + dol_syslog(get_class($this)."::updateline id=$rowid, desc=$desc, pu=$pu, qty=$qty, remise_percent=$remise_percent, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, price_base_type=$price_base_type, info_bits=$info_bits, date_start=$date_start, date_end=$date_end, type=$type, fk_parent_line=$fk_parent_line, pa_ht=$pa_ht, special_code=$special_code"); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; if (! empty($this->brouillon)) @@ -2468,7 +2468,7 @@ class Commande extends CommonOrder $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty, $mysoc); - $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, '', $localtaxes_type); + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 5541c726d642845da62ddb806ed12dbd52e7585b..666620f016e6af069c782c4b65aa8a72fa6ad056 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1484,7 +1484,7 @@ if (empty($reshook)) if (preg_match('/\*/', $vat_rate)) $info_bits |= 0x01; - // Define vat_rate + // Define vat_rate $vat_rate = str_replace('*', '', $vat_rate); $localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty); $localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty); @@ -1505,6 +1505,10 @@ if (empty($reshook)) } } + // Define special_code for special lines + $special_code=GETPOST('special_code'); + if (! GETPOST('qty')) $special_code=3; + $line = new FactureLigne($db); $line->fetch(GETPOST('lineid')); $percent = $line->get_prev_progress(); @@ -1557,7 +1561,7 @@ if (empty($reshook)) if (! $error) { $result = $object->updateline(GETPOST('lineid'), $description, $pu_ht, $qty, GETPOST('remise_percent'), $date_start, $date_end, $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $type, - GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, 0, $array_options, GETPOST('progress'), + GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, GETPOST('progress'), $_POST['units']); if ($result >= 0) { diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 739135b9809ed340c61546a89a405172e8d79184..59acd0b81f26f41655dee8d934b10ccc0fe2dede 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2293,7 +2293,7 @@ class Facture extends CommonInvoice global $mysoc; - dol_syslog(get_class($this)."::updateline $rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $type, $fk_parent_line, $fk_unit", LOG_DEBUG); + dol_syslog(get_class($this)."::updateline rowid=$rowid, desc=$desc, pu=$pu, qty=$qty, remise_percent=$remise_percent, date_start=$date_start, date_end=$date_end, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, price_base_type=$price_base_type, info_bits=$info_bits, type=$type, fk_parent_line=$fk_parent_line pa_ht=$pa_ht, special_code=$special_code fk_unit=$fk_unit", LOG_DEBUG); if ($this->brouillon) { @@ -2322,7 +2322,8 @@ class Facture extends CommonInvoice $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty, $mysoc); - $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type,'',$localtaxes_type, $situation_percent); + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, $situation_percent); + $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 94ea025879abb91c3a54f52cbfd90040e7e3811a..47810e204bdf995685dd80b64785160690f4cbb2 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -209,8 +209,7 @@ class HookManager // TODO dead code to remove (do not enable this, but fix hook instead): result must not be a string. we must use $actionclassinstance->resprints to return a string if (! is_array($result) && ! is_numeric($result)) { - //print 'Error: Bug into module '.get_class($actionclassinstance).' hook must not return a string but an int and set string into ->resprints'; - dol_syslog('Error: Bug into module '.get_class($actionclassinstance).' hook must not return a string but an int and set string into ->resprints', LOG_ERR); + dol_syslog('Error: Bug into hook '.$method.' of module class '.get_class($actionclassinstance).'. Method must not return a string but an int (0=OK, 1=Replace, -1=KO) and set string into ->resprints', LOG_ERR); if (empty($actionclassinstance->resprints)) { $this->resPrint.=$result; $result=0; } } } diff --git a/htdocs/core/modules/expedition/modules_expedition.php b/htdocs/core/modules/expedition/modules_expedition.php index a2437d5001f476d2d16326a47db3e6cdbb0ca874..0300d380fe8b2fd697cc7de8b51732f8d8df0913 100644 --- a/htdocs/core/modules/expedition/modules_expedition.php +++ b/htdocs/core/modules/expedition/modules_expedition.php @@ -143,14 +143,17 @@ abstract class ModelNumRefExpedition } /** - * Cree un bon d'expedition sur disque + * Create a document onto disk according to template module. * - * @param DoliDB $db Objet base de donnee - * @param Expedition $object Object expedition - * @param string $modele Force le modele a utiliser ('' to not force) - * @param Translate $outputlangs Objet lang a utiliser pour traduction - * @return int <=0 if KO, >0 if OK - * @deprecated Use the new function generateDocument of Expedition class + * @param DoliDB $db Objet base de donnee + * @param Object $object Object expedition + * @param string $modele Force le modele a utiliser ('' to not force) + * @param Translate $outputlangs Objet lang a utiliser pour traduction + * @param int $hidedetails Hide details of lines + * @param int $hidedesc Hide description + * @param int $hideref Hide ref + * @return int 1 if OK -1 if KO + * @deprecated Use the new function generateDocument of Expedition class */ function expedition_pdf_create(DoliDB $db, Expedition $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) { diff --git a/htdocs/core/modules/modContrat.class.php b/htdocs/core/modules/modContrat.class.php index 113db82c38fec415c42a7e349334f261a03eeb2e..daf8d4da537c5463bf3a82b5223f9d6a927a0aaa 100644 --- a/htdocs/core/modules/modContrat.class.php +++ b/htdocs/core/modules/modContrat.class.php @@ -41,7 +41,7 @@ class modContrat extends DolibarrModules */ function __construct($db) { - global $conf, $langs; + global $conf; $this->db = $db; $this->numero = 54; @@ -118,12 +118,10 @@ class modContrat extends DolibarrModules // Exports //-------- - $langs->load("contracts"); - $r=1; $this->export_code[$r]=$this->rights_class.'_'.$r; - $this->export_label[$r]=$langs->trans('ContractsAndLine'); // Translation key (used only if key ExportDataset_xxx_z not found) + $this->export_label[$r]='ContractsAndLine'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_icon[$r]='contract'; $this->export_permission[$r]=array(array("contrat","export")); $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode', diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 00c1c61ed575c383e77c2f59b16015252a4bf9ed..c519a0adff365ad8577d958f9b6409dddb3f7bea 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr> - * Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es> + * Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr> * @@ -169,28 +169,60 @@ class pdf_azur extends ModelePDFPropales $realpatharray=array(); if (! empty($conf->global->MAIN_GENERATE_PROPOSALS_WITH_PICTURE)) { + $objphoto = new Product($this->db); + for ($i = 0 ; $i < $nblignes ; $i++) { if (empty($object->lines[$i]->fk_product)) continue; - $objphoto = new Product($this->db); $objphoto->fetch($object->lines[$i]->fk_product); - $pdir = get_exdir($object->lines[$i]->fk_product,2) . $object->lines[$i]->fk_product ."/photos/"; - $dir = $conf->product->dir_output.'/'.$pdir; + if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) + { + $pdir[0] = get_exdir($objphoto->id,2) . $objphoto->id ."/photos/"; + $pdir[1] = dol_sanitizeFileName($objphoto->ref).'/'; + } + else + { + $pdir[0] = dol_sanitizeFileName($objphoto->ref).'/'; + $pdir[1] = get_exdir($objphoto->id,2) . $objphoto->id ."/photos/"; + } - $realpath=''; - foreach ($objphoto->liste_photos($dir,1) as $key => $obj) + $arephoto = false; + foreach ($pdir as $midir) { - $filename=$obj['photo']; - //if ($obj['photo_vignette']) $filename='thumbs/'.$obj['photo_vignette']; - $realpath = $dir.$filename; - break; + if (! $arephoto) + { + $dir = $conf->product->dir_output.'/'.$midir; + + foreach ($objphoto->liste_photos($dir,1) as $key => $obj) + { + if (empty($conf->global->CAT_HIGH_QUALITY_IMAGES)) // If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo + { + if ($obj['photo_vignette']) + { + $filename= $obj['photo_vignette']; + } + else + { + $filename=$obj['photo']; + } + } + else + { + $filename=$obj['photo']; + } + + $realpath = $dir.$filename; + $arephoto = true; + } + } } - if ($realpath) $realpatharray[$i]=$realpath; + if ($realpath && $arephoto) $realpatharray[$i]=$realpath; } } + if (count($realpatharray) == 0) $this->posxpicture=$this->posxtva; if ($conf->propal->dir_output) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index e47261f5958bee8715d8df79a047d509f904ec3c..41def896ac0f585351a3971acab94473e3c13a3d 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1639,7 +1639,7 @@ class Expedition extends CommonObject } /** - * Create a document onto disk accordign to template module. + * Create a document onto disk according to template module. * * @param string $modele Force the model to using ('' to not force) * @param Translate $outputlangs object lang to use for translations diff --git a/htdocs/langs/fr_FR/categories.lang b/htdocs/langs/fr_FR/categories.lang index 5836c7725f819d8b0a5fd95b15c0267d289afd18..65943bd8c2af0c5e74cc65aaf0b4475ac45d9d1a 100644 --- a/htdocs/langs/fr_FR/categories.lang +++ b/htdocs/langs/fr_FR/categories.lang @@ -74,12 +74,12 @@ SuppliersCategoryShort=Tags/catégories de fournisseurs CustomersCategoryShort=Tags/catégories de clients ProductsCategoryShort=Tags/catégories de produits MembersCategoryShort=Tags/catégories de membres -SuppliersCategoriesShort=Tags/catégories de fournisseurs +SuppliersCategoriesShort=Tags fournisseurs CustomersCategoriesShort=Tags/catégories de clients CustomersProspectsCategoriesShort=Tags clients/prosp. ProductsCategoriesShort=Tags/catégories de produits MembersCategoriesShort=Tags/catégories de membres -ContactCategoriesShort=Tags/catégories de contacts +ContactCategoriesShort=Tags de contacts ThisCategoryHasNoProduct=Ce tag/catégorie ne contient aucun produit. ThisCategoryHasNoSupplier=Ce tag/catégorie ne contient aucun fournisseur. ThisCategoryHasNoCustomer=Ce tag/catégorie ne contient aucun client. diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 9e25415b47fc8e49d9ec2bd73c1517b8521e03fe..d79d7a008d43e1fdd6e703087416de96673febf6 100755 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1537,7 +1537,6 @@ class Product extends CommonObject else if ($ref_ext) $sql.= " AND ref_ext = '".$this->db->escape($ref_ext)."'"; } - dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql = $this->db->query($sql); if ( $resql ) {