From 1ef27913d7225dc4c8e107841f763a28ead49b11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Tue, 26 Jul 2016 17:07:56 +0200 Subject: [PATCH 01/20] FIX #5549 getNomUrl tooltips show Order info even if user has no rights to read them --- htdocs/commande/class/commande.class.php | 34 ++++++++++++++++-------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 9eb67cecc56..003f3fab255 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3081,17 +3081,29 @@ class Commande extends CommonOrder if ($short) return $url; $picto = 'order'; - $label = '' . $langs->trans("ShowOrder") . ''; - if (! empty($this->ref)) - $label .= '
' . $langs->trans('Ref') . ': ' . $this->ref; - if (! empty($this->ref_client)) - $label.= '
' . $langs->trans('RefCustomer') . ': ' . $this->ref_client; - if (! empty($this->total_ht)) - $label.= '
' . $langs->trans('AmountHT') . ': ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); - if (! empty($this->total_tva)) - $label.= '
' . $langs->trans('VAT') . ': ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); - if (! empty($this->total_ttc)) - $label.= '
' . $langs->trans('AmountTTC') . ': ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); + $label = ''; + + if ($user->rights->commande->lire) { + $label = ''.$langs->trans("ShowOrder").''; + if (!empty($this->ref)) { + $label .= '
'.$langs->trans('Ref').': '.$this->ref; + } + if (!empty($this->ref_client)) { + $label .= '
'.$langs->trans('RefCustomer').': '.$this->ref_client; + } + if (!empty($this->total_ht)) { + $label .= '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, + $conf->currency); + } + if (!empty($this->total_tva)) { + $label .= '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, + $conf->currency); + } + if (!empty($this->total_ttc)) { + $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, + $conf->currency); + } + } $linkstart = ''; $linkend=''; From 86c2ced714d59dcd83beb29f055e4d8216481c74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Fri, 29 Jul 2016 11:53:24 +0200 Subject: [PATCH 02/20] Missing $user variable --- htdocs/commande/class/commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 003f3fab255..7c4176edac8 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3071,7 +3071,7 @@ class Commande extends CommonOrder */ function getNomUrl($withpicto=0,$option=0,$max=0,$short=0) { - global $conf, $langs; + global $conf, $langs, $user; $result=''; From 69247afd06361d287fb2cedf51db44bf2b49b2a8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Jul 2016 17:26:24 +0200 Subject: [PATCH 03/20] FIX #4447 --- htdocs/compta/prelevement/fiche-stat.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/prelevement/fiche-stat.php b/htdocs/compta/prelevement/fiche-stat.php index 0e9174ef034..9d70bc76a4e 100644 --- a/htdocs/compta/prelevement/fiche-stat.php +++ b/htdocs/compta/prelevement/fiche-stat.php @@ -141,7 +141,7 @@ if ($prev_id) print price($row[0]); print ''; - print round($row[0]/$bon->amount*100,2)." %"; + if ($bon->amount) print round($row[0]/$bon->amount*100,2)." %"; print ''; print "\n"; From fb2444c7a35e4c495b4354a5c1e02a3357a3c0b0 Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Mon, 1 Aug 2016 10:20:10 +0200 Subject: [PATCH 04/20] Fix: Can't set PRODUIT_LIMIT_SIZE to value 0 --- htdocs/product/admin/product.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index b8c07df87a5..c2069bea15f 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -7,6 +7,7 @@ * Copyright (C) 2011-2012 Juanjo Menent * Copyright (C) 2012 Christophe Battarel * Copyright (C) 2012 Cedric Salvador + * Copyright (C) 2016 Ferran Marcet * * 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 @@ -108,7 +109,7 @@ if ($action == 'setModuleOptions') } } -if ($action == 'other' && GETPOST('value_PRODUIT_LIMIT_SIZE') > 0) +if ($action == 'other' && GETPOST('value_PRODUIT_LIMIT_SIZE') >= 0) { $res = dolibarr_set_const($db, "PRODUIT_LIMIT_SIZE", GETPOST('value_PRODUIT_LIMIT_SIZE'),'chaine',0,'',$conf->entity); } From 5144f21c6ce0a6c49c5b4769cd1cca36c22f651d Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Tue, 2 Aug 2016 15:36:00 +0200 Subject: [PATCH 05/20] FIX php Strict --- htdocs/core/modules/barcode/mod_barcode_product_standard.php | 4 ++-- htdocs/core/modules/barcode/modules_barcode.class.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php index aeb7ea4cd8f..12f4fb96545 100644 --- a/htdocs/core/modules/barcode/mod_barcode_product_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php @@ -278,7 +278,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode } dol_syslog(get_class($this).'::verif_syntax codefortest='.$codefortest." typefortest=".$typefortest); - + $newcodefortest=$codefortest; // Special case, if mask is on 12 digits instead of 13, we remove last char into code to test @@ -290,7 +290,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode dol_syslog(get_class($this).'::verif_syntax newcodefortest='.$newcodefortest); } } - + $result=check_value($mask,$newcodefortest); return $result; diff --git a/htdocs/core/modules/barcode/modules_barcode.class.php b/htdocs/core/modules/barcode/modules_barcode.class.php index d03302f36b7..43924165901 100644 --- a/htdocs/core/modules/barcode/modules_barcode.class.php +++ b/htdocs/core/modules/barcode/modules_barcode.class.php @@ -87,11 +87,11 @@ abstract class ModeleNumRefBarCode /** * Return next value available * - * @param Societe $objsoc Object thirdparty + * @param Societe $objproduct Object Product * @param int $type Type * @return string Value */ - function getNextValue($objsoc=0,$type=-1) + function getNextValue($objproduct,$type='') { global $langs; return $langs->trans("Function_getNextValue_InModuleNotWorking"); From da274f0ca4ea0a780758e927ec6eccfb5e69f107 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Wed, 3 Aug 2016 07:28:00 +0200 Subject: [PATCH 06/20] Uniformize presentation on contract --- htdocs/contrat/card.php | 24 ++++++++++++------------ htdocs/contrat/contact.php | 4 ++-- htdocs/contrat/document.php | 4 ++-- htdocs/contrat/info.php | 2 +- htdocs/contrat/note.php | 4 ++-- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 5a9c8a267ea..f6d299f94e0 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -998,7 +998,7 @@ if (empty($reshook)) * View */ -llxHeader('',$langs->trans("ContractCard"),"Contrat"); +llxHeader('',$langs->trans("Contract"),""); $form = new Form($db); $formfile = new FormFile($db); @@ -1094,7 +1094,7 @@ if ($action == 'create') } else { $tmpcode=''; } - print ''.$langs->trans('Ref').''.$tmpcode.''; + print ''.$langs->trans('Ref').''.$tmpcode.''; // Ref customer print ''.$langs->trans('RefCustomer').''; @@ -1137,12 +1137,12 @@ if ($action == 'create') } // Commercial suivi - print ''.$langs->trans("TypeContact_contrat_internal_SALESREPFOLL").''; + print ''.$langs->trans("TypeContact_contrat_internal_SALESREPFOLL").''; print $form->select_dolusers(GETPOST("commercial_suivi_id")?GETPOST("commercial_suivi_id"):$user->id,'commercial_suivi_id',1,''); print ''; // Commercial signature - print ''.$langs->trans("TypeContact_contrat_internal_SALESREPSIGN").''; + print ''.$langs->trans("TypeContact_contrat_internal_SALESREPSIGN").''; print $form->select_dolusers(GETPOST("commercial_signature_id")?GETPOST("commercial_signature_id"):$user->id,'commercial_signature_id',1,''); print ''; @@ -1188,7 +1188,7 @@ if ($action == 'create') dol_fiche_end(); - print '
'; + print '
'; print ''; print '     '; print ''; @@ -1295,13 +1295,13 @@ else $linkback = ''.$langs->trans("BackToList").''; // Ref du contrat - if (!empty($modCodeContract->code_auto)) { - print ''.$langs->trans("Ref").''; + if (! empty($modCodeContract->code_auto)) { + print ''.$langs->trans("Ref").''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); print ""; } else { print ''; - print ''; + print ''; print $form->editfieldkey("Ref",'ref',$object->ref,$object,$user->rights->contrat->creer); print ''; print $form->editfieldval("Ref",'ref',$object->ref,$object,$user->rights->contrat->creer); @@ -1310,7 +1310,7 @@ else } print ''; - print ''; + print ''; print $form->editfieldkey("RefCustomer",'ref_customer',$object->ref_customer,$object,$user->rights->contrat->creer); print ''; print $form->editfieldval("RefCustomer",'ref_customer',$object->ref_customer,$object,$user->rights->contrat->creer); @@ -1318,7 +1318,7 @@ else print ''; print ''; - print ''; + print ''; print $form->editfieldkey("RefSupplier",'ref_supplier',$object->ref_supplier,$object,$user->rights->contrat->creer); print ''; print $form->editfieldval("RefSupplier",'ref_supplier',$object->ref_supplier,$object,$user->rights->contrat->creer); @@ -1348,7 +1348,7 @@ else // Date print ''; - print ''; + print ''; print $form->editfieldkey("Date",'date_contrat',$object->date_contrat,$object,$user->rights->contrat->creer); print ''; print $form->editfieldval("Date",'date_contrat',$object->date_contrat,$object,$user->rights->contrat->creer,'datehourpicker'); @@ -1584,7 +1584,7 @@ else } - //Display lines extrafields + // Display lines extrafields if (is_array($extralabelslines) && count($extralabelslines)>0) { print ''; $line = new ContratLigne($db); diff --git a/htdocs/contrat/contact.php b/htdocs/contrat/contact.php index cd070f6078d..304ae5b17be 100644 --- a/htdocs/contrat/contact.php +++ b/htdocs/contrat/contact.php @@ -109,7 +109,7 @@ if ($action == 'deletecontact' && $user->rights->contrat->creer) * View */ -llxHeader('', $langs->trans("ContractCard"), "Contrat"); +llxHeader('',$langs->trans("Contract"),""); $form = new Form($db); $formcompany= new FormCompany($db); @@ -142,7 +142,7 @@ if ($id > 0 || ! empty($ref)) $linkback = ''.$langs->trans("BackToList").''; // Reference du contrat - print ''.$langs->trans("Ref").''; + print ''.$langs->trans("Ref").''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); print ""; diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index 95da343e3af..024cf561fb5 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -86,7 +86,7 @@ include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; $form = new Form($db); -llxHeader(); +llxHeader('',$langs->trans("Contract"),""); if ($object->id) @@ -110,7 +110,7 @@ if ($object->id) $linkback = ''.$langs->trans("BackToList").''; // Reference - print ''.$langs->trans('Ref').''.$form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '').''; + print ''.$langs->trans('Ref').''.$form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '').''; // Societe print ''.$langs->trans("Customer").''; diff --git a/htdocs/contrat/info.php b/htdocs/contrat/info.php index 2067247dbf6..f993a940e14 100644 --- a/htdocs/contrat/info.php +++ b/htdocs/contrat/info.php @@ -38,7 +38,7 @@ $result = restrictedArea($user, 'contrat',$contratid,''); * View */ -llxHeader(); +llxHeader('',$langs->trans("Contract"),""); $contrat = new Contrat($db); $contrat->fetch($contratid); diff --git a/htdocs/contrat/note.php b/htdocs/contrat/note.php index 502b354ee69..806434176fd 100644 --- a/htdocs/contrat/note.php +++ b/htdocs/contrat/note.php @@ -58,7 +58,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, * View */ -llxHeader(); +llxHeader('',$langs->trans("Contract"),""); $form = new Form($db); @@ -78,7 +78,7 @@ if ($id > 0 || ! empty($ref)) $linkback = ''.$langs->trans("BackToList").''; // Reference - print ''.$langs->trans('Ref').''.$form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '').''; + print ''.$langs->trans('Ref').''.$form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '').''; // Societe print ''.$langs->trans("Customer").''; From 21e753d510f7946f85de4f659e040e5e7f11d0e1 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Wed, 3 Aug 2016 08:00:30 +0200 Subject: [PATCH 07/20] Uniformize presentation on intervention --- htdocs/fichinter/card.php | 2 +- htdocs/fichinter/contact.php | 2 +- htdocs/fichinter/document.php | 2 +- htdocs/fichinter/note.php | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 3f266f71de4..a01ba2f1180 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1154,7 +1154,7 @@ else if ($id > 0 || ! empty($ref)) $linkback = ''.$langs->trans("BackToList").''; // Ref - print ''.$langs->trans("Ref").''; + print ''.$langs->trans("Ref").''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); print ''; diff --git a/htdocs/fichinter/contact.php b/htdocs/fichinter/contact.php index b64a16f91ba..473445049f7 100644 --- a/htdocs/fichinter/contact.php +++ b/htdocs/fichinter/contact.php @@ -128,7 +128,7 @@ if ($id > 0 || ! empty($ref)) $linkback = ''.$langs->trans("BackToList").''; // Ref - print ''.$langs->trans("Ref").''; + print ''.$langs->trans("Ref").''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); print ""; diff --git a/htdocs/fichinter/document.php b/htdocs/fichinter/document.php index aca31d4e7c2..59a3bbf3c5d 100644 --- a/htdocs/fichinter/document.php +++ b/htdocs/fichinter/document.php @@ -106,7 +106,7 @@ if ($object->id) $linkback = ''.$langs->trans("BackToList").''; // Ref - print ''.$langs->trans("Ref").''; + print ''.$langs->trans("Ref").''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); print ''; diff --git a/htdocs/fichinter/note.php b/htdocs/fichinter/note.php index 3c5fce7caa2..c672d48cb71 100644 --- a/htdocs/fichinter/note.php +++ b/htdocs/fichinter/note.php @@ -54,7 +54,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, * View */ -llxHeader(); +llxHeader('',$langs->trans("Intervention")); $form = new Form($db); @@ -70,12 +70,12 @@ if ($id > 0 || ! empty($ref)) $linkback = ''.$langs->trans("BackToList").''; - print ''.$langs->trans('Ref').''; + print ''.$langs->trans('Ref').''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); print ''; // Company - print ''.$langs->trans('Company').''.$societe->getNomUrl(1).''; + print ''.$langs->trans('Company').''.$societe->getNomUrl(1).''; print ""; From 27603b966ebb4c3be81d13560af630471f97bf90 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Wed, 3 Aug 2016 08:25:35 +0200 Subject: [PATCH 08/20] Uniformize presentation on supplier order --- htdocs/fourn/commande/card.php | 6 +++--- htdocs/fourn/commande/contact.php | 6 +++--- htdocs/fourn/commande/dispatch.php | 6 +++--- htdocs/fourn/commande/document.php | 5 +++-- htdocs/fourn/commande/info.php | 3 ++- htdocs/fourn/commande/note.php | 6 +++--- 6 files changed, 17 insertions(+), 15 deletions(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index afaff18734c..d5be9002241 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1307,8 +1307,8 @@ if (empty($reshook)) /* * View */ - -llxHeader('',$langs->trans("OrderCard"),"CommandeFournisseur"); +$help_url='EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores'; +llxHeader('',$langs->trans("Order"),$help_url); $form = new Form($db); $formfile = new FormFile($db); @@ -1757,7 +1757,7 @@ elseif (! empty($object->id)) $linkback = ''.$langs->trans("BackToList").''; // Ref - print ''.$langs->trans("Ref").''; + print ''.$langs->trans("Ref").''; print ''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); print ''; diff --git a/htdocs/fourn/commande/contact.php b/htdocs/fourn/commande/contact.php index 8ced1e9844c..446b96687b5 100644 --- a/htdocs/fourn/commande/contact.php +++ b/htdocs/fourn/commande/contact.php @@ -112,8 +112,8 @@ else if ($action == 'deletecontact' && $user->rights->fournisseur->commande->cre /* * View */ - -llxHeader('', $langs->trans("Order"), "Commande"); +$help_url='EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores'; +llxHeader('',$langs->trans("Order"),$help_url); $form = new Form($db); $formcompany = new FormCompany($db); @@ -149,7 +149,7 @@ if ($id > 0 || ! empty($ref)) $linkback = ''.$langs->trans("BackToList").''; // Ref - print ''.$langs->trans("Ref").''; + print ''.$langs->trans("Ref").''; print ''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); print ''; diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index f4685469711..51b6aa48e84 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -251,8 +251,8 @@ $warehouse_static = new Entrepot($db); $supplierorderdispatch = new CommandeFournisseurDispatch($db); -$help_url='EN:CommandeFournisseur'; -llxHeader('',$langs->trans("OrderCard"),$help_url,'',0,0,array('/fourn/js/lib_dispatch.js')); +$help_url='EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores'; +llxHeader('',$langs->trans("Order"),$help_url,'',0,0,array('/fourn/js/lib_dispatch.js')); $now=dol_now(); @@ -284,7 +284,7 @@ if ($id > 0 || ! empty($ref)) print ''; // Ref - print ''; + print ''; print ''; diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php index e78320c0043..cd6542a2810 100644 --- a/htdocs/fourn/commande/document.php +++ b/htdocs/fourn/commande/document.php @@ -89,7 +89,8 @@ $form = new Form($db); if ($object->id > 0) { - llxHeader(); + $help_url='EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores'; + llxHeader('',$langs->trans("Order"),$help_url); $author = new User($db); $author->fetch($object->user_author_id); @@ -113,7 +114,7 @@ if ($object->id > 0) $linkback = ''.$langs->trans("BackToList").''; // Ref - print ''; + print ''; print ''; diff --git a/htdocs/fourn/commande/info.php b/htdocs/fourn/commande/info.php index c8ed0e73660..5cd8510d854 100644 --- a/htdocs/fourn/commande/info.php +++ b/htdocs/fourn/commande/info.php @@ -62,7 +62,8 @@ if ($id > 0 || ! empty($ref)) $soc->fetch($object->socid); - llxHeader('',$langs->trans("History"),"CommandeFournisseur"); + $help_url='EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores'; + llxHeader('',$langs->trans("Order"),$help_url); $head = ordersupplier_prepare_head($object); diff --git a/htdocs/fourn/commande/note.php b/htdocs/fourn/commande/note.php index 6a1c6cfe80e..1e2ae3e4c7b 100644 --- a/htdocs/fourn/commande/note.php +++ b/htdocs/fourn/commande/note.php @@ -57,8 +57,8 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, /* * View */ - -llxHeader('',$langs->trans("OrderCard"),"CommandeFournisseur"); +$help_url='EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores'; +llxHeader('',$langs->trans("Order"),$help_url); $form = new Form($db); @@ -94,7 +94,7 @@ if ($id > 0 || ! empty($ref)) $linkback = ''.$langs->trans("BackToList").''; // Ref - print ''; + print ''; print ''; From 28efc3e50fc2df4839823e019f6a012d4780eeee Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Wed, 3 Aug 2016 09:45:12 +0200 Subject: [PATCH 09/20] NEW Add Panama datas --- .../install/mysql/data/llx_10_c_regions.sql | 7 +++++-- .../mysql/data/llx_20_c_departements.sql | 16 ++++++++++++++-- .../mysql/data/llx_c_forme_juridique.sql | 8 +++++++- htdocs/install/mysql/data/llx_c_tva.sql | 6 +++++- .../install/mysql/migration/3.9.0-4.0.0.sql | 19 +++++++++++++++++++ 5 files changed, 50 insertions(+), 6 deletions(-) diff --git a/htdocs/install/mysql/data/llx_10_c_regions.sql b/htdocs/install/mysql/data/llx_10_c_regions.sql index 46999c537ed..62b474533f4 100644 --- a/htdocs/install/mysql/data/llx_10_c_regions.sql +++ b/htdocs/install/mysql/data/llx_10_c_regions.sql @@ -5,7 +5,7 @@ -- Copyright (C) 2004 Guillaume Delecourt -- Copyright (C) 2005-2009 Regis Houssin -- Copyright (C) 2007 Patrick Raguin --- Copyright (C) 2010-2011 Juanjo Menent +-- Copyright (C) 2010-2016 Juanjo Menent -- Copyright (C) 2012 Sebastian Neuwert -- Copyright (C) 2012 Ricardo Schluter -- Copyright (C) 2015 Ferran Marcet @@ -320,4 +320,7 @@ INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) va INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 181, 18123, '', 0, 'San Martín', 1); INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 181, 18124, '', 0, 'Tacna', 1); INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 181, 18125, '', 0, 'Tumbes', 1); -INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 181, 18126, '', 0, 'Ucayali', 1); \ No newline at end of file +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 181, 18126, '', 0, 'Ucayali', 1); + +-- Regions Panama (id country=178) +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 178, 17801, '', 0, 'Panama', 1); \ No newline at end of file diff --git a/htdocs/install/mysql/data/llx_20_c_departements.sql b/htdocs/install/mysql/data/llx_20_c_departements.sql index c50bdf94987..066bbb9fd6e 100644 --- a/htdocs/install/mysql/data/llx_20_c_departements.sql +++ b/htdocs/install/mysql/data/llx_20_c_departements.sql @@ -5,7 +5,7 @@ -- Copyright (C) 2004 Guillaume Delecourt -- Copyright (C) 2005-2009 Regis Houssin -- Copyright (C) 2007 Patrick Raguin --- Copyright (C) 2010-2013 Juanjo Menent +-- Copyright (C) 2010-2016 Juanjo Menent -- Copyright (C) 2012 Sebastian Neuwert -- Copyright (C) 2012 Ricardo Schluter -- Copyright (C) 2015 Ferran Marcet @@ -1479,4 +1479,16 @@ INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, nc INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2501', 18126, '', 0, '', 'Coronel Portillo', 1); INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2502', 18126, '', 0, '', 'Atalaya', 1); INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2503', 18126, '', 0, '', 'Padre Abad', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2504', 18126, '', 0, '', 'Purús', 1); \ No newline at end of file +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2504', 18126, '', 0, '', 'Purús', 1); + +-- Provinces Panama (id country=178) +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-1', 17801, '', 0, '', 'Bocas del Toro', 1); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-2', 17801, '', 0, '', 'Coclé', 1); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-3', 17801, '', 0, '', 'Colón', 1); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-4', 17801, '', 0, '', 'Chiriquí', 1); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-5', 17801, '', 0, '', 'Darién', 1); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-6', 17801, '', 0, '', 'Herrera', 1); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-7', 17801, '', 0, '', 'Los Santos', 1); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-8', 17801, '', 0, '', 'Panamá', 1); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-9', 17801, '', 0, '', 'Veraguas', 1); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-13', 17801, '', 0, '', 'Panamá Oeste', 1); \ No newline at end of file diff --git a/htdocs/install/mysql/data/llx_c_forme_juridique.sql b/htdocs/install/mysql/data/llx_c_forme_juridique.sql index bfbad1f1f2b..8948984e907 100644 --- a/htdocs/install/mysql/data/llx_c_forme_juridique.sql +++ b/htdocs/install/mysql/data/llx_c_forme_juridique.sql @@ -5,7 +5,7 @@ -- Copyright (C) 2004 Guillaume Delecourt -- Copyright (C) 2005-2009 Regis Houssin -- Copyright (C) 2007 Patrick Raguin --- Copyright (C) 2010-2011 Juanjo Menent +-- Copyright (C) 2010-2016 Juanjo Menent -- Copyright (C) 2012 Sebastian Neuwert -- Copyright (C) 2012 Tommaso Basilici -- Copyright (C) 2012 Ricardo Schluter @@ -308,3 +308,9 @@ INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (188, INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (188, '18816', 'SRL - Societate comercialã cu rãspundere limitatã', 1); INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (188, '18817', 'URL - Intreprindere profesionala unipersonala cu rãspundere limitata (IPURL)', 1); +-- Panama +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (178, '17801', 'Empresa individual', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (178, '17802', 'Asociación General', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (178, '17803', 'Sociedad de Responsabilidad Limitada', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (178, '17804', 'Sociedad Civil', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (178, '17805', 'Sociedad Anónima', 1); \ No newline at end of file diff --git a/htdocs/install/mysql/data/llx_c_tva.sql b/htdocs/install/mysql/data/llx_c_tva.sql index 774ffc381fc..7c1da17c8b0 100644 --- a/htdocs/install/mysql/data/llx_c_tva.sql +++ b/htdocs/install/mysql/data/llx_c_tva.sql @@ -5,7 +5,7 @@ -- Copyright (C) 2004 Guillaume Delecourt -- Copyright (C) 2005-2009 Regis Houssin -- Copyright (C) 2007 Patrick Raguin --- Copyright (C) 2010-2015 Juanjo Menent +-- Copyright (C) 2010-2016 Juanjo Menent -- Copyright (C) 2012 Sebastian Neuwert -- Copyright (C) 2012 Ricardo Schluter -- @@ -200,6 +200,10 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (17 insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1733, 173, '8','0','VAT reduced rate', 1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1734, 173, '0','0','VAT Rate 0', 1); +-- PANAMA (id country=178) +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1781, 178, '7','0','ITBMS standard rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1782, 178, '0','0','ITBMS Rate 0',1); + -- PERU (id country=181) insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1811, 181, '18','0','VAT standard rate',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1812, 181, '0','0','VAT Rate 0',1); diff --git a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql index 6afc871f668..1309c1dc225 100644 --- a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql +++ b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql @@ -517,4 +517,23 @@ CREATE TABLE llx_oauth_state ( ALTER TABLE llx_product_batch ADD UNIQUE INDEX uk_product_batch (fk_product_stock, batch); +-- Panama datas +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1781, 178, '7','0','ITBMS standard rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1782, 178, '0','0','ITBMS Rate 0',1); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 178, 17801, '', 0, 'Panama', 1); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-1', 17801, '', 0, '', 'Bocas del Toro', 1); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-2', 17801, '', 0, '', 'Coclé', 1); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-3', 17801, '', 0, '', 'Colón', 1); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-4', 17801, '', 0, '', 'Chiriquí', 1); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-5', 17801, '', 0, '', 'Darién', 1); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-6', 17801, '', 0, '', 'Herrera', 1); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-7', 17801, '', 0, '', 'Los Santos', 1); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-8', 17801, '', 0, '', 'Panamá', 1); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-9', 17801, '', 0, '', 'Veraguas', 1); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-13', 17801, '', 0, '', 'Panamá Oeste', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (178, '17801', 'Empresa individual', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (178, '17802', 'Asociación General', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (178, '17803', 'Sociedad de Responsabilidad Limitada', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (178, '17804', 'Sociedad Civil', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (178, '17805', 'Sociedad Anónima', 1); From 5f415478aca360a6e28f215e0313af10ddf3cde3 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Wed, 3 Aug 2016 17:29:04 +0200 Subject: [PATCH 10/20] FIX : update limit stock on product stock --- htdocs/product/stock/product.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 9d84ccd6bfe..3170f329ea7 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -50,7 +50,7 @@ $cancel=GETPOST('cancel'); $id=GETPOST('id', 'int'); $ref=GETPOST('ref', 'alpha'); -$stocklimit = GETPOST('stocklimit'); +$stocklimit = GETPOST('seuil_stock_alerte'); $desiredstock = GETPOST('desiredstock'); $cancel = GETPOST('cancel'); $fieldid = isset($_GET["ref"])?'ref':'rowid'; @@ -70,7 +70,7 @@ $result=restrictedArea($user,'produit&stock',$id,'product&product','','',$fieldi if ($cancel) $action=''; // Set stock limit -if ($action == 'setstocklimit') +if ($action == 'setseuil_stock_alerte') { $object = new Product($db); $result=$object->fetch($id); From 48fe3524d5d378221540474c6ab10532e72d54d1 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Thu, 4 Aug 2016 17:34:53 +0200 Subject: [PATCH 11/20] Fix #5582 Can't add or change customer ref on proposal --- htdocs/comm/propal/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index b09ce43af96..25337446b5b 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -5,7 +5,7 @@ * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2010-2014 Juanjo Menent + * Copyright (C) 2010-2016 Juanjo Menent * Copyright (C) 2010-2015 Philippe Grand * Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2012 Cedric Salvador @@ -1717,7 +1717,7 @@ if ($action == 'create') print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").''; print $form->showrefnav($commande,'ref','',1,'ref','ref'); print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); print '
'; print ''; if ($user->rights->propal->creer && $action == 'refclient') { - print '
'; + print ''; print ''; print ''; print ''; From c2e81b6edb44eaa7fbf38a27b805e5ac5537c5b9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Aug 2016 00:36:58 +0200 Subject: [PATCH 12/20] Fix colspan --- htdocs/product/card.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 7f338c6dc06..d386132813e 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1841,14 +1841,14 @@ if ($object->id && ($action == '' || $action == 'view') && $object->status) { $var=!$var; $html .= ''; - $html .= $langs->trans("AddToDraftProposals").''; + $html .= $langs->trans("AddToDraftProposals").''; $html .= $form->selectarray("propalid", $otherprop, 0, 1); $html .= ''; } else { $html .= ''; - $html .= $langs->trans("AddToDraftProposals").''; + $html .= $langs->trans("AddToDraftProposals").''; $html .= $langs->trans("NoDraftProposals"); $html .= ''; } @@ -1867,14 +1867,14 @@ if ($object->id && ($action == '' || $action == 'view') && $object->status) { $var=!$var; $html .= ''; - $html .= $langs->trans("AddToDraftOrders").''; + $html .= $langs->trans("AddToDraftOrders").''; $html .= $form->selectarray("commandeid", $othercom, 0, 1); $html .= ''; } else { $html .= ''; - $html .= $langs->trans("AddToDraftOrders").''; + $html .= $langs->trans("AddToDraftOrders").''; $html .= $langs->trans("NoDraftOrders"); $html .= ''; } @@ -1893,14 +1893,14 @@ if ($object->id && ($action == '' || $action == 'view') && $object->status) { $var=!$var; $html .= ''; - $html .= $langs->trans("AddToDraftInvoices").''; + $html .= $langs->trans("AddToDraftInvoices").''; $html .= $form->selectarray("factureid", $otherinvoice, 0, 1); $html .= ''; } else { $html .= ''; - $html .= $langs->trans("AddToDraftInvoices").''; + $html .= $langs->trans("AddToDraftInvoices").''; $html .= $langs->trans("NoDraftInvoices"); $html .= ''; } @@ -1918,7 +1918,8 @@ if ($object->id && ($action == '' || $action == 'view') && $object->status) dol_fiche_head(''); $html .= ''.$langs->trans("Quantity").' '; - $html .= ''.$langs->trans("ReductionShort").'(%) '; + $html .= ''; + $html .= ''.$langs->trans("ReductionShort").'(%) '; $html .= ''; $html .= ''; From 1b10e276181d28754f6f396a7a670caafcbcc4c6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Aug 2016 04:20:38 +0200 Subject: [PATCH 13/20] Fix bad link --- htdocs/product/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index d386132813e..f06009ecfa7 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1954,7 +1954,7 @@ if ($action == '' || $action == 'view') $var=true; - $somethingshown=$formfile->show_documents($modulepart,$object->id,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang); + $somethingshown=$formfile->show_documents($modulepart,$object->ref,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang); print '
'; From e1e8254bcf19f7dd25d52710ee50eb5725712429 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Aug 2016 04:31:19 +0200 Subject: [PATCH 14/20] Fix thumbs are using same extension than original. --- htdocs/core/class/html.formfile.class.php | 6 ++---- htdocs/product/class/product.class.php | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index f4163a889f0..5a55b3a8a9c 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -860,10 +860,8 @@ class FormFile print ''; if (image_format_supported($file['name']) > 0) { - $minifile=getImageFileNameForSize($file['name'], '_mini', '.png'); // Thumbs are created with filename in lower case and with .png extension - //print $relativepath.'
'; - //print $file['path'].'/'.$minifile.'
'; - if (! dol_is_file($file['path'].'/'.$minifile)) $minifile=getImageFileNameForSize($file['name'], '_mini', '.'.$fileinfo['extension']); // For old thumbs + $minifile=getImageFileNameForSize($file['name'], '_mini'); // For new thumbs using same ext (in lower case howerver) than original + if (! dol_is_file($file['path'].'/'.$minifile)) $minifile=getImageFileNameForSize($file['name'], '_mini', '.png'); // For backward compatibility of old thumbs that were created with filename in lower case and with .png extension //print $file['path'].'/'.$minifile.'
'; print ''; print ''; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 982b109da99..7b3f1750003 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -3676,7 +3676,7 @@ class Product extends CommonObject if ($size == 1 || $size == 'small') { // Format vignette // Find name of thumb file - $photo_vignette=basename(getImageFileNameForSize($dir.$file, '_small', '.png')); + $photo_vignette=basename(getImageFileNameForSize($dir.$file, '_small')); if (! dol_is_file($dirthumb.$photo_vignette)) $photo_vignette=''; // Get filesize of original file From 4cf01bc685fe3d5ce42cae2c842a5d9168412a41 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Aug 2016 04:48:30 +0200 Subject: [PATCH 15/20] Fix code comment --- htdocs/core/actions_linkedfiles.inc.php | 2 +- htdocs/product/document.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php index 22ff9155fd1..8977938eb4a 100644 --- a/htdocs/core/actions_linkedfiles.inc.php +++ b/htdocs/core/actions_linkedfiles.inc.php @@ -22,7 +22,7 @@ // Variable $upload_dir must be defined when entering here // Variable $upload_dirold may also exists. -// Send file/link +// Submit file/link if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) { if ($object->id) diff --git a/htdocs/product/document.php b/htdocs/product/document.php index 259ffae5913..cddcff12374 100644 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -110,7 +110,7 @@ if (empty($reshook)) } } - // Action sending file + // Action submit/delete file/link include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; } From fb3f6972ebc1542dba768565353f33c19a96da7c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 8 Aug 2016 14:21:43 +0200 Subject: [PATCH 16/20] Work on module website Conflicts: htdocs/websites/index.php --- htdocs/public/websites/index.php | 12 ++- htdocs/public/websites/styles.css.php | 139 ++++++++++++++++++++++++++ htdocs/websites/index.php | 53 +++++++--- 3 files changed, 186 insertions(+), 18 deletions(-) create mode 100644 htdocs/public/websites/styles.css.php diff --git a/htdocs/public/websites/index.php b/htdocs/public/websites/index.php index 4625bc1573a..8c83a1daebc 100644 --- a/htdocs/public/websites/index.php +++ b/htdocs/public/websites/index.php @@ -17,8 +17,8 @@ /** * \file htdocs/public/websites/index.php - * \ingroup core - * \brief A redirect page to an error + * \ingroup website + * \brief Page to output pages * \author Laurent Destailleur */ @@ -90,14 +90,14 @@ if (empty($pageid)) // Security: Delete string ../ into $original_file global $dolibarr_main_data_root; -if ($pageid == 'css') +if ($pageid == 'css') // No more used ? { header('Content-type: text/css'); // Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access. //if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate'); //else header('Cache-Control: no-cache'); - $original_file=$dolibarr_main_data_root.'/websites/'.$website.'/styles.css'; + $original_file=$dolibarr_main_data_root.'/websites/'.$website.'/styles.css.php'; } else { @@ -142,7 +142,11 @@ if (! file_exists($original_file_osencoded)) exit; } + +// Output page content +print "\n".''."\n"; include_once $original_file_osencoded; + if (is_object($db)) $db->close(); diff --git a/htdocs/public/websites/styles.css.php b/htdocs/public/websites/styles.css.php new file mode 100644 index 00000000000..5a736affc25 --- /dev/null +++ b/htdocs/public/websites/styles.css.php @@ -0,0 +1,139 @@ + + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/public/websites/styles.css.php + * \ingroup website + * \brief Page to output style page + * \author Laurent Destailleur + */ + +define('NOTOKENRENEWAL',1); // Disables token renewal +define("NOLOGIN",1); +define("NOCSRFCHECK",1); // We accept to go on this page from external web site. +if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); +if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); +if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); + +/** + * Header empty + * + * @return void + */ +function llxHeader() { } +/** + * Footer empty + * + * @return void + */ +function llxFooter() { } + +require '../../master.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + + +$error=0; +$website=GETPOST('website', 'alpha'); +$pageid=GETPOST('page', 'alpha')?GETPOST('page', 'alpha'):GETPOST('pageid', 'alpha'); + +$accessallowed = 1; +$type=''; + + +/* + * View + */ + +$appli=constant('DOL_APPLICATION_TITLE'); +if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $appli=$conf->global->MAIN_APPLICATION_TITLE; + +//print 'Directory with '.$appli.' websites.
'; + +if (empty($pageid)) +{ + require_once DOL_DOCUMENT_ROOT.'/websites/class/website.class.php'; + require_once DOL_DOCUMENT_ROOT.'/websites/class/websitepage.class.php'; + + $object=new Website($db); + $object->fetch(0, $website); + + $objectpage=new WebsitePage($db); + $array=$objectpage->fetchAll($object->id); + + if (count($array) > 0) + { + $firstrep=reset($array); + $pageid=$firstrep->id; + } +} +if (empty($pageid)) +{ + $langs->load("website"); + print $langs->trans("PreviewOfSiteNotYetAvailable"); + exit; +} + +// Security: Delete string ../ into $original_file +global $dolibarr_main_data_root; + +$original_file=$dolibarr_main_data_root.'/websites/'.$website.'/styles.css.php'; + +// Find the subdirectory name as the reference +$refname=basename(dirname($original_file)."/"); + +// Security: +// Limite acces si droits non corrects +if (! $accessallowed) +{ + accessforbidden(); +} + +// Security: +// On interdit les remontees de repertoire ainsi que les pipe dans +// les noms de fichiers. +if (preg_match('/\.\./',$original_file) || preg_match('/[<>|]/',$original_file)) +{ + dol_syslog("Refused to deliver file ".$original_file); + $file=basename($original_file); // Do no show plain path of original_file in shown error message + dol_print_error(0,$langs->trans("ErrorFileNameInvalid",$file)); + exit; +} + +clearstatcache(); + +$filename = basename($original_file); + +// Output file on browser +dol_syslog("styles.css.php include $original_file $filename content-type=$type"); +$original_file_osencoded=dol_osencode($original_file); // New file name encoded in OS encoding charset + +// This test if file exists should be useless. We keep it to find bug more easily +if (! file_exists($original_file_osencoded)) +{ + $langs->load("website"); + print $langs->trans("RequestedPageHasNoContentYet", $pageid); + //dol_print_error(0,$langs->trans("ErrorFileDoesNotExists",$original_file)); + exit; +} + + +// Output page content +require_once $original_file_osencoded; + + +if (is_object($db)) $db->close(); + diff --git a/htdocs/websites/index.php b/htdocs/websites/index.php index 19f72486c3f..8fdd09c30ae 100644 --- a/htdocs/websites/index.php +++ b/htdocs/websites/index.php @@ -123,7 +123,7 @@ if ($pageid > 0 && $action != 'add') global $dolibarr_main_data_root; $pathofwebsite=$dolibarr_main_data_root.'/websites/'.$website; -$filecss=$pathofwebsite.'/styles.css'; +$filecss=$pathofwebsite.'/styles.css.php'; $filetpl=$pathofwebsite.'/page'.$pageid.'.tpl.php'; // Define $urlwithroot @@ -276,7 +276,10 @@ if ($action == 'updatecss') $db->rollback(); }*/ - $csscontent = GETPOST('WEBSITE_CSS_INLINE'); + $csscontent ='"."\n"; + $csscontent .= GETPOST('WEBSITE_CSS_INLINE'); dol_mkdir($pathofwebsite); file_put_contents($filecss, $csscontent); @@ -379,15 +382,26 @@ if ($action == 'updatecontent') if (! $error) { $db->commit(); - setEventMessages($langs->trans("Saved"), null, 'mesgs'); + // Now create the .tpl file dol_mkdir($pathofwebsite); dol_delete_file($filetpl); - file_put_contents($filetpl, $objectpage->content); + + $tplcontent = ''."\n"; + $tplcontent.= '
'."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= '
'."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= $objectpage->content."\n"; + $tplcontent.= ''."\n"; +//var_dump($filetpl);exit; + $result = file_put_contents($filetpl, $tplcontent); if (! empty($conf->global->MAIN_UMASK)) @chmod($filetpl, octdec($conf->global->MAIN_UMASK)); - - header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website.'&pageid='.$pageid); + + setEventMessages($langs->trans("Saved"), null, 'mesgs'); + + header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website.'&pageid='.$pageid); exit; } else @@ -555,16 +569,17 @@ if (count($object->records) > 0) else $out.=''; $out.=''; print $out; - print ''; - print ''; + + print ''; //print $form->selectarray('page', $array); if ($website && $pageid > 0) { print ' - '.$langs->trans("RealURL").' '; $realurl=$urlwithroot.'/public/websites/index.php?website='.$website.'&page='.$pageid; - print ' '; - print '
'.$langs->trans("ViewPageInNewTab").''; + print ' '; + print ''.$langs->trans("ViewPageInNewTab").''; // View page in new Tab + //print ''; } print '
'; @@ -586,14 +601,15 @@ if (count($object->records) > 0) print ''; //print ''.dol_escape_htmltag($langs->trans("EditPageMeta")).''; //print ''.dol_escape_htmltag($langs->trans("EditPageContent")).''; + print ''; } } if (! in_array($action, array('editcss','editmenu','create'))) { if ($action != 'preview') print ''; - if (preg_match('/^create/',$action)) print ''; - if (preg_match('/^edit/',$action)) print ''; + if (preg_match('/^create/',$action)) print ''; + if (preg_match('/^edit/',$action)) print ''; } print '
'; @@ -735,8 +751,17 @@ if ($action == 'editcontent') /* * Editing global variables not related to a specific theme */ + + $csscontent = @file_get_contents($filecss); + + $contentforedit = ''; + /*$contentforedit.=''."\n";*/ + $contentforedit .= $objectpage->content; + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('PAGE_CONTENT',$objectpage->content,'',500,'Full','',true,true,true,5,60); + $doleditor=new DolEditor('PAGE_CONTENT',$contentforedit,'',500,'Full','',true,true,true,5,60); $doleditor->Create(); } @@ -750,7 +775,7 @@ if ($action == 'preview') { $objectpage->fetch($pageid); - print "\n".''."\n"; + print "\n".''."\n"; $csscontent = @file_get_contents($filecss); From 54b47d7f4f2be3de625234830c0d15d9fe5877ab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 8 Aug 2016 18:25:37 +0200 Subject: [PATCH 17/20] Fix edit of page in module website Conflicts: htdocs/websites/class/website.class.php --- htdocs/install/mysql/tables/llx_website.sql | 1 + htdocs/websites/class/website.class.php | 1 + htdocs/websites/index.php | 111 ++++++++++++++++++-- 3 files changed, 102 insertions(+), 11 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_website.sql b/htdocs/install/mysql/tables/llx_website.sql index 8dd257ffa69..331e6b085bd 100644 --- a/htdocs/install/mysql/tables/llx_website.sql +++ b/htdocs/install/mysql/tables/llx_website.sql @@ -25,6 +25,7 @@ CREATE TABLE llx_website description varchar(255), status integer, fk_default_home integer, + virtualhost varchar(255), date_creation datetime, date_modification datetime, tms timestamp diff --git a/htdocs/websites/class/website.class.php b/htdocs/websites/class/website.class.php index e87e830bb77..b7c8f02d20c 100644 --- a/htdocs/websites/class/website.class.php +++ b/htdocs/websites/class/website.class.php @@ -380,6 +380,7 @@ class Website extends CommonObject $sql .= ' description = '.(isset($this->description)?"'".$this->db->escape($this->description)."'":"null").','; $sql .= ' status = '.(isset($this->status)?$this->status:"null").','; $sql .= ' fk_default_home = '.(($this->fk_default_home > 0)?$this->fk_default_home:"null").','; + $sql .= ' virtualhost = '.(($this->virtualhost != '')?"'".$this->db->escape($this->virtualhost)."'":"null").','; $sql .= ' date_creation = '.(! isset($this->date_creation) || dol_strlen($this->date_creation) != 0 ? "'".$this->db->idate($this->date_creation)."'" : 'null').','; $sql .= ' date_modification = '.(! isset($this->date_modification) || dol_strlen($this->date_modification) != 0 ? "'".$this->db->idate($this->date_modification)."'" : 'null').','; $sql .= ' tms = '.(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : "'".$this->db->idate(dol_now())."'"); diff --git a/htdocs/websites/index.php b/htdocs/websites/index.php index 8fdd09c30ae..16bdd23d4ce 100644 --- a/htdocs/websites/index.php +++ b/htdocs/websites/index.php @@ -125,6 +125,7 @@ global $dolibarr_main_data_root; $pathofwebsite=$dolibarr_main_data_root.'/websites/'.$website; $filecss=$pathofwebsite.'/styles.css.php'; $filetpl=$pathofwebsite.'/page'.$pageid.'.tpl.php'; +$fileindex=$pathofwebsite.'/index.php'; // Define $urlwithroot $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); @@ -279,13 +280,16 @@ if ($action == 'updatecss') $csscontent ='"."\n"; - $csscontent .= GETPOST('WEBSITE_CSS_INLINE'); + $csscontent.= GETPOST('WEBSITE_CSS_INLINE'); dol_mkdir($pathofwebsite); - file_put_contents($filecss, $csscontent); + $result = file_put_contents($filecss, $csscontent); if (! empty($conf->global->MAIN_UMASK)) @chmod($filecss, octdec($conf->global->MAIN_UMASK)); - + + if ($result) setEventMessages($langs->trans("Saved"), null, 'mesgs'); + else setEventMessages('Failed to write file '.$fileindex, null, 'errors'); + $action='preview'; } @@ -306,7 +310,23 @@ if ($action == 'setashome') if (! $error) { $db->commit(); - setEventMessages($langs->trans("Saved"), null, 'mesgs'); + + // Generate the index.php page to be the home page + //------------------------------------------------- + dol_mkdir($pathofwebsite); + dol_delete_file($fileindex); + + $indexcontent = ''."\n"; + $result = file_put_contents($fileindex, $indexcontent); + if (! empty($conf->global->MAIN_UMASK)) + @chmod($fileindex, octdec($conf->global->MAIN_UMASK)); + + if ($result) setEventMessages($langs->trans("Saved"), null, 'mesgs'); + else setEventMessages('Failed to write file '.$fileindex, null, 'errors'); + $action='preview'; } else @@ -326,6 +346,8 @@ if ($action == 'updatemeta') $res = $objectpage->fetch($pageid, $object->fk_website); if ($res > 0) { + $oldobjectpage = clone $objectpage; + $objectpage->pageurl = GETPOST('WEBSITE_PAGENAME'); $objectpage->title = GETPOST('WEBSITE_TITLE'); $objectpage->description = GETPOST('WEBSITE_DESCRIPTION'); @@ -341,7 +363,61 @@ if ($action == 'updatemeta') if (! $error) { $db->commit(); - setEventMessages($langs->trans("Saved"), null, 'mesgs'); + + $fileoldalias=$pathofwebsite.'/'.$oldobjectpage->pageurl.'.php'; + $filealias=$pathofwebsite.'/'.$objectpage->pageurl.'.php'; + + // Generate the alias.php page + //----------------------------- + dol_mkdir($pathofwebsite); + dol_delete_file($fileoldalias); + + $aliascontent = 'id.".tpl.php'\n"; + $aliascontent.= '?>'."\n"; + $result = file_put_contents($filealias, $aliascontent); + if (! empty($conf->global->MAIN_UMASK)) + @chmod($filealias, octdec($conf->global->MAIN_UMASK)); + + if ($result) setEventMessages($langs->trans("Saved"), null, 'mesgs'); + else setEventMessages('Failed to write file '.$filealias, null, 'errors'); + + + + // Now create the .tpl file (duplicate code with actions updatecontent but we need this to save new header) + dol_mkdir($pathofwebsite); + dol_delete_file($filetpl); + + $tplcontent = ''."\n"; + $tplcontent.= '
'."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= ''.dol_escape_htmltag($objectpage->title).''."\n"; + $tplcontent.= '
'."\n"; + + $tplcontent.= ''."\n"; + $tplcontent.= $objectpage->content."\n"; + $tplcontent.= ''."\n"; + //var_dump($filetpl);exit; + $result = file_put_contents($filetpl, $tplcontent); + if (! empty($conf->global->MAIN_UMASK)) + @chmod($filetpl, octdec($conf->global->MAIN_UMASK)); + + if ($result) + { + //setEventMessages($langs->trans("Saved"), null, 'mesgs'); + //header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website.'&pageid='.$pageid); + //exit; + } + else setEventMessages('Failed to write file '.$filetpl, null, 'errors'); + $action='preview'; } else @@ -384,25 +460,38 @@ if ($action == 'updatecontent') $db->commit(); // Now create the .tpl file + // TODO Keep a one time generate file or include a dynamicaly generated content ? dol_mkdir($pathofwebsite); dol_delete_file($filetpl); $tplcontent = ''."\n"; $tplcontent.= '
'."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= ''."\n"; $tplcontent.= ''."\n"; + $tplcontent.= ''.dol_escape_htmltag($objectpage->title).''."\n"; $tplcontent.= '
'."\n"; + $tplcontent.= ''."\n"; $tplcontent.= $objectpage->content."\n"; $tplcontent.= ''."\n"; -//var_dump($filetpl);exit; + //var_dump($filetpl);exit; $result = file_put_contents($filetpl, $tplcontent); if (! empty($conf->global->MAIN_UMASK)) @chmod($filetpl, octdec($conf->global->MAIN_UMASK)); - - setEventMessages($langs->trans("Saved"), null, 'mesgs'); - - header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website.'&pageid='.$pageid); - exit; + + if ($result) + { + setEventMessages($langs->trans("Saved"), null, 'mesgs'); + header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website.'&pageid='.$pageid); + exit; + } + else setEventMessages('Failed to write file '.$filetpl, null, 'errors'); } else { From 2262c1c7dddbeb940c16f9ee506992f68bfa85ef Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 8 Aug 2016 21:58:47 +0200 Subject: [PATCH 18/20] Fix code generator --- dev/skeletons/build_class_from_table.php | 12 ++++++---- dev/skeletons/skeleton_list.php | 30 ++++++++++++++++-------- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/dev/skeletons/build_class_from_table.php b/dev/skeletons/build_class_from_table.php index ecdbbd09dc4..62ad1188759 100755 --- a/dev/skeletons/build_class_from_table.php +++ b/dev/skeletons/build_class_from_table.php @@ -587,11 +587,10 @@ foreach ($skeletonfiles as $skeletonfile => $outfile) { if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime']) { - $varprop.="if (! empty(\$arrayfields['t.".$prop['field']."']['checked'])) print_liste_field_titre(\$arrayfields['t.".$prop['field']."']['label'],\$_SERVER['PHP_SELF'],'t.".$prop['field']."','',\$param,'',\$sortfield,\$sortorder);\n"; + $varprop.="if (! empty(\$arrayfields['t.".$prop['field']."']['checked'])) print_liste_field_titre(\$arrayfields['t.".$prop['field']."']['label'],\$_SERVER['PHP_SELF'],'t.".$prop['field']."','',\$params,'',\$sortfield,\$sortorder);\n"; } } - $targetcontent=preg_replace('/'.preg_quote("if (! empty(\$arrayfields['t.field1']['checked'])) print_liste_field_titre(\$langs->trans('field1'),\$_SERVER['PHP_SELF'],'t.field1','',\$param,'',\$sortfield,\$sortorder);",'/').'/', $varprop, $targetcontent); - $targetcontent=preg_replace('/'.preg_quote("if (! empty(\$arrayfields['t.field2']['checked'])) print_liste_field_titre(\$langs->trans('field2'),\$_SERVER['PHP_SELF'],'t.field2','',\$param,'',\$sortfield,\$sortorder);",'/').'/', '', $targetcontent); + $targetcontent=preg_replace('/LIST_OF_TD_TITLE_FIELDS/', $varprop, $targetcontent); // Substitute fields title search $varprop="\n"; @@ -603,8 +602,7 @@ foreach ($skeletonfiles as $skeletonfile => $outfile) $varprop.="if (! empty(\$arrayfields['t.".$prop['field']."']['checked'])) print '';\n"; } } - $targetcontent=preg_replace('/'.preg_quote("if (! empty(\$arrayfields['t.field1']['checked'])) print '';",'/').'/', $varprop, $targetcontent); - $targetcontent=preg_replace('/'.preg_quote("if (! empty(\$arrayfields['t.field2']['checked'])) print '';",'/').'/', '', $targetcontent); + $targetcontent=preg_replace('/LIST_OF_TD_TITLE_SEARCH/', $varprop, $targetcontent); // Substitute where for .fieldx. $varprop="\n"; @@ -656,6 +654,10 @@ foreach ($skeletonfiles as $skeletonfile => $outfile) $targetcontent=preg_replace('/LIST_OF_TD_LABEL_FIELDS_VIEW/', $varprop, $targetcontent); + // LIST_OF_TD_FIELDS_LIST + + + // Build file $fp=fopen($outfile,"w"); if ($fp) diff --git a/dev/skeletons/skeleton_list.php b/dev/skeletons/skeleton_list.php index f1413bb3712..670f13fc3f0 100644 --- a/dev/skeletons/skeleton_list.php +++ b/dev/skeletons/skeleton_list.php @@ -104,7 +104,7 @@ $arrayfields=array( 't.field1'=>array('label'=>$langs->trans("Field1"), 'checked'=>1), 't.field2'=>array('label'=>$langs->trans("Field2"), 'checked'=>1), //'t.entity'=>array('label'=>$langs->trans("Entity"), 'checked'=>1, 'enabled'=>(! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode))), - 't.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), + 't.datec'=>array('label'=>$langs->trans("DateCreationShort"), 'checked'=>0, 'position'=>500), 't.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), //'t.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), ); @@ -188,12 +188,16 @@ if (empty($reshook)) * Put here all code to build page ****************************************************/ -llxHeader('','MyPageName',''); +$now=dol_now(); $form=new Form($db); -// Put here content of your page +//$help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes"; +$help_url=''; $title = $langs->trans('MyModuleListTitle'); +llxHeader('', $title, $help_url); + +// Put here content of your page // Example : Adding jquery code print '