From ef4831d119ca096fd7e86befe3016dddc53925c3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Sep 2012 11:46:50 +0200 Subject: [PATCH 01/28] Solved FIXME. I keep the code but commented, to keep source the more similar as possible than invoices. --- .../modules/propale/doc/pdf_azur.modules.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 6a479426012..e4bed7e2883 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -147,7 +147,7 @@ class pdf_azur extends ModelePDFPropales { $object->fetch_thirdparty(); - $deja_regle = ""; // FIXME not use in proposal? + // $deja_regle = 0; // Definition of $dir and $file if ($object->specimen) @@ -395,10 +395,12 @@ class pdf_azur extends ModelePDFPropales $posy=$this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); // Affiche zone versements + /* if ($deja_regle) { - $posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs); // FIXME not use in proposal? + $posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs); } + */ // Pied de page $this->_pagefoot($pdf,$object,$outputlangs); @@ -795,9 +797,11 @@ class pdf_azur extends ModelePDFPropales $pdf->SetTextColor(0,0,0); - $resteapayer = $object->total_ttc - $deja_regle; // FIXME not use in proposal? - if (! empty($object->paye)) $resteapayer=0; // FIXME not use in proposal? - + /* + $resteapayer = $object->total_ttc - $deja_regle; + if (! empty($object->paye)) $resteapayer=0; + */ + if ($deja_regle > 0) { $index++; @@ -808,7 +812,7 @@ class pdf_azur extends ModelePDFPropales $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle), 0, 'R', 0); - // FIXME not use in proposal? + /* if ($object->close_code == 'discount_vat') { $index++; @@ -822,6 +826,7 @@ class pdf_azur extends ModelePDFPropales $resteapayer=0; } + */ $index++; $pdf->SetTextColor(0,0,60); From 7167edb244ad394a4ff3195a93e761956146b418 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Sep 2012 16:00:41 +0200 Subject: [PATCH 02/28] Fix: Comment to avoid bug --- htdocs/user/index.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/user/index.php b/htdocs/user/index.php index 4d85ff977b1..b97f8809e9c 100644 --- a/htdocs/user/index.php +++ b/htdocs/user/index.php @@ -138,8 +138,9 @@ if ($result) } else { - $mc->getInfo($obj->entity); - print $mc->label; + // FIXME Should add here a hook. Disabled for the moment because $mc is not defined. + //$mc->getInfo($obj->entity); + //print $mc->label; } } else if ($obj->ldap_sid) @@ -172,7 +173,7 @@ else dol_print_error($db); } -$db->close(); - llxFooter(); + +$db->close(); ?> From c42cf7ce7888450b87c116f232332249680a7e11 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 17 Sep 2012 16:16:48 +0200 Subject: [PATCH 03/28] Fix: broken features --- htdocs/user/index.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/user/index.php b/htdocs/user/index.php index b97f8809e9c..9ac5afd50aa 100644 --- a/htdocs/user/index.php +++ b/htdocs/user/index.php @@ -81,9 +81,9 @@ else if (!empty($socid)) $sql.= " AND u.fk_societe = ".$socid; if ($search_user) { - $sql.= " AND (u.login like '%".$search_user."%' OR u.name like '%".$search_user."%' OR u.firstname like '%".$search_user."%')"; + $sql.= " AND (u.login LIKE '%".$search_user."%' OR u.name LIKE '%".$search_user."%' OR u.firstname LIKE '%".$search_user."%')"; } -if ($sall) $sql.= " AND (u.login like '%".$db->escape($sall)."%' OR u.name like '%".$db->escape($sall)."%' OR u.firstname like '%".$db->escape($sall)."%' OR u.email like '%".$db->escape($sall)."%' OR u.note like '%".$db->escape($sall)."%')"; +if ($sall) $sql.= " AND (u.login LIKE '%".$db->escape($sall)."%' OR u.name LIKE '%".$db->escape($sall)."%' OR u.firstname LIKE '%".$db->escape($sall)."%' OR u.email LIKE '%".$db->escape($sall)."%' OR u.note LIKE '%".$db->escape($sall)."%')"; $sql.=$db->order($sortfield,$sortorder); $result = $db->query($sql); @@ -130,6 +130,7 @@ if ($result) $companystatic->canvas=$obj->canvas; print $companystatic->getNomUrl(1); } + // Multicompany enabled else if (! empty($conf->multicompany->enabled)) { if (! $obj->entity) @@ -138,9 +139,10 @@ if ($result) } else { - // FIXME Should add here a hook. Disabled for the moment because $mc is not defined. - //$mc->getInfo($obj->entity); - //print $mc->label; + // $mc is defined in conf.class.php if multicompany enabled. + // remove constante MAIN_MODULE_MULTICOMPANY if you have an error. + $mc->getInfo($obj->entity); + print $mc->label; } } else if ($obj->ldap_sid) From dc7100677a027fa58e385b6448e35b683160d95d Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 17 Sep 2012 16:28:37 +0200 Subject: [PATCH 04/28] Fix: avoid warning if no object --- htdocs/core/lib/functions.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 5826e248b13..3483635c944 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4003,7 +4003,7 @@ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode= if (verifCond($values[4])) { if ($values[3]) $langs->load($values[3]); - $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[5]),1); + $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i', (! empty($object->id)?$object->id:''), $values[5]), 1); $head[$h][1] = $langs->trans($values[2]); $head[$h][2] = str_replace('+','',$values[1]); $h++; @@ -4013,7 +4013,7 @@ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode= { if ($values[0] != $type) continue; if ($values[3]) $langs->load($values[3]); - $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[4]),1); + $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i', (! empty($object->id)?$object->id:''), $values[4]), 1); $head[$h][1] = $langs->trans($values[2]); $head[$h][2] = str_replace('+','',$values[1]); $h++; @@ -4022,7 +4022,7 @@ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode= { if ($values[0] != $type) continue; if ($values[2]) $langs->load($values[2]); - $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[3]),1); + $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i', (! empty($object->id)?$object->id:''), $values[3]), 1); $head[$h][1] = $langs->trans($values[1]); $head[$h][2] = 'tab'.$values[1]; $h++; From 58ae3b9372c73c6235accdd3b33c3393ba69e810 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 17 Sep 2012 19:32:45 +0200 Subject: [PATCH 05/28] Fix: possibility to disable hook --- htdocs/core/lib/files.lib.php | 51 ++++++++++++++++-------------- htdocs/core/lib/functions2.lib.php | 2 +- htdocs/societe/soc.php | 2 +- 3 files changed, 29 insertions(+), 26 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index b020febd3b0..31fc5073fbe 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -47,25 +47,16 @@ function dol_basename($pathfile) * @param string $sortcriteria Sort criteria ("","fullname","name","date","size") * @param string $sortorder Sort order (SORT_ASC, SORT_DESC) * @param int $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower), 2=Force load of date only, 3=Force load of size only + * @param int $nohook Disable all hooks * @return array Array of array('name'=>'xxx','fullname'=>'/abc/xxx','date'=>'yyy','size'=>99,'type'=>'dir|file') */ -function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter="", $sortcriteria="name", $sortorder=SORT_ASC, $mode=0) +function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter="", $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=false) { global $db, $hookmanager; global $object; dol_syslog("files.lib.php::dol_dir_list path=".$path." types=".$types." recursive=".$recursive." filter=".$filter." excludefilter=".json_encode($excludefilter)); - if (! is_object($hookmanager)) - { - if (! class_exists('HookManager')) { - // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array - require DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; - $hookmanager=new HookManager($db); - } - } - $hookmanager->initHooks(array('fileslib')); - $loaddate=($mode==1||$mode==2)?true:false; $loadsize=($mode==1||$mode==3)?true:false; @@ -73,23 +64,35 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil $path=preg_replace('/([\\/]+)$/i','',$path); $newpath=dol_osencode($path); - $parameters=array( - 'path' => $newpath, - 'types'=> $types, - 'recursive' => $recursive, - 'filter' => $filter, - 'excludefilter' => $excludefilter, - 'sortcriteria' => $sortcriteria, - 'sortorder' => $sortorder, - 'loaddate' => $loaddate, - 'loadsize' => $loadsize - ); - $reshook=$hookmanager->executeHooks('getNodesList', $parameters, $object); + if (! $nohook) { + if (! is_object($hookmanager)) + { + if (! class_exists('HookManager')) { + // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array + require DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager=new HookManager($db); + } + } + $hookmanager->initHooks(array('fileslib')); + + $parameters=array( + 'path' => $newpath, + 'types'=> $types, + 'recursive' => $recursive, + 'filter' => $filter, + 'excludefilter' => $excludefilter, + 'sortcriteria' => $sortcriteria, + 'sortorder' => $sortorder, + 'loaddate' => $loaddate, + 'loadsize' => $loadsize + ); + $reshook=$hookmanager->executeHooks('getNodesList', $parameters, $object); + } // $reshook may contain returns stacked by other modules // $reshook is always empty with an array for can not lose returns stacked with other modules // $hookmanager->resArray may contain array stacked by other modules - if (! empty($hookmanager->resArray)) // forced to use $hookmanager->resArray even if $hookmanager->resArray['nodes'] is empty + if (! $nohook && ! empty($hookmanager->resArray)) // forced to use $hookmanager->resArray even if $hookmanager->resArray['nodes'] is empty { return $hookmanager->resArray['nodes']; } diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index c63360a07ad..38456afc255 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1230,7 +1230,7 @@ function getListOfModels($db,$type,$maxfilenamelength=0) if (! $tmpdir) { unset($listofdir[$key]); continue; } if (is_dir($tmpdir)) { - $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.odt'); + $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.odt','','name',SORT_ASC,0,true); // Disable hook for the moment if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles); } } diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 3c26f9af46d..2a5650aad91 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -1817,7 +1817,7 @@ else $var=true; - $somethingshown=$formfile->show_documents('company',$object->id,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang); + $somethingshown=$formfile->show_documents('company',$object->id,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang,$hookmanager); print ''; print ''; From 8bab5fdadd77dadabd02bd68a38b06e9f91c1df0 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 17 Sep 2012 19:33:44 +0200 Subject: [PATCH 06/28] Fix: convert line delimiters --- htdocs/core/lib/functions.lib.php | 6 +++--- .../modules/commande/doc/pdf_einstein.modules.php | 6 +++--- .../doc/pdf_expedition_rouget.modules.php | 6 +++--- .../core/modules/facture/doc/pdf_crabe.modules.php | 2 +- .../modules/fichinter/doc/pdf_soleil.modules.php | 14 +++++++------- .../modules/livraison/pdf/pdf_sirocco.modules.php | 6 +++--- .../modules/livraison/pdf/pdf_typhon.modules.php | 6 +++--- .../core/modules/propale/doc/pdf_azur.modules.php | 6 +++--- .../societe/doc/doc_generic_odt.modules.php | 2 +- .../supplier_invoice/pdf/pdf_canelle.modules.php | 6 +++--- .../supplier_order/pdf/pdf_muscadet.modules.php | 6 +++--- 11 files changed, 33 insertions(+), 33 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 3483635c944..1a4aa60a012 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3419,10 +3419,10 @@ function dol_textishtml($msg,$option=0) function dol_concatdesc($text1,$text2,$forxml=false) { $ret=''; - $ret.= (! dol_textishtml($text1) && dol_textishtml($text2))?dol_nl2br($text1, 0, $forxml):$text1; - $ret.= (! empty($text1) && ! empty($text2)) ? ((dol_textishtml($text1) || dol_textishtml($text2))?($forxml?"
\n":"
\n") : "\n") : ""; + $ret.= (! dol_textishtml($text1) && dol_textishtml($text2))?dol_nl2br($text1, 0, $forxml):$text1; + $ret.= (! empty($text1) && ! empty($text2)) ? ((dol_textishtml($text1) || dol_textishtml($text2))?($forxml?"
\n":"
\n") : "\n") : ""; $ret.= (dol_textishtml($text1) && ! dol_textishtml($text2))?dol_nl2br($text2, 0, $forxml):$text2; - return $ret; + return $ret; } /** diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index a39c4a5a4a6..082339490a2 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -261,9 +261,9 @@ class pdf_einstein extends ModelePDFCommandes for ($i = 0 ; $i < $nblignes ; $i++) { $curY = $nexY; - $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage - - $pdf->setTopMargin($tab_top_newpage); + $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage + + $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); diff --git a/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php index 4a28d6d257c..01888689100 100644 --- a/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php @@ -226,9 +226,9 @@ class pdf_expedition_rouget extends ModelePdfExpedition for ($i = 0; $i < $num; $i++) { $curY = $nexY; - $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage - - $pdf->setTopMargin($tab_top_newpage); + $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage + + $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index bbb503b7aa2..08ef7ae767c 100755 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -264,7 +264,7 @@ class pdf_crabe extends ModelePDFFactures for ($i = 0; $i < $nblignes; $i++) { $curY = $nexY; - $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage + $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index d5d05aac1c3..fd3f1242bf3 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -177,7 +177,7 @@ class pdf_soleil extends ModelePDFFicheinter $this->_pagehead($pdf, $object, 1, $outputlangs, $hookmanager); $pdf->SetFont('','', $default_font_size - 1); $pdf->MultiCell(0, 3, ''); // Set interline to 3 - $pdf->SetTextColor(0,0,0); + $pdf->SetTextColor(0,0,0); $tab_top = 90; $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); @@ -245,9 +245,9 @@ class pdf_soleil extends ModelePDFFicheinter if ($valide > 0 || $object->specimen) { $curY = $nexY; - $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage - - $pdf->setTopMargin($tab_top_newpage); + $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage + + $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); @@ -257,7 +257,7 @@ class pdf_soleil extends ModelePDFFicheinter $pdf->writeHTMLCell(0, 0, $curX, $curY, dol_concatdesc($txt,$desc), 0, 1, 0); - $nexY = $pdf->GetY(); + $nexY = $pdf->GetY(); $pageposafter=$pdf->getPage(); $pdf->setPage($pageposbefore); $pdf->setTopMargin($this->marge_haute); @@ -394,8 +394,8 @@ class pdf_soleil extends ModelePDFFicheinter $pdf->SetXY(20,230); $pdf->MultiCell(66,5, $outputlangs->transnoentities("NameAndSignatureOfInternalContact"),0,'L',0); - $pdf->SetXY(20,235); - $pdf->MultiCell(80,25, '', 1); + $pdf->SetXY(20,235); + $pdf->MultiCell(80,25, '', 1); $pdf->SetXY(110,230); $pdf->MultiCell(80,5, $outputlangs->transnoentities("NameAndSignatureOfExternalContact"),0,'L',0); diff --git a/htdocs/core/modules/livraison/pdf/pdf_sirocco.modules.php b/htdocs/core/modules/livraison/pdf/pdf_sirocco.modules.php index ca1d1a937d1..81d13e8cee5 100644 --- a/htdocs/core/modules/livraison/pdf/pdf_sirocco.modules.php +++ b/htdocs/core/modules/livraison/pdf/pdf_sirocco.modules.php @@ -183,9 +183,9 @@ class pdf_sirocco extends ModelePDFDeliveryOrder for ($i = 0 ; $i < $nblines ; $i++) { $curY = $nexY; - $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage - - $pdf->setTopMargin($tab_top_newpage); + $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage + + $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); diff --git a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php index 9cc0de35648..b9cfc5ea909 100644 --- a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php @@ -240,9 +240,9 @@ class pdf_typhon extends ModelePDFDeliveryOrder for ($i = 0 ; $i < $nblines ; $i++) { $curY = $nexY; - $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage - - $pdf->setTopMargin($tab_top_newpage); + $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage + + $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot-50); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index e4bed7e2883..d7e4cd7e538 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -262,9 +262,9 @@ class pdf_azur extends ModelePDFPropales for ($i = 0 ; $i < $nblignes ; $i++) { $curY = $nexY; - $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage - - $pdf->setTopMargin($tab_top_newpage); + $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage + + $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index 7eeddd1f856..058cd1ffab8 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -109,7 +109,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0); else { - $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.odt'); + $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.odt','','name',SORT_ASC,0,true); // Disable hook for the moment if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles); } } diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index 75cd1c17385..01649837213 100755 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -259,9 +259,9 @@ class pdf_canelle extends ModelePDFSuppliersInvoices for ($i = 0 ; $i < $nblignes ; $i++) { $curY = $nexY; - $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage - - $pdf->setTopMargin($tab_top_newpage); + $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage + + $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index a0fe3c05aea..bdd23c5b1da 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -271,9 +271,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders for ($i = 0 ; $i < $nblignes ; $i++) { $curY = $nexY; - $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage - - $pdf->setTopMargin($tab_top_newpage); + $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage + + $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); From 4a98c08a748fb5fe0430de5c5b10e73c388fc002 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Sep 2012 22:05:13 +0200 Subject: [PATCH 07/28] Fix: Use correct date timezone. --- htdocs/core/class/html.formfile.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 07f51ebd72c..ce0a24d6f42 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -479,7 +479,7 @@ class FormFile // Show file date $date=(! empty($file['date'])?$file['date']:dol_filemtime($filedir."/".$file["name"])); - $out.= ''.dol_print_date($date, 'dayhour').''; + $out.= ''.dol_print_date($date, 'dayhour','tzuser').''; if ($delallowed) { @@ -662,7 +662,7 @@ class FormFile print ''; print "\n"; print ''.dol_print_size($file['size'],1,1).''; - print ''.dol_print_date($file['date'],"dayhour").''; + print ''.dol_print_date($file['date'],"dayhour","tzuser").''; // Preview if (empty($useinecm)) { From eb964e6436e8b279168bdf0dd44a1f5215f0a511 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Sep 2012 22:08:41 +0200 Subject: [PATCH 08/28] Fix: Should works for everybody like that --- htdocs/user/index.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/user/index.php b/htdocs/user/index.php index 9ac5afd50aa..f63156c6ce6 100644 --- a/htdocs/user/index.php +++ b/htdocs/user/index.php @@ -140,9 +140,11 @@ if ($result) else { // $mc is defined in conf.class.php if multicompany enabled. - // remove constante MAIN_MODULE_MULTICOMPANY if you have an error. - $mc->getInfo($obj->entity); - print $mc->label; + if (is_object($mc)) + { + $mc->getInfo($obj->entity); + print $mc->label; + } } } else if ($obj->ldap_sid) From 951b98a963ad50d270c08095f0ebf50673333d96 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 18 Sep 2012 09:44:34 +0200 Subject: [PATCH 09/28] add option to select contact type associated to commercial agents for margin and commission modules --- htdocs/commissions/admin/commissions.php | 27 +++++++++++++- htdocs/commissions/index.php | 46 ++++++++++++++---------- htdocs/langs/en_US/commissions.lang | 5 ++- htdocs/langs/en_US/margins.lang | 5 ++- htdocs/langs/fr_FR/commissions.lang | 6 +++- htdocs/langs/fr_FR/margins.lang | 5 +++ htdocs/margin/admin/margin.php | 34 ++++++++++++++++++ htdocs/margin/agentMargins.php | 45 +++++++++++++---------- htdocs/margin/customerMargins.php | 13 ++++--- htdocs/margin/productMargins.php | 13 ++++--- htdocs/margin/tabs/productMargins.php | 17 +++++---- htdocs/margin/tabs/thirdpartyMargins.php | 13 ++++--- 12 files changed, 167 insertions(+), 62 deletions(-) diff --git a/htdocs/commissions/admin/commissions.php b/htdocs/commissions/admin/commissions.php index 66911efc924..e14b97b35b2 100644 --- a/htdocs/commissions/admin/commissions.php +++ b/htdocs/commissions/admin/commissions.php @@ -24,8 +24,11 @@ include '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/commissions/lib/commissions.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'); +require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"); $langs->load("admin"); +$langs->load("bills"); $langs->load("commissions"); if (! $user->admin) accessforbidden(); @@ -68,6 +71,17 @@ if (GETPOST('serviceCommissionRate')) } } +if (GETPOST('AGENT_CONTACT_TYPE')) +{ + if (dolibarr_set_const($db, 'AGENT_CONTACT_TYPE', GETPOST('AGENT_CONTACT_TYPE'), 'chaine', 0, '', $conf->entity) > 0) + { + $conf->global->AGENT_CONTACT_TYPE = GETPOST('AGENT_CONTACT_TYPE'); + } + else + { + dol_print_error($db); + } +} /* * View @@ -145,6 +159,18 @@ print ''; print ''.$langs->trans('ServiceCommissionRateDetails').''; print ''; +// INTERNAL CONTACT TYPE USED AS COMMERCIAL AGENT +$var=!$var; +print ''; +print ''.$langs->trans("AgentContactType").''; +print ''; +$formcompany = new FormCompany($db); +$facture = new Facture($db); +print $formcompany->selectTypeContact($facture, $conf->global->AGENT_CONTACT_TYPE, "AGENT_CONTACT_TYPE","internal","code",1); +print ''; +print ''.$langs->trans('AgentContactTypeDetails').''; +print ''; + $var=!$var; print ''; print ''; @@ -152,7 +178,6 @@ print ''; print ''; print ''; - print ''; print '
'; diff --git a/htdocs/commissions/index.php b/htdocs/commissions/index.php index 0a9c37abb4b..4a68cb8bbd1 100644 --- a/htdocs/commissions/index.php +++ b/htdocs/commissions/index.php @@ -134,44 +134,52 @@ print ''; print ""; print ''; -$sql = "SELECT distinct s.nom, s.rowid as socid, s.code_client, s.client, sc.fk_user as agent,"; +$sql = "SELECT s.nom, s.rowid as socid, s.code_client, s.client, sc.fk_user as agent,"; $sql.= " u.login,"; -$sql.= " f.facnumber, f.total as total_ht,"; if ($conf->global->COMMISSION_BASE == "MARGIN") { $sql.= " sum(case d.product_type when 1 then 0 else (((d.subprice * (1 - d.remise_percent / 100)) - d.buy_price_ht) * d.qty) end) as productBase," ; - $sql.= " sum(case d.product_type when 1 then (((d.subprice * (1 - d.remise_percent / 100)) - d.buy_price_ht) * d.qty) else 0 end) as serviceBase," ; + $sql.= " sum(case d.product_type when 1 then (((d.subprice * (1 - d.remise_percent / 100)) - d.buy_price_ht) * d.qty) else 0 end) as serviceBase" ; } elseif ($conf->global->COMMISSION_BASE == "TURNOVER") { $sql.= " sum(case d.product_type when 1 then 0 else (((d.subprice * (1 - d.remise_percent / 100))) * d.qty) end) as productBase," ; - $sql.= " sum(case d.product_type when 1 then (((d.subprice * (1 - d.remise_percent / 100))) * d.qty) else 0 end) as serviceBase," ; + $sql.= " sum(case d.product_type when 1 then (((d.subprice * (1 - d.remise_percent / 100))) * d.qty) else 0 end) as serviceBase" ; } -$sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."facture as f"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_contact e ON e.element_id = f.rowid and e.statut = 4 and e.fk_c_type_contact = ".(empty($conf->global->AGENT_CONTACT_TYPE)?-1:$conf->global->AGENT_CONTACT_TYPE); $sql.= ", ".MAIN_DB_PREFIX."facturedet as d"; $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ", ".MAIN_DB_PREFIX."user as u"; $sql.= " WHERE f.fk_soc = s.rowid"; $sql.= " AND sc.fk_soc = f.fk_soc"; -$sql.= " AND sc.fk_user = u.rowid"; +if (! empty($conf->global->AGENT_CONTACT_TYPE)) + $sql.= " AND ((e.fk_socpeople IS NULL AND sc.fk_user = u.rowid) OR (e.fk_socpeople IS NOT NULL AND e.fk_socpeople = u.rowid))"; +else + $sql .= " AND sc.fk_user = u.rowid"; if (GETPOST('unpayed') == 'on') $sql.= " AND f.fk_statut > 0"; else $sql.= " AND f.fk_statut > 1"; $sql.= " AND s.entity = ".$conf->entity; $sql.= " AND d.fk_facture = f.rowid"; -if ($agentid > 0) - $sql.= " AND sc.fk_user = $agentid"; +if ($agentid > 0) { + if (! empty($conf->global->AGENT_CONTACT_TYPE)) + $sql.= " AND ((e.fk_socpeople IS NULL AND sc.fk_user = ".$agentid.") OR (e.fk_socpeople IS NOT NULL AND e.fk_socpeople = ".$agentid."))"; + else + $sql .= " AND sc.fk_user = ".$agentid; +} if (!empty($startdate)) $sql.= " AND f.datef >= '".$startdate."'"; if (!empty($enddate)) $sql.= " AND f.datef <= '".$enddate."'"; +if ($conf->global->COMMISSION_BASE == "MARGIN") + $sql .= " AND d.buy_price_ht IS NOT NULL"; if (($conf->global->COMMISSION_BASE == "MARGIN") && isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1) $sql .= " AND d.buy_price_ht <> 0"; if ($agentid > 0) $sql.= " GROUP BY s.rowid"; else - $sql.= " GROUP BY sc.fk_user"; + $sql.= " GROUP BY u.rowid"; $sql.= " ORDER BY $sortfield $sortorder "; //$sql.= $db->plimit($conf->liste_limit +1, $offset); @@ -219,6 +227,7 @@ if ($result) $cumul_base_service = 0; $cumul_commission_produit = 0; $cumul_commission_service = 0; + $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT); if ($num > 0) { $var=True; @@ -260,22 +269,22 @@ if ($result) // total commission print "".price($productCommission + $serviceCommission)."\n"; print "\n"; + $i++; - $cumul_base_produit += $productBase; - $cumul_base_service += $serviceBase; - $cumul_commission_produit += $productCommission; - $cumul_commission_service += $serviceCommission; + + $cumul_base_produit += round($productBase, $rounding); + $cumul_base_service += round($serviceBase, $rounding); + $cumul_commission_produit += round($productCommission, $rounding); + $cumul_commission_service += round($serviceCommission, $rounding); } } // affichage totaux commission $var=!$var; print ''; - if (! empty($client)) - print ''; - else - print ''; - print $langs->trans('TotalCommission').""; + print ''; + print $langs->trans('Total'); + print ""; // product commission print "".price($cumul_base_produit)."\n"; print "".price((! empty($conf->global->PRODUCT_COMMISSION_RATE)?$conf->global->PRODUCT_COMMISSION_RATE:0))."\n"; @@ -289,6 +298,7 @@ if ($result) print "\n"; + print ""; print ""; } else diff --git a/htdocs/langs/en_US/commissions.lang b/htdocs/langs/en_US/commissions.lang index c7690318142..776f4d0c1a1 100644 --- a/htdocs/langs/en_US/commissions.lang +++ b/htdocs/langs/en_US/commissions.lang @@ -38,4 +38,7 @@ CommercialAgent=Commercial agent StartDate=Start date EndDate=End date -Launch=Start \ No newline at end of file +Launch=Start + +AgentContactType=Contact type used for commissioning +AgentContactTypeDetails=Défine what contact type (linked on invoices) will be associated with commercial agents \ No newline at end of file diff --git a/htdocs/langs/en_US/margins.lang b/htdocs/langs/en_US/margins.lang index 09775869a45..41203847ba5 100644 --- a/htdocs/langs/en_US/margins.lang +++ b/htdocs/langs/en_US/margins.lang @@ -46,4 +46,7 @@ MargeNette=Net margin MARGIN_TYPE_DETAILS=Raw margin : Selling price - Buying price
Net margin : Selling price - Cost price BuyingCost=Cost price -UnitCharges=Unit charges \ No newline at end of file +UnitCharges=Unit charges + +AgentContactType=Contact type used for commissioning +AgentContactTypeDetails=Défine what contact type (linked on invoices) will be associated with commercial agents \ No newline at end of file diff --git a/htdocs/langs/fr_FR/commissions.lang b/htdocs/langs/fr_FR/commissions.lang index 2ae2aef2332..5fb83f32320 100644 --- a/htdocs/langs/fr_FR/commissions.lang +++ b/htdocs/langs/fr_FR/commissions.lang @@ -1,6 +1,7 @@ # Dolibarr language file - fr_FR - commissions CHARSET=UTF-8 +Module60000Desc=Gestion des commissions commissionsSetup=Paramétrage de la gestion des commissions ProductCommissionRate=Taux de commissionnement sur les produits @@ -37,4 +38,7 @@ CommercialAgent=Agent commercial StartDate=Date de début EndDate=Date de fin -Launch=Démarrer \ No newline at end of file +Launch=Démarrer + +AgentContactType=Type de contact commissionné +AgentContactTypeDetails=Permet de définir le type de contact associé aux factures qui sera associé aux agents commerciaux \ No newline at end of file diff --git a/htdocs/langs/fr_FR/margins.lang b/htdocs/langs/fr_FR/margins.lang index a08df30498d..02dfedbbe9a 100644 --- a/htdocs/langs/fr_FR/margins.lang +++ b/htdocs/langs/fr_FR/margins.lang @@ -1,6 +1,8 @@ # Dolibarr language file - fr_FR - margins CHARSET=UTF-8 +Module59000Name=Marges +Module59000Desc=Gestion des marges commerciales Margin=Marge Margins=Marges TotalMargin=Marge totale @@ -45,3 +47,6 @@ MARGIN_TYPE_DETAILS=Marge brute : Prix de vente HT - Prix d'achat HT
Marge n BuyingCost=Coût de revient UnitCharges=Charge unitaire + +AgentContactType=Type de contact commissionné +AgentContactTypeDetails=Permet de définir le type de contact associé aux factures qui sera associé aux agents commerciaux \ No newline at end of file diff --git a/htdocs/margin/admin/margin.php b/htdocs/margin/admin/margin.php index dc401d61f45..963b9289acb 100644 --- a/htdocs/margin/admin/margin.php +++ b/htdocs/margin/admin/margin.php @@ -25,8 +25,11 @@ include '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/margin/lib/margins.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'); +require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"); $langs->load("admin"); +$langs->load("bills"); $langs->load("margins"); if (! $user->admin) accessforbidden(); @@ -89,6 +92,18 @@ if ($action == 'typemarges') } } +if ($action == 'contact') +{ + if (dolibarr_set_const($db, 'AGENT_CONTACT_TYPE', $_POST['AGENT_CONTACT_TYPE'], 'chaine', 0, '', $conf->entity) > 0) + { + $conf->global->AGENT_CONTACT_TYPE = $_POST['AGENT_CONTACT_TYPE']; + } + else + { + dol_print_error($db); + } +} + /* * View */ @@ -244,6 +259,25 @@ print ''.$langs->trans('MARGIN_METHODE_FOR_DISCOUNT_DETAILS').''; print ''; print ''; +// INTERNAL CONTACT TYPE USED AS COMMERCIAL AGENT +$var=!$var; +print '
'; +print ''; +print ""; +print ''; +print ''.$langs->trans("AgentContactType").''; +print ''; +$formcompany = new FormCompany($db); +$facture = new Facture($db); +print $formcompany->selectTypeContact($facture, $conf->global->AGENT_CONTACT_TYPE, "AGENT_CONTACT_TYPE","internal","code",1); +print ''; +print ''; +print ''; +print ''; +print ''.$langs->trans('AgentContactTypeDetails').''; +print ''; +print '
'; + print ''; print '
'; diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index 5d7e4d389fe..ece6bd192db 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -118,35 +118,42 @@ if (! empty($conf->global->DISPLAY_MARK_RATES)) { print ""; print ''; -$sql = "SELECT distinct s.nom, s.rowid as socid, s.code_client, s.client, sc.fk_user as agent,"; +$sql = "SELECT s.nom, s.rowid as socid, s.code_client, s.client, sc.fk_user as agent,"; $sql.= " u.login,"; -$sql.= " f.facnumber, f.total as total_ht,"; $sql.= " sum(d.subprice * d.qty * (1 - d.remise_percent / 100)) as selling_price,"; -$sql.= " sum(d.buy_price_ht * d.qty) as buying_price, sum(((d.subprice * (1 - d.remise_percent / 100)) - d.buy_price_ht) * d.qty) as marge," ; -$sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid"; +$sql.= " sum(d.buy_price_ht * d.qty) as buying_price, sum(((d.subprice * (1 - d.remise_percent / 100)) - d.buy_price_ht) * d.qty) as marge" ; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."facture as f"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_contact e ON e.element_id = f.rowid and e.statut = 4 and e.fk_c_type_contact = ".(empty($conf->global->AGENT_CONTACT_TYPE)?-1:$conf->global->AGENT_CONTACT_TYPE); $sql.= ", ".MAIN_DB_PREFIX."facturedet as d"; $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ", ".MAIN_DB_PREFIX."user as u"; $sql.= " WHERE f.fk_soc = s.rowid"; $sql.= " AND sc.fk_soc = f.fk_soc"; -$sql.= " AND sc.fk_user = u.rowid"; +if (! empty($conf->global->AGENT_CONTACT_TYPE)) + $sql.= " AND ((e.fk_socpeople IS NULL AND sc.fk_user = u.rowid) OR (e.fk_socpeople IS NOT NULL AND e.fk_socpeople = u.rowid))"; +else + $sql .= " AND sc.fk_user = u.rowid"; $sql.= " AND f.fk_statut > 0"; $sql.= " AND s.entity = ".$conf->entity; $sql.= " AND d.fk_facture = f.rowid"; -if ($agentid > 0) - $sql.= " AND sc.fk_user = $agentid"; +if ($agentid > 0) { + if (! empty($conf->global->AGENT_CONTACT_TYPE)) + $sql.= " AND ((e.fk_socpeople IS NULL AND sc.fk_user = ".$agentid.") OR (e.fk_socpeople IS NOT NULL AND e.fk_socpeople = ".$agentid."))"; + else + $sql .= " AND sc.fk_user = ".$agentid; +} if (!empty($startdate)) $sql.= " AND f.datef >= '".$startdate."'"; if (!empty($enddate)) $sql.= " AND f.datef <= '".$enddate."'"; +$sql .= " AND d.buy_price_ht IS NOT NULL"; if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1) $sql .= " AND d.buy_price_ht <> 0"; if ($agentid > 0) $sql.= " GROUP BY s.rowid"; else - $sql.= " GROUP BY sc.fk_user"; + $sql.= " GROUP BY u.rowid"; $sql.= " ORDER BY $sortfield $sortorder "; $sql.= $db->plimit($conf->liste_limit +1, $offset); @@ -168,17 +175,19 @@ if ($result) print_liste_field_titre($langs->trans("CommercialAgent"),$_SERVER["PHP_SELF"],"u.login","","&agentid=".$agentid,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buyng_price","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buying_price","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder); if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"d.marge_tx","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder); if (! empty($conf->global->DISPLAY_MARK_RATES)) - print_liste_field_titre($langs->trans("MarkRate"),$_SERVER["PHP_SELF"],"d.marque_tx","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("MarkRate"),$_SERVER["PHP_SELF"],"","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder); print "\n"; $cumul_achat = 0; $cumul_vente = 0; $cumul_qty = 0; + $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT); + if ($num > 0) { $var=true; @@ -211,9 +220,11 @@ if ($result) if (! empty($conf->global->DISPLAY_MARK_RATES)) print "".(($markRate === '')?'n/a':price($markRate)."%")."\n"; print "\n"; + $i++; - $cumul_achat += $objp->buying_price; - $cumul_vente += $objp->selling_price; + + $cumul_achat += round($objp->buying_price, $rounding); + $cumul_vente += round($objp->selling_price, $rounding); } } @@ -223,11 +234,9 @@ if ($result) $marginRate = ($cumul_achat != 0)?(100 * round($totalMargin / $cumul_achat, 5)):''; $markRate = ($cumul_vente != 0)?(100 * round($totalMargin / $cumul_vente, 5)):''; print ''; - if (! empty($client)) - print ''; - else - print ''; - print $langs->trans('TotalMargin').""; + print ''; + print $langs->trans('Total'); + print ""; print "".price($cumul_vente)."\n"; print "".price($cumul_achat)."\n"; print "".price($totalMargin)."\n"; diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index 665624ffa53..805b8824267 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -158,6 +158,7 @@ if (!empty($startdate)) $sql.= " AND f.datef >= '".$startdate."'"; if (!empty($enddate)) $sql.= " AND f.datef <= '".$enddate."'"; +$sql .= " AND d.buy_price_ht IS NOT NULL"; if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1) $sql .= " AND d.buy_price_ht <> 0"; if ($client) @@ -186,17 +187,19 @@ if ($result) else print_liste_field_titre($langs->trans("Customer"),$_SERVER["PHP_SELF"],"s.nom","","&socid=".$socid,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&socid=".$socid,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buyng_price","","&socid=".$socid,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buying_price","","&socid=".$socid,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&socid=".$socid,'align="right"',$sortfield,$sortorder); if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"d.marge_tx","","&socid=".$socid,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"","","&socid=".$socid,'align="right"',$sortfield,$sortorder); if (! empty($conf->global->DISPLAY_MARK_RATES)) - print_liste_field_titre($langs->trans("MarkRate"),$_SERVER["PHP_SELF"],"d.marque_tx","","&socid=".$socid,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("MarkRate"),$_SERVER["PHP_SELF"],"","","&socid=".$socid,'align="right"',$sortfield,$sortorder); print "\n"; $cumul_achat = 0; $cumul_vente = 0; $cumul_qty = 0; + $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT); + if ($num > 0) { $var=True; @@ -234,8 +237,8 @@ if ($result) print "".(($markRate === '')?'n/a':price($markRate)."%")."\n"; print "\n"; $i++; - $cumul_achat += $objp->buying_price; - $cumul_vente += $objp->selling_price; + $cumul_achat += round($objp->buying_price, $rounding); + $cumul_vente += round($objp->selling_price, $rounding); } } diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index d91cec567e0..9054e731529 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -162,6 +162,7 @@ if (!empty($startdate)) $sql.= " AND f.datef >= '".$startdate."'"; if (!empty($enddate)) $sql.= " AND f.datef <= '".$enddate."'"; +$sql .= " AND d.buy_price_ht IS NOT NULL"; if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1) $sql .= " AND d.buy_price_ht <> 0"; if ($id > 0) @@ -190,17 +191,19 @@ if ($result) else print_liste_field_titre($langs->trans("ProductService"),$_SERVER["PHP_SELF"],"p.ref","","&id=".$id,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&id=".$id,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buyng_price","","&id=".$id,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buying_price","","&id=".$id,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&id=".$id,'align="right"',$sortfield,$sortorder); if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"d.marge_tx","","&id=".$id,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"","","&id=".$id,'align="right"',$sortfield,$sortorder); if (! empty($conf->global->DISPLAY_MARK_RATES)) - print_liste_field_titre($langs->trans("MarkRate"),$_SERVER["PHP_SELF"],"d.marque_tx","","&id=".$id,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("MarkRate"),$_SERVER["PHP_SELF"],"","","&id=".$id,'align="right"',$sortfield,$sortorder); print "\n"; $cumul_achat = 0; $cumul_vente = 0; $cumul_qty = 0; + $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT); + if ($num > 0) { $var=True; @@ -241,8 +244,8 @@ if ($result) print "".(($markRate === '')?'n/a':price($markRate)."%")."\n"; print "\n"; $i++; - $cumul_achat += $objp->buying_price; - $cumul_vente += $objp->selling_price; + $cumul_achat += round($objp->buying_price, $rounding); + $cumul_vente += round($objp->selling_price, $rounding); } } diff --git a/htdocs/margin/tabs/productMargins.php b/htdocs/margin/tabs/productMargins.php index 646b84fee88..3ca6efee655 100644 --- a/htdocs/margin/tabs/productMargins.php +++ b/htdocs/margin/tabs/productMargins.php @@ -142,10 +142,11 @@ if ($id > 0 || ! empty($ref)) $sql.= " AND s.entity = ".$conf->entity; $sql.= " AND d.fk_facture = f.rowid"; $sql.= " AND d.fk_product =".$object->id; - if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1) - $sql .= " AND d.buy_price_ht <> 0"; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if (! empty($socid)) $sql.= " AND f.fk_soc = $socid"; + $sql .= " AND d.buy_price_ht IS NOT NULL"; + if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1) + $sql .= " AND d.buy_price_ht <> 0"; $sql.= " ORDER BY $sortfield $sortorder "; $sql.= $db->plimit($conf->liste_limit +1, $offset); @@ -165,19 +166,21 @@ if ($id > 0 || ! empty($ref)) print_liste_field_titre($langs->trans("CustomerCode"),$_SERVER["PHP_SELF"],"s.code_client","","&id=".$object->id,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateInvoice"),$_SERVER["PHP_SELF"],"f.datef","","&id=".$object->id,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&id=".$object->id,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buyng_price","","&id=".$object->id,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buying_price","","&id=".$object->id,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Qty"),$_SERVER["PHP_SELF"],"d.qty","","&id=".$object->id,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&id=".$object->id,'align="right"',$sortfield,$sortorder); if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"d.marge_tx","","&id=".$object->id,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"","","&id=".$object->id,'align="right"',$sortfield,$sortorder); if (! empty($conf->global->DISPLAY_MARK_RATES)) - print_liste_field_titre($langs->trans("MarkRate"),$_SERVER["PHP_SELF"],"d.marque_tx","","&id=".$object->id,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("MarkRate"),$_SERVER["PHP_SELF"],"","","&id=".$object->id,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.paye,f.fk_statut","","&id=".$object->id,'align="right"',$sortfield,$sortorder); print "\n"; $cumul_achat = 0; $cumul_vente = 0; $cumul_qty = 0; + $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT); + if ($num > 0) { $var=True; @@ -209,8 +212,8 @@ if ($id > 0 || ! empty($ref)) print ''.$invoicestatic->LibStatut($objp->paye,$objp->statut,5).''; print "\n"; $i++; - $cumul_achat += $objp->buying_price; - $cumul_vente += $objp->selling_price; + $cumul_achat += round($objp->buying_price, $rounding); + $cumul_vente += round($objp->selling_price, $rounding); $cumul_qty += $objp->qty; } } diff --git a/htdocs/margin/tabs/thirdpartyMargins.php b/htdocs/margin/tabs/thirdpartyMargins.php index 3689afd240f..65c8d25463d 100644 --- a/htdocs/margin/tabs/thirdpartyMargins.php +++ b/htdocs/margin/tabs/thirdpartyMargins.php @@ -138,6 +138,7 @@ if ($socid > 0) $sql.= " AND s.entity = ".$conf->entity; $sql.= " AND d.fk_facture = f.rowid"; $sql.= " AND f.fk_soc = $socid"; + $sql .= " AND d.buy_price_ht IS NOT NULL"; if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1) $sql .= " AND d.buy_price_ht <> 0"; $sql.= " GROUP BY f.rowid"; @@ -158,18 +159,20 @@ if ($socid > 0) print_liste_field_titre($langs->trans("Invoice"),$_SERVER["PHP_SELF"],"f.facnumber","","&socid=".$_REQUEST["socid"],'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateInvoice"),$_SERVER["PHP_SELF"],"f.datef","","&socid=".$_REQUEST["socid"],'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buyng_price","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buying_price","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder); if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"d.marge_tx","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder); if (! empty($conf->global->DISPLAY_MARK_RATES)) - print_liste_field_titre($langs->trans("MarkRate"),$_SERVER["PHP_SELF"],"d.marque_tx","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("MarkRate"),$_SERVER["PHP_SELF"],"","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.paye,f.fk_statut","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder); print "\n"; $cumul_achat = 0; $cumul_vente = 0; $cumul_qty = 0; + $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT); + if ($num > 0) { $var=True; @@ -200,8 +203,8 @@ if ($socid > 0) print ''.$invoicestatic->LibStatut($objp->paye,$objp->statut,5).''; print "\n"; $i++; - $cumul_achat += $objp->buying_price; - $cumul_vente += $objp->selling_price; + $cumul_achat += round($objp->buying_price, $rounding); + $cumul_vente += round($objp->selling_price, $rounding); } } From ffbe2acc36d6b148b9e51902f2dea4cfd8864176 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Sep 2012 11:06:49 +0200 Subject: [PATCH 10/28] Fix: use https if https is used --- htdocs/user/class/user.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 9ca8c07907d..c162bfb4294 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1416,8 +1416,9 @@ class User extends CommonObject { $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',$dolibarr_main_url_root); } - if (! empty($dolibarr_main_force_https)) $urlwithouturlroot=preg_replace('/http:/i','https:',$urlwithouturlroot); - + if (! empty($dolibarr_main_force_https) + || (! empty($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on')) $urlwithouturlroot=preg_replace('/http:/i','https:',$urlwithouturlroot); + // TODO Use outputlangs to translate messages if (! $changelater) { From 889f71db6f516d9ab449e2f50d13aa5e0b95a400 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Sep 2012 12:52:54 +0200 Subject: [PATCH 11/28] Fix: Color of lines must be set for each lines --- htdocs/core/modules/commande/doc/pdf_einstein.modules.php | 3 ++- .../expedition/doc/pdf_expedition_merou.modules.php | 6 ++++-- .../expedition/doc/pdf_expedition_rouget.modules.php | 4 +++- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 3 ++- htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php | 3 ++- htdocs/core/modules/livraison/pdf/pdf_sirocco.modules.php | 7 ++++--- htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php | 7 +++---- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 3 ++- .../modules/supplier_invoice/pdf/pdf_canelle.modules.php | 3 ++- .../modules/supplier_order/pdf/pdf_muscadet.modules.php | 3 ++- 10 files changed, 26 insertions(+), 16 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 082339490a2..d1beb882588 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -262,7 +262,8 @@ class pdf_einstein extends ModelePDFCommandes { $curY = $nexY; $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage - + $pdf->SetTextColor(0,0,0); + $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); diff --git a/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php index c7e7c4c1744..ad3cf02fcf6 100644 --- a/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2009 Laurent Destailleur + * Copyright (C) 2005-2012 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -195,11 +195,13 @@ class pdf_expedition_merou extends ModelePdfExpedition $nexY = $tab_top + 7; $num=count($object->lines); + // Loop on each lines for ($i = 0; $i < $num; $i++) { $curY = $nexY; $pdf->SetFont('','', $default_font_size - 3); - + $pdf->SetTextColor(0,0,0); + $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); diff --git a/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php index 01888689100..fe8288d3cca 100644 --- a/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2009 Laurent Destailleur + * Copyright (C) 2005-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -223,10 +223,12 @@ class pdf_expedition_rouget extends ModelePdfExpedition $nexY = $tab_top + 7; $num=count($object->lines); + // Loop on each lines for ($i = 0; $i < $num; $i++) { $curY = $nexY; $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage + $pdf->SetTextColor(0,0,0); $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 08ef7ae767c..44a1987aaf2 100755 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -265,7 +265,8 @@ class pdf_crabe extends ModelePDFFactures { $curY = $nexY; $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage - + $pdf->SetTextColor(0,0,0); + $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index fd3f1242bf3..c4b9c11f6be 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -246,7 +246,8 @@ class pdf_soleil extends ModelePDFFicheinter { $curY = $nexY; $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage - + $pdf->SetTextColor(0,0,0); + $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); diff --git a/htdocs/core/modules/livraison/pdf/pdf_sirocco.modules.php b/htdocs/core/modules/livraison/pdf/pdf_sirocco.modules.php index 81d13e8cee5..481cb6849df 100644 --- a/htdocs/core/modules/livraison/pdf/pdf_sirocco.modules.php +++ b/htdocs/core/modules/livraison/pdf/pdf_sirocco.modules.php @@ -31,8 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; /** - * \class pdf_sirocco - * \brief Classe permettant de generer les bons de livraison au modele Sirocco + * Classe permettant de generer les bons de livraison au modele Sirocco */ class pdf_sirocco extends ModelePDFDeliveryOrder { @@ -180,11 +179,13 @@ class pdf_sirocco extends ModelePDFDeliveryOrder $curY = $tab_top + 7; $nexY = $tab_top + 7; + // Loop on each lines for ($i = 0 ; $i < $nblines ; $i++) { $curY = $nexY; $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage - + $pdf->SetTextColor(0,0,0); + $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); diff --git a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php index b9cfc5ea909..16200636ce4 100644 --- a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php @@ -34,10 +34,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; /** - * \class pdf_typhon - * \brief Classe permettant de generer les bons de livraison au modele Typho + * Classe permettant de generer les bons de livraison au modele Typho */ - class pdf_typhon extends ModelePDFDeliveryOrder { var $emetteur; // Objet societe qui emet @@ -236,11 +234,12 @@ class pdf_typhon extends ModelePDFDeliveryOrder $curY = $tab_top + 7; $nexY = $tab_top + 7; - // Boucle sur les lignes + // Loop on each lines for ($i = 0 ; $i < $nblines ; $i++) { $curY = $nexY; $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage + $pdf->SetTextColor(0,0,0); $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot-50); // The only function to edit the bottom margin of current page to set it. diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index d7e4cd7e538..0a2d1484bdd 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -263,7 +263,8 @@ class pdf_azur extends ModelePDFPropales { $curY = $nexY; $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage - + $pdf->SetTextColor(0,0,0); + $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index 01649837213..77ae627120f 100755 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -260,7 +260,8 @@ class pdf_canelle extends ModelePDFSuppliersInvoices { $curY = $nexY; $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage - + $pdf->SetTextColor(0,0,0); + $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index bdd23c5b1da..67786e0a944 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -272,7 +272,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders { $curY = $nexY; $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage - + $pdf->SetTextColor(0,0,0); + $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); From b65c23576a0d216db17d22511b262d12272160fe Mon Sep 17 00:00:00 2001 From: simnandez Date: Tue, 18 Sep 2012 15:28:38 +0200 Subject: [PATCH 12/28] Trad: Add ca_ES and es_ES translations --- htdocs/langs/ca_ES/admin.lang | 14 ++++++++++++-- htdocs/langs/ca_ES/commissions.lang | 1 + htdocs/langs/ca_ES/main.lang | 2 ++ htdocs/langs/ca_ES/margins.lang | 2 ++ htdocs/langs/ca_ES/products.lang | 3 +++ htdocs/langs/ca_ES/stocks.lang | 2 ++ htdocs/langs/es_ES/admin.lang | 14 ++++++++++++-- htdocs/langs/es_ES/commissions.lang | 1 + htdocs/langs/es_ES/main.lang | 2 ++ htdocs/langs/es_ES/margins.lang | 2 ++ htdocs/langs/es_ES/products.lang | 3 +++ htdocs/langs/es_ES/stocks.lang | 2 ++ 12 files changed, 44 insertions(+), 4 deletions(-) diff --git a/htdocs/langs/ca_ES/admin.lang b/htdocs/langs/ca_ES/admin.lang index 8e61f05950f..791367b82f6 100644 --- a/htdocs/langs/ca_ES/admin.lang +++ b/htdocs/langs/ca_ES/admin.lang @@ -345,7 +345,13 @@ OldVATRates=Taxa d'IVA antiga NewVATRates=Taxa d'IVA nova PriceBaseTypeToChange=Canviar el preu on la referència de base és MassConvert=Convertir massivament -# Modules= undefined== +String=Cadena +TextLong=Text llarg +Int=numèric enter +Float=Decimal +DateAndTime=Data i hora + +# Modules Module0Name=Usuaris y grups Module0Desc=Gestió d'usuaris i grups Module1Name=Tercers @@ -455,6 +461,8 @@ Module2900Name=GeoIPMaxmind Module2900Desc=Capacitats de conversió GeoIP Maxmind Module5000Name=Multi-empresa Module5000Desc=Permet gestionar diverses empreses +Module20000Name=Dies lliures +Module20000Desc=Gestió dels dies lliures dels empleats Module50000Name=PayBox Module50000Desc=Mòdul per a proporcionar un pagament en línia amb targeta de crèdit mitjançant Paybox Module50100Name=TPV @@ -899,6 +907,8 @@ MAIN_PROXY_USER=Login del servidor proxy MAIN_PROXY_PASS=Contrasenya del servidor proxy DefineHereComplementaryAttributes=Definiu aquí la llista d'atributs addicionals, no disponibles a estàndard, i que vol gestionar per %s. ExtraFields=Atributs addicionals +ExtraFieldsThirdParties=Atributs adicionals (tercers) +ExtraFieldsContacts=Atributs adicionals (contactes/adreçes) ExtraFieldHasWrongValue=L'atribut %s te un valor incorrecte. AlphaNumOnlyCharsAndNoSpace=només carateres alfanumèrics sense espais SendingMailSetup=Configuració de l'enviament per mail @@ -908,7 +918,7 @@ PathDirectory=Catàleg SendmailOptionMayHurtBuggedMTA=La funcionalitat d'enviar correu electrònic a través del "correu directe PHP" genera una sol·licitud que pot ser mal interpretada per alguns servidors de correu. Això es tradueix en missatges de correu electrònic il·legibles per a les persones allotjades en aquestes plataformes. Aquest és el cas de clients en certs proveïdors de serveis d'Internet (Ex: Orange). Això no és un problema ni de Dolibarr ni de PHP, però sí del servidor de correu. No obstant això, podeu afegir l'opció MAIN_FIX_FOR_BUGGED_MTA amb valor 1 en configuració-varis per tractar que Dolibarr eviti l'error. Una altra solució (recomanada) és utilitzar el mètode d'enviament per SMTP que no té aquest inconvenient. TranslationSetup=Configuració traducció TranslationDesc=L'elecció de l'idioma mostrat en pantalla es modifica:
* A nivell global des del menú Inici - Configuració - Entorn
* De manera específica a l'usuari des de la pestanya interface usuari de la seva fitxa d'usuari (fer clic al seu login a la part superior esquerra de la pantalla). -##### Module password generation= undefined== +##### Module password generation PasswordGenerationStandard=Retorna una contrasenya generada per l'algoritme intern Dolibarr: 8 caràcters, números i caràcters en minúscules barrejades. PasswordGenerationNone=No ofereix contrasenyes. La contrasenya s'introdueix manualment. ##### Users setup ##### diff --git a/htdocs/langs/ca_ES/commissions.lang b/htdocs/langs/ca_ES/commissions.lang index 1335c7a1f9c..da97a4066f2 100644 --- a/htdocs/langs/ca_ES/commissions.lang +++ b/htdocs/langs/ca_ES/commissions.lang @@ -1,6 +1,7 @@ # Dolibarr language file - ca_ES - commissions CHARSET=UTF-8 +Module60000Desc=Gestió de comissions commissionsSetup=Configuració de la gestió de comissions ProductCommissionRate=Taxa de comissió sobre els productes diff --git a/htdocs/langs/ca_ES/main.lang b/htdocs/langs/ca_ES/main.lang index b016d67f6af..97683be8657 100644 --- a/htdocs/langs/ca_ES/main.lang +++ b/htdocs/langs/ca_ES/main.lang @@ -250,6 +250,8 @@ Quadri=Trimistre MonthOfDay=Mes del dia HourShort=H Rate=Tipus +UseLocalTax=Incloure taxes +LocalTaxDesc=Alguns països apliquen 2 o 3 taxes a cada línia de factura. Si és el cas, escolliu el tipus de la segona i tercera taxa i el seu valor. Els possibles tipus són:
1: taxa local aplicable a productes i serveis sense IVA (IVA no s'aplica a la taxa local)
2: taxa local s'aplica a productes i serveis abans de l'IVA (IVA es calcula sobre import + taxa local)
3: taxa local s'aplica a productes sense IVA (IVA no s'aplica a la taxa local)
4: taxa local s'aplica a productes abans de l'IVA (IVA es calcula sobre l'import + taxa local)
5: taxa local s'aplica a serveis sense IVA (IVA no s'aplica a la taxa local)
6: taxa local s'aplica a serveis abans de l'IVA (IVA es calcula sobre import + taxa local)
7: la taxa local és un import fix aplicat al total de la factura Bytes=Bytes KiloBytes=Kilobytes MegaBytes=Megabytes diff --git a/htdocs/langs/ca_ES/margins.lang b/htdocs/langs/ca_ES/margins.lang index 55d5374963a..f502a3274bf 100644 --- a/htdocs/langs/ca_ES/margins.lang +++ b/htdocs/langs/ca_ES/margins.lang @@ -1,6 +1,8 @@ # Dolibarr language file - ca_ES - margins CHARSET=UTF-8 +Module59000Name=Marges +Module59000Desc=Gestió de marges comercials Margin=Marge Margins=Marges TotalMargin=Marge total diff --git a/htdocs/langs/ca_ES/products.lang b/htdocs/langs/ca_ES/products.lang index 12b98a54c44..f1c0fbb0616 100644 --- a/htdocs/langs/ca_ES/products.lang +++ b/htdocs/langs/ca_ES/products.lang @@ -176,3 +176,6 @@ AddThisProductCard=Crear fitxa producte HelpAddThisProductCard=Aquesta opció permet crear o clonar una fitxa de producte en cas que no hi hagi AddThisServiceCard=Crear fitxa servei HelpAddThisServiceCard=Aquesta opció permet crear o clonar una fitxa de servei en cas que no hi hagi +CurrentProductPrice=Preu actual +AlwaysUseNewPrice=Utilitzar sempre el preu actual +AlwaysUseFixedPrice=Utilitzar el preu fixat \ No newline at end of file diff --git a/htdocs/langs/ca_ES/stocks.lang b/htdocs/langs/ca_ES/stocks.lang index 63365eb4c83..e4bd2affa13 100644 --- a/htdocs/langs/ca_ES/stocks.lang +++ b/htdocs/langs/ca_ES/stocks.lang @@ -8,6 +8,8 @@ MenuNewWarehouse=Nou magatzem WarehouseOpened=Magatzem obert WarehouseClosed=Magatzem tancat WarehouseSource=Magatzem origen +WarehouseSourceNotDefined=Sense magatzems definits, +AddOne=Afegir un WarehouseTarget=Magatzem destinació ValidateSending=Validar enviament CancelSending=Anul·lar enviament diff --git a/htdocs/langs/es_ES/admin.lang b/htdocs/langs/es_ES/admin.lang index dc0af998df7..58005491211 100644 --- a/htdocs/langs/es_ES/admin.lang +++ b/htdocs/langs/es_ES/admin.lang @@ -346,7 +346,13 @@ OldVATRates=Tasa de IVA antigua NewVATRates=Tasa de IVA nueva PriceBaseTypeToChange=Cambiar el precio cuya referencia de base es MassConvert=Convertir masivamente -# Modules= undefined= +String=Cadena +TextLong=Texto largo +Int=Numérico entero +Float=Decimal +DateAndTime=Fecha y hora + +# Modules Module0Name=Usuarios y grupos Module0Desc=Gestión de usuarios y grupos Module1Name=Terceros @@ -455,7 +461,9 @@ Module2800Desc=Cliente FTP Module2900Name=GeoIPMaxmind Module2900Desc=Capacidades de conversión GeoIP Maxmind Module5000Name=Multi-empresa -Module5000Desc=Permite gestionar varias empresas +Module5000Desc=Permite gestionar varias empresas +Module20000Name=Días libres +Module20000Desc=Gestión de los días libres de los empleados Module50000Name=PayBox Module50000Desc=Módulo para proporcionar un pago en línea con tarjeta de crédito mediante Paybox Module50100Name=TPV @@ -901,6 +909,8 @@ MAIN_PROXY_USER=Login del servidor proxy MAIN_PROXY_PASS=Contraseña del servidor proxy DefineHereComplementaryAttributes=Defina aquí la lista de atributos adicionales, no disponibles por defecto, y que desea gestionar para %s. ExtraFields=Atributos adicionales +ExtraFieldsThirdParties=Atributos adicionales (terceros) +ExtraFieldsContacts=Atributos adicionales (contactos/direcciones) ExtraFieldHasWrongValue=El atributo %s tiene un valor incorrecto. AlphaNumOnlyCharsAndNoSpace=solamente caracteres alfanuméricos sin espacios SendingMailSetup=Configuración del envío por mail diff --git a/htdocs/langs/es_ES/commissions.lang b/htdocs/langs/es_ES/commissions.lang index f771cad3185..2077ca5990c 100644 --- a/htdocs/langs/es_ES/commissions.lang +++ b/htdocs/langs/es_ES/commissions.lang @@ -1,6 +1,7 @@ # Dolibarr language file - es_ES - commissions CHARSET=UTF-8 +Module60000Desc=Gestión de comisiones commissionsSetup=Configuración de la gestión de comisiones ProductCommissionRate=Tasa de comisión sobre los productos diff --git a/htdocs/langs/es_ES/main.lang b/htdocs/langs/es_ES/main.lang index 140b25c161e..102624c20dc 100644 --- a/htdocs/langs/es_ES/main.lang +++ b/htdocs/langs/es_ES/main.lang @@ -250,6 +250,8 @@ Quadri=Trimestre MonthOfDay=Mes del día HourShort=H Rate=Tipo +UseLocalTax=Incluir tasas +LocalTaxDesc=Algunos países aplican 2 o 3 tasas a cada línea de factura. Si es el caso, escoja el tipo de la segunda y tercera tasa y su valor. Los posibles tipos son:
1 : tasa local aplicable a productos y servicios sin IVA (IVA no se aplica en la tasa local)
2 : tasa local se aplica a productos y servicios antes del IVA (IVA se calcula sobre importe+tasa local)
3 : tasa local se aplica a productos sin IVA (IVA no se aplica en la tasa local)
4 : tasa local se aplica a productos antes del IVA (IVA se calcula sobre el importe+tasa local)
5 : tasa local se aplica a servicios sin IVA (IVA no se aplica a la tasa local)
6 : tasa local se aplica a servicios antes del IVA (IVA se calcula sobre importe + tasa local)
7 : la tasa local es un importe fijo aplicado al total de la factura Bytes=Bytes KiloBytes=Kilobytes MegaBytes=Megabytes diff --git a/htdocs/langs/es_ES/margins.lang b/htdocs/langs/es_ES/margins.lang index 213b672aafb..5ff7b74b7d4 100644 --- a/htdocs/langs/es_ES/margins.lang +++ b/htdocs/langs/es_ES/margins.lang @@ -1,6 +1,8 @@ # Dolibarr language file - es_ES - margins CHARSET=UTF-8 +Module59000Name=Márgenes +Module59000Desc=Gestión de márgenes comerciales Margin=Margen Margins=Márgenes TotalMargin=Margen total diff --git a/htdocs/langs/es_ES/products.lang b/htdocs/langs/es_ES/products.lang index 81eb557fc53..97d4586bae6 100644 --- a/htdocs/langs/es_ES/products.lang +++ b/htdocs/langs/es_ES/products.lang @@ -176,3 +176,6 @@ AddThisProductCard=Crear ficha producto HelpAddThisProductCard=Esta opción permite crear o clonar una ficha de producto en caso de que no exista AddThisServiceCard=Crear ficha servicio HelpAddThisServiceCard=Esta opción permite crear o clonar una ficha de servicio en caso de que no exista +CurrentProductPrice=Precio actual +AlwaysUseNewPrice=Usar siempre el precio actual +AlwaysUseFixedPrice=Usar el precio fijado \ No newline at end of file diff --git a/htdocs/langs/es_ES/stocks.lang b/htdocs/langs/es_ES/stocks.lang index 919564f7100..55a440302a7 100644 --- a/htdocs/langs/es_ES/stocks.lang +++ b/htdocs/langs/es_ES/stocks.lang @@ -8,6 +8,8 @@ MenuNewWarehouse=Nuevo almacén WarehouseOpened=Almacén abierto WarehouseClosed=Almacén cerrado WarehouseSource=Almacén origen +WarehouseSourceNotDefined=Sin almacenes definidos, +AddOne=Añadir uno WarehouseTarget=Almacén destino ValidateSending=Validar envío CancelSending=Anular envío From fab101d2e8635a878ce7e6f0abf209cd26a8ce3d Mon Sep 17 00:00:00 2001 From: simnandez Date: Tue, 18 Sep 2012 15:38:08 +0200 Subject: [PATCH 13/28] Fix: Spanish localtax1 must be only applicable to products Add localtax2_type --- htdocs/install/mysql/migration/3.2.0-3.3.0.sql | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/install/mysql/migration/3.2.0-3.3.0.sql b/htdocs/install/mysql/migration/3.2.0-3.3.0.sql index 953ec46f91e..eeb7c4d13e3 100755 --- a/htdocs/install/mysql/migration/3.2.0-3.3.0.sql +++ b/htdocs/install/mysql/migration/3.2.0-3.3.0.sql @@ -238,7 +238,12 @@ create table llx_socpeople_extrafields ALTER TABLE llx_socpeople_extrafields ADD INDEX idx_socpeople_extrafields (fk_object); --- update type of localtax for spain -UPDATE llx_c_tva SET localtax1_type = '1' WHERE rowid = 41 AND fk_pays = 4 AND localtax1_type = '0'; -UPDATE llx_c_tva SET localtax1_type = '1' WHERE rowid = 42 AND fk_pays = 4 AND localtax1_type = '0'; -UPDATE llx_c_tva SET localtax1_type = '1' WHERE rowid = 43 AND fk_pays = 4 AND localtax1_type = '0'; +-- update type of localtax1 for spain +UPDATE llx_c_tva SET localtax1_type = '3' WHERE rowid = 41 AND fk_pays = 4 AND (localtax1_type = '0' OR localtax1_type='1'); +UPDATE llx_c_tva SET localtax1_type = '3' WHERE rowid = 42 AND fk_pays = 4 AND (localtax1_type = '0' OR localtax1_type='1'); +UPDATE llx_c_tva SET localtax1_type = '3' WHERE rowid = 43 AND fk_pays = 4 AND (localtax1_type = '0' OR localtax1_type='1'); + +-- update type of localtax2 for spain +UPDATE llx_c_tva SET localtax2_type = '1' WHERE rowid = 41 AND fk_pays = 4 AND localtax2_type = '0'; +UPDATE llx_c_tva SET localtax2_type = '1' WHERE rowid = 42 AND fk_pays = 4 AND localtax2_type = '0'; +UPDATE llx_c_tva SET localtax2_type = '1' WHERE rowid = 43 AND fk_pays = 4 AND localtax2_type = '0'; From 76f3fb56ea705c9342e2288d992e70809408262a Mon Sep 17 00:00:00 2001 From: simnandez Date: Tue, 18 Sep 2012 16:06:45 +0200 Subject: [PATCH 14/28] Fix: Add type of product/service into propals for a correct localtaxes calculation Fix: Localtax2_type for Spain must be 3 --- htdocs/comm/propal.php | 6 ++++-- htdocs/comm/propal/class/propal.class.php | 12 +++++++----- htdocs/core/lib/price.lib.php | 4 ++-- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 7dd553b0046..5b64c4ab59b 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -790,7 +790,8 @@ else if ($action == "addline" && $user->rights->propal->creer) GETPOST('fk_parent_line'), $fournprice, $buyingprice, - $label + $label, + $type ); if ($result > 0) @@ -912,7 +913,8 @@ else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('sa 0, $fournprice, $buying_price, - $label + $label, + $type ); if ($result >= 0) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index a548153f91d..78f49394b5e 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -6,7 +6,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2008 Raphael Bertrand - * Copyright (C) 2010-2011 Juanjo Menent + * Copyright (C) 2010-2012 Juanjo Menent * Copyright (C) 2010-2011 Philippe Grand * Copyright (C) 2012 Christophe Battarel * @@ -306,11 +306,12 @@ class Propal extends CommonObject * @param int $fk_fournprice Id supplier price * @param int $pa_ht Buying price without tax * @param string $label ??? + * @param int $type 0/1=Product/service * @return int >0 if OK, <0 if KO * * @see add_product */ - function addline($propalid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='') + function addline($propalid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='',$type=0) { global $conf; @@ -352,7 +353,7 @@ class Propal extends CommonObject // qty, pu, remise_percent et txtva // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits); + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits,$type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; @@ -463,9 +464,10 @@ class Propal extends CommonObject * @param int $fk_fournprice Id supplier price * @param int $pa_ht Buying price without tax * @param string $label ??? + * @param int $type 0/1=Product/service * @return int 0 if OK, <0 if KO */ - function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='') + function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='',$type=0) { global $conf,$user,$langs; @@ -491,7 +493,7 @@ class Propal extends CommonObject // qty, pu, remise_percent et txtva // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits); + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits,$type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; diff --git a/htdocs/core/lib/price.lib.php b/htdocs/core/lib/price.lib.php index 78a357cd71b..d6188ec75a0 100644 --- a/htdocs/core/lib/price.lib.php +++ b/htdocs/core/lib/price.lib.php @@ -1,7 +1,7 @@ * Copyright (C) 2006-2008 Laurent Destailleur - * Copyright (C) 2010 Juanjo Menent + * Copyright (C) 2010-2012 Juanjo Menent * Copyright (C) 2012 Christophe Battarel * * This program is free software; you can redistribute it and/or modify @@ -58,7 +58,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $localtax1 // TODO Remove this code. Added for backward compatibility. To remove once localtaxX_type is provided by caller. if ($localtax1_type == '?') { - if ($mysoc->country_code=='ES') $localtax1_type='1'; + if ($mysoc->country_code=='ES') $localtax1_type='3'; else $localtax1_type='0'; } if ($localtax2_type == '?') From 0bf29edb60c3bebe5e973d8b12f87e99ef59d68b Mon Sep 17 00:00:00 2001 From: simnandez Date: Tue, 18 Sep 2012 17:41:59 +0200 Subject: [PATCH 15/28] Fix: Add type of product/service into commandes for a correct localtaxes calculation --- htdocs/commande/class/commande.class.php | 12 ++++++++---- htdocs/commande/fiche.php | 6 ++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 6d6181ad75c..c79930b6cd0 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -999,6 +999,8 @@ class Commande extends CommonOrder * @param int $fk_parent_line Parent line * @param int $fk_fournprice Id supplier price * @param int $pa_ht Buying price (without tax) + * @param string $label Label + * @param int $type 0/1=Product/service * @return int >0 if OK, <0 if KO * * @see add_product @@ -1008,7 +1010,7 @@ class Commande extends CommonOrder * par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,produit) * et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue) */ - function addline($commandeid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0, $date_start='', $date_end='', $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='') + function addline($commandeid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0, $date_start='', $date_end='', $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='',$type=0) { dol_syslog(get_class($this)."::addline commandeid=$commandeid, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc, date_start=$date_start, date_end=$date_end, type=$type", LOG_DEBUG); @@ -1054,7 +1056,7 @@ class Commande extends CommonOrder // qty, pu, remise_percent et txtva // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits); + $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits,$type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; @@ -2159,9 +2161,11 @@ class Commande extends CommonOrder * @param int $skip_update_total Skip update of total * @param int $fk_fournprice Id supplier price * @param int $pa_ht Buying price (without tax) + * @param string $label Label + * @param int $type 0/1=Product/service * @return int < 0 if KO, > 0 if OK */ - function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0,$txlocaltax2=0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='') + function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0,$txlocaltax2=0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $type=0) { global $conf; @@ -2192,7 +2196,7 @@ class Commande extends CommonOrder // qty, pu, remise_percent et txtva // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits); + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 2d348b131e8..0afb711076e 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -699,7 +699,8 @@ else if ($action == 'addline' && $user->rights->commande->creer) GETPOST('fk_parent_line'), $fournprice, $buyingprice, - $label + $label, + $type ); if ($result > 0) @@ -825,7 +826,8 @@ else if ($action == 'updateligne' && $user->rights->commande->creer && GETPOST(' 0, $fournprice, $buyingprice, - $label + $label, + $type ); if ($result >= 0) From dd9d3c8ba4b7e147d6fd6b7cf15f3b4c0d6b06b5 Mon Sep 17 00:00:00 2001 From: simnandez Date: Tue, 18 Sep 2012 17:57:52 +0200 Subject: [PATCH 16/28] Fix: localtaxes must display in pdf even if they are in negative --- htdocs/core/modules/commande/doc/pdf_einstein.modules.php | 6 +++--- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 6 +++--- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index d1beb882588..b426c0caaa4 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand - * Copyright (C) 2010-2011 Juanjo Menent + * Copyright (C) 2010-2012 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -695,7 +695,7 @@ class pdf_einstein extends ModelePDFCommandes //Local tax 1 foreach($this->localtax1 as $tvakey => $tvaval) { - if ($tvakey>0) // On affiche pas taux 0 + if ($tvakey!=0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; @@ -723,7 +723,7 @@ class pdf_einstein extends ModelePDFCommandes //Local tax 2 foreach($this->localtax2 as $tvakey => $tvaval) { - if ($tvakey>0) // On affiche pas taux 0 + if ($tvakey!=0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 44a1987aaf2..5ca79c9a1fd 100755 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand - * Copyright (C) 2010-2011 Juanjo Menent + * Copyright (C) 2010-2012 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -810,7 +810,7 @@ class pdf_crabe extends ModelePDFFactures //Local tax 1 foreach($this->localtax1 as $tvakey => $tvaval) { - if ($tvakey>0) // On affiche pas taux 0 + if ($tvakey!=0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; @@ -838,7 +838,7 @@ class pdf_crabe extends ModelePDFFactures //Local tax 2 foreach($this->localtax2 as $tvakey => $tvaval) { - if ($tvakey>0) // On affiche pas taux 0 + if ($tvakey!=0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 0a2d1484bdd..d48c67b3cf6 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -729,7 +729,7 @@ class pdf_azur extends ModelePDFPropales //Local tax 1 foreach($this->localtax1 as $tvakey => $tvaval) { - if ($tvakey>0) // On affiche pas taux 0 + if ($tvakey!=0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; @@ -757,7 +757,7 @@ class pdf_azur extends ModelePDFPropales //Local tax 2 foreach($this->localtax2 as $tvakey => $tvaval) { - if ($tvakey>0) // On affiche pas taux 0 + if ($tvakey!=0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; From b7837f9280c45bdaba66c4a98436e80658d5166e Mon Sep 17 00:00:00 2001 From: simnandez Date: Tue, 18 Sep 2012 18:18:30 +0200 Subject: [PATCH 17/28] Fix: Localtaxes type only missing in propal update line --- htdocs/comm/propal.php | 3 +-- htdocs/comm/propal/class/propal.class.php | 7 +++---- htdocs/commande/class/commande.class.php | 6 ++---- htdocs/commande/fiche.php | 6 ++---- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 5b64c4ab59b..ff28de54e80 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -790,8 +790,7 @@ else if ($action == "addline" && $user->rights->propal->creer) GETPOST('fk_parent_line'), $fournprice, $buyingprice, - $label, - $type + $label ); if ($result > 0) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 78f49394b5e..65287b23e57 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -306,12 +306,11 @@ class Propal extends CommonObject * @param int $fk_fournprice Id supplier price * @param int $pa_ht Buying price without tax * @param string $label ??? - * @param int $type 0/1=Product/service * @return int >0 if OK, <0 if KO * * @see add_product */ - function addline($propalid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='',$type=0) + function addline($propalid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='') { global $conf; @@ -467,7 +466,7 @@ class Propal extends CommonObject * @param int $type 0/1=Product/service * @return int 0 if OK, <0 if KO */ - function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='',$type=0) + function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $type=0) { global $conf,$user,$langs; @@ -493,7 +492,7 @@ class Propal extends CommonObject // qty, pu, remise_percent et txtva // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits,$type); + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index c79930b6cd0..924477e0dd2 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1000,7 +1000,6 @@ class Commande extends CommonOrder * @param int $fk_fournprice Id supplier price * @param int $pa_ht Buying price (without tax) * @param string $label Label - * @param int $type 0/1=Product/service * @return int >0 if OK, <0 if KO * * @see add_product @@ -1010,7 +1009,7 @@ class Commande extends CommonOrder * par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,produit) * et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue) */ - function addline($commandeid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0, $date_start='', $date_end='', $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='',$type=0) + function addline($commandeid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0, $date_start='', $date_end='', $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='') { dol_syslog(get_class($this)."::addline commandeid=$commandeid, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc, date_start=$date_start, date_end=$date_end, type=$type", LOG_DEBUG); @@ -2162,10 +2161,9 @@ class Commande extends CommonOrder * @param int $fk_fournprice Id supplier price * @param int $pa_ht Buying price (without tax) * @param string $label Label - * @param int $type 0/1=Product/service * @return int < 0 if KO, > 0 if OK */ - function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0,$txlocaltax2=0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $type=0) + function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0,$txlocaltax2=0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='') { global $conf; diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 0afb711076e..2d348b131e8 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -699,8 +699,7 @@ else if ($action == 'addline' && $user->rights->commande->creer) GETPOST('fk_parent_line'), $fournprice, $buyingprice, - $label, - $type + $label ); if ($result > 0) @@ -826,8 +825,7 @@ else if ($action == 'updateligne' && $user->rights->commande->creer && GETPOST(' 0, $fournprice, $buyingprice, - $label, - $type + $label ); if ($result >= 0) From 89dfd246d14a576ada5cfd405e264cb5332e0bb5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Sep 2012 18:27:10 +0200 Subject: [PATCH 18/28] Init data must match migrated data --- htdocs/install/mysql/migration/3.2.0-3.3.0.sql | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/install/mysql/migration/3.2.0-3.3.0.sql b/htdocs/install/mysql/migration/3.2.0-3.3.0.sql index 953ec46f91e..642c1e6f40e 100755 --- a/htdocs/install/mysql/migration/3.2.0-3.3.0.sql +++ b/htdocs/install/mysql/migration/3.2.0-3.3.0.sql @@ -242,3 +242,11 @@ ALTER TABLE llx_socpeople_extrafields ADD INDEX idx_socpeople_extrafields (fk_ob UPDATE llx_c_tva SET localtax1_type = '1' WHERE rowid = 41 AND fk_pays = 4 AND localtax1_type = '0'; UPDATE llx_c_tva SET localtax1_type = '1' WHERE rowid = 42 AND fk_pays = 4 AND localtax1_type = '0'; UPDATE llx_c_tva SET localtax1_type = '1' WHERE rowid = 43 AND fk_pays = 4 AND localtax1_type = '0'; + +UPDATE llx_c_tva set localtax1 = 1, localtax1_type = '4', localtax2 = 0.4, localtax2_type = '7' where rowid= 101 and fk_pays= 10 AND localtax1_type='0'; +UPDATE llx_c_tva set localtax1 = 1, localtax1_type = '4', localtax2 = 0.4, localtax2_type = '7' where rowid= 102 and fk_pays= 10 AND localtax1_type='0'; +UPDATE llx_c_tva set localtax1 = 1, localtax1_type = '4', localtax2 = 0.4, localtax2_type = '7' where rowid= 103 and fk_pays= 10 AND localtax1_type='0'; +UPDATE llx_c_tva set localtax1 = 1, localtax1_type = '4', localtax2 = 0.4, localtax2_type = '7' where rowid= 104 and fk_pays= 10 AND localtax1_type='0'; +UPDATE llx_c_tva set localtax1 = 1, localtax1_type = '4', localtax2 = 0.4, localtax2_type = '7' where rowid= 105 and fk_pays= 10 AND localtax1_type='0'; +UPDATE llx_c_tva set localtax1 = 1, localtax1_type = '4', localtax2 = 0.4, localtax2_type = '7' where rowid= 106 and fk_pays= 10 AND localtax1_type='0'; +UPDATE llx_c_tva set localtax1 = 1, localtax1_type = '4', localtax2 = 0.4, localtax2_type = '7' where rowid= 107 and fk_pays= 10 AND localtax1_type='0'; From 13aeca2ffd0227e47f0b6b9e6a061f664fe84992 Mon Sep 17 00:00:00 2001 From: simnandez Date: Tue, 18 Sep 2012 18:27:28 +0200 Subject: [PATCH 19/28] Fix: Add type of product/service into factures for a correct localtaxes calculation --- htdocs/compta/facture/class/facture.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 6f6c85abd59..bc05717f5fa 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1925,7 +1925,7 @@ class Facture extends CommonInvoice // qty, pu, remise_percent et txtva // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits); + $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; @@ -2063,7 +2063,7 @@ class Facture extends CommonInvoice // Calculate total with, without tax and tax from qty, pu, remise_percent and txtva // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits); + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; From cf72ffd650071fa7b8502f94e82b6310f16fe01c Mon Sep 17 00:00:00 2001 From: simnandez Date: Tue, 18 Sep 2012 18:50:02 +0200 Subject: [PATCH 20/28] Trad: Improve bank translations for adjust into pdf info size --- htdocs/langs/ca_ES/bills.lang | 4 ++-- htdocs/langs/es_ES/bills.lang | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/langs/ca_ES/bills.lang b/htdocs/langs/ca_ES/bills.lang index 8d21a2700d9..f6ce99e3c04 100644 --- a/htdocs/langs/ca_ES/bills.lang +++ b/htdocs/langs/ca_ES/bills.lang @@ -318,9 +318,9 @@ PaymentTypeTRA=Lletra de canvi PaymentTypeShortTRA=Lletra BankDetails=Dades bancàries BankCode=Codi banc -DeskCode=Codi sucursal +DeskCode=Cod. sucursal BankAccountNumber=Número compte -BankAccountNumberKey=Dígit control +BankAccountNumberKey=D. C. Residence=Domiciliació IBANNumber=Codi IBAN IBAN=IBAN diff --git a/htdocs/langs/es_ES/bills.lang b/htdocs/langs/es_ES/bills.lang index 18be5b85314..63a33d062b0 100644 --- a/htdocs/langs/es_ES/bills.lang +++ b/htdocs/langs/es_ES/bills.lang @@ -318,9 +318,9 @@ PaymentTypeTRA=Letra de cambio PaymentTypeShortTRA=Letra BankDetails=Datos bancarios BankCode=Código banco -DeskCode=Código sucursal +DeskCode=Cód. sucursal BankAccountNumber=Número cuenta -BankAccountNumberKey=Dígito Control +BankAccountNumberKey=D. C. Residence=Domiciliación IBANNumber=Código IBAN IBAN=IBAN From 60fc0f2b74446eff44388d696c646bffdec5c1e2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Sep 2012 11:56:50 +0200 Subject: [PATCH 21/28] Removed warning --- htdocs/core/login/functions_http.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/login/functions_http.php b/htdocs/core/login/functions_http.php index c40e3b1609d..8aea6d40a2c 100644 --- a/htdocs/core/login/functions_http.php +++ b/htdocs/core/login/functions_http.php @@ -33,7 +33,7 @@ */ function check_user_password_http($usertotest,$passwordtotest,$entitytotest) { - dol_syslog("functions_http::check_user_password_http _SERVER[REMOTE_USER]=".$_SERVER["REMOTE_USER"]); + dol_syslog("functions_http::check_user_password_http _SERVER[REMOTE_USER]=".(empty($_SERVER["REMOTE_USER"])?'':$_SERVER["REMOTE_USER"])); $login=''; if (! empty($_SERVER["REMOTE_USER"])) From de93c819f49fbac4e98a3c59a23a34d91efcde66 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 19 Sep 2012 12:02:06 +0200 Subject: [PATCH 22/28] correct some ajax bugs caused by tpl recent updates --- htdocs/core/tpl/objectline_edit.tpl.php | 8 ++-- .../tpl/predefinedproductline_create.tpl.php | 37 ++++++++++--------- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index d0f838c6b5f..4b079ef78d2 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -133,7 +133,7 @@ -service->enabled && $line->product_type == 1 && $dateSelector) { ?> +service->enabled) && $line->product_type == 1 && $dateSelector) { ?> > trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; ?> - margin->enabled)) { ?> - $.post('/fourn/ajax/getSupplierPrices.php', {'idprod': fk_product; ?>}, function(data) { - if (data.length > 0) { + margin->enabled)) { ?> + $.post('/fourn/ajax/getSupplierPrices.php', {'idprod': fk_product?$line->fk_product:0; ?>}, function(data) { + if (data && data.length > 0) { var options = ''; var trouve=false; $(data).each(function() { diff --git a/htdocs/core/tpl/predefinedproductline_create.tpl.php b/htdocs/core/tpl/predefinedproductline_create.tpl.php index f0c11c07f87..e10dc184ccb 100644 --- a/htdocs/core/tpl/predefinedproductline_create.tpl.php +++ b/htdocs/core/tpl/predefinedproductline_create.tpl.php @@ -32,7 +32,7 @@ global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="4"' : ' colspan="3"'); ?>> trans("AddNewLine").' - '; - if ($conf->service->enabled) + if (! empty($conf->service->enabled)) echo $langs->trans('RecordedProductsAndServices'); else echo $langs->trans('RecordedProducts'); @@ -46,9 +46,9 @@ if (! empty($conf->margin->enabled)) { ?> trans('BuyingPrice'); ?> global->DISPLAY_MARGIN_RATES) + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; - if($conf->global->DISPLAY_MARK_RATES) + if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; } ?> @@ -100,9 +100,9 @@ if (! empty($conf->margin->enabled)) { "> global->DISPLAY_MARGIN_RATES) + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; - if($conf->global->DISPLAY_MARK_RATES) + if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; } ?> @@ -115,9 +115,10 @@ if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) else $colspan = 9; if (! empty($conf->margin->enabled)) { - if($conf->global->DISPLAY_MARGIN_RATES) + $colspan++; // For the buying price + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; - if($conf->global->DISPLAY_MARK_RATES) + if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; } ?> @@ -139,10 +140,12 @@ if (! empty($conf->margin->enabled)) { ?>