From 1523b2ef8095cd95f46e617d7a75cb18054780d1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 28 Aug 2017 14:02:08 +0200 Subject: [PATCH 01/46] FIX #7222 --- htdocs/install/mysql/data/llx_accounting.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/data/llx_accounting.sql b/htdocs/install/mysql/data/llx_accounting.sql index 6448646bda0..f8696de1ea5 100644 --- a/htdocs/install/mysql/data/llx_accounting.sql +++ b/htdocs/install/mysql/data/llx_accounting.sql @@ -378,7 +378,7 @@ INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (323,'PCG99-BASE','CHARGE','XXXXXX', '601', '322', 'Achats stockés - Matières premières (et fournitures)', 1); INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (324,'PCG99-BASE','CHARGE','XXXXXX', '602', '322', 'Achats stockés - Autres approvisionnements', 1); INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (325,'PCG99-BASE','CHARGE','XXXXXX', '603', '322', 'Variations des stocks (approvisionnements et marchandises)', 1); -INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (326,'PCG99-BASE','CHARGE','XXXXXX', '604', '322', 'Achats stockés - Matières premières (et fournitures)', 1); +INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (326,'PCG99-BASE','CHARGE','XXXXXX', '604', '322', 'Achats études et prestations de services', 1); INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (327,'PCG99-BASE','CHARGE','XXXXXX', '605', '322', 'Achats de matériel, équipements et travaux', 1); INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (328,'PCG99-BASE','CHARGE','XXXXXX', '606', '322', 'Achats non stockés de matière et fournitures', 1); INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (329,'PCG99-BASE','CHARGE','XXXXXX', '607', '322', 'Achats de marchandises', 1); From 07f7db1b6d17de941b9473853729ddc38b003bb2 Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Tue, 29 Aug 2017 11:22:50 +0200 Subject: [PATCH 02/46] FIX createFromCurrent lastvalue --- htdocs/compta/facture/class/facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 221f224e043..efb55f9b64c 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -783,7 +783,7 @@ class Facture extends CommonInvoice $facture->situation_final = $this->situation_final; // Loop on each line of new invoice - foreach($facture->lines as $i => $line) + foreach($facture->lines as $i => &$line) { $facture->lines[$i]->fk_prev_id = $this->lines[$i]->rowid; if ($invertdetail) From e9cdf852868a3744b838c1fe762870a4321bcf2c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Aug 2017 12:58:18 +0200 Subject: [PATCH 03/46] Fxi repeair of collation --- htdocs/install/mysql/migration/repair.sql | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index cd55b7b38e2..e759985b7a8 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -35,7 +35,10 @@ -- VMYSQLUTF8UNICODECI ALTER TABLE llx_product_lot MODIFY batch VARCHAR(30) COLLATE utf8_unicode_ci; -- VMYSQLUTF8UNICODECI ALTER TABLE llx_product_batch MODIFY batch VARCHAR(30) CHARACTER SET utf8; -- VMYSQLUTF8UNICODECI ALTER TABLE llx_product_batch MODIFY batch VARCHAR(30) COLLATE utf8_unicode_ci; - +-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product MODIFY accountancy_code_sell VARCHAR(32) CHARACTER SET utf8; +-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product MODIFY accountancy_code_sell VARCHAR(32) COLLATE utf8_unicode_ci; +-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product MODIFY accountancy_code_buy VARCHAR(32) CHARACTER SET utf8; +-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product MODIFY accountancy_code_buy VARCHAR(32) COLLATE utf8_unicode_ci; -- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES'; From 22ca29a51febce118d726fdc6f1f0d5a4369c6eb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Aug 2017 13:32:25 +0200 Subject: [PATCH 04/46] Fix sql syntax error --- htdocs/core/menus/standard/auguria.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index fd4d2a4e7f7..3d38328249d 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -357,8 +357,8 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM $sql = "SELECT rowid, code, label, nature"; $sql.= " FROM ".MAIN_DB_PREFIX."accounting_journal"; $sql.= " WHERE entity = ".$conf->entity; - $sql.= " active = 1"; - $sql.= " ORDER BY label"; + $sql.= " AND active = 1"; + $sql.= " ORDER BY label DESC"; $resql = $db->query($sql); if ($resql) From eebaff95cf6a3f2ca9e384a355f1537da8d6b312 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Aug 2017 13:41:44 +0200 Subject: [PATCH 05/46] Fix pb with imagick --- htdocs/core/lib/files.lib.php | 31 +++++++++++++++++++------------ htdocs/core/lib/functions.lib.php | 7 +++++-- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 99b80049999..e3419be0d14 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1565,34 +1565,41 @@ function dol_remove_file_process($filenb,$donotupdatesession=0,$donotdeletefile= * @param string $fileinput Input file name * @param string $ext Format of target file (It is also extension added to file if fileoutput is not provided). * @param string $fileoutput Output filename - * @return int <0 if KO, >0 if OK + * @return int <0 if KO, 0=Nothing done, >0 if OK */ function dol_convert_file($fileinput,$ext='png',$fileoutput='') { global $langs; - $image=new Imagick(); - $ret = $image->readImage($fileinput); - if ($ret) + if (class_exists('Imagick')) { - $ret = $image->setImageFormat($ext); + $image=new Imagick(); + $ret = $image->readImage($fileinput); if ($ret) { - if (empty($fileoutput)) $fileoutput=$fileinput.".".$ext; + $ret = $image->setImageFormat($ext); + if ($ret) + { + if (empty($fileoutput)) $fileoutput=$fileinput.".".$ext; - $count = $image->getNumberImages(); - $ret = $image->writeImages($fileoutput, true); - if ($ret) return $count; - else return -3; + $count = $image->getNumberImages(); + $ret = $image->writeImages($fileoutput, true); + if ($ret) return $count; + else return -3; + } + else + { + return -2; + } } else { - return -2; + return -1; } } else { - return -1; + return 0; } } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 46796467ae6..4af0679920d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1236,8 +1236,11 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r && (! file_exists($fileimagebis) || (filemtime($fileimagebis) < filemtime($file))) ) { - $ret = dol_convert_file($file, 'png', $fileimage); - if ($ret < 0) $error++; + if (empty($conf->global->MAIN_DISABLE_PDF_THUMBS)) // If you experienc trouble with pdf thumb generation and imagick, you can disable here. + { + $ret = dol_convert_file($file, 'png', $fileimage); + if ($ret < 0) $error++; + } } $heightforphotref=70; From 8f01db10a6a77c5938d1e49d3e95311d1e181aae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Aug 2017 13:41:55 +0200 Subject: [PATCH 06/46] Fix setup for india --- htdocs/install/mysql/data/llx_c_tva.sql | 4 ++-- htdocs/install/mysql/migration/5.0.0-6.0.0.sql | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/htdocs/install/mysql/data/llx_c_tva.sql b/htdocs/install/mysql/data/llx_c_tva.sql index df533f39db0..cce279d79da 100644 --- a/htdocs/install/mysql/data/llx_c_tva.sql +++ b/htdocs/install/mysql/data/llx_c_tva.sql @@ -138,8 +138,8 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (11 insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1173, 117, '1','0','VAT super-reduced rate',0); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1174, 117, '0','0','VAT Rate 0', 0); -insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1176, 117, 'IGST+CGST', 8, 8, '1', 0, '0', 0, 'IGST+CGST', 1); -insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1177, 117, 'SGST' , 0, 0, '0', 16, '1', 0, 'SGST', 1); +insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1176, 117, 'CGST+SGST', 0, 9, '1', 9, '1', 0, 'CGST+SGST - Same state sales', 1); +insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1177, 117, 'IGST' , 18, 0, '0', 0, '0', 0, 'IGST', 1); -- IRELAND (id country=8) insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (81, 8, '0','0','VAT Rate 0',1); diff --git a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql index e41e561da38..b1a7088062d 100644 --- a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql +++ b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql @@ -582,6 +582,5 @@ ALTER TABLE llx_mailing_cibles MODIFY COLUMN source_url varchar(255); -- VPGSQL8.2 CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_website FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); -- VPGSQL8.2 CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_website_page FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); - -insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1176, 117, 'IGST-CGST', 8, 8, '1', 0, '0', 0, 'IGST-CGST', 1); -insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1177, 117, 'SGST', 0, 0, '0', 16, '1', 0, 'SGST', 1); +insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1176, 117, 'CGST+SGST', 0, 9, '1', 9, '1', 0, 'CGST+SGST - Same state sales', 1); +insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1177, 117, 'IGST' , 18, 0, '0', 0, '0', 0, 'IGST', 1); From 7218a9de0ebb781f0a73dfdedae3dbb6beb83925 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Aug 2017 13:52:24 +0200 Subject: [PATCH 07/46] Fix translation of total VAT --- .../commande/doc/pdf_einstein.modules.php | 30 +++++++++---------- .../modules/facture/doc/pdf_crabe.modules.php | 2 +- .../modules/propale/doc/pdf_azur.modules.php | 24 +++++++-------- .../pdf/pdf_canelle.modules.php | 4 +-- .../pdf/pdf_muscadet.modules.php | 8 ++--- .../doc/pdf_aurore.modules.php | 14 ++++----- 6 files changed, 41 insertions(+), 41 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 396ac54e9b5..785e4361c04 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -45,28 +45,28 @@ class pdf_einstein extends ModelePDFCommandes * @var DoliDb Database handler */ public $db; - + /** * @var string model name */ public $name; - + /** * @var string model description (short text) */ public $description; - + /** * @var string document type */ public $type; - + /** * @var array() Minimum version of PHP required by module. * e.g.: PHP ≥ 5.3 = array(5, 3) */ - public $phpmin = array(5, 2); - + public $phpmin = array(5, 2); + /** * Dolibarr version of the loaded document * @public string @@ -240,11 +240,11 @@ class pdf_einstein extends ModelePDFCommandes $pdf=pdf_getInstance($this->format); $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance $pdf->SetAutoPageBreak(1,0); - + $heightforinfotot = 40; // Height reserved to output the info and total part $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) - + if (class_exists('TCPDF')) { $pdf->setPrintHeader(false); @@ -317,16 +317,16 @@ class pdf_einstein extends ModelePDFCommandes $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1); $nexY = $pdf->GetY(); $height_incoterms=$nexY-$tab_top; - + // Rect prend une longueur en 3eme param $pdf->SetDrawColor(192,192,192); $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_incoterms+1); - + $tab_top = $nexY+6; $height_incoterms += 4; } } - + // Affiche notes $notetoshow=empty($object->note_public)?'':$object->note_public; if (! empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) @@ -478,7 +478,7 @@ class pdf_einstein extends ModelePDFCommandes // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva; else $tvaligne=$object->lines[$i]->total_tva; - + $localtax1ligne=$object->lines[$i]->total_localtax1; $localtax2ligne=$object->lines[$i]->total_localtax2; $localtax1_rate=$object->lines[$i]->localtax1_tx; @@ -585,7 +585,7 @@ class pdf_einstein extends ModelePDFCommandes $posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs); } */ - + // Pied de page $this->_pagefoot($pdf,$object,$outputlangs); if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); @@ -953,7 +953,7 @@ class pdf_einstein extends ModelePDFCommandes $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat =$outputlangs->transnoentities("TotalVAT").' '; + $totalvat =$outputlangs->transcountrynoentities("TotalVAT",$mysoc->country_code).' '; $totalvat.=vatrate($tvakey,1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -1294,7 +1294,7 @@ class pdf_einstein extends ModelePDFCommandes $pdf->MultiCell(100, 3, $langs->trans("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R'); } } - + $posy+=2; // Show list of linked objects diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 092ae36fe28..491b7562408 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1176,7 +1176,7 @@ class pdf_crabe extends ModelePDFFactures $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat =$outputlangs->transnoentities("TotalVAT").' '; + $totalvat =$outputlangs->transcountrynoentities("TotalVAT",$mysoc->country_code).' '; $totalvat.=vatrate($tvakey,1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index d2ecfb60d81..621e2af3218 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -273,7 +273,7 @@ class pdf_azur extends ModelePDFPropales $pdf=pdf_getInstance($this->format); $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance $pdf->SetAutoPageBreak(1,0); - + if (class_exists('TCPDF')) { $pdf->setPrintHeader(false); @@ -322,19 +322,19 @@ class pdf_azur extends ModelePDFPropales $pdf->AddPage(); if (! empty($tplidx)) $pdf->useTemplate($tplidx); $pagenb++; - + $heightforinfotot = 40; // Height reserved to output the info and total part $heightforsignature = empty($conf->global->PROPAL_DISABLE_SIGNATURE)?(pdfGetHeightForHtmlContent($pdf, $outputlangs->transnoentities("ProposalCustomerSignature"))+10):0; $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) - //print $heightforinfotot + $heightforsignature + $heightforfreetext + $heightforfooter;exit; - + //print $heightforinfotot + $heightforsignature + $heightforfreetext + $heightforfooter;exit; + $this->_pagehead($pdf, $object, 1, $outputlangs); $pdf->SetFont('','', $default_font_size - 1); $pdf->MultiCell(0, 3, ''); // Set interline to 3 $pdf->SetTextColor(0,0,0); - + $tab_top = 90; $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); $tab_height = 130; @@ -383,7 +383,7 @@ class pdf_azur extends ModelePDFPropales $notetoshow.='Affaire suivi par '.$tmpuser->getFullName($langs); if ($tmpuser->email) $notetoshow.=', Mail: '.$tmpuser->email; if ($tmpuser->office_phone) $notetoshow.=', Tel: '.$tmpuser->office_phone; - } + } if ($notetoshow) { $tab_top = 88 + $height_incoterms; @@ -552,14 +552,14 @@ class pdf_azur extends ModelePDFPropales // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva; else $tvaligne=$object->lines[$i]->total_tva; - + $localtax1ligne=$object->lines[$i]->total_localtax1; $localtax2ligne=$object->lines[$i]->total_localtax2; $localtax1_rate=$object->lines[$i]->localtax1_tx; $localtax2_rate=$object->lines[$i]->localtax2_tx; $localtax1_type=$object->lines[$i]->localtax1_type; - $localtax2_type=$object->lines[$i]->localtax2_type; - + $localtax2_type=$object->lines[$i]->localtax2_type; + if ($object->remise_percent) $tvaligne-=($tvaligne*$object->remise_percent)/100; if ($object->remise_percent) $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100; if ($object->remise_percent) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100; @@ -667,7 +667,7 @@ class pdf_azur extends ModelePDFPropales { $posy=$this->_signature_area($pdf, $object, $posy, $outputlangs); } - + // Pied de page $this->_pagefoot($pdf,$object,$outputlangs); if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); @@ -1103,7 +1103,7 @@ class pdf_azur extends ModelePDFPropales $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat =$outputlangs->transnoentities("TotalVAT").' '; + $totalvat =$outputlangs->transcountrynoentities("TotalVAT",$mysoc->country_code).' '; $totalvat.=vatrate($tvakey,1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -1479,7 +1479,7 @@ class pdf_azur extends ModelePDFPropales $pdf->MultiCell(100, 3, $langs->trans("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R'); } } - + $posy+=2; // Show list of linked objects 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 1e7e6f4bcad..36750226a0d 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -620,7 +620,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat =$outputlangs->transnoentities("TotalVAT").' '; + $totalvat =$outputlangs->transcountrynoentities("TotalVAT",$mysoc->country_code).' '; $totalvat.=vatrate($tvakey,1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -632,7 +632,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices { $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalVAT"), 0, 'L', 1); + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code), 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_tva), 0, 'R', 1); 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 c882ed89800..0365eb2bfb4 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -439,7 +439,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva; else $tvaligne=$object->lines[$i]->total_tva; - + $localtax1ligne=$object->lines[$i]->total_localtax1; $localtax2ligne=$object->lines[$i]->total_localtax2; $localtax1_rate=$object->lines[$i]->localtax1_tx; @@ -718,7 +718,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat =$outputlangs->transnoentities("TotalVAT").' '; + $totalvat =$outputlangs->transcountrynoentities("TotalVAT",$mysoc->country_code).' '; $totalvat.=vatrate($tvakey,1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -730,7 +730,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders { $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalVAT"), 0, 'L', 1); + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code), 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_tva), 0, 'R', 1); @@ -1124,7 +1124,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->MultiCell(100, 3, $langs->trans("BuyerName")." : ".$usertmp->getFullName($langs), '', 'R'); } } - + $posy+=1; $pdf->SetTextColor(0,0,60); diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index a7e8952c604..0982a18f3d0 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -177,7 +177,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $pdir = get_exdir(0,2,0,0,$objphoto,'product') . dol_sanitizeFileName($objphoto->ref).'/'; $dir = $conf->product->dir_output.'/'.$pdir; } - + $realpath=''; foreach ($objphoto->liste_photos($dir,1) as $key => $obj) { @@ -445,7 +445,7 @@ class pdf_aurore extends ModelePDFSupplierProposal if ($up_excl_tax > 0) $pdf->MultiCell($this->posxqty-$this->posxup-0.8, 3, $up_excl_tax, 0, 'R', 0); */ - + // Quantity $qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails); $pdf->SetXY($this->posxqty, $curY); @@ -466,11 +466,11 @@ class pdf_aurore extends ModelePDFSupplierProposal if ($total_excl_tax > 0) $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $total_excl_tax, 0, 'R', 0); */ - + // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva; else $tvaligne=$object->lines[$i]->total_tva; - + $localtax1ligne=$object->lines[$i]->total_localtax1; $localtax2ligne=$object->lines[$i]->total_localtax2; $localtax1_rate=$object->lines[$i]->localtax1_tx; @@ -941,7 +941,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat =$outputlangs->transnoentities("TotalVAT").' '; + $totalvat =$outputlangs->transcountrynoentities("TotalVAT",$mysoc->country_code).' '; $totalvat.=vatrate($tvakey,1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -1035,7 +1035,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $resteapayer = $object->total_ttc - $deja_regle; if (! empty($object->paye)) $resteapayer=0; */ - + if ($deja_regle > 0) { $index++; @@ -1297,7 +1297,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $pdf->MultiCell(100, 3, $langs->trans("BuyerName")." : ".$usertmp->getFullName($langs), '', 'R'); } } - + $posy+=2; // Show list of linked objects From d96a83adaccf74d19bea6ccd1be54d6e6d2cb093 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Aug 2017 16:37:00 +0200 Subject: [PATCH 08/46] Fix bad total included tax when mutlicurrency is on --- htdocs/core/modules/commande/doc/pdf_einstein.modules.php | 2 +- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 2 +- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 2 +- .../core/modules/supplier_invoice/pdf/pdf_canelle.modules.php | 2 +- htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 785e4361c04..c87a66de791 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -1035,7 +1035,7 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetFillColor(224,224,224); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); - $total_ttc = ($conf->multicurrency->enabled && $object->multiccurency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; + $total_ttc = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc, 0, $outputlangs), $useborder, 'R', 1); } diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 491b7562408..c473740a05d 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1270,7 +1270,7 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetFillColor(224,224,224); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); - $total_ttc = ($conf->multicurrency->enabled && $object->multiccurency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; + $total_ttc = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($sign * $total_ttc, 0, $outputlangs), $useborder, 'R', 1); } diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 621e2af3218..9a928a7ce2b 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -1186,7 +1186,7 @@ class pdf_azur extends ModelePDFPropales $pdf->SetFillColor(224,224,224); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); - $total_ttc = ($conf->multicurrency->enabled && $object->multiccurency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; + $total_ttc = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc, 0, $outputlangs), $useborder, 'R', 1); } 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 36750226a0d..8737c39f67f 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -723,7 +723,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->SetFillColor(224,224,224); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); - $total_ttc = ($conf->multicurrency->enabled && $object->multiccurency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; + $total_ttc = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc), $useborder, 'R', 1); 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 0365eb2bfb4..8380ff65e9a 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -829,7 +829,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetFillColor(224,224,224); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); - $total_ttc = ($conf->multicurrency->enabled && $object->multiccurency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; + $total_ttc = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc), $useborder, 'R', 1); $pdf->SetFont('','', $default_font_size - 1); From e862ba9daf02bab51a5876e182d8bd4e566d6142 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Aug 2017 17:22:03 +0200 Subject: [PATCH 09/46] NEW Add detail of all tax rates into pdf column tax sale. --- htdocs/core/lib/pdf.lib.php | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 5b344056efb..e4fa52e787f 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1470,7 +1470,7 @@ function pdf_getlineref_supplier($object,$i,$outputlangs,$hidedetails=0) */ function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0) { - global $hookmanager; + global $conf, $hookmanager, $mysoc; $result=''; $reshook=0; @@ -1487,7 +1487,32 @@ function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0) } if (empty($reshook)) { - if (empty($hidedetails) || $hidedetails > 1) $result.=vatrate($object->lines[$i]->tva_tx,1,$object->lines[$i]->info_bits,1); + if (empty($hidedetails) || $hidedetails > 1) + { + $tmpresult=''; + + $tmpresult.=vatrate($object->lines[$i]->tva_tx,1,$object->lines[$i]->info_bits,1); + if (empty($conf->PDF_MAIN_HIDE_SECOND_TAX)) + { + if ($object->lines[$i]->total_localtax1 != 0) + { + if (preg_replace('/[\s0%]/','',$tmpresult)) $tmpresult.='+'; + else $tmpresult=''; + $tmpresult.=vatrate(abs($object->lines[$i]->total_localtax1),1); + } + } + if (empty($conf->PDF_MAIN_HIDE_THIRD_TAX)) + { + if ($object->lines[$i]->total_localtax2 != 0) + { + if (preg_replace('/[\s0%]/','',$tmpresult)) $tmpresult.='+'; + else $tmpresult=''; + $tmpresult.=vatrate(abs($object->lines[$i]->total_localtax2),1); + } + } + + $result.=$tmpresult; + } } return $result; } From dabd8820560c549355456e78498b07a2cde1e3df Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Aug 2017 17:24:49 +0200 Subject: [PATCH 10/46] Use a slash --- htdocs/core/lib/pdf.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index e4fa52e787f..7e282c3667d 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1496,7 +1496,7 @@ function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0) { if ($object->lines[$i]->total_localtax1 != 0) { - if (preg_replace('/[\s0%]/','',$tmpresult)) $tmpresult.='+'; + if (preg_replace('/[\s0%]/','',$tmpresult)) $tmpresult.='/'; else $tmpresult=''; $tmpresult.=vatrate(abs($object->lines[$i]->total_localtax1),1); } @@ -1505,7 +1505,7 @@ function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0) { if ($object->lines[$i]->total_localtax2 != 0) { - if (preg_replace('/[\s0%]/','',$tmpresult)) $tmpresult.='+'; + if (preg_replace('/[\s0%]/','',$tmpresult)) $tmpresult.='/'; else $tmpresult=''; $tmpresult.=vatrate(abs($object->lines[$i]->total_localtax2),1); } From 044feab00fd887d226e64863475b945861589cc8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Aug 2017 17:52:10 +0200 Subject: [PATCH 11/46] Fix duplicate code --- htdocs/holiday/list.php | 55 ++++++++++++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 14 deletions(-) diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 8541454e549..9c7ff195018 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -260,9 +260,16 @@ if ($id > 0) dol_banner_tab($fuser,'id',$linkback,$user->rights->user->user->lire || $user->admin); - print '
'; + if (empty($conf->global->HOLIDAY_HIDE_BALANCE)) + { + print '
'; - print '
'; + print '
'; + + showMyBalance($holiday, $user_id); + } + + dol_fiche_end(); } else { @@ -270,23 +277,43 @@ else //print count($holiday->holiday); print_barre_liste($langs->trans("ListeCP"), $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, "", $num, count($holiday->holiday), 'title_hrm.png', 0, '', '', $limit); - dol_fiche_head(''); + if (empty($conf->global->HOLIDAY_HIDE_BALANCE)) + { + dol_fiche_head(''); + + showMyBalance($holiday, $user_id); + + dol_fiche_end(); + } } -$alltypeleaves=$holiday->getTypes(1,-1); // To have labels -$out=''; -$typeleaves=$holiday->getTypes(1,1); -foreach($typeleaves as $key => $val) + +/** + * Show balance of user + * + * @param Holiday $holiday Object $holiday + * @param int $user_id User id + * @return string Html code with balance + */ +function showMyBalance($holiday, $user_id) { - $nb_type = $holiday->getCPforUser($user_id, $val['rowid']); - $nb_holiday += $nb_type; - $out .= ' - '.$val['label'].': '.($nb_type?price2num($nb_type):0).'
'; -} -print $langs->trans('SoldeCPUser', round($nb_holiday,5)).'
'; -print $out; + global $conf, $langs; + + $alltypeleaves=$holiday->getTypes(1,-1); // To have labels + + $out=''; + $typeleaves=$holiday->getTypes(1,1); + foreach($typeleaves as $key => $val) + { + $nb_type = $holiday->getCPforUser($user_id, $val['rowid']); + $nb_holiday += $nb_type; + $out .= ' - '.$val['label'].': '.($nb_type?price2num($nb_type):0).'
'; + } + print $langs->trans('SoldeCPUser', round($nb_holiday,5)).'
'; + print $out; +} -dol_fiche_end(); if ($id > 0) print '
'; From 945fb61e591193c3c8bf92a3004426facfc7120d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Aug 2017 18:22:01 +0200 Subject: [PATCH 12/46] Update facture.class.php --- htdocs/compta/facture/class/facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index efb55f9b64c..b5a399675e7 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -783,7 +783,7 @@ class Facture extends CommonInvoice $facture->situation_final = $this->situation_final; // Loop on each line of new invoice - foreach($facture->lines as $i => &$line) + foreach($facture->lines as $i => $tmpline) { $facture->lines[$i]->fk_prev_id = $this->lines[$i]->rowid; if ($invertdetail) From 6c202c5fa1910347f66ec85eaef35938bd5d7133 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Aug 2017 19:55:49 +0200 Subject: [PATCH 13/46] Fix vat rate to show and not vat amount --- htdocs/core/lib/pdf.lib.php | 10 +++++----- htdocs/langs/en_US/errors.lang | 1 + htdocs/langs/en_US/main.lang | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 7e282c3667d..77f295bd813 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1491,23 +1491,23 @@ function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0) { $tmpresult=''; - $tmpresult.=vatrate($object->lines[$i]->tva_tx,1,$object->lines[$i]->info_bits,1); + $tmpresult.=vatrate($object->lines[$i]->tva_tx, 1, $object->lines[$i]->info_bits, 1); if (empty($conf->PDF_MAIN_HIDE_SECOND_TAX)) { - if ($object->lines[$i]->total_localtax1 != 0) + if ($object->lines[$i]->localtax1_tx != 0) { if (preg_replace('/[\s0%]/','',$tmpresult)) $tmpresult.='/'; else $tmpresult=''; - $tmpresult.=vatrate(abs($object->lines[$i]->total_localtax1),1); + $tmpresult.=vatrate(abs($object->lines[$i]->localtax1_tx),1); } } if (empty($conf->PDF_MAIN_HIDE_THIRD_TAX)) { - if ($object->lines[$i]->total_localtax2 != 0) + if ($object->lines[$i]->localtax2_tx != 0) { if (preg_replace('/[\s0%]/','',$tmpresult)) $tmpresult.='/'; else $tmpresult=''; - $tmpresult.=vatrate(abs($object->lines[$i]->total_localtax2),1); + $tmpresult.=vatrate(abs($object->lines[$i]->localtax2_tx),1); } } diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index b03b8ad37bb..8dfc02c49f1 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -195,6 +195,7 @@ ErrorNoWarehouseDefined=Error, no warehouses defined. ErrorBadLinkSourceSetButBadValueForRef=The link you use is not valid. A 'source' for payment is defined, but value for 'ref' is not valid. ErrorTooManyErrorsProcessStopped=Too many errors. Process was stopped. ErrorOnlyInvoiceValidatedCanBeSentInMassAction=Only validated invoices can be sent using the "Send by email" mass action. +ErrorChooseBetweenFreeEntryOrPredefinedProduct=You must choose if article is a predefined product or not # Warnings WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user. diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 8d180568073..b8544ee3eda 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -657,8 +657,8 @@ Page=Page Notes=Notes AddNewLine=Add new line AddFile=Add file -FreeZone=Free entry -FreeLineOfType=Free entry of type +FreeZone=Not a predefined product/service +FreeLineOfType=Not a predefined entry of type CloneMainAttributes=Clone object with its main attributes PDFMerge=PDF Merge Merge=Merge From 991a33f7b67a34a0e7aee41f473cbfe36661adae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Aug 2017 20:40:51 +0200 Subject: [PATCH 14/46] Make different vat rates visible --- htdocs/core/lib/functions.lib.php | 8 +++++- htdocs/core/tpl/objectline_view.tpl.php | 33 ++++++++++++++++--------- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 4af0679920d..d79c3def247 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3702,7 +3702,13 @@ function vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0) $info_bits |= 1; } - $ret=price($rate,0,'',0,0).($addpercent?'%':''); + // If rate is '9/9/9' we don't change it. If rate is '9.000' we apply price() + if (! preg_match('/\//', $rate)) $ret=price($rate,0,'',0,0).($addpercent?'%':''); + else + { + // TODO Split on / and output with a price2num to have clean numbers with ton of 000. + $ret=$rate.($addpercent?'%':''); + } if ($info_bits & 1) $ret.=' *'; $ret.=$morelabel; return $ret; diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index c347c693691..5cfe2459247 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -32,7 +32,7 @@ * $usemargins (0 to disable all margins columns, 1 to show according to margin setup) * $object_rights->creer initialized from = $object->getRights() * $disableedit, $disablemove, $disableremove - * + * * $type, $text, $description, $line */ @@ -55,7 +55,7 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0;
- info_bits & 2) == 2) { ?> @@ -83,7 +83,7 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0; $discount->fetch($line->fk_remise_except); echo ($txt?' - ':'').$langs->transnoentities("DiscountFromDeposit",$discount->getNomUrl(0)); // Add date of deposit - if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) + if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo ' ('.dol_print_date($discount->datec).')'; } elseif ($line->description == '(EXCESS RECEIVED)' && $objp->fk_remise_except > 0) @@ -101,11 +101,11 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0; else { $format = $conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE?'dayhour':'day'; - + if ($line->fk_product > 0) { echo $form->textwithtooltip($text,$description,3,'','',$i,0,(!empty($line->fk_parent_line)?img_picto('', 'rightarrow'):'')); - + // Show range echo get_date_range($line->date_start, $line->date_end, $format); @@ -138,17 +138,26 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0; element == 'supplier_proposal') { ?> ref_fourn; ?> - - tva_tx.($line->vat_src_code?(' ('.$line->vat_src_code.')'):''), '%', $line->info_bits); ?> + tva_tx)) $positiverates.=($positiverates?'/':'').price2num($line->tva_tx); + if (price2num($line->localtax1_tx)) $positiverates.=($positiverates?'/':'').price2num($line->localtax1_tx); + if (price2num($line->localtax2_tx)) $positiverates.=($positiverates?'/':'').price2num($line->localtax2_tx); + if (empty($positiverates)) $positiverates='0'; + echo vatrate($positiverates.($line->vat_src_code?' ('.$line->vat_src_code.')':''), '%', $line->info_bits); + //echo vatrate($line->tva_tx.($line->vat_src_code?(' ('.$line->vat_src_code.')'):''), '%', $line->info_bits); + ?> subprice); ?> - + multicurrency->enabled)) { ?> multicurrency_subprice); ?> - + pu_ttc)?price($line->pu_ttc):price($line->subprice)); ?> @@ -194,7 +203,7 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0; { $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT); ?> - + rights->margins->creer)) { ?> pa_ht); ?> @@ -220,7 +229,7 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0; - statut == 0 && ($object_rights->creer)) { ?> info_bits & 2) == 2 || ! empty($disableedit)) { ?> @@ -241,7 +250,7 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0; ?> - 1 && empty($conf->browser->phone) && ($this->situation_counter == 1 || !$this->situation_cycle_ref) && empty($disablemove)) { ?> 0) { ?> From 4998eb3061cb403f283202a6be0f2e197a39623d Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 29 Aug 2017 21:21:59 +0200 Subject: [PATCH 15/46] Fix: Accountancy journal, fetch on rowid, not code --- htdocs/compta/bank/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php index 9e5ddf8008a..fa880e0597f 100644 --- a/htdocs/compta/bank/index.php +++ b/htdocs/compta/bank/index.php @@ -514,7 +514,7 @@ foreach ($accounts as $key=>$type) if (! empty($conf->accounting->enabled)) { $accountingjournal = new AccountingJournal($db); - $accountingjournal->fetch('',$acc->fk_accountancy_journal); + $accountingjournal->fetch($acc->fk_accountancy_journal); print $accountingjournal->getNomUrl(0,1,1,'',1); } else From e081653cef9cb616292ea029fef04cd235ccba88 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 30 Aug 2017 06:38:33 +0200 Subject: [PATCH 16/46] Add fk_projet in table various_payment --- htdocs/install/mysql/migration/6.0.0-7.0.0.sql | 14 +++++++------- .../install/mysql/tables/llx_payment_various.sql | 3 ++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql index 76517914c0e..b0ca503d938 100644 --- a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql +++ b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql @@ -64,24 +64,24 @@ CREATE TABLE IF NOT EXISTS llx_expensereport_ik ( datec datetime DEFAULT NULL, tms timestamp, fk_c_exp_tax_cat integer DEFAULT 0 NOT NULL, - fk_range integer DEFAULT 0 NOT NULL, - coef double DEFAULT 0 NOT NULL, - offset double DEFAULT 0 NOT NULL + fk_range integer DEFAULT 0 NOT NULL, + coef double DEFAULT 0 NOT NULL, + offset double DEFAULT 0 NOT NULL )ENGINE=innodb DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS llx_c_exp_tax_cat ( rowid integer AUTO_INCREMENT PRIMARY KEY, label varchar(48) NOT NULL, entity integer DEFAULT 1 NOT NULL, - active integer DEFAULT 1 NOT NULL + active integer DEFAULT 1 NOT NULL )ENGINE=innodb DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS llx_c_exp_tax_range ( rowid integer AUTO_INCREMENT PRIMARY KEY, fk_c_exp_tax_cat integer DEFAULT 1 NOT NULL, - range_ik double DEFAULT 0 NOT NULL, + range_ik double DEFAULT 0 NOT NULL, entity integer DEFAULT 1 NOT NULL, - active integer DEFAULT 1 NOT NULL + active integer DEFAULT 1 NOT NULL )ENGINE=innodb DEFAULT CHARSET=utf8; INSERT INTO llx_c_type_fees (code, label, active, accountancy_code) VALUES @@ -201,5 +201,5 @@ ALTER TABLE llx_extrafields ADD COLUMN tms timestamp; ALTER TABLE llx_holiday_config MODIFY COLUMN name varchar(128); ALTER TABLE llx_holiday_config ADD UNIQUE INDEX idx_holiday_config (name); - +ALTER TABLE llx_payment_various ADD COLUMN fk_projet integer DEFAULT NULL after accountancy_code; diff --git a/htdocs/install/mysql/tables/llx_payment_various.sql b/htdocs/install/mysql/tables/llx_payment_various.sql index abaf9fdab26..e92b244b009 100644 --- a/htdocs/install/mysql/tables/llx_payment_various.sql +++ b/htdocs/install/mysql/tables/llx_payment_various.sql @@ -28,7 +28,8 @@ create table llx_payment_various fk_typepayment integer NOT NULL, num_payment varchar(50), -- ref label varchar(255), - accountancy_code varchar(32), + accountancy_code varchar(32), + fk_projet integer DEFAULT NULL, entity integer DEFAULT 1 NOT NULL, -- multi company id note text, fk_bank integer, From d3c95e030baafb3da50f5e4a30e31c429aa85d63 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Aug 2017 14:34:36 +0200 Subject: [PATCH 17/46] Fix delete file not possible for external user even with permissions --- htdocs/comm/propal/document.php | 1 - htdocs/commande/document.php | 1 - htdocs/compta/facture/document.php | 17 +++++++++-------- htdocs/core/actions_linkedfiles.inc.php | 6 +++--- .../tpl/document_actions_post_headers.tpl.php | 2 +- htdocs/supplier_proposal/document.php | 19 +++++++++---------- 6 files changed, 22 insertions(+), 24 deletions(-) diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index 65b8eef5a66..3a9f3a98e26 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -45,7 +45,6 @@ $ref = GETPOST('ref','alpha'); $socid=''; if (! empty($user->societe_id)) { - $action=''; $socid = $user->societe_id; } $result = restrictedArea($user, 'propal', $id); diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index 7eea9c95877..d69ec07360a 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -44,7 +44,6 @@ $ref = GETPOST('ref'); // Security check if ($user->societe_id) { - $action=''; $socid = $user->societe_id; } $result=restrictedArea($user,'commande',$id,''); diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index b6c77207952..1ab0d7ceb93 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -49,7 +49,6 @@ $confirm=GETPOST('confirm', 'alpha'); // Security check if ($user->societe_id) { - $action=''; $socid = $user->societe_id; } $result=restrictedArea($user,'facture',$id,''); @@ -72,9 +71,11 @@ if ($object->fetch($id)) $upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($object->ref); } + /* * Actions */ + include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; @@ -100,7 +101,7 @@ if ($id > 0 || ! empty($ref)) dol_fiche_head($head, 'documents', $langs->trans('InvoiceCustomer'), -1, 'bill'); $totalpaye = $object->getSommePaiement(); - + // Construit liste des fichiers $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); $totalsize=0; @@ -109,11 +110,11 @@ if ($id > 0 || ! empty($ref)) $totalsize+=$file['size']; } - + // Invoice content - + $linkback = '' . $langs->trans("BackToList") . ''; - + $morehtmlref='
'; // Ref customer $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); @@ -154,14 +155,14 @@ if ($id > 0 || ! empty($ref)) } } $morehtmlref.='
'; - + $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status - + dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0); print '
'; print '
'; - + print ''; print ''; diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php index f21c41d828d..981de037c13 100644 --- a/htdocs/core/actions_linkedfiles.inc.php +++ b/htdocs/core/actions_linkedfiles.inc.php @@ -30,9 +30,9 @@ if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) if ($object->id) { if (! empty($upload_dirold) && ! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) - dol_add_file_process($upload_dirold, 0, 1, 'userfile', GETPOST('savingdocmask')); + $result = dol_add_file_process($upload_dirold, 0, 1, 'userfile', GETPOST('savingdocmask')); else - dol_add_file_process($upload_dir, 0, 1, 'userfile', GETPOST('savingdocmask')); + $result = dol_add_file_process($upload_dir, 0, 1, 'userfile', GETPOST('savingdocmask')); } } elseif (GETPOST('linkit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) @@ -176,7 +176,7 @@ elseif ($action == 'renamefile' && GETPOST('renamefilesave')) setEventMessages($langs->trans("FileRenamed"), null); } - else + else { $langs->load("errors"); // key must be loaded because we can't rely on loading during output, we need var substitution to be done now. setEventMessages($langs->trans("ErrorFailToRenameFile", $filenamefrom, $filenameto), null, 'errors'); diff --git a/htdocs/core/tpl/document_actions_post_headers.tpl.php b/htdocs/core/tpl/document_actions_post_headers.tpl.php index 064eda8e5b5..e613c479ee0 100644 --- a/htdocs/core/tpl/document_actions_post_headers.tpl.php +++ b/htdocs/core/tpl/document_actions_post_headers.tpl.php @@ -80,7 +80,7 @@ $formfile->form_attach_new_file( $disablemove=1; if ($modulepart == 'produit') $disablemove=0; - + // List of document $formfile->list_of_documents( $filearray, diff --git a/htdocs/supplier_proposal/document.php b/htdocs/supplier_proposal/document.php index cec276a6064..4985fd34629 100644 --- a/htdocs/supplier_proposal/document.php +++ b/htdocs/supplier_proposal/document.php @@ -44,7 +44,6 @@ $ref = GETPOST('ref','alpha'); $socid=''; if (! empty($user->societe_id)) { - $action=''; $socid = $user->societe_id; } $result = restrictedArea($user, 'supplier_proposal', $id); @@ -96,8 +95,8 @@ if ($object->id > 0) // Supplier proposal card $linkback = '' . $langs->trans("BackToList") . ''; - - + + $morehtmlref='
'; // Ref supplier //$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', 0, 1); @@ -138,14 +137,14 @@ if ($object->id > 0) } } $morehtmlref.='
'; - - + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - - + + print '
'; print '
'; - + print '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'; print ''; @@ -154,9 +153,9 @@ if ($object->id > 0) print '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'; print '
'; - + dol_fiche_end(); - + $modulepart = 'supplier_proposal'; $permission = $user->rights->supplier_proposal->creer; $permtoedit = $user->rights->supplier_proposal->creer; From bfc5f01e1ea364c068f4e9e1f912173e0c3861f6 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Wed, 30 Aug 2017 14:36:00 +0200 Subject: [PATCH 18/46] NEW Add detail of all tax rates into pdf column tax sale. -Can be hidden by pdf setup page -For know if localtax is applied into line we have to read totaltax line --- htdocs/admin/pdf.php | 76 ++++++++++++++++++++++++- htdocs/core/lib/pdf.lib.php | 12 ++-- htdocs/core/tpl/objectline_view.tpl.php | 5 +- htdocs/langs/en_US/admin.lang | 6 +- 4 files changed, 87 insertions(+), 12 deletions(-) diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 6698be8b01f..f366d8a5ce3 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -2,7 +2,7 @@ /* Copyright (C) 2001-2005 Rodolphe Quiedeville * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin - * Copyright (C) 2012-2105 Juanjo Menent + * Copyright (C) 2012-2107 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 @@ -74,7 +74,11 @@ if ($action == 'update') dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_REF"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", $_POST["MAIN_PDF_USE_ISO_LOCATION"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS"],'chaine',0,'',$conf->entity); - + + + dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_SECOND_TAX", $_POST["MAIN_PDF_MAIN_HIDE_SECOND_TAX"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_THIRD_TAX", $_POST["_MAIN_PDF_MAIN_HIDE_THIRD_TAX"],'chaine',0,'',$conf->entity); + header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); exit; } @@ -249,6 +253,40 @@ if ($action == 'edit') // Edit print '
'; + // Localtaxes + if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2)) + { + $locales =''; + $text=''; + + if ($mysoc->useLocalTax(1)) + { + $locales = $langs->transcountry("LT1",$mysoc->country_code); + $text ='' . $langs->trans("HideLocalTaxOnPDF",$langs->transcountry("LT1",$mysoc->country_code)) . ''; + $text.= $form->selectyesno('MAIN_PDF_MAIN_HIDE_SECOND_TAX', (!empty($conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX)) ? $conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX : 0, 1); + $text .= ''; + } + + if ($mysoc->useLocalTax(2)) + { + $locales.=($locales?' & ':'').$langs->transcountry("LT2",$mysoc->country_code); + + $text.= '' . $langs->trans("HideLocalTaxOnPDF",$langs->transcountry("LT2",$mysoc->country_code)) . ''; + $text.= $form->selectyesno('MAIN_PDF_MAIN_HIDE_THIRD_TAX', (!empty($conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX)) ? $conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX : 0, 1); + $text.= ''; + } + + print load_fiche_titre($langs->trans("PDFLocaltax",$locales),'',''); + $var=true; + print ''; + print ''; + print $text; + + print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; + print '
'; + + } + // Other print load_fiche_titre($langs->trans("Other"),'','').'
'; $var=true; @@ -444,6 +482,40 @@ else // Show print '
'; + // Localtaxes + if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2)) + { + $locales =''; + $text=''; + + if ($mysoc->useLocalTax(1)) + { + $locales = $langs->transcountry("LT1",$mysoc->country_code); + $text ='' . $langs->trans("HideLocalTaxOnPDF",$langs->transcountry("LT1",$mysoc->country_code)) . ''; + $text .= yn($conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX,1); + $text .= ''; + } + + if ($mysoc->useLocalTax(2)) + { + $locales.=($locales?' & ':'').$langs->transcountry("LT2",$mysoc->country_code); + + $text.= '' . $langs->trans("HideLocalTaxOnPDF",$langs->transcountry("LT2",$mysoc->country_code)) . ''; + $text.= yn($conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX,1); + $text.= ''; + } + + print load_fiche_titre($langs->trans("PDFLocaltax",$locales),'',''); + $var=true; + print ''; + print ''; + print $text; + + print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; + print '
'; + + } + // Other print load_fiche_titre($langs->trans("Other"),'',''); $var=true; diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 77f295bd813..8a445625022 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1,9 +1,9 @@ +/* Copyright (C) 2006-2017 Laurent Destailleur * Copyright (C) 2006 Rodolphe Quiedeville * Copyright (C) 2007 Patrick Raguin * Copyright (C) 2010-2012 Regis Houssin - * Copyright (C) 2010 Juanjo Menent + * Copyright (C) 2010-2017 Juanjo Menent * Copyright (C) 2012 Christophe Battarel * Copyright (C) 2012 Cédric Salvador * Copyright (C) 2012-2015 Raphaël Doursenaud @@ -1492,18 +1492,18 @@ function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0) $tmpresult=''; $tmpresult.=vatrate($object->lines[$i]->tva_tx, 1, $object->lines[$i]->info_bits, 1); - if (empty($conf->PDF_MAIN_HIDE_SECOND_TAX)) + if (empty($conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX)) { - if ($object->lines[$i]->localtax1_tx != 0) + if ($object->lines[$i]->total_localtax1 != 0) { if (preg_replace('/[\s0%]/','',$tmpresult)) $tmpresult.='/'; else $tmpresult=''; $tmpresult.=vatrate(abs($object->lines[$i]->localtax1_tx),1); } } - if (empty($conf->PDF_MAIN_HIDE_THIRD_TAX)) + if (empty($conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX)) { - if ($object->lines[$i]->localtax2_tx != 0) + if ($object->lines[$i]->total_localtax2 != 0) { if (preg_replace('/[\s0%]/','',$tmpresult)) $tmpresult.='/'; else $tmpresult=''; diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 5cfe2459247..7176e4a028d 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -5,6 +5,7 @@ * Copyright (C) 2012 Cédric Salvador * Copyright (C) 2012-2014 Raphaël Doursenaud * Copyright (C) 2013 Florian Henry + * Copyright (C) 2017 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 @@ -145,8 +146,8 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0; //var_dump($line); $positiverates=''; if (price2num($line->tva_tx)) $positiverates.=($positiverates?'/':'').price2num($line->tva_tx); - if (price2num($line->localtax1_tx)) $positiverates.=($positiverates?'/':'').price2num($line->localtax1_tx); - if (price2num($line->localtax2_tx)) $positiverates.=($positiverates?'/':'').price2num($line->localtax2_tx); + if (price2num($line->total_localtax1)) $positiverates.=($positiverates?'/':'').price2num($line->localtax1_tx); + if (price2num($line->total_localtax2_tx)) $positiverates.=($positiverates?'/':'').price2num($line->localtax2_tx); if (empty($positiverates)) $positiverates='0'; echo vatrate($positiverates.($line->vat_src_code?' ('.$line->vat_src_code.')':''), '%', $line->info_bits); //echo vatrate($line->tva_tx.($line->vat_src_code?(' ('.$line->vat_src_code.')'):''), '%', $line->info_bits); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 2e3ccdd965e..4ef46f4d2fc 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -356,6 +356,8 @@ PDF=PDF PDFDesc=You can set each global options related to the PDF generation PDFAddressForging=Rules to forge address boxes HideAnyVATInformationOnPDF=Hide all information related to VAT on generated PDF +PDFLocaltax=Rules for %s +HideLocalTaxOnPDF=Hide %s into pdf column tax sale HideDescOnPDF=Hide products description on generated PDF HideRefOnPDF=Hide products ref. on generated PDF HideDetailsOnPDF=Hide product lines details on generated PDF @@ -1638,11 +1640,11 @@ BackgroundTableLineEvenColor=Background color for even table lines MinimumNoticePeriod=Minimum notice period (Your leave request must be done before this delay) NbAddedAutomatically=Number of days added to counters of users (automatically) each month EnterAnyCode=This field contains a reference to identify line. Enter any value of your choice, but without special characters. -UnicodeCurrency=Enter here between braces, list of byte number that represent the currency symbol. For exemple: for $, enter [36] - for brazil real R$ [82,36] - for €, enter [8364] +UnicodeCurrency=Enter here between braces, list of byte number that represent the currency symbol. For exemple: for $, enter [36] - for brazil real R$ [82,36] - for ?, enter [8364] ColorFormat=The RGB color is in HEX format, eg: FF0000 PositionIntoComboList=Position of line into combo lists SellTaxRate=Sale tax rate -RecuperableOnly=Yes for VAT "Non Perçue Récupérable" dedicated for some state in France. Keep value to "No" in all other cases. +RecuperableOnly=Yes for VAT "Non Per?ue R?cup?rable" dedicated for some state in France. Keep value to "No" in all other cases. UrlTrackingDesc=If the provider or transport service offer a page or web site to check status of your shipping, you can enter it here. You can use the key {TRACKID} into URL parameters so the system will replace it with value of tracking number user entered into shipment card. OpportunityPercent=When you create an opportunity, you will defined an estimated amount of project/lead. According to status of opportunity, this amount may be multiplicated by this rate to evaluate global amount all your opportunities may generate. Value is percent (between 0 and 100). TemplateForElement=This template record is dedicated to which element From 70cbaeb423684fe231b61f509459e6dcb6b15bd8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Aug 2017 16:10:39 +0200 Subject: [PATCH 19/46] Fix mass merging must read only PDF generated for REF. --- htdocs/core/actions_massactions.inc.php | 38 ++++++++++++------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index e424fe0376b..68258025098 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -429,7 +429,7 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se } $arrayofinclusion=array(); - foreach($listofobjectref as $tmppdf) $arrayofinclusion[]=preg_quote($tmppdf.'.pdf','/'); + foreach($listofobjectref as $tmppdf) $arrayofinclusion[]='^'.preg_quote($tmppdf.'.pdf','/').'$'; $listoffiles = dol_dir_list($uploaddir,'all',1,implode('|',$arrayofinclusion),'\.meta$|\.png','date',SORT_DESC,0,true); // build list of files with full path @@ -505,8 +505,8 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se $pdf=pdf_getInstance(); if (class_exists('TCPDF')) { - $pdf->setPrintHeader(false); - $pdf->setPrintFooter(false); + $pdf->setPrintHeader(false); + $pdf->setPrintFooter(false); } $pdf->SetFont(pdf_getPDFFont($outputlangs)); @@ -515,15 +515,15 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se // Add all others foreach($files as $file) { - // Charge un document PDF depuis un fichier. - $pagecount = $pdf->setSourceFile($file); - for ($i = 1; $i <= $pagecount; $i++) - { - $tplidx = $pdf->importPage($i); - $s = $pdf->getTemplatesize($tplidx); - $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); - $pdf->useTemplate($tplidx); - } + // Charge un document PDF depuis un fichier. + $pagecount = $pdf->setSourceFile($file); + for ($i = 1; $i <= $pagecount; $i++) + { + $tplidx = $pdf->importPage($i); + $s = $pdf->getTemplatesize($tplidx); + $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); + $pdf->useTemplate($tplidx); + } } // Create output dir if not exists @@ -536,18 +536,18 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se // Save merged file if ($filter=='paye:0') { - if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late"))); - else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))); + if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late"))); + else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))); } if ($year) $filename.='_'.$year; if ($month) $filename.='_'.$month; if ($pagecount) { - $now=dol_now(); - $file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf'; - $pdf->Output($file,'F'); - if (! empty($conf->global->MAIN_UMASK)) - @chmod($file, octdec($conf->global->MAIN_UMASK)); + $now=dol_now(); + $file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf'; + $pdf->Output($file,'F'); + if (! empty($conf->global->MAIN_UMASK)) + @chmod($file, octdec($conf->global->MAIN_UMASK)); $langs->load("exports"); setEventMessages($langs->trans('FileSuccessfullyBuilt',$filename.'_'.dol_print_date($now,'dayhourlog')), null, 'mesgs'); From a3085cb44a95afd7453f12e33362158ad5c27dca Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Aug 2017 16:43:57 +0200 Subject: [PATCH 20/46] Update objectline_view.tpl.php --- htdocs/core/tpl/objectline_view.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 7176e4a028d..f968fdcbfc7 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -147,7 +147,7 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0; $positiverates=''; if (price2num($line->tva_tx)) $positiverates.=($positiverates?'/':'').price2num($line->tva_tx); if (price2num($line->total_localtax1)) $positiverates.=($positiverates?'/':'').price2num($line->localtax1_tx); - if (price2num($line->total_localtax2_tx)) $positiverates.=($positiverates?'/':'').price2num($line->localtax2_tx); + if (price2num($line->total_localtax2)) $positiverates.=($positiverates?'/':'').price2num($line->localtax2_tx); if (empty($positiverates)) $positiverates='0'; echo vatrate($positiverates.($line->vat_src_code?' ('.$line->vat_src_code.')':''), '%', $line->info_bits); //echo vatrate($line->tva_tx.($line->vat_src_code?(' ('.$line->vat_src_code.')'):''), '%', $line->info_bits); From 2c4e8cbb4a9cc12b5c829560978c04a766423ccd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Aug 2017 16:45:53 +0200 Subject: [PATCH 21/46] Update admin.lang --- htdocs/langs/en_US/admin.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 4ef46f4d2fc..75b904dfa2d 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1640,11 +1640,11 @@ BackgroundTableLineEvenColor=Background color for even table lines MinimumNoticePeriod=Minimum notice period (Your leave request must be done before this delay) NbAddedAutomatically=Number of days added to counters of users (automatically) each month EnterAnyCode=This field contains a reference to identify line. Enter any value of your choice, but without special characters. -UnicodeCurrency=Enter here between braces, list of byte number that represent the currency symbol. For exemple: for $, enter [36] - for brazil real R$ [82,36] - for ?, enter [8364] +UnicodeCurrency=Enter here between braces, list of byte number that represent the currency symbol. For exemple: for $, enter [36] - for brazil real R$ [82,36] - for €, enter [8364] ColorFormat=The RGB color is in HEX format, eg: FF0000 PositionIntoComboList=Position of line into combo lists SellTaxRate=Sale tax rate -RecuperableOnly=Yes for VAT "Non Per?ue R?cup?rable" dedicated for some state in France. Keep value to "No" in all other cases. +RecuperableOnly=Yes for VAT "Not Perceived but Recoverable" dedicated for some state in France. Keep value to "No" in all other cases. UrlTrackingDesc=If the provider or transport service offer a page or web site to check status of your shipping, you can enter it here. You can use the key {TRACKID} into URL parameters so the system will replace it with value of tracking number user entered into shipment card. OpportunityPercent=When you create an opportunity, you will defined an estimated amount of project/lead. According to status of opportunity, this amount may be multiplicated by this rate to evaluate global amount all your opportunities may generate. Value is percent (between 0 and 100). TemplateForElement=This template record is dedicated to which element From 3e4a7ba97cde90c818666b37f4a01042c0a0e314 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Aug 2017 16:46:50 +0200 Subject: [PATCH 22/46] Update admin.lang --- htdocs/langs/en_US/admin.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 75b904dfa2d..dfd6e90929a 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -357,7 +357,7 @@ PDFDesc=You can set each global options related to the PDF generation PDFAddressForging=Rules to forge address boxes HideAnyVATInformationOnPDF=Hide all information related to VAT on generated PDF PDFLocaltax=Rules for %s -HideLocalTaxOnPDF=Hide %s into pdf column tax sale +HideLocalTaxOnPDF=Hide %s rate into pdf column tax sale HideDescOnPDF=Hide products description on generated PDF HideRefOnPDF=Hide products ref. on generated PDF HideDetailsOnPDF=Hide product lines details on generated PDF From 0a67ca53d450e5850b6d9280f56ebbccf282870a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Aug 2017 17:14:54 +0200 Subject: [PATCH 23/46] Fix menu auguria --- htdocs/core/menus/init_menu_auguria.sql | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 5655ada681c..445ec83d58d 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -288,16 +288,16 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3602__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/list.php?leftmenu=projects', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3603__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/stats/index.php?leftmenu=projects', 'Statistics', 1, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3700__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/index.php?leftmenu=projects', 'Activities', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3701__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks.php?leftmenu=projects&action=create', 'NewTask', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3702__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks/list.php?leftmenu=projects', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3704__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks/stats/index.php?leftmenu=projects', 'Statistics', 1, 'projects', '$user->rights->projet->lire', '', 2, 4, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled && $conf->global->PROJECT_USE_TASKS', __HANDLER__, 'left', 3700__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/index.php?leftmenu=projects', 'Activities', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled && $conf->global->PROJECT_USE_TASKS', __HANDLER__, 'left', 3701__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks.php?leftmenu=projects&action=create', 'NewTask', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled && $conf->global->PROJECT_USE_TASKS', __HANDLER__, 'left', 3702__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks/list.php?leftmenu=projects', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled && $conf->global->PROJECT_USE_TASKS', __HANDLER__, 'left', 3704__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks/stats/index.php?leftmenu=projects', 'Statistics', 1, 'projects', '$user->rights->projet->lire', '', 2, 4, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3400__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/perweek.php?leftmenu=projects', 'NewTimeSpent', 0, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled && $conf->global->PROJECT_USE_TASKS', __HANDLER__, 'left', 3400__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/perweek.php?leftmenu=projects', 'NewTimeSpent', 0, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__); -- Project - Categories -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3804__+MAX_llx_menu__, 'project', 'cat', 3__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&type=6', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3805__+MAX_llx_menu__, 'project', '', 3200__+MAX_llx_menu__, '/categories/card.php?action=create&type=6', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3804__+MAX_llx_menu__, 'project', 'cat', 7__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&type=6', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3805__+MAX_llx_menu__, 'project', '', 3804__+MAX_llx_menu__, '/categories/card.php?action=create&type=6', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); -- Tools insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3900__+MAX_llx_menu__, 'tools', 'mailing', 8__+MAX_llx_menu__, '/comm/mailing/index.php?leftmenu=mailing', 'EMailings', 0, 'mails', '$user->rights->mailing->lire', '', 0, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3901__+MAX_llx_menu__, 'tools', '', 3900__+MAX_llx_menu__, '/comm/mailing/card.php?leftmenu=mailing&action=create', 'NewMailing', 1, 'mails', '$user->rights->mailing->creer', '', 0, 0, __ENTITY__); From c761eb592e344185b500346d5ba97307a81d946f Mon Sep 17 00:00:00 2001 From: Quentin Sutkowski Date: Thu, 31 Aug 2017 11:15:55 +0200 Subject: [PATCH 24/46] Fix barcode reader on POS Solve the keyboard emulation issue with a barcode reader on cashdesk module research area. --- htdocs/cashdesk/tpl/facturation1.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/cashdesk/tpl/facturation1.tpl.php b/htdocs/cashdesk/tpl/facturation1.tpl.php index 580012847f5..8cfe70638e3 100644 --- a/htdocs/cashdesk/tpl/facturation1.tpl.php +++ b/htdocs/cashdesk/tpl/facturation1.tpl.php @@ -42,9 +42,9 @@ $langs->load("cashdesk"); trans("FilterRefOrLabelOrBC"); ?>trans("Designation"); ?> + From 6a3d110d3ac1339e7a60664d03378719959aaf30 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 31 Aug 2017 14:44:32 +0200 Subject: [PATCH 25/46] Enhance repair for utf8 mix collation --- htdocs/install/mysql/migration/repair.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index e759985b7a8..14622a3963c 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -29,6 +29,8 @@ -- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_account MODIFY account_number VARCHAR(20) CHARACTER SET utf8; -- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_account MODIFY account_number VARCHAR(20) COLLATE utf8_unicode_ci; +-- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_bookkeeping MODIFY numero_compte VARCHAR(20) CHARACTER SET utf8; +-- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_bookkeeping MODIFY numero_compte VARCHAR(20) COLLATE utf8_unicode_ci; -- VMYSQLUTF8UNICODECI ALTER TABLE llx_stock_mouvement MODIFY batch VARCHAR(30) CHARACTER SET utf8; -- VMYSQLUTF8UNICODECI ALTER TABLE llx_stock_mouvement MODIFY batch VARCHAR(30) COLLATE utf8_unicode_ci; -- VMYSQLUTF8UNICODECI ALTER TABLE llx_product_lot MODIFY batch VARCHAR(30) CHARACTER SET utf8; From 2ab12f54ff33beee452e3881230df751cb969e43 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 31 Aug 2017 22:42:14 +0200 Subject: [PATCH 26/46] Fix install error due to too large column with index --- htdocs/install/mysql/migration/5.0.0-6.0.0.sql | 1 + htdocs/install/mysql/tables/llx_holiday_config.sql | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql index b1a7088062d..f6a2c18da82 100644 --- a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql +++ b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql @@ -24,6 +24,7 @@ -- -- VPGSQL8.2 DELETE FROM llx_usergroup_user WHERE fk_user NOT IN (SELECT rowid from llx_user); -- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); +ALTER TABLE llx_holiday_config MODIFY COLUMN name varchar(128); ALTER TABLE llx_supplier_proposaldet CHANGE COLUMN fk_askpricesupplier fk_supplier_proposal integer NOT NULL; diff --git a/htdocs/install/mysql/tables/llx_holiday_config.sql b/htdocs/install/mysql/tables/llx_holiday_config.sql index 2f08bf5aa41..d5989747778 100644 --- a/htdocs/install/mysql/tables/llx_holiday_config.sql +++ b/htdocs/install/mysql/tables/llx_holiday_config.sql @@ -19,7 +19,7 @@ CREATE TABLE llx_holiday_config ( rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY, -name VARCHAR( 255 ) NOT NULL UNIQUE, +name VARCHAR(128) NOT NULL UNIQUE, value TEXT NULL ) ENGINE=innodb; \ No newline at end of file From 84fcbb724e24b37b5a9d3cbdb9d28979efa70cea Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 1 Sep 2017 07:21:27 +0200 Subject: [PATCH 27/46] Add project on various_payment --- .../bank/class/paymentvarious.class.php | 67 ++++++++++++++- htdocs/compta/bank/various_payment/card.php | 84 +++++++++++++++++-- htdocs/compta/bank/various_payment/index.php | 2 +- htdocs/langs/en_US/banks.lang | 3 +- htdocs/langs/en_US/projects.lang | 1 + htdocs/projet/element.php | 24 +++++- 6 files changed, 165 insertions(+), 16 deletions(-) diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index 1d0568c8064..45ae8d5dd95 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -30,8 +30,9 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php'; */ class PaymentVarious extends CommonObject { - //public $element='payment_various'; //!< Id that identify managed objects - //public $table_element='payment_various'; //!< Name of table without prefix where object is stored + public $element='variouspayment'; //!< Id that identify managed objects + public $table_element='payment_various'; //!< Name of table without prefix where object is stored + public $picto = 'bill'; var $tms; var $datep; @@ -42,6 +43,7 @@ class PaymentVarious extends CommonObject var $num_payment; var $label; var $accountancy_code; + var $fk_project; var $fk_bank; var $fk_user_author; var $fk_user_modif; @@ -96,6 +98,7 @@ class PaymentVarious extends CommonObject $sql.= " label='".$this->db->escape($this->label)."',"; $sql.= " note='".$this->db->escape($this->note)."',"; $sql.= " accountancy_code='".$this->db->escape($this->accountancy_code)."',"; + $sql.= " fk_projet='".$this->db->escape($this->fk_project)."',"; $sql.= " fk_bank=".($this->fk_bank > 0 ? $this->fk_bank:"null").","; $sql.= " fk_user_author=".$this->fk_user_author.","; $sql.= " fk_user_modif=".$this->fk_user_modif; @@ -154,6 +157,7 @@ class PaymentVarious extends CommonObject $sql.= " v.label,"; $sql.= " v.note,"; $sql.= " v.accountancy_code,"; + $sql.= " v.fk_projet as fk_project,"; $sql.= " v.fk_bank,"; $sql.= " v.fk_user_author,"; $sql.= " v.fk_user_modif,"; @@ -185,6 +189,7 @@ class PaymentVarious extends CommonObject $this->label = $obj->label; $this->note = $obj->note; $this->accountancy_code = $obj->accountancy_code; + $this->fk_project = $obj->fk_project; $this->fk_bank = $obj->fk_bank; $this->fk_user_author = $obj->fk_user_author; $this->fk_user_modif = $obj->fk_user_modif; @@ -317,6 +322,7 @@ class PaymentVarious extends CommonObject if ($this->note) $sql.= ", note"; $sql.= ", label"; $sql.= ", accountancy_code"; + $sql.= ", fk_projet"; $sql.= ", fk_user_author"; $sql.= ", datec"; $sql.= ", fk_bank"; @@ -451,6 +457,63 @@ class PaymentVarious extends CommonObject } + /** + * Retourne le libelle du statut + * + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto + * @return string Libelle + */ + function getLibStatut($mode=0) + { + return $this->LibStatut($this->statut,$mode); + } + + /** + * Renvoi le libelle d'un statut donne + * + * @param int $statut Id status + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto + * @return string Libelle + */ + function LibStatut($statut,$mode=0) + { + global $langs; + + if ($mode == 0) + { + return $langs->trans($this->statuts[$statut]); + } + if ($mode == 1) + { + return $langs->trans($this->statuts_short[$statut]); + } + if ($mode == 2) + { + if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts_short[$statut]); + if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts_short[$statut]); + if ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts_short[$statut]); + } + if ($mode == 3) + { + if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0'); + if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4'); + if ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); + } + if ($mode == 4) + { + if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]); + if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]); + if ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]); + } + if ($mode == 5) + { + if ($statut==0 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut0'); + if ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut4'); + if ($statut==2 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); + } + } + + /** * Send name clicable (with possibly the picto) * diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index e16c822db9b..4c57ab5f324 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -29,6 +29,11 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; +if (! empty($conf->projet->enabled)) +{ + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; +} $langs->loadLangs(array("compta", "banks", "bills", "users", "accountancy")); @@ -44,6 +49,7 @@ $sens=GETPOST("sens","int"); $amount=GETPOST("amount"); $paymenttype=GETPOST("paymenttype"); $accountancy_code=GETPOST("accountancy_code","int"); +$projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0); // Security check $socid = GETPOST("socid","int"); @@ -67,6 +73,13 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e if (empty($reshook)) { + // Link to a project + if ($action == 'classin' && $user->rights->banque->modifier) + { + $object->fetch($id); + $object->setProject(GETPOST('projectid')); + } + if ($cancel) { if ($action != 'addlink') @@ -98,6 +111,7 @@ if (empty($reshook)) $object->fk_user_author=$user->id; $object->accountancy_code=GETPOST("accountancy_code") > 0 ? GETPOST("accountancy_code","int") : ""; $object->sens=GETPOST('sens'); + $object->fk_project= GETPOST('fk_project'); if (empty($datep) || empty($datev)) { @@ -205,6 +219,7 @@ llxHeader("",$langs->trans("VariousPayment")); $form = new Form($db); if (! empty($conf->accounting->enabled)) $formaccounting = New FormAccounting($db); +if (! empty($conf->projet->enabled)) $formproject = new FormProjets($db); if ($id) { @@ -306,6 +321,21 @@ if ($action == 'create') print ''; } + // Project + if (! empty($conf->projet->enabled)) + { + $formproject=new FormProjets($db); + + // Associated project + $langs->load("projects"); + + print ''.$langs->trans("Project").''; + + $numproject=$formproject->select_projects(-1, $projectid,'fk_project',0,0,1,1); + + print ''; + } + // Other attributes $parameters=array(); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook @@ -333,19 +363,52 @@ if ($action == 'create') if ($id) { - $head=various_payment_prepare_head($object); - dol_fiche_head($head, 'card', $langs->trans("VariousPayment"), 0, 'payment'); - - print ''; + dol_fiche_head($head, 'card', $langs->trans("VariousPayment"), -1, 'payment'); + $morehtmlref='
'; + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.=$langs->trans('Project') . ' '; + if ($user->rights->tax->charges->creer) + { + if ($action != 'classify') + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.=''; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.='
'; $linkback = ''.$langs->trans("BackToList").''; - print ""; - print ''; + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + + print '
'; + print '
'; + + print '
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', ''); - print '
'; // Label print ''; @@ -404,6 +467,11 @@ if ($id) print '
'.$langs->trans("Label").''.$object->label.'
'; + print ''; + print ''; + + print '
'; + dol_fiche_end(); diff --git a/htdocs/compta/bank/various_payment/index.php b/htdocs/compta/bank/various_payment/index.php index 42558d11635..48f37d24235 100644 --- a/htdocs/compta/bank/various_payment/index.php +++ b/htdocs/compta/bank/various_payment/index.php @@ -243,7 +243,7 @@ if ($result) $accountingjournal = new AccountingJournal($db); $accountingjournal->fetch($obj->accountancy_journal); - $accountstatic->accountancy_journal = $accountingjournal->code; + $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0,1,1,'',1); } $accountstatic->label=$obj->blabel; diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index 46222fca80c..d261fe8a53d 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -156,4 +156,5 @@ DocumentModelBan=Template to print a page with BAN information. NewVariousPayment=New miscellaneous payments VariousPayment=Miscellaneous payments VariousPayments=Miscellaneous payments -ShowVariousPayment=Show miscellaneous payments +ShowVariousPayment=Show miscellaneous payments +AddVariousPayment=Add miscellaneous payments \ No newline at end of file diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 8b380645f73..92282fd29f0 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -88,6 +88,7 @@ ListShippingAssociatedProject=List of shippings associated with the project ListFichinterAssociatedProject=List of interventions associated with the project ListExpenseReportsAssociatedProject=List of expense reports associated with the project ListDonationsAssociatedProject=List of donations associated with the project +ListVariousPaymentsAssociatedProject=List of various payments associated with the project ListActionsAssociatedProject=List of events associated with the project ListTaskTimeUserProject=List of time consumed on tasks of project ActivityOnProjectToday=Activity on project today diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index bda8d793840..0dcb710cfb5 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -51,6 +51,7 @@ if (! empty($conf->don->enabled)) require_once DOL_DOCUMENT_ROOT.'/don/class/d if (! empty($conf->loan->enabled)) require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php'; if (! empty($conf->stock->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; if (! empty($conf->tax->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; +if (! empty($conf->banque->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php'; $langs->load("projects"); $langs->load("companies"); @@ -439,6 +440,19 @@ $listofreferent=array( 'datefieldname'=>'datem', 'disableamount'=>0, 'test'=>($conf->stock->enabled && $user->rights->stock->mouvement->lire && ! empty($conf->global->STOCK_MOVEMENT_INTO_PROJECT_OVERVIEW))), +'variouspayment'=>array( + 'name'=>"VariousPayments", + 'title'=>"ListVariousPaymentsAssociatedProject", + 'class'=>'PaymentVarious', + 'table'=>'payment_various', + 'datefieldname'=>'datev', + 'margin'=>'minus', + 'disableamount'=>0, + 'urlnew'=>DOL_URL_ROOT.'/compta/bank_various_payment/card.php?action=create&projectid='.$id.'&socid='.$socid, + 'lang'=>'banks', + 'buttonnew'=>'AddVariousPayment', + 'testnew'=>$user->rights->banque->modifier, + 'test'=>$conf->banque->enabled && $user->rights->banque->lire), /* No need for this, available on dedicated tab "Agenda/Events" 'agenda'=>array( 'name'=>"Agenda", @@ -769,6 +783,7 @@ foreach ($listofreferent as $key => $value) // Thirdparty or user print ''; if (in_array($tablename, array('projet_task')) && $key == 'project_task') print ''; // if $key == 'project_task', we don't want details per user + elseif (in_array($tablename, array('payment_various'))) print ''; // if $key == 'payment_various', we don't have any thirdparty elseif (in_array($tablename, array('expensereport_det','don','projet_task','stock_mouvement'))) print $langs->trans("User"); else print $langs->trans("ThirdParty"); print ''; @@ -898,7 +913,8 @@ foreach ($listofreferent as $key => $value) $date=''; $total_time_by_line = null; if ($tablename == 'expensereport_det') $date = $element->date; // No draft status on lines elseif ($tablename == 'stock_mouvement') $date = $element->datem; - if ($tablename == 'chargesociales') $date = $element->date_ech; + elseif ($tablename == 'payment_various') $date = $element->datev; + elseif ($tablename == 'chargesociales') $date = $element->date_ech; elseif (! empty($element->status) || ! empty($element->statut) || ! empty($element->fk_status)) { if ($tablename == 'don') $date = $element->datedon; @@ -909,7 +925,7 @@ foreach ($listofreferent as $key => $value) elseif ($tablename == 'supplier_proposal') $date=$element->date_validation; // There is no other date for this elseif ($tablename == 'fichinter') $date=$element->datev; // There is no other date for this elseif ($tablename == 'projet_task') $date=''; // We show no date. Showing date of beginning of task make user think it is date of time consumed - else + else { $date=$element->date; // invoice, ... if (empty($date)) $date=$element->date_contrat; @@ -963,7 +979,7 @@ foreach ($listofreferent as $key => $value) { $total_ht_by_line=null; $othermessage=''; - if ($tablename == 'don' || $tablename == 'chargesociales') $total_ht_by_line=$element->amount; + if ($tablename == 'don' || $tablename == 'chargesociales' || $tablename == 'payment_various') $total_ht_by_line=$element->amount; else if($tablename == 'fichinter') $total_ht_by_line=$element->getAmount(); elseif ($tablename == 'stock_mouvement') $total_ht_by_line=$element->price*abs($element->qty); elseif (in_array($tablename, array('projet_task'))) @@ -1004,7 +1020,7 @@ foreach ($listofreferent as $key => $value) if (empty($value['disableamount'])) { $total_ttc_by_line=null; - if ($tablename == 'don' || $tablename == 'chargesociales') $total_ttc_by_line=$element->amount; + if ($tablename == 'don' || $tablename == 'chargesociales' || $tablename == 'payment_various') $total_ttc_by_line=$element->amount; else if($tablename == 'fichinter') $total_ttc_by_line=$element->getAmount(); elseif ($tablename == 'stock_mouvement') $total_ttc_by_line=$element->price*abs($element->qty); elseif ($tablename == 'projet_task') From d88a75b6668f5b2be1685089f6f4faa58015b26f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Sep 2017 13:47:12 +0200 Subject: [PATCH 28/46] Fix typo --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 746893edb58..c915c04a08d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,7 +9,7 @@ NEW: Add a payment module for Stripe. NEW: Add module "Product variant" (like red, blue for the product shoes) NEW: Accountancy - Activate multi-journal & Add journal_label to database (FEC) NEW: Add a tracking id into mass emailing. -NEW: Tax system more compatible with the new tax roollout in India (IGST / CGST / SGST). +NEW: Tax system more compatible with the new tax rollout in India (IGST / CGST / SGST). NEW: Add calculation function for Loan schedule NEW: Add "depends on" and "required by" into module informations NEW: Add hidden option THIRDPARTY_INCLUDE_PARENT_IN_LINKTO From 2768878618587f0cc4caf08bac01b014d43275af Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Sep 2017 16:37:45 +0200 Subject: [PATCH 29/46] FIX Bad condition on sms log debug --- htdocs/core/class/CSMSFile.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/CSMSFile.class.php b/htdocs/core/class/CSMSFile.class.php index 4456df76f83..3bdd644ecc1 100644 --- a/htdocs/core/class/CSMSFile.class.php +++ b/htdocs/core/class/CSMSFile.class.php @@ -107,6 +107,7 @@ class CSMSFile if (empty($conf->global->MAIN_DISABLE_ALL_SMS)) { + // Action according to choosed sending method if ($conf->global->MAIN_SMS_SENDMODE == 'ovh') // Backward compatibility @deprecated { @@ -129,7 +130,7 @@ class CSMSFile { dol_syslog("CSMSFile::sendfile: sms send success with id=".$res, LOG_DEBUG); //var_dump($res); // 1973128 - $this->dump_sms_result($res); + if (! empty($conf->global->MAIN_SMS_DEBUG)) $this->dump_sms_result($res); } } else if (! empty($conf->global->MAIN_SMS_SENDMODE)) // $conf->global->MAIN_SMS_SENDMODE looks like a value 'class@module' @@ -159,7 +160,7 @@ class CSMSFile { dol_syslog("CSMSFile::sendfile: sms send success with id=".$res, LOG_DEBUG); //var_dump($res); // 1973128 - $this->dump_sms_result($res); + if (! empty($conf->global->MAIN_SMS_DEBUG)) $this->dump_sms_result($res); } } catch(Exception $e) From 223e1b1cd4228e42cd63f97917b803ccae73cb1a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Sep 2017 16:54:06 +0200 Subject: [PATCH 30/46] Fix missing the nostop tag --- htdocs/core/class/CSMSFile.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/class/CSMSFile.class.php b/htdocs/core/class/CSMSFile.class.php index 3bdd644ecc1..570cf6f9b6c 100644 --- a/htdocs/core/class/CSMSFile.class.php +++ b/htdocs/core/class/CSMSFile.class.php @@ -42,6 +42,7 @@ class CSMSFile var $priority; var $class; var $message; + var $nostop; /** @@ -81,6 +82,7 @@ class CSMSFile $this->priority=$priority; $this->class=$class; $this->message=$msg; + $this->nostop=false; } @@ -119,6 +121,7 @@ class CSMSFile $sms->deferred=$this->deferred; $sms->priority=$this->priority; $sms->class=$this->class; + $sms->nostop=$this->nostop; $res=$sms->SmsSend(); if ($res <= 0) @@ -148,6 +151,7 @@ class CSMSFile $sms->priority=$this->priority; $sms->class=$this->class; $sms->message=$this->message; + $sms->nostop=$this->nostop; $res=$sms->SmsSend(); $this->error = $sms->error; From 4660bc58fc80c5921373307f4d0b9a200aceadb2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Sep 2017 17:07:26 +0200 Subject: [PATCH 31/46] Fix nostop option --- htdocs/core/class/CSMSFile.class.php | 1 + htdocs/core/class/html.formsms.class.php | 18 ++++++++++++------ htdocs/langs/en_US/sms.lang | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/CSMSFile.class.php b/htdocs/core/class/CSMSFile.class.php index 570cf6f9b6c..0a149feabf4 100644 --- a/htdocs/core/class/CSMSFile.class.php +++ b/htdocs/core/class/CSMSFile.class.php @@ -212,6 +212,7 @@ class CSMSFile fputs($fp, "Priority: ".$this->priority."\n"); fputs($fp, "Class: ".$this->class."\n"); fputs($fp, "Deferred: ".$this->deferred."\n"); + fputs($fp, "DisableStop: ".$this->nostop."\n"); fputs($fp, "Message:\n".$this->message); fclose($fp); diff --git a/htdocs/core/class/html.formsms.class.php b/htdocs/core/class/html.formsms.class.php index 9412582599d..4c64e04187a 100644 --- a/htdocs/core/class/html.formsms.class.php +++ b/htdocs/core/class/html.formsms.class.php @@ -147,7 +147,7 @@ function limitChars(textarea, limit, infodiv) { if ($this->withfromreadonly) { - print ''.$langs->trans("SmsFrom"); + print ''.$langs->trans("SmsFrom"); print ''; print ""; if ($this->fromtype == 'user') @@ -223,7 +223,7 @@ function limitChars(textarea, limit, infodiv) if (is_array($resultsender) && count($resultsender) > 0) { - print ''; foreach($resultsender as $obj) { print ''; @@ -244,7 +244,7 @@ function limitChars(textarea, limit, infodiv) // To (target) if ($this->withto || is_array($this->withto)) { - print ''; + print ''; //$moretext=$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"); $moretext=''; print $form->textwithpicto($langs->trans("SmsTo"),$moretext); @@ -285,7 +285,7 @@ function limitChars(textarea, limit, infodiv) $defaultmessage=str_replace('\n',"\n",$defaultmessage); print ""; - print "".$langs->trans("SmsText").""; + print ''.$langs->trans("SmsText").""; print ""; if ($this->withbodyreadonly) { @@ -306,7 +306,7 @@ function limitChars(textarea, limit, infodiv) '.$langs->trans("Priority").' : - @@ -314,11 +314,17 @@ function limitChars(textarea, limit, infodiv) '.$langs->trans("Type").' : - + + + '.$langs->trans("DisableStopIfSupported").' : + '; print "\n"; diff --git a/htdocs/langs/en_US/sms.lang b/htdocs/langs/en_US/sms.lang index 8918aa6a365..05b521aae36 100644 --- a/htdocs/langs/en_US/sms.lang +++ b/htdocs/langs/en_US/sms.lang @@ -48,4 +48,4 @@ SmsInfoNumero= (format international ie : +33899701761) DelayBeforeSending=Delay before sending (minutes) SmsNoPossibleSenderFound=No sender available. Check setup of your SMS provider. SmsNoPossibleRecipientFound=No target available. Check setup of your SMS provider. - +DisableStopIfSupported=Disable STOP message (if supported) From 0d0b7f8af27d7f2a604e4d31cbfca15e04bc8538 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Sep 2017 17:18:07 +0200 Subject: [PATCH 32/46] Fix email --- htdocs/societe/tpl/linesalesrepresentative.tpl.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/societe/tpl/linesalesrepresentative.tpl.php b/htdocs/societe/tpl/linesalesrepresentative.tpl.php index 34a7ce3f4c4..3ec07697ec7 100644 --- a/htdocs/societe/tpl/linesalesrepresentative.tpl.php +++ b/htdocs/societe/tpl/linesalesrepresentative.tpl.php @@ -32,6 +32,8 @@ $userstatic->firstname=$val['firstname']; $userstatic->statut=$val['statut']; $userstatic->photo=$val['photo']; + $userstatic->email=$val['email']; + $userstatic->entity=$val['entity']; print $userstatic->getNomUrl(-1); $i++; if ($i < $nbofsalesrepresentative) print ', '; From 9b51810653c212ca1d97e8cbd8f396fb01dbdef0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Sep 2017 17:30:09 +0200 Subject: [PATCH 33/46] Clean code --- htdocs/accountancy/admin/categories_list.php | 240 +------------------ htdocs/langs/en_US/accountancy.lang | 2 +- 2 files changed, 14 insertions(+), 228 deletions(-) diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index fb3328c047d..d8f93ee1af5 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -100,7 +100,7 @@ $tablib[32]= "DictionaryAccountancyCategory"; // Requests to extract data $tabsql=array(); -$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.sens, a.category_type, a.formula, a.position as position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1"; +$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.category_type, a.formula, a.position as position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1"; // Criteria to sort dictionaries $tabsqlsort=array(); @@ -108,15 +108,15 @@ $tabsqlsort[32]="position ASC"; // Nom des champs en resultat de select pour affichage du dictionnaire $tabfield=array(); -$tabfield[32]= "code,label,range_account,sens,category_type,formula,position,country_id,country"; +$tabfield[32]= "code,label,range_account,category_type,formula,position,country_id,country"; // Nom des champs d'edition pour modification d'un enregistrement $tabfieldvalue=array(); -$tabfieldvalue[32]= "code,label,range_account,sens,category_type,formula,position,country"; +$tabfieldvalue[32]= "code,label,range_account,category_type,formula,position,country"; // Nom des champs dans la table pour insertion d'un enregistrement $tabfieldinsert=array(); -$tabfieldinsert[32]= "code,label,range_account,sens,category_type,formula,position,fk_country"; +$tabfieldinsert[32]= "code,label,range_account,category_type,formula,position,fk_country"; // Nom du rowid si le champ n'est pas de type autoincrement // Example: "" if id field is "rowid" and has autoincrement on @@ -167,24 +167,15 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) $ok=1; foreach ($listfield as $f => $value) { - if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryVAT','DictionaryRegion','DictionaryCompanyType','DictionaryHolidayTypes','DictionaryRevenueStamp','DictionaryAccountancysystem','DictionaryAccountancyCategory'))) continue; // For some pages, country is not mandatory - if ($value == 'country' && in_array($tablib[$id],array('DictionaryCanton','DictionaryCompanyType','DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory if ($value == 'formula' && empty($_POST['formula'])) continue; - if ((! isset($_POST[$value]) || $_POST[$value]=='') - && (! in_array($listfield[$f], array('decalage','module','accountancy_code','accountancy_code_sell','accountancy_code_buy')) // Fields that are not mandatory - && (! ($id == 10 && $listfield[$f] == 'code')) // Code is mandatory fir table 10 - ) - ) + if (! isset($_POST[$value]) || $_POST[$value]=='') { $ok=0; $fieldnamekey=$listfield[$f]; // We take translate key of field if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label'; - if ($fieldnamekey == 'libelle_facture') $fieldnamekey = 'LabelOnDocuments'; - if ($fieldnamekey == 'module') $fieldnamekey='Module'; if ($fieldnamekey == 'code') $fieldnamekey = 'Code'; if ($fieldnamekey == 'note') $fieldnamekey = 'Note'; - if ($fieldnamekey == 'taux') $fieldnamekey = 'Rate'; if ($fieldnamekey == 'type') $fieldnamekey = 'Type'; if ($fieldnamekey == 'position') $fieldnamekey = 'Position'; if ($fieldnamekey == 'category_type') $fieldnamekey = 'Calculated'; @@ -550,8 +541,7 @@ if ($id) if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); } if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); } if ($fieldlist[$field]=='pcg_version' || $fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); } - if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); } - if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Direction"); } + if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Comment"); } if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); } if ($valuetoshow != '') @@ -704,8 +694,7 @@ if ($id) if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); } if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); } if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); } - if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); } - if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Direction"); } + if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Comment"); } if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); } // Affiche nom du champ if ($showfield) @@ -763,17 +752,9 @@ if ($id) $showfield=1; $align="left"; $valuetoshow=$obj->{$fieldlist[$field]}; - if ($value == 'type_template') + if ($value == 'category_type') { - $valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow; - } - if ($value == 'element') - { - $valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow; - } - else if ($value == 'source') - { - $valuetoshow = isset($sourceList[$valuetoshow])?$sourceList[$valuetoshow]:$valuetoshow; + $valuetoshow = yn($valuetoshow); } else if ($valuetoshow=='all') { $valuetoshow=$langs->trans('All'); @@ -789,12 +770,6 @@ if ($id) $valuetoshow=($key != "Country".strtoupper($obj->country_code)?$obj->country_code." - ".$key:$obj->country); } } - else if ($fieldlist[$field]=='libelle_facture') { - $langs->load("bills"); - $key=$langs->trans("PaymentCondition".strtoupper($obj->code)); - $valuetoshow=($obj->code && $key != "PaymentCondition".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); - $valuetoshow=nl2br($valuetoshow); - } else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_country') { $key=$langs->trans("Country".strtoupper($obj->code)); $valuetoshow=($obj->code && $key != "Country".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); @@ -808,83 +783,11 @@ if ($id) $key=$langs->trans("Action".strtoupper($obj->code)); $valuetoshow=($obj->code && $key != "Action".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); } - else if (! empty($obj->code_iso) && $fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_currencies') { - $key=$langs->trans("Currency".strtoupper($obj->code_iso)); - $valuetoshow=($obj->code_iso && $key != "Currency".strtoupper($obj->code_iso)?$key:$obj->{$fieldlist[$field]}); - } - else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_typent') { - $key=$langs->trans(strtoupper($obj->code)); - $valuetoshow=($key != strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); - } - else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_prospectlevel') { - $key=$langs->trans(strtoupper($obj->code)); - $valuetoshow=($key != strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); - } - else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_civility') { - $key=$langs->trans("Civility".strtoupper($obj->code)); - $valuetoshow=($obj->code && $key != "Civility".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); - } - else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_type_contact') { - $langs->load('agenda'); - $key=$langs->trans("TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code)); - $valuetoshow=($obj->code && $key != "TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); - } - else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_payment_term') { - $langs->load("bills"); - $key=$langs->trans("PaymentConditionShort".strtoupper($obj->code)); - $valuetoshow=($obj->code && $key != "PaymentConditionShort".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); - } - else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_paiement') { - $langs->load("bills"); - $key=$langs->trans("PaymentType".strtoupper($obj->code)); - $valuetoshow=($obj->code && $key != "PaymentType".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); - } - else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_input_reason') { - $key=$langs->trans("DemandReasonType".strtoupper($obj->code)); - $valuetoshow=($obj->code && $key != "DemandReasonType".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); - } - else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_input_method') { - $langs->load("orders"); - $key=$langs->trans($obj->code); - $valuetoshow=($obj->code && $key != $obj->code)?$key:$obj->{$fieldlist[$field]}; - } - else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_shipment_mode') { - $langs->load("sendings"); - $key=$langs->trans("SendingMethod".strtoupper($obj->code)); - $valuetoshow=($obj->code && $key != "SendingMethod".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); - } - else if ($fieldlist[$field] == 'libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_paper_format') - { - $key = $langs->trans('PaperFormat'.strtoupper($obj->code)); - $valuetoshow = ($obj->code && $key != 'PaperFormat'.strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); - } - else if ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_type_fees') - { - $langs->load('trips'); - $key = $langs->trans(strtoupper($obj->code)); - $valuetoshow = ($obj->code && $key != strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); - } else if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; } - else if ($fieldlist[$field]=='label' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_units') { - $langs->load("products"); - $valuetoshow=$langs->trans($obj->{$fieldlist[$field]}); - } - else if ($fieldlist[$field]=='short_label' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_units') { - $langs->load("products"); - $valuetoshow = $langs->trans($obj->{$fieldlist[$field]}); - } - else if (in_array($fieldlist[$field],array('recuperableonly'))) - { - $align="center"; - } - else if ($fieldlist[$field]=='accountancy_code' || $fieldlist[$field]=='accountancy_code_sell' || $fieldlist[$field]=='accountancy_code_buy') { - $valuetoshow = length_accountg($valuetoshow); - } $class='tddict'; - if ($fieldlist[$field] == 'tracking') $class.=' tdoverflowauto'; // Show value for field if ($showfield) print ''.$valuetoshow.''; } @@ -1010,130 +913,14 @@ function fieldListAccountingCategories($fieldlist, $obj='', $tabname='', $contex print ''; } } - elseif ($fieldlist[$field] == 'region') - { - print ''; - $formcompany->select_region($region_id,'region'); + elseif ($fieldlist[$field] == 'category_type') { + print ''; + print $form->selectyesno($fieldlist[$field],(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''),1); print ''; } - elseif ($fieldlist[$field] == 'region_id') - { - $region_id = (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:0); - print ''; - print ''; - print ''; - } - elseif ($fieldlist[$field] == 'lang') - { - print ''; - print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT,'lang'); - print ''; - } - // Le type de template - elseif ($fieldlist[$field] == 'type_template') - { - print ''; - print $form->selectarray('type_template', $elementList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'')); - print ''; - } - // Le type de l'element (pour les type de contact) - elseif ($fieldlist[$field] == 'element') - { - print ''; - print $form->selectarray('element', $elementList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'')); - print ''; - } - // La source de l'element (pour les type de contact) - elseif ($fieldlist[$field] == 'source') - { - print ''; - print $form->selectarray('source', $sourceList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'')); - print ''; - } - elseif ($fieldlist[$field] == 'type' && $tabname == MAIN_DB_PREFIX."c_actioncomm") - { - print ''; - print 'user'; - print ''; - } - elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'type_cdr' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') { - if ($fieldlist[$field] == 'type_cdr') print ''; - else print ''; - if ($fieldlist[$field] == 'type_cdr') { - print $form->selectarray($fieldlist[$field], array(0=>$langs->trans('None'), 1=>$langs->trans('AtEndOfMonth'), 2=>$langs->trans('CurrentNext')), (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'')); - } else { - print $form->selectyesno($fieldlist[$field],(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''),1); - } - print ''; - } - elseif (in_array($fieldlist[$field],array('nbjour','decalage','taux','localtax1','localtax2'))) { - $align="left"; - if (in_array($fieldlist[$field],array('taux','localtax1','localtax2'))) $align="center"; // Fields aligned on right - print ''; - print ''; - print ''; - } - elseif (in_array($fieldlist[$field], array('libelle_facture'))) { - print ''; - } - elseif (in_array($fieldlist[$field], array('content'))) - { - if ($tabname == MAIN_DB_PREFIX.'c_email_templates') - { - print ''; // To create an artificial CR for the current tr we are on - } - else print ''; - if ($context != 'hide') - { - //print ''; - $okforextended=true; - if ($tabname == MAIN_DB_PREFIX.'c_email_templates' && empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended=false; - $doleditor = new DolEditor($fieldlist[$field], (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_5, '90%'); - print $doleditor->Create(1); - } - else print ' '; - print ''; - } - elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i',$fieldlist[$field])) { - print ''; - } elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) { print ''; } - elseif ($fieldlist[$field]=='unit') { - print ''; - $units = array( - 'mm' => $langs->trans('SizeUnitmm'), - 'cm' => $langs->trans('SizeUnitcm'), - 'point' => $langs->trans('SizeUnitpoint'), - 'inch' => $langs->trans('SizeUnitinch') - ); - print $form->selectarray('unit', $units, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), 0, 0, 0); - print ''; - } - // Le type de taxe locale - elseif ($fieldlist[$field] == 'localtax1_type' || $fieldlist[$field] == 'localtax2_type') - { - print ''; - print $form->selectarray($fieldlist[$field], $localtax_typeList, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'')); - print ''; - } - elseif ($fieldlist[$field] == 'accountancy_code' || $fieldlist[$field] == 'accountancy_code_sell' || $fieldlist[$field] == 'accountancy_code_buy') - { - print ''; - if (! empty($conf->accounting->enabled)) - { - $fieldname = $fieldlist[$field]; - $accountancy_account = (! empty($obj->$fieldname) ? $obj->$fieldname : 0); - print $formaccounting->select_account($accountancy_account, $fieldlist[$field], 1, '', 1, 1, 'maxwidth200 maxwidthonsmartphone'); - } - else - { - $fieldname = $fieldlist[$field]; - print ''; - } - print ''; - } else { print ''; @@ -1141,8 +928,7 @@ function fieldListAccountingCategories($fieldlist, $obj='', $tabname='', $contex if ($fieldlist[$field]=='code') $class='maxwidth100'; if ($fieldlist[$field]=='position') $class='maxwidth50'; if ($fieldlist[$field]=='libelle') $class='quatrevingtpercent'; - if ($fieldlist[$field]=='tracking') $class='quatrevingtpercent'; - if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $fieldlist[$field]=='category_type') $size='size="2" '; + if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='category_type') $size='size="2" '; print ''; print ''; } diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 63a37bc921f..1362fd71b81 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -154,7 +154,7 @@ NumPiece=Piece number TransactionNumShort=Num. transaction AccountingCategory=Accounting account groups GroupByAccountAccounting=Group by accounting account -AccountingAccountGroupsDesc=You can define here some groups of accounting account. It will be used in the report %s to show your income/expense with data grouped according to your groups. +AccountingAccountGroupsDesc=You can define here some groups of accounting account. It will be used in the report %s to show your income/expense with data grouped according to these groups. ByAccounts=By accounts ByPredefinedAccountGroups=By predefined groups ByPersonalizedAccountGroups=By personalized groups From d71359b634bc0f934713e549a769361948ef3150 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Sep 2017 17:42:04 +0200 Subject: [PATCH 34/46] Update data --- htdocs/install/mysql/data/llx_accounting_category.sql | 2 +- htdocs/install/mysql/migration/6.0.0-7.0.0.sql | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/data/llx_accounting_category.sql b/htdocs/install/mysql/data/llx_accounting_category.sql index 776e0edf066..10b0ea07ae7 100644 --- a/htdocs/install/mysql/data/llx_accounting_category.sql +++ b/htdocs/install/mysql/data/llx_accounting_category.sql @@ -19,5 +19,5 @@ -- Group of accounting account for French result INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 1, 'VTE', 'Income of products', '707xxx', 0, 0, '', '10', 1, 1); -INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 2, 'MAR', 'Expenses of products', '603xxx | 607xxx | 609xxx', 0, 0, '', '20', 1, 1); +INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 2, 'MAR', 'Expenses of products', '603xxx - 607xxx - 609xxx', 0, 0, '', '20', 1, 1); INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 3, 'MARGE', 'Commercial margin', '', 0, 1, 'VTE+MAR', '30', 1, 1); \ No newline at end of file diff --git a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql index 1fcb5e7c089..a4b6af7917e 100644 --- a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql +++ b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql @@ -25,6 +25,10 @@ -- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); +INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 1, 'VTE', 'Income of products', '707xxx', 0, 0, '', '10', 1, 1); +INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 2, 'MAR', 'Expenses of products', '603xxx - 607xxx - 609xxx', 0, 0, '', '20', 1, 1); +INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 3, 'MARGE', 'Commercial margin', '', 0, 1, 'VTE+MAR', '30', 1, 1); + UPDATE llx_c_accounting_category set formula = 'VTE+MAR' where code = 'MARGE'; ALTER TABLE llx_menu MODIFY COLUMN perms text; From 30eefb34aaf9f70de1ebe5ecaba56e67b56c1552 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Sep 2017 18:03:26 +0200 Subject: [PATCH 35/46] Fix payment suffix --- htdocs/public/payment/newpayment.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index b6c525f1924..2519e4d0d46 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -62,24 +62,24 @@ $action=GETPOST('action','aZ09'); // tag (a free text, required if type is empty) // currency (iso code) -$suffix=GETPOST("suffix",'alpha'); -$amount=price2num(GETPOST("amount")); +$suffix=GETPOST("suffix",'aZ09'); +$amount=price2num(GETPOST("amount",'alpha')); if (! GETPOST("currency",'alpha')) $currency=$conf->currency; else $currency=GETPOST("currency",'alpha'); if (! $action) { - if (! GETPOST("amount") && ! GETPOST("source")) + if (! GETPOST("amount",'alpha') && ! GETPOST("source",'alpha')) { dol_print_error('',$langs->trans('ErrorBadParameters')." - amount or source"); exit; } - if (is_numeric($amount) && ! GETPOST("tag") && ! GETPOST("source")) + if (is_numeric($amount) && ! GETPOST("tag",'alpha') && ! GETPOST("source",'alpha')) { dol_print_error('',$langs->trans('ErrorBadParameters')." - tag or source"); exit; } - if (GETPOST("source") && ! GETPOST("ref")) + if (GETPOST("source",'alpha') && ! GETPOST("ref",'alpha')) { dol_print_error('',$langs->trans('ErrorBadParameters')." - ref"); exit; @@ -551,20 +551,21 @@ $width=0; // Define logo and logosmall $logosmall=$mysoc->logo_small; $logo=$mysoc->logo; -$paramlogo='PAYMENT_LOGO_'.$suffix; +$paramlogo='ONLINE_PAYMENT_LOGO_'.$suffix; if (! empty($conf->global->$paramlogo)) $logosmall=$conf->global->$paramlogo; -else if (! empty($conf->global->PAYMENT_LOGO)) $logosmall=$conf->global->PAYMENT_LOGO; +else if (! empty($conf->global->ONLINE_PAYMENT_LOGO)) $logosmall=$conf->global->ONLINE_PAYMENT_LOGO; //print ''."\n"; // Define urllogo $urllogo=''; if (! empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) { $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('thumbs/'.$logosmall); + $width=128; } elseif (! empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) { $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode($logo); - $width=96; + $width=128; } // Output html code for logo if ($urllogo) From 796684713f6dedee7826d25b95251c715f9eac5f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Sep 2017 18:49:55 +0200 Subject: [PATCH 36/46] Work on generic payment module --- htdocs/public/payment/newpayment.php | 15 ++++++++---- htdocs/public/payment/paymentko.php | 34 ++++++++++++++++++++++++++++ htdocs/public/payment/paymentok.php | 33 +++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 5 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 2519e4d0d46..005131e1d08 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -71,17 +71,17 @@ if (! $action) { if (! GETPOST("amount",'alpha') && ! GETPOST("source",'alpha')) { - dol_print_error('',$langs->trans('ErrorBadParameters')." - amount or source"); + print $langs->trans('ErrorBadParameters')." - amount or source"; exit; } if (is_numeric($amount) && ! GETPOST("tag",'alpha') && ! GETPOST("source",'alpha')) { - dol_print_error('',$langs->trans('ErrorBadParameters')." - tag or source"); + print $langs->trans('ErrorBadParameters')." - tag or source"; exit; } if (GETPOST("source",'alpha') && ! GETPOST("ref",'alpha')) { - dol_print_error('',$langs->trans('ErrorBadParameters')." - ref"); + print $langs->trans('ErrorBadParameters')." - ref"; exit; } } @@ -117,6 +117,11 @@ $FULLTAG=GETPOST("fulltag",'alpha'); // fulltag is tag with more informations $SECUREKEY=GETPOST("securekey"); // Secure key if ($paymentmethod && ! preg_match('/'.preg_quote('PM='.$paymentmethod,'/').'/', $FULLTAG)) $FULLTAG.=($FULLTAG?'.':'').'PM='.$paymentmethod; +if (! empty($suffix)) +{ + $urlok.='suffix='.urlencode($suffix).'&'; + $urlko.='suffix='.urlencode($suffix).'&'; +} if (! empty($SOURCE)) { $urlok.='source='.urlencode($SOURCE).'&'; @@ -560,12 +565,12 @@ $urllogo=''; if (! empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) { $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('thumbs/'.$logosmall); - $width=128; + $width=150; } elseif (! empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) { $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode($logo); - $width=128; + $width=150; } // Output html code for logo if ($urllogo) diff --git a/htdocs/public/payment/paymentko.php b/htdocs/public/payment/paymentko.php index d4dea960b2f..c5eb9f7e698 100644 --- a/htdocs/public/payment/paymentko.php +++ b/htdocs/public/payment/paymentko.php @@ -70,6 +70,8 @@ if (! empty($conf->stripe->enabled)) $FULLTAG=GETPOST('FULLTAG'); if (empty($FULLTAG)) $FULLTAG=GETPOST('fulltag'); +$suffix=GETPOST("suffix",'aZ09'); + // Detect $paymentmethod $paymentmethod=''; @@ -202,6 +204,38 @@ llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'online // Show ko message print ''."\n"; print '
'."\n"; + + +// Show logo (search order: logo defined by PAYMENT_LOGO_suffix, then PAYMENT_LOGO, then small company logo, large company logo, theme logo, common logo) +$width=0; +// Define logo and logosmall +$logosmall=$mysoc->logo_small; +$logo=$mysoc->logo; +$paramlogo='ONLINE_PAYMENT_LOGO_'.$suffix; +if (! empty($conf->global->$paramlogo)) $logosmall=$conf->global->$paramlogo; +else if (! empty($conf->global->ONLINE_PAYMENT_LOGO)) $logosmall=$conf->global->ONLINE_PAYMENT_LOGO; +//print ''."\n"; +// Define urllogo +$urllogo=''; +if (! empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) +{ + $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('thumbs/'.$logosmall); + $width=150; +} +elseif (! empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) +{ + $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode($logo); + $width=150; +} +// Output html code for logo +if ($urllogo) +{ + print '
'; + print '
'; +} + print $langs->trans("YourPaymentHasNotBeenRecorded")."

"; if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_KO)) print $conf->global->ONLINE_PAYMENT_MESSAGE_KO; diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 4cb7dc0427c..ceda6a8c5a7 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -79,6 +79,8 @@ if (empty($FULLTAG)) $FULLTAG=GETPOST('fulltag'); $source=GETPOST('source'); $ref=GETPOST('ref'); +$suffix=GETPOST("suffix",'aZ09'); + // Detect $paymentmethod $paymentmethod=''; @@ -149,6 +151,37 @@ print ''."\n"; print '
'."\n"; +// Show logo (search order: logo defined by PAYMENT_LOGO_suffix, then PAYMENT_LOGO, then small company logo, large company logo, theme logo, common logo) +$width=0; +// Define logo and logosmall +$logosmall=$mysoc->logo_small; +$logo=$mysoc->logo; +$paramlogo='ONLINE_PAYMENT_LOGO_'.$suffix; +if (! empty($conf->global->$paramlogo)) $logosmall=$conf->global->$paramlogo; +else if (! empty($conf->global->ONLINE_PAYMENT_LOGO)) $logosmall=$conf->global->ONLINE_PAYMENT_LOGO; +//print ''."\n"; +// Define urllogo +$urllogo=''; +if (! empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) +{ + $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('thumbs/'.$logosmall); + $width=150; +} +elseif (! empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) +{ + $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode($logo); + $width=150; +} +// Output html code for logo +if ($urllogo) +{ + print '
'; + print '
'; +} + + if (! empty($conf->paypal->enabled)) { if ($paymentmethod == 'paypal') From 1a5f96123abd75e066c7d1d9bd07f0b534df84de Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Sep 2017 19:30:56 +0200 Subject: [PATCH 37/46] Work on generic payment module --- htdocs/public/payment/newpayment.php | 24 +++++++++++++----------- htdocs/theme/common/credit_card.png | Bin 0 -> 7676 bytes htdocs/theme/eldy/style.css.php | 11 +++++++++++ 3 files changed, 24 insertions(+), 11 deletions(-) create mode 100644 htdocs/theme/common/credit_card.png diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 005131e1d08..faf0b5ea165 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1225,7 +1225,19 @@ if ($action != 'dopayment') { // Buttons for all payments registration methods - if (! empty($conf->paypal->enabled)) + if (! empty($conf->paybox->enabled)) + { + // If STRIPE_PICTO_FOR_PAYMENT is 'cb' we show a picto of a crdit card instead of paybox + print '
'; + } + + if (! empty($conf->stripe->enabled)) + { + // If STRIPE_PICTO_FOR_PAYMENT is 'cb' we show a picto of a crdit card instead of stripe + print '
'; + } + + if (! empty($conf->paypal->enabled)) { if (empty($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY)) $conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY='integral'; @@ -1238,16 +1250,6 @@ if ($action != 'dopayment') print '
'; } } - - if (! empty($conf->paybox->enabled)) - { - print '
'; - } - - if (! empty($conf->stripe->enabled)) - { - print '
'; - } } else { diff --git a/htdocs/theme/common/credit_card.png b/htdocs/theme/common/credit_card.png new file mode 100644 index 0000000000000000000000000000000000000000..1d2fc827f61763bf217699ed4fc145bdeb6de873 GIT binary patch literal 7676 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 + background-size: 24px; + background-repeat: no-repeat; + background-position: 5px 4px; +} +input.buttonpaymentcheque { + background-image: url(); + background-repeat: no-repeat; + background-position: 5px 4px; +} input.buttonpaymentpaypal { background-image: url(); background-repeat: no-repeat; From 55691bfbc2065f19ca2b676755ca266627c94976 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Sep 2017 19:30:56 +0200 Subject: [PATCH 38/46] Work on generic payment module --- htdocs/public/payment/newpayment.php | 24 +++++++++++++----------- htdocs/theme/common/credit_card.png | Bin 0 -> 7676 bytes htdocs/theme/eldy/style.css.php | 18 +++++++++++++++--- 3 files changed, 28 insertions(+), 14 deletions(-) create mode 100644 htdocs/theme/common/credit_card.png diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 005131e1d08..faf0b5ea165 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1225,7 +1225,19 @@ if ($action != 'dopayment') { // Buttons for all payments registration methods - if (! empty($conf->paypal->enabled)) + if (! empty($conf->paybox->enabled)) + { + // If STRIPE_PICTO_FOR_PAYMENT is 'cb' we show a picto of a crdit card instead of paybox + print '
'; + } + + if (! empty($conf->stripe->enabled)) + { + // If STRIPE_PICTO_FOR_PAYMENT is 'cb' we show a picto of a crdit card instead of stripe + print '
'; + } + + if (! empty($conf->paypal->enabled)) { if (empty($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY)) $conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY='integral'; @@ -1238,16 +1250,6 @@ if ($action != 'dopayment') print '
'; } } - - if (! empty($conf->paybox->enabled)) - { - print '
'; - } - - if (! empty($conf->stripe->enabled)) - { - print '
'; - } } else { diff --git a/htdocs/theme/common/credit_card.png b/htdocs/theme/common/credit_card.png new file mode 100644 index 0000000000000000000000000000000000000000..1d2fc827f61763bf217699ed4fc145bdeb6de873 GIT binary patch literal 7676 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 + background-size: 26px; + background-repeat: no-repeat; + background-position: 5px 5px; +} +input.buttonpaymentcheque { + background-image: url(); + background-repeat: no-repeat; + background-position: 8px 7px; } input.buttonpaymentpaypal { background-image: url(); background-repeat: no-repeat; - background-position: 5px 4px; + background-position: 8px 7px; } input.buttonpaymentpaybox { background-image: url(); background-repeat: no-repeat; - background-position: 5px 4px; + background-position: 8px 7px; } input.buttonpaymentstripe { background-image: url(); background-repeat: no-repeat; - background-position: 5px 3px; + background-position: 8px 7px; } span.timesheetalreadyrecorded input { border: none; From 407febc14134f02b3efe44e1af5bf55293efd7c0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Sep 2017 22:49:33 +0200 Subject: [PATCH 39/46] Fix travis --- htdocs/websites/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/websites/index.php b/htdocs/websites/index.php index f763c8dd39b..0d4763f5dc3 100644 --- a/htdocs/websites/index.php +++ b/htdocs/websites/index.php @@ -169,7 +169,7 @@ if ($action == 'addsite') { $db->begin(); - if (! $error && empty(GETPOST('WEBSITE_REF','alpha'))) + if (! $error && ! GETPOST('WEBSITE_REF','alpha')) { $error++; setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities("Ref")), null, 'errors'); From 58b08c7de8a1c7e0bcd39cf542d3b381c364fe18 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Sep 2017 23:56:59 +0200 Subject: [PATCH 40/46] Clean code --- htdocs/admin/dolistore/ajax/image.php | 2 +- .../admin/dolistore/class/dolistore.class.php | 268 +++++++++--------- htdocs/admin/dolistore/class/init.php | 2 +- htdocs/cashdesk/css/style.css | 4 - htdocs/cashdesk/javascript/dhtml.js | 16 +- htdocs/cashdesk/tpl/facturation1.tpl.php | 3 +- 6 files changed, 141 insertions(+), 154 deletions(-) diff --git a/htdocs/admin/dolistore/ajax/image.php b/htdocs/admin/dolistore/ajax/image.php index 10ce4656c40..6d63dd3e08b 100644 --- a/htdocs/admin/dolistore/ajax/image.php +++ b/htdocs/admin/dolistore/ajax/image.php @@ -42,7 +42,7 @@ if (!$res) die("Include of main fails"); global $lang, $user, $conf; -dol_include_once('/dolistore/class/dolistore.class.php'); +require_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/dolistore.class.php'; $dolistore = new Dolistore(); $id_product = GETPOST('id_product', 'int'); diff --git a/htdocs/admin/dolistore/class/dolistore.class.php b/htdocs/admin/dolistore/class/dolistore.class.php index 5e0aa546cc0..0c5a7f08568 100644 --- a/htdocs/admin/dolistore/class/dolistore.class.php +++ b/htdocs/admin/dolistore/class/dolistore.class.php @@ -19,9 +19,145 @@ include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; include_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/PSWebServiceLibrary.class.php'; + + /** * Class DolistoreModel */ +class DolistoreModel +{ + + function get_categories($parent = 0) + { + if (!isset($this->categories)) die('not possible'); + if ($parent != 0) { + $html = '
    '; + } else { + $html = ''; + } + + $nbofcateg = count($this->categories); + for ($i = 0; $i < $nbofcateg; $i++) + { + $cat = $this->categories[$i]; + if ($cat->is_root_category == 1 && $parent == 0) { + $html .= '
  • '.$cat->name->language[$this->lang].' '.$cat->nb_products_recursive.'

    '; + $html .= self::get_categories($cat->id); + $html .= "
  • \n"; + } elseif (trim($cat->id_parent) == $parent && $cat->active == 1 && trim($cat->id_parent) != 0) { // si cat est de ce niveau + $select = ($cat->id == $this->categorie) ? ' selected' : ''; + $html .= '
  • '.$cat->name->language[$this->lang].' '.$cat->nb_products_recursive.''; + $html .= self::get_categories($cat->id); + $html .= "
  • \n"; + } else { + + } + } + + if ($html == '
      ') { + return ''; + } + if ($parent != 0) { + return $html.'
    '; + } else { + return $html; + } + } + + function get_products() + { + global $langs, $conf; + $html = ""; + $parity = "pair"; + $last_month = time() - (30 * 24 * 60 * 60); + foreach ($this->products as $product) { + $parity = ($parity == "impair") ? 'pair' : 'impair'; + + // check new product ? + $newapp = ''; + if ($last_month < strtotime($product->date_add)) { + $newapp .= ''.$langs->trans('New').' '; + } + + // check updated ? + if ($last_month < strtotime($product->date_upd) && $newapp == '') { + $newapp .= ''.$langs->trans('Updated').' '; + } + + // add image or default ? + if ($product->id_default_image != '') { + $image_url = dol_buildPath('/dolistore/ajax/image.php?id_product=', 2).$product->id.'&id_image='.$product->id_default_image; + $images = ''. + ''; + } else { + $images = ''; + } + + // free or pay ? + if ($product->price > 0) { + $price = '

    '.price(round((float) $product->price * $this->vat_rate, 2)).' €

    '; + $download_link = ''; + } else { + $price = $langs->trans('Free'); + $download_link = ''; + } + + //checking versions + if ($this->version_compare($product->dolibarr_min, DOL_VERSION) <= 0) { + if ($this->version_compare($product->dolibarr_max, DOL_VERSION) >= 0) { + //compatible + $version = ''.$langs->trans('CompatibleUpTo', $product->dolibarr_max, + $product->dolibarr_min, $product->dolibarr_max).''; + $compatible = ''; + } else { + //never compatible, module expired + $version = ''.$langs->trans('NotCompatible', DOL_VERSION, + $product->dolibarr_min, $product->dolibarr_max).''; + $compatible = 'NotCompatible'; + } + } else { + //need update + $version = ''.$langs->trans('CompatibleAfterUpdate', DOL_VERSION, + $product->dolibarr_min, $product->dolibarr_max).''; + $compatible = 'NotCompatible'; + } + + //output template + $html .= ' +
    '.$newapp.$images.'
    +

    '.$product->name->language[$this->lang].'Details' + .'
    '.$version.'

    + '.dol_print_date(strtotime($product->date_upd)).' - '.$langs->trans('Référence').': '.$product->reference.' - '.$langs->trans('Id').': '.$product->id.'

    '.$product->description_short->language[$this->lang].' + '.$product->description->language[$this->lang].' + '.$price.' + '.$download_link.' + '; + } + return $html; + } + + function get_previous_link($text = '<<') + { + return ''.$text.''; + } + + function get_next_link($text = '>>') + { + return ''.$text.''; + } +} + + + +/** + * Class Dolistore + */ class Dolistore extends DolistoreModel { // params @@ -182,135 +318,3 @@ class Dolistore extends DolistoreModel } } - -/** - * Class DolistoreModel - */ -class DolistoreModel -{ - - function get_categories($parent = 0) - { - if (!isset($this->categories)) die('not possible'); - if ($parent != 0) { - $html = '
      '; - } else { - $html = ''; - } - - $nbofcateg = count($this->categories); - for ($i = 0; $i < $nbofcateg; $i++) - { - $cat = $this->categories[$i]; - if ($cat->is_root_category == 1 && $parent == 0) { - $html .= '
    • '.$cat->name->language[$this->lang].' '.$cat->nb_products_recursive.'

      '; - $html .= self::get_categories($cat->id); - $html .= "
    • \n"; - } elseif (trim($cat->id_parent) == $parent && $cat->active == 1 && trim($cat->id_parent) != 0) { // si cat est de ce niveau - $select = ($cat->id == $this->categorie) ? ' selected' : ''; - $html .= '
    • '.$cat->name->language[$this->lang].' '.$cat->nb_products_recursive.''; - $html .= self::get_categories($cat->id); - $html .= "
    • \n"; - } else { - - } - } - - if ($html == '
        ') { - return ''; - } - if ($parent != 0) { - return $html.'
      '; - } else { - return $html; - } - } - - function get_products() - { - global $langs, $conf; - $html = ""; - $parity = "pair"; - $last_month = time() - (30 * 24 * 60 * 60); - foreach ($this->products as $product) { - $parity = ($parity == "impair") ? 'pair' : 'impair'; - - // check new product ? - $newapp = ''; - if ($last_month < strtotime($product->date_add)) { - $newapp .= ''.$langs->trans('New').' '; - } - - // check updated ? - if ($last_month < strtotime($product->date_upd) && $newapp == '') { - $newapp .= ''.$langs->trans('Updated').' '; - } - - // add image or default ? - if ($product->id_default_image != '') { - $image_url = dol_buildPath('/dolistore/ajax/image.php?id_product=', 2).$product->id.'&id_image='.$product->id_default_image; - $images = ''. - ''; - } else { - $images = ''; - } - - // free or pay ? - if ($product->price > 0) { - $price = '

      '.price(round((float) $product->price * $this->vat_rate, 2)).' €

      '; - $download_link = ''; - } else { - $price = $langs->trans('Free'); - $download_link = ''; - } - - //checking versions - if ($this->version_compare($product->dolibarr_min, DOL_VERSION) <= 0) { - if ($this->version_compare($product->dolibarr_max, DOL_VERSION) >= 0) { - //compatible - $version = ''.$langs->trans('CompatibleUpTo', $product->dolibarr_max, - $product->dolibarr_min, $product->dolibarr_max).''; - $compatible = ''; - } else { - //never compatible, module expired - $version = ''.$langs->trans('NotCompatible', DOL_VERSION, - $product->dolibarr_min, $product->dolibarr_max).''; - $compatible = 'NotCompatible'; - } - } else { - //need update - $version = ''.$langs->trans('CompatibleAfterUpdate', DOL_VERSION, - $product->dolibarr_min, $product->dolibarr_max).''; - $compatible = 'NotCompatible'; - } - - //output template - $html .= ' -
      '.$newapp.$images.'
      -

      '.$product->name->language[$this->lang].'Details' - .'
      '.$version.'

      - '.dol_print_date(strtotime($product->date_upd)).' - '.$langs->trans('Référence').': '.$product->reference.' - '.$langs->trans('Id').': '.$product->id.'

      '.$product->description_short->language[$this->lang].' - '.$product->description->language[$this->lang].' - '.$price.' - '.$download_link.' - '; - } - return $html; - } - - function get_previous_link($text = '<<') - { - return ''.$text.''; - } - - function get_next_link($text = '>>') - { - return ''.$text.''; - } -} diff --git a/htdocs/admin/dolistore/class/init.php b/htdocs/admin/dolistore/class/init.php index df5773d9e7d..4a94e08002c 100644 --- a/htdocs/admin/dolistore/class/init.php +++ b/htdocs/admin/dolistore/class/init.php @@ -29,7 +29,7 @@ // Here we define constants /!\ You need to replace this parameters //https://dolistorecatalogpublickey1234567@vmdevwww.dolistore.com/api/ define('DEBUG', true); // Debug mode -define('PS_SHOP_PATH', 'http://vmdevwww.dolistore.com/'); // Root path of your PrestaShop store +define('PS_SHOP_PATH', 'https://www.dolistore.com/'); // Root path of your PrestaShop store define('PS_WS_AUTH_KEY', 'dolistorecatalogpublickey1234567'); // Auth key (Get it in your Back Office) require_once('./PSWebServiceLibrary.php'); // Here we make the WebService Call diff --git a/htdocs/cashdesk/css/style.css b/htdocs/cashdesk/css/style.css index c34e8596f01..d4149619aae 100644 --- a/htdocs/cashdesk/css/style.css +++ b/htdocs/cashdesk/css/style.css @@ -260,10 +260,6 @@ p.titre { padding: 0; } -.resultats_dhtml { - width: 400px; - position: absolute; -} /* --------------------- Combo lists ------------------- */ .select_design { diff --git a/htdocs/cashdesk/javascript/dhtml.js b/htdocs/cashdesk/javascript/dhtml.js index 7f5df55a767..db05855a3b2 100644 --- a/htdocs/cashdesk/javascript/dhtml.js +++ b/htdocs/cashdesk/javascript/dhtml.js @@ -51,26 +51,14 @@ function file(fichier) { } -// Affichage des donnees aTexte dans le bloc identifie par aId -function afficheDonnees(aId, aTexte) { - - document.getElementById(aId).innerHTML = aTexte; - -} - - // aCible : id du bloc de destination; aCode : argument a passer a la page php chargee du traitement et de l'affichage function verifResultat(aCible, aCode, iLimit) { if (aCode != '' && aCode.length >= iLimit) { if (texte = file('facturation_dhtml.php?code='+escape(aCode))) { - - afficheDonnees (aCible, texte); - + document.getElementById(aCible).innerHTML = texte; } else - - afficheDonnees (aCible, ''); - + document.getElementById(aCible).innerHTML = ''; } } diff --git a/htdocs/cashdesk/tpl/facturation1.tpl.php b/htdocs/cashdesk/tpl/facturation1.tpl.php index 8cfe70638e3..3f0a0f4c371 100644 --- a/htdocs/cashdesk/tpl/facturation1.tpl.php +++ b/htdocs/cashdesk/tpl/facturation1.tpl.php @@ -45,8 +45,7 @@ $langs->load("cashdesk"); + onfocus="javascript: this.select();" /> Date: Sat, 2 Sep 2017 00:33:18 +0200 Subject: [PATCH 41/46] Fix double translation --- htdocs/compta/resultat/clientfourn.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 195292e6471..927774e82d9 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2012 Cédric Salvador * Copyright (C) 2012-2014 Raphaël Dourseanud @@ -197,7 +197,7 @@ if ($date_endyear) $param.='&date_endyear='.$date_startyear; print ''; print ''; print_liste_field_titre(''); -print_liste_field_titre($langs->trans("Groups"), $_SERVER["PHP_SELF"],'s.nom, s.rowid','',$param,'',$sortfield,$sortorder); +print_liste_field_titre("Groups", $_SERVER["PHP_SELF"],'s.nom, s.rowid','',$param,'',$sortfield,$sortorder); if ($modecompta == 'BOOKKEEPING') { print_liste_field_titre("Amount", $_SERVER["PHP_SELF"],'amount','',$param,'align="right"',$sortfield,$sortorder); From 015bc51c43202ed9ba2cf53f5580580c4ddfecb3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 2 Sep 2017 12:17:29 +0200 Subject: [PATCH 42/46] Fix regression adding a false error message --- htdocs/core/class/extrafields.class.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 7e015d951b1..0040f1e3184 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -769,8 +769,8 @@ class ExtraFields $this->attributes[$tab->elementtype]['ishidden'][$tab->name]=$tab->ishidden; $this->attributes[$tab->elementtype]['entityid'][$tab->name]=$tab->entity; - - if (!empty($conf->multicompany->enabled)) { + if (!empty($conf->multicompany->enabled)) + { $sql_entity_name='SELECT label FROM '.MAIN_DB_PREFIX.'entity WHERE rowid='.$tab->entity; $resql_entity_name=$this->db->query($sql_entity_name); if ($resql_entity_name) @@ -785,11 +785,6 @@ class ExtraFields } } } - else - { - $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::fetch_name_optionals_label ".$this->error, LOG_ERR); - } } } if ($elementtype) $this->attributes[$elementtype]['loaded']=1; From a6a560257229eec3af6241865a05e0f3a9a0e6ef Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 2 Sep 2017 12:36:22 +0200 Subject: [PATCH 43/46] NEW Can set email of thirdparty as unique and/or mandatory --- htdocs/compta/facture/card.php | 63 ++++++--- htdocs/core/actions_builddoc.inc.php | 18 +-- htdocs/core/lib/functions.lib.php | 4 +- htdocs/societe/admin/societe.php | 115 +++++++--------- .../canvas/company/tpl/card_create.tpl.php | 2 +- .../canvas/company/tpl/card_edit.tpl.php | 2 +- .../canvas/individual/tpl/card_create.tpl.php | 2 +- .../canvas/individual/tpl/card_edit.tpl.php | 2 +- htdocs/societe/card.php | 65 +++------ .../class/api_deprecated_thirdparty.class.php | 2 +- .../societe/class/api_thirdparties.class.php | 2 +- htdocs/societe/class/societe.class.php | 129 ++++++++++++++---- 12 files changed, 230 insertions(+), 176 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 5a9dad480a0..1349d3b9199 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -73,7 +73,7 @@ if (!empty($conf->incoterm->enabled)) $langs->load('incoterm'); if (! empty($conf->margin->enabled)) $langs->load('margins'); -$projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0); +$projectid = (GETPOST('projectid','int') ? GETPOST('projectid', 'int') : 0); $id = (GETPOST('id', 'int') ? GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility $ref = GETPOST('ref', 'alpha'); @@ -83,7 +83,7 @@ $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'alpha'); $lineid = GETPOST('lineid', 'int'); $userid = GETPOST('userid', 'int'); -$search_ref = GETPOST('sf_ref') ? GETPOST('sf_ref', 'alpha') : GETPOST('search_ref', 'alpha'); +$search_ref = GETPOST('sf_ref','alpha') ? GETPOST('sf_ref', 'alpha') : GETPOST('search_ref', 'alpha'); $search_societe = GETPOST('search_societe', 'alpha'); $search_montant_ht = GETPOST('search_montant_ht', 'alpha'); $search_montant_ttc = GETPOST('search_montant_ttc', 'alpha'); @@ -430,27 +430,52 @@ if (empty($reshook)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->invoice_advance->validate))) ) { - $idwarehouse = GETPOST('idwarehouse'); + $idwarehouse = GETPOST('idwarehouse','int'); $object->fetch($id); $object->fetch_thirdparty(); // Check parameters - // Check for mandatory prof id (but only if country is than than ours) - if ($mysoc->country_id > 0 && $object->thirdparty->country_id == $mysoc->country_id) + // Check for mandatory fields defined into setup + $array_to_check=array('IDPROF1','IDPROF2','IDPROF3','IDPROF4','IDPROF5','IDPROF6','EMAIL'); + foreach($array_to_check as $key) { - for ($i = 1; $i <= 6; $i++) - { - $idprof_mandatory = 'SOCIETE_IDPROF' . ($i) . '_INVOICE_MANDATORY'; - $idprof = 'idprof' . $i; - if (! $object->thirdparty->$idprof && ! empty($conf->global->$idprof_mandatory)) - { - if (! $error) $langs->load("errors"); - $error++; - setEventMessages($langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId' . $i, $object->thirdparty->country_code)), null, 'errors'); - } - } + $keymin=strtolower($key); + $i=(int) preg_replace('/[^0-9]/','',$key); + $vallabel=$object->thirdparty->$keymin; + + if ($i > 0) + { + if ($object->thirdparty->isACompany()) + { + // Check for mandatory prof id (but only if country is other than ours) + if ($mysoc->country_id > 0 && $object->thirdparty->country_id == $mysoc->country_id) + { + $idprof_mandatory ='SOCIETE_'.$key.'_INVOICE_MANDATORY'; + if (! $vallabel && ! empty($conf->global->$idprof_mandatory)) + { + $langs->load("errors"); + $error++; + setEventMessages($langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId'.$i, $object->thirdparty->country_code)).' ('.$langs->trans("ForbiddenBySetupRules").')', null, 'errors'); + } + } + } + } + else + { + //var_dump($conf->global->SOCIETE_EMAIL_MANDATORY); + if ($key == 'EMAIL') + { + // Check for mandatory + if (! empty($conf->global->SOCIETE_EMAIL_INVOICE_MANDATORY) && ! isValidEMail($object->thirdparty->email)) + { + $langs->load("errors"); + $error++; + setEventMessages($langs->trans("ErrorBadEMail", $object->thirdparty->email).' ('.$langs->trans("ForbiddenBySetupRules").')', null, 'errors'); + } + } + } } $qualified_for_stock_change = 0; @@ -4260,7 +4285,7 @@ else if ($id > 0 || ! empty($ref)) print '
      '; // Select mail models is same action as presend - if (GETPOST('modelselected')) { + if (GETPOST('modelselected','alpha')) { $action = 'presend'; } if ($action != 'prerelance' && $action != 'presend') @@ -4347,7 +4372,7 @@ else if ($id > 0 || ! empty($ref)) // Build document if it not exists if (! $file || ! is_readable($file)) { - $result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + $result = $object->generateDocument(GETPOST('model','alpha') ? GETPOST('model','alpha') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { dol_print_error($db, $object->error, $object->errors); exit(); @@ -4367,7 +4392,7 @@ else if ($id > 0 || ! empty($ref)) include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; $formmail = new FormMail($db); $formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang); - $formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user')); + $formmail->fromtype = (GETPOST('fromtype','alpha')?GETPOST('fromtype','alpha'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user')); if($formmail->fromtype === 'user'){ $formmail->fromid = $user->id; diff --git a/htdocs/core/actions_builddoc.inc.php b/htdocs/core/actions_builddoc.inc.php index 076a7a6a035..a1ff6417f92 100644 --- a/htdocs/core/actions_builddoc.inc.php +++ b/htdocs/core/actions_builddoc.inc.php @@ -33,8 +33,8 @@ // Build doc if ($action == 'builddoc' && $permissioncreate) { - - if (is_numeric(GETPOST('model'))) + + if (is_numeric(GETPOST('model','alpha'))) { $error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Model")); } @@ -48,18 +48,18 @@ if ($action == 'builddoc' && $permissioncreate) dol_print_error('Object must have been loaded by a fetch'); exit; }*/ - + // Save last template used to generate document - if (GETPOST('model')) + if (GETPOST('model','alpha')) { $object->setDocModel($user, GETPOST('model','alpha')); } - + // Special case to force bank account //if (property_exists($object, 'fk_bank')) //{ - if (GETPOST('fk_bank')) { // this field may come from an external module - $object->fk_bank = GETPOST('fk_bank'); + if (GETPOST('fk_bank','int')) { // this field may come from an external module + $object->fk_bank = GETPOST('fk_bank','int'); } else if (! empty($object->fk_account)) { $object->fk_bank = $object->fk_account; } @@ -76,13 +76,13 @@ if ($action == 'builddoc' && $permissioncreate) $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - + // To be sure vars is defined if (empty($hidedetails)) $hidedetails=0; if (empty($hidedesc)) $hidedesc=0; if (empty($hideref)) $hideref=0; if (empty($moreparams)) $moreparams=null; - + $result= $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); if ($result <= 0) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 4aa3ab65ce5..da6cbc6c15c 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5738,8 +5738,8 @@ function dol_osencode($str) * @param DoliDB $db Database handler * @param string $key Code or Id to get Id or Code * @param string $tablename Table name without prefix - * @param string $fieldkey Field for code - * @param string $fieldid Field for id + * @param string $fieldkey Field for search ('code' or 'id') + * @param string $fieldid Field to get ('id' or 'code') * @return int <0 if KO, Id of code if OK * @see $langs->getLabelFromKey */ diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index 89ef7d0323d..ed4704471d0 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -167,23 +167,6 @@ if ($action == 'setdoc') } } -//Activate ProfId -if ($action == 'setprofid') -{ - $status = GETPOST('status','alpha'); - - $idprof="SOCIETE_IDPROF".$value."_UNIQUE"; - if (dolibarr_set_const($db, $idprof,$status,'chaine',0,'',$conf->entity) > 0) - { - header("Location: ".$_SERVER["PHP_SELF"]); - exit; - } - else - { - dol_print_error($db); - } -} - //Activate Set ref in list if ($action=="setaddrefinlist") { $setaddrefinlist = GETPOST('value','int'); @@ -214,16 +197,33 @@ if ($action=="setaskforshippingmet") { } } +//Activate ProfId unique +if ($action == 'setprofid') +{ + $status = GETPOST('status','alpha'); + + $idprof="SOCIETE_".$value."_UNIQUE"; + if (dolibarr_set_const($db, $idprof, $status, 'chaine', 0, '', $conf->entity) > 0) + { + //header("Location: ".$_SERVER["PHP_SELF"]); + //exit; + } + else + { + dol_print_error($db); + } +} + //Activate ProfId mandatory if ($action == 'setprofidmandatory') { $status = GETPOST('status','alpha'); - $idprof="SOCIETE_IDPROF".$value."_MANDATORY"; - if (dolibarr_set_const($db, $idprof,$status,'chaine',0,'',$conf->entity) > 0) + $idprof="SOCIETE_".$value."_MANDATORY"; + if (dolibarr_set_const($db, $idprof, $status, 'chaine', 0, '', $conf->entity) > 0) { - header("Location: ".$_SERVER["PHP_SELF"]); - exit; + //header("Location: ".$_SERVER["PHP_SELF"]); + //exit; } else { @@ -236,11 +236,11 @@ if ($action == 'setprofidinvoicemandatory') { $status = GETPOST('status','alpha'); - $idprof="SOCIETE_IDPROF".$value."_INVOICE_MANDATORY"; - if (dolibarr_set_const($db, $idprof,$status,'chaine',0,'',$conf->entity) > 0) + $idprof="SOCIETE_".$value."_INVOICE_MANDATORY"; + if (dolibarr_set_const($db, $idprof, $status, 'chaine', 0, '', $conf->entity) > 0) { - header("Location: ".$_SERVER["PHP_SELF"]); - exit; + //header("Location: ".$_SERVER["PHP_SELF"]); + //exit; } else { @@ -298,7 +298,6 @@ print '
      '; print ' '; print "\n"; -$var = true; foreach ($dirsociete as $dirroot) { $dir = dol_buildpath($dirroot,0); @@ -327,7 +326,6 @@ foreach ($dirsociete as $dirroot) if ($modCodeTiers->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; if ($modCodeTiers->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; - $var = !$var; print ''."\n"; print ''."\n"; print ''."\n"; @@ -380,7 +378,6 @@ print ''; print ''; print "\n"; -$var=true; foreach ($dirsociete as $dirroot) { $dir = dol_buildpath($dirroot,0); @@ -403,7 +400,6 @@ foreach ($dirsociete as $dirroot) } $modCodeCompta = new $file; - $var = !$var; print ''; print ''; print ''; print "\n"; -$var=true; foreach ($dirsociete as $dirroot) { $dir = dol_buildpath($dirroot.'doc/',0); @@ -507,7 +502,6 @@ foreach ($dirsociete as $dirroot) if ($modulequalified) { - $var = !$var; print ''; print ''; print "\n"; -$profid[0][0]=$langs->trans("ProfId1"); -$profid[0][1]=$langs->transcountry('ProfId1', $mysoc->country_code); -$profid[1][0]=$langs->trans("ProfId2"); -$profid[1][1]=$langs->transcountry('ProfId2', $mysoc->country_code); -$profid[2][0]=$langs->trans("ProfId3"); -$profid[2][1]=$langs->transcountry('ProfId3', $mysoc->country_code); -$profid[3][0]=$langs->trans("ProfId4"); -$profid[3][1]=$langs->transcountry('ProfId4', $mysoc->country_code); -$profid[4][0]=$langs->trans("ProfId5"); -$profid[4][1]=$langs->transcountry('ProfId5', $mysoc->country_code); -$profid[5][0]=$langs->trans("ProfId6"); -$profid[5][1]=$langs->transcountry('ProfId6', $mysoc->country_code); - -$var = true; -$i=0; +$profid['IDPROF1'][0]=$langs->trans("ProfId1"); +$profid['IDPROF1'][1]=$langs->transcountry('ProfId1', $mysoc->country_code); +$profid['IDPROF2'][0]=$langs->trans("ProfId2"); +$profid['IDPROF2'][1]=$langs->transcountry('ProfId2', $mysoc->country_code); +$profid['IDPROF3'][0]=$langs->trans("ProfId3"); +$profid['IDPROF3'][1]=$langs->transcountry('ProfId3', $mysoc->country_code); +$profid['IDPROF4'][0]=$langs->trans("ProfId4"); +$profid['IDPROF4'][1]=$langs->transcountry('ProfId4', $mysoc->country_code); +$profid['IDPROF5'][0]=$langs->trans("ProfId5"); +$profid['IDPROF5'][1]=$langs->transcountry('ProfId5', $mysoc->country_code); +$profid['IDPROF6'][0]=$langs->trans("ProfId6"); +$profid['IDPROF6'][1]=$langs->transcountry('ProfId6', $mysoc->country_code); +$profid['EMAIL'][0]=$langs->trans("EMail"); +$profid['EMAIL'][1]=$langs->trans('Email'); $nbofloop=count($profid); -while ($i < $nbofloop) +foreach($profid as $key => $val) { - if ($profid[$i][1]!='-') + if ($profid[$key][1]!='-') { - $var = !$var; - print ''; - print ''; - $idprof_unique ='SOCIETE_IDPROF'.($i+1).'_UNIQUE'; - $idprof_mandatory ='SOCIETE_IDPROF'.($i+1).'_MANDATORY'; - $idprof_invoice_mandatory ='SOCIETE_IDPROF'.($i+1).'_INVOICE_MANDATORY'; + $idprof_unique ='SOCIETE_'.$key.'_UNIQUE'; + $idprof_mandatory ='SOCIETE_'.$key.'_MANDATORY'; + $idprof_invoice_mandatory ='SOCIETE_'.$key.'_INVOICE_MANDATORY'; + $verif=(empty($conf->global->$idprof_unique)?false:true); $mandatory=(empty($conf->global->$idprof_mandatory)?false:true); $invoice_mandatory=(empty($conf->global->$idprof_invoice_mandatory)?false:true); if ($verif) { - print ''; } else { - print ''; } if ($mandatory) { - print ''; } else { - print ''; } if ($invoice_mandatory) { - print ''; } else { - print ''; } @@ -683,7 +675,6 @@ print load_fiche_titre($langs->trans("Other"),'',''); // Autres options $form=new Form($db); -$var=true; print ''; print ''; diff --git a/htdocs/societe/canvas/company/tpl/card_create.tpl.php b/htdocs/societe/canvas/company/tpl/card_create.tpl.php index d542f0553ba..45b5e76fcda 100644 --- a/htdocs/societe/canvas/company/tpl/card_create.tpl.php +++ b/htdocs/societe/canvas/company/tpl/card_create.tpl.php @@ -133,7 +133,7 @@ - + diff --git a/htdocs/societe/canvas/company/tpl/card_edit.tpl.php b/htdocs/societe/canvas/company/tpl/card_edit.tpl.php index 1f6201ec829..951d17c5b63 100644 --- a/htdocs/societe/canvas/company/tpl/card_edit.tpl.php +++ b/htdocs/societe/canvas/company/tpl/card_edit.tpl.php @@ -148,7 +148,7 @@ if ($this->control->tpl['fournisseur']) { - + diff --git a/htdocs/societe/canvas/individual/tpl/card_create.tpl.php b/htdocs/societe/canvas/individual/tpl/card_create.tpl.php index 1be20214c35..44bf9dadf58 100644 --- a/htdocs/societe/canvas/individual/tpl/card_create.tpl.php +++ b/htdocs/societe/canvas/individual/tpl/card_create.tpl.php @@ -143,7 +143,7 @@ - + diff --git a/htdocs/societe/canvas/individual/tpl/card_edit.tpl.php b/htdocs/societe/canvas/individual/tpl/card_edit.tpl.php index 90543958902..81e0b66c103 100644 --- a/htdocs/societe/canvas/individual/tpl/card_edit.tpl.php +++ b/htdocs/societe/canvas/individual/tpl/card_edit.tpl.php @@ -145,7 +145,7 @@ if ($this->control->tpl['fournisseur']) { - + diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 53c5a1add14..00b463f647a 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -325,7 +325,6 @@ if (empty($reshook)) $action='create'; } - if ($action == 'update') { $ret=$object->fetch($socid); @@ -333,7 +332,7 @@ if (empty($reshook)) } else $object->canvas=$canvas; - if (GETPOST("private") == 1) + if (GETPOST("private") == 1) // Ask to create a contact { $object->particulier = GETPOST("private"); @@ -356,14 +355,14 @@ if (empty($reshook)) $object->skype = GETPOST('skype', 'alpha'); $object->phone = GETPOST('phone', 'alpha'); $object->fax = GETPOST('fax','alpha'); - $object->email = GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL); - $object->url = GETPOST('url', 'custom', 0, FILTER_SANITIZE_URL); - $object->idprof1 = GETPOST('idprof1', 'alpha'); - $object->idprof2 = GETPOST('idprof2', 'alpha'); - $object->idprof3 = GETPOST('idprof3', 'alpha'); - $object->idprof4 = GETPOST('idprof4', 'alpha'); - $object->idprof5 = GETPOST('idprof5', 'alpha'); - $object->idprof6 = GETPOST('idprof6', 'alpha'); + $object->email = trim(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL)); + $object->url = trim(GETPOST('url', 'custom', 0, FILTER_SANITIZE_URL)); + $object->idprof1 = trim(GETPOST('idprof1', 'alpha')); + $object->idprof2 = trim(GETPOST('idprof2', 'alpha')); + $object->idprof3 = trim(GETPOST('idprof3', 'alpha')); + $object->idprof4 = trim(GETPOST('idprof4', 'alpha')); + $object->idprof5 = trim(GETPOST('idprof5', 'alpha')); + $object->idprof6 = trim(GETPOST('idprof6', 'alpha')); $object->prefix_comm = GETPOST('prefix_comm', 'alpha'); $object->code_client = GETPOST('code_client', 'alpha'); $object->code_fournisseur = GETPOST('code_fournisseur', 'alpha'); @@ -383,7 +382,9 @@ if (empty($reshook)) $object->forme_juridique_code = GETPOST('forme_juridique_code', 'int'); $object->effectif_id = GETPOST('effectif_id', 'int'); - $object->typent_id = GETPOST('typent_id'); + $object->typent_id = GETPOST('typent_id','int'); + + $object->typent_code = dol_getIdFromCode($db, $object->typent_id, 'c_typent', 'id', 'code'); // Force typent_code too so check in verify() will be done on new type $object->client = GETPOST('client', 'int'); $object->fournisseur = GETPOST('fournisseur', 'int'); @@ -461,40 +462,6 @@ if (empty($reshook)) $object->country_code=$tmparray['code']; $object->country=$tmparray['label']; } - - // Check for duplicate or mandatory prof id - // Only for companies - if (!($object->particulier || $private)) - { - for ($i = 1; $i <= 6; $i++) - { - $slabel="idprof".$i; - $_POST[$slabel]=trim($_POST[$slabel]); - $vallabel=$_POST[$slabel]; - if ($vallabel && $object->id_prof_verifiable($i)) - { - if($object->id_prof_exists($i,$vallabel,$object->id)) - { - $langs->load("errors"); - $error++; $errors[] = $langs->transcountry('ProfId'.$i, $object->country_code)." ".$langs->trans("ErrorProdIdAlreadyExist", $vallabel); - $action = (($action=='add'||$action=='create')?'create':'edit'); - } - } - - // Check for mandatory prof id (but only if country is than than ours) - if ($mysoc->country_id > 0 && $object->country_id == $mysoc->country_id) - { - $idprof_mandatory ='SOCIETE_IDPROF'.($i).'_MANDATORY'; - if (! $vallabel && ! empty($conf->global->$idprof_mandatory)) - { - $langs->load("errors"); - $error++; - $errors[] = $langs->trans("ErrorProdIdIsMandatory", $langs->transcountry('ProfId'.$i, $object->country_code)); - $action = (($action=='add'||$action=='create')?'create':'edit'); - } - } - } - } } if (! $error) @@ -512,7 +479,7 @@ if (empty($reshook)) { if ($object->particulier) { - dol_syslog("This thirdparty is a personal people",LOG_DEBUG); + dol_syslog("We ask to create a contact/address too", LOG_DEBUG); $result=$object->create_individual($user); if (! $result >= 0) { @@ -1152,7 +1119,7 @@ else } // Email web - print ''; + print ''; print ''; print ''; print ''; @@ -1710,7 +1677,7 @@ else } // EMail / Web - print ''; + print ''; print ''; print ''; print ''; @@ -1740,7 +1707,7 @@ else if (($j % 2) == 0) print ''; $idprof_mandatory ='SOCIETE_IDPROF'.($i).'_MANDATORY'; - if(empty($conf->global->$idprof_mandatory)) + if (empty($conf->global->$idprof_mandatory) || ! $object->isACompany()) print ''; - $out .= ''; $html_id = !empty($this->id) ? $this->element.'_extras_'.$key.'_'.$this->id : ''; $out .=''; From 9923c87fd808de7b99968ad8bfb1f4ca6b2ea2a4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 2 Sep 2017 13:03:14 +0200 Subject: [PATCH 46/46] Fix translation of extrafields --- htdocs/core/class/commonobject.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 14d8f03b84b..b84f9887abb 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4622,7 +4622,9 @@ abstract class CommonObject $labeltoshow = $langs->trans($label); if($extrafields->attribute_required[$key]) - $label = ''.$labeltoshow.''; + { + $labeltoshow = ''.$labeltoshow.''; + } $out .= ''; $html_id = !empty($this->id) ? $this->element.'_extras_'.$key.'_'.$this->id : '';
      '.$langs->trans("Status").''.$langs->trans("ShortInfo").'
      '.$modCodeTiers->name.''.$modCodeTiers->info($langs).''.$langs->trans("Status").''.$langs->trans("ShortInfo").'
      '.$modCodeCompta->name."\n"; @@ -474,7 +470,6 @@ print ''.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
      '; print $module->name; print "\n"; @@ -597,76 +591,74 @@ print ''.$langs->trans("MustBeMandatory").''.$langs->trans("MustBeInvoiceMandatory").'
      '.$profid[$i][0]."\n"; - print $profid[$i][1]; + print ''.$profid[$key][0]."\n"; + print $profid[$key][1]; print ''; + print ''; print img_picto($langs->trans("Activated"),'switch_on'); print ''; + print ''; print img_picto($langs->trans("Disabled"),'switch_off'); print ''; + print ''; print img_picto($langs->trans("Activated"),'switch_on'); print ''; + print ''; print img_picto($langs->trans("Disabled"),'switch_off'); print ''; + print ''; print img_picto($langs->trans("Activated"),'switch_on'); print ''; + print ''; print img_picto($langs->trans("Disabled"),'switch_off'); print '
      trans('EMail').($conf->global->SOCIETE_MAIL_REQUIRED?'*':''); ?>trans('EMail').($conf->global->SOCIETE_EMAIL_MANDATORY?'*':''); ?> trans('Web'); ?>
      trans('EMail').($conf->global->SOCIETE_MAIL_REQUIRED?'*':''); ?>trans('EMail').($conf->global->SOCIETE_EMAIL_MANDATORY?'*':''); ?> trans('Web'); ?>
      trans('EMail').($conf->global->SOCIETE_MAIL_REQUIRED?'*':''); ?>trans('EMail').($conf->global->SOCIETE_EMAIL_MANDATORY?'*':''); ?> trans('Web'); ?>
      trans('EMail').($conf->global->SOCIETE_MAIL_REQUIRED?'*':''); ?>trans('EMail').($conf->global->SOCIETE_EMAIL_MANDATORY?'*':''); ?> trans('Web'); ?>
      '.fieldLabel('EMail','email').(! empty($conf->global->SOCIETE_MAIL_REQUIRED)?'*':'').'
      '.fieldLabel('EMail','email',$conf->global->SOCIETE_EMAIL_MANDATORY).'
      '.fieldLabel('Web','url').'
      '.fieldLabel('EMail','email',(! empty($conf->global->SOCIETE_MAIL_REQUIRED))).'
      '.fieldLabel('EMail','email',(! empty($conf->global->SOCIETE_EMAIL_MANDATORY))).'
      '.fieldLabel('Web','url').'
      '.fieldLabel($idprof,$key).''; else print ''.fieldLabel($idprof,$key).''; diff --git a/htdocs/societe/class/api_deprecated_thirdparty.class.php b/htdocs/societe/class/api_deprecated_thirdparty.class.php index b335fb35183..c31e4278f46 100644 --- a/htdocs/societe/class/api_deprecated_thirdparty.class.php +++ b/htdocs/societe/class/api_deprecated_thirdparty.class.php @@ -60,7 +60,7 @@ class ThirdpartyApi extends DolibarrApi $this->company = new Societe($this->db); $this->customer = new Client($this->db); - if (! empty($conf->global->SOCIETE_MAIL_REQUIRED)) { + if (! empty($conf->global->SOCIETE_EMAIL_MANDATORY)) { static::$FIELDS[] = 'email'; } } diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 24cf991da52..f25fda9a5fb 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -49,7 +49,7 @@ class Thirdparties extends DolibarrApi $this->db = $db; $this->company = new Societe($this->db); - if (! empty($conf->global->SOCIETE_MAIL_REQUIRED)) { + if (! empty($conf->global->SOCIETE_EMAIL_MANDATORY)) { static::$FIELDS[] = 'email'; } } diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 2bd764c92ed..00f49046d45 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -400,7 +400,7 @@ class Societe extends CommonObject */ function create($user) { - global $langs,$conf; + global $langs,$conf,$mysoc; $error=0; @@ -422,14 +422,6 @@ class Societe extends CommonObject dol_syslog(get_class($this)."::create ".$this->name); - // Check parameters - if (! empty($conf->global->SOCIETE_MAIL_REQUIRED) && ! isValidEMail($this->email)) - { - $langs->load("errors"); - $this->error = $langs->trans("ErrorBadEMail",$this->email); - return -1; - } - $now=dol_now(); $this->db->begin(); @@ -438,7 +430,7 @@ class Societe extends CommonObject if ($this->code_client == -1) $this->get_codeclient($this,0); if ($this->code_fournisseur == -1) $this->get_codefournisseur($this,1); - // Check more parameters + // Check more parameters (including mandatory setup // If error, this->errors[] is filled $result = $this->verify(); @@ -524,6 +516,7 @@ class Societe extends CommonObject } } + /** * Create a contact/address from thirdparty * @@ -568,6 +561,9 @@ class Societe extends CommonObject */ function verify() { + global $conf, $langs, $mysoc; + + $error = 0; $this->errors=array(); $result = 0; @@ -630,6 +626,69 @@ class Societe extends CommonObject } } + // Check for duplicate or mandatory fields defined into setup + $array_to_check=array('IDPROF1','IDPROF2','IDPROF3','IDPROF4','IDPROF5','IDPROF6','EMAIL'); + foreach($array_to_check as $key) + { + $keymin=strtolower($key); + $i=(int) preg_replace('/[^0-9]/','',$key); + $vallabel=$this->$keymin; + + if ($i > 0) + { + if ($this->isACompany()) + { + // Check for unicity + if ($vallabel && $this->id_prof_verifiable($i)) + { + if ($this->id_prof_exists($keymin, $vallabel, ($this->id > 0 ? $this->id : 0))) + { + $langs->load("errors"); + $error++; $this->errors[] = $langs->transcountry('ProfId'.$i, $this->country_code)." ".$langs->trans("ErrorProdIdAlreadyExist", $vallabel).' ('.$langs->trans("ForbiddenBySetupRules").')'; + } + } + + // Check for mandatory prof id (but only if country is other than ours) + if ($mysoc->country_id > 0 && $this->country_id == $mysoc->country_id) + { + $idprof_mandatory ='SOCIETE_'.$key.'_MANDATORY'; + if (! $vallabel && ! empty($conf->global->$idprof_mandatory)) + { + $langs->load("errors"); + $error++; + $this->errors[] = $langs->trans("ErrorProdIdIsMandatory", $langs->transcountry('ProfId'.$i, $this->country_code)).' ('.$langs->trans("ForbiddenBySetupRules").')'; + } + } + } + } + else + { + //var_dump($conf->global->SOCIETE_EMAIL_MANDATORY); + if ($key == 'EMAIL') + { + // Check for unicity + if ($vallabel) + { + if ($this->id_prof_exists($keymin, $vallabel, ($this->id > 0 ? $this->id : 0))) + { + $langs->load("errors"); + $error++; $this->errors[] = $langs->transcountry('ProfId'.$i, $this->country_code)." ".$langs->trans("ErrorProdIdAlreadyExist", $vallabel).' ('.$langs->trans("ForbiddenBySetupRules").')'; + } + } + + // Check for mandatory + if (! empty($conf->global->SOCIETE_EMAIL_MANDATORY) && ! isValidEMail($this->email)) + { + $langs->load("errors"); + $error++; + $this->errors[] = $langs->trans("ErrorBadEMail", $this->email).' ('.$langs->trans("ForbiddenBySetupRules").')'; + } + } + } + } + + if ($error) $result = -4; + return $result; } @@ -719,13 +778,7 @@ class Societe extends CommonObject $this->code_compta=trim($this->code_compta); $this->code_compta_fournisseur=trim($this->code_compta_fournisseur); - // Check parameters - if (! empty($conf->global->SOCIETE_MAIL_REQUIRED) && ! isValidEMail($this->email)) - { - $langs->load("errors"); - $this->error = $langs->trans("ErrorBadEMail",$this->email); - return -1; - } + // Check parameters. More tests are done later in the ->verify() if (! is_numeric($this->client) && ! is_numeric($this->fournisseur)) { $langs->load("errors"); @@ -2581,7 +2634,7 @@ class Societe extends CommonObject /** * Returns if a profid sould be verified * - * @param int $idprof 1,2,3,4 (Exemple: 1=siren,2=siret,3=naf,4=rcs/rm) + * @param int $idprof 1,2,3,4,5,6 (Exemple: 1=siren,2=siret,3=naf,4=rcs/rm,5=idprof5,6=idprof6) * @return boolean true , false */ function id_prof_verifiable($idprof) @@ -2602,6 +2655,12 @@ class Societe extends CommonObject case 4: $ret=(!$conf->global->SOCIETE_IDPROF4_UNIQUE?false:true); break; + case 5: + $ret=(!$conf->global->SOCIETE_IDPROF5_UNIQUE?false:true); + break; + case 6: + $ret=(!$conf->global->SOCIETE_IDPROF6_UNIQUE?false:true); + break; default: $ret=false; } @@ -2612,28 +2671,40 @@ class Societe extends CommonObject /** * Verify if a profid exists into database for others thirds * - * @param int $idprof 1,2,3,4 (Example: 1=siren,2=siret,3=naf,4=rcs/rm) + * @param string $idprof 'idprof1','idprof2','idprof3','idprof4','idprof5','idprof6','email' (Example: idprof1=siren, idprof2=siret, idprof3=naf, idprof4=rcs/rm) * @param string $value Value of profid - * @param int $socid Id of thirdparty if update - * @return boolean true if exists, false if not + * @param int $socid Id of thirdparty to exclude (if update) + * @return boolean True if exists, False if not */ - function id_prof_exists($idprof,$value,$socid=0) + function id_prof_exists($idprof, $value, $socid=0) { - switch($idprof) + $field = $idprof; + + switch($idprof) // For backward compatibility { - case 1: + case '1': + case 'idprof1': $field="siren"; break; - case 2: + case '2': + case 'idprof2': $field="siret"; break; - case 3: + case '3': + case 'idprof3': $field="ape"; break; - case 4: + case '4': + case 'idprof4': $field="idprof4"; break; - } + case '5': + $field="idprof5"; + break; + case '6': + $field="idprof6"; + break; + } //Verify duplicate entries $sql = "SELECT COUNT(*) as idprof FROM ".MAIN_DB_PREFIX."societe WHERE ".$field." = '".$value."' AND entity IN (".getEntity('societe').")"; @@ -2895,7 +2966,7 @@ class Societe extends CommonObject $isacompany=empty($conf->global->MAIN_UNKNOWN_CUSTOMERS_ARE_COMPANIES)?0:1; // 0 by default if (! empty($this->tva_intra)) $isacompany=1; else if (! empty($this->typent_code) && in_array($this->typent_code,array('TE_PRIVATE'))) $isacompany=0; - else if (! empty($this->typent_code) && in_array($this->typent_code,array('TE_SMALL','TE_MEDIUM','TE_LARGE'))) $isacompany=1; + else if (! empty($this->typent_code) && in_array($this->typent_code,array('TE_SMALL','TE_MEDIUM','TE_LARGE','TE_GROUP'))) $isacompany=1; return $isacompany; } From e5400a4a36a668c32a2ab9da94e098d2c1eb74b7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 2 Sep 2017 13:01:41 +0200 Subject: [PATCH 44/46] Fix translation of extrafields --- htdocs/core/class/commonobject.class.php | 5 +++-- htdocs/install/mysql/migration/6.0.0-7.0.0.sql | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 450bc4ba393..292492eb9fc 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4620,10 +4620,11 @@ abstract class CommonObject $value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$this->db->jdate($this->array_options['options_'.$key]); } + $labeltoshow = $langs->trans($labeltoshow); if($extrafields->attribute_required[$key]) - $label = ''.$label.''; + $label = ''.$labeltoshow.''; + $out .= ''.$labeltoshow.''.$langs->trans($label).''; diff --git a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql index 8458a6167d2..7ae8b4d8e76 100644 --- a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql +++ b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql @@ -204,6 +204,8 @@ ALTER TABLE llx_extrafields ADD COLUMN fk_user_modif integer; ALTER TABLE llx_extrafields ADD COLUMN datec datetime; ALTER TABLE llx_extrafields ADD COLUMN tms timestamp; +ALTER TABLE llx_extrafields MODIFY COLUMN langs varchar(64); + ALTER TABLE llx_holiday_config MODIFY COLUMN name varchar(128); ALTER TABLE llx_holiday_config ADD UNIQUE INDEX idx_holiday_config (name); From 36eb21c13554a970e0cf50d8b6c526609c6cdde5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 2 Sep 2017 13:02:01 +0200 Subject: [PATCH 45/46] Fix translation of extrafields --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 292492eb9fc..14d8f03b84b 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4620,7 +4620,7 @@ abstract class CommonObject $value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$this->db->jdate($this->array_options['options_'.$key]); } - $labeltoshow = $langs->trans($labeltoshow); + $labeltoshow = $langs->trans($label); if($extrafields->attribute_required[$key]) $label = ''.$labeltoshow.''; $out .= ''.$labeltoshow.''.$labeltoshow.'