From a593e5d4e5b584fe65d66334f63aa274859037b1 Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Mon, 8 Apr 2013 11:56:50 +0200 Subject: [PATCH 01/16] fix: wrong url --- htdocs/core/lib/order.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/order.lib.php b/htdocs/core/lib/order.lib.php index 8e8700ac741..16aae46f9fc 100644 --- a/htdocs/core/lib/order.lib.php +++ b/htdocs/core/lib/order.lib.php @@ -122,7 +122,7 @@ function order_admin_prepare_head($object) $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT.'/admin/order.php'; + $head[$h][0] = DOL_URL_ROOT.'/admin/commande.php'; $head[$h][1] = $langs->trans("Miscellaneous"); $head[$h][2] = 'general'; $h++; From 79b3907ec9b51686c45027d2a3185459a28ce562 Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Mon, 8 Apr 2013 12:18:19 +0200 Subject: [PATCH 02/16] some fixes for wrong and missing names --- htdocs/admin/order_extrafields.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/order_extrafields.php b/htdocs/admin/order_extrafields.php index 5d740593a5f..be3ffe8d1e5 100644 --- a/htdocs/admin/order_extrafields.php +++ b/htdocs/admin/order_extrafields.php @@ -35,6 +35,7 @@ if (!$user->admin) $langs->load("admin"); $langs->load("other"); +$langs->load("orders"); $extrafields = new ExtraFields($db); $form = new Form($db); @@ -63,11 +64,12 @@ require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; * View */ +$textobject=$langs->transnoentitiesnoconv("Orders"); llxHeader(); $linkback=''.$langs->trans("BackToModuleList").''; -print_fiche_titre($langs->trans("AgendaSetup"),$linkback,'setup'); +print_fiche_titre($langs->trans("OrdersSetup"),$linkback,'setup'); print "
\n"; $head = order_admin_prepare_head(null); From 0eef6c7808cabdbba268c9ecda691162d140097a Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Mon, 8 Apr 2013 12:29:49 +0200 Subject: [PATCH 03/16] some fixes for wrong and missing names --- htdocs/admin/order_extrafields.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/admin/order_extrafields.php b/htdocs/admin/order_extrafields.php index be3ffe8d1e5..cb57c0d2e45 100644 --- a/htdocs/admin/order_extrafields.php +++ b/htdocs/admin/order_extrafields.php @@ -4,6 +4,7 @@ * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2012 Regis Houssin * Copyright (C) 2012 Florian Henry + * Copyright (C) 2013 Philippe Grand * * 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 @@ -20,9 +21,9 @@ */ /** - * \file htdocs/admin/agenda_extrafields.php - * \ingroup agenda - * \brief Page to setup extra fields of agenda + * \file htdocs/admin/order_extrafields.php + * \ingroup order + * \brief Page to setup extra fields of order */ require '../main.inc.php'; @@ -66,7 +67,7 @@ require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; $textobject=$langs->transnoentitiesnoconv("Orders"); -llxHeader(); +llxHeader('',$langs->trans("OrdersSetup")); $linkback=''.$langs->trans("BackToModuleList").''; print_fiche_titre($langs->trans("OrdersSetup"),$linkback,'setup'); @@ -109,7 +110,6 @@ foreach($extrafields->attribute_type as $key => $value) print ''.img_edit().''; print "  ".img_delete()."\n"; print ""; - // $i++; } print ""; @@ -128,8 +128,8 @@ if ($action != 'create' && $action != 'edit') /* ************************************************************************** */ /* */ -/* Creation d'un champ optionnel - /* */ +/* Creation d'un champ optionnel */ +/* */ /* ************************************************************************** */ if ($action == 'create') From 76929325f1e9a022db9b7f0bd494fc0e1d1b8712 Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Mon, 8 Apr 2013 12:57:33 +0200 Subject: [PATCH 04/16] some fixes for missing names --- htdocs/admin/agenda_extrafields.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/agenda_extrafields.php b/htdocs/admin/agenda_extrafields.php index 901ddfa2148..d66a91ba62c 100644 --- a/htdocs/admin/agenda_extrafields.php +++ b/htdocs/admin/agenda_extrafields.php @@ -35,6 +35,7 @@ if (!$user->admin) $langs->load("admin"); $langs->load("other"); +$langs->load("agenda"); $extrafields = new ExtraFields($db); $form = new Form($db); @@ -63,8 +64,9 @@ require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; * View */ +$textobject=$langs->transnoentitiesnoconv("Agenda"); -llxHeader(); +llxHeader('',$langs->trans("AgendaSetup")); $linkback=''.$langs->trans("BackToModuleList").''; print_fiche_titre($langs->trans("AgendaSetup"),$linkback,'setup'); @@ -107,7 +109,6 @@ foreach($extrafields->attribute_type as $key => $value) print ''.img_edit().''; print "  ".img_delete()."\n"; print ""; - // $i++; } print ""; @@ -126,8 +127,8 @@ if ($action != 'create' && $action != 'edit') /* ************************************************************************** */ /* */ -/* Creation d'un champ optionnel - /* */ +/* Creation d'un champ optionnel */ +/* */ /* ************************************************************************** */ if ($action == 'create') From 707ef0f378324cce3a404c8a75dc21d37492662e Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Mon, 8 Apr 2013 14:12:46 +0200 Subject: [PATCH 05/16] some fixes for missing names --- htdocs/adherents/admin/adherent_extrafields.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/adherents/admin/adherent_extrafields.php b/htdocs/adherents/admin/adherent_extrafields.php index d94686da7ef..2fa5af1cc1b 100755 --- a/htdocs/adherents/admin/adherent_extrafields.php +++ b/htdocs/adherents/admin/adherent_extrafields.php @@ -70,7 +70,7 @@ print_fiche_titre($langs->trans("MembersSetup"),$linkback,'setup'); $head = member_admin_prepare_head(); -dol_fiche_head($head, 'attributes', $langs->trans("Member"), 0, 'user'); +dol_fiche_head($head, 'attributes', $langs->trans("Members"), 0, 'user'); print $langs->trans("DefineHereComplementaryAttributes",$textobject).'
'."\n"; @@ -105,7 +105,6 @@ foreach($extrafields->attribute_type as $key => $value) print ''.img_edit().''; print "  ".img_delete()."\n"; print ""; - // $i++; } print ""; @@ -124,8 +123,8 @@ if ($action != 'create' && $action != 'edit') /* ************************************************************************** */ /* */ -/* Creation d'un champ optionnel - /* */ +/* Creation d'un champ optionnel */ +/* */ /* ************************************************************************** */ if ($action == 'create') From d7f2c9c480287f3a9e78b1ac0e936912d296d730 Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Mon, 8 Apr 2013 14:21:42 +0200 Subject: [PATCH 06/16] some fixes for missing names --- htdocs/adherents/admin/adherent_type_extrafields.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/htdocs/adherents/admin/adherent_type_extrafields.php b/htdocs/adherents/admin/adherent_type_extrafields.php index 416be0d9f63..7873573ff34 100644 --- a/htdocs/adherents/admin/adherent_type_extrafields.php +++ b/htdocs/adherents/admin/adherent_type_extrafields.php @@ -59,7 +59,7 @@ require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; * View */ -$textobject=$langs->transnoentitiesnoconv("Members"); +$textobject=$langs->transnoentitiesnoconv("MembersTypes"); $help_url='EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'; llxHeader('',$langs->trans("MembersSetup"),$help_url); @@ -71,7 +71,7 @@ print_fiche_titre($langs->trans("MembersSetup"),$linkback,'setup'); $head = member_admin_prepare_head(); -dol_fiche_head($head, 'attributes_type', $langs->trans("Member"), 0, 'user'); +dol_fiche_head($head, 'attributes_type', $langs->trans("Members"), 0, 'user'); print $langs->trans("DefineHereComplementaryAttributes",$textobject).'
'."\n"; @@ -106,7 +106,6 @@ foreach($extrafields->attribute_type as $key => $value) print ''.img_edit().''; print "  ".img_delete()."\n"; print ""; - // $i++; } print ""; @@ -125,8 +124,8 @@ if ($action != 'create' && $action != 'edit') /* ************************************************************************** */ /* */ -/* Creation d'un champ optionnel - /* */ +/* Creation d'un champ optionnel */ +/* */ /* ************************************************************************** */ if ($action == 'create') From ea077e959b3b764505d494ddaebced7dcb3fa37e Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Mon, 8 Apr 2013 14:57:06 +0200 Subject: [PATCH 07/16] normalize code --- htdocs/commande/class/commande.class.php | 34 ++++++++++++------------ 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 47f18b8e5e8..cab6e77be23 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -150,7 +150,7 @@ class Commande extends CommonOrder } else { - dol_print_error($db,"Commande::getNextNumRef ".$obj->error); + dol_print_error($db,get_class($this)."::getNextNumRef ".$obj->error); return ""; } } @@ -419,7 +419,7 @@ class Commande extends CommonOrder $sql.= ' SET fk_statut=1, facture=0'; $sql.= ' WHERE rowid = '.$this->id; - dol_syslog("Commande::set_reopen sql=".$sql); + dol_syslog(get_class($this)."::set_reopen sql=".$sql); $resql = $this->db->query($sql); if ($resql) { @@ -530,7 +530,7 @@ class Commande extends CommonOrder $sql.= " WHERE rowid = ".$this->id; $sql.= " AND fk_statut = 1"; - dol_syslog("Commande::cancel sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::cancel sql=".$sql, LOG_DEBUG); if ($this->db->query($sql)) { // If stock is decremented on validate order, we must reincrement it @@ -604,7 +604,7 @@ class Commande extends CommonOrder // Clean parameters $this->brouillon = 1; // On positionne en mode brouillon la commande - dol_syslog("Commande::create user=".$user->id); + dol_syslog(get_class($this)."::create user=".$user->id); // Check parameters $soc = new Societe($this->db); @@ -612,13 +612,13 @@ class Commande extends CommonOrder if ($result < 0) { $this->error="Failed to fetch company"; - dol_syslog("Commande::create ".$this->error, LOG_ERR); + dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); return -2; } if (! empty($conf->global->COMMANDE_REQUIRE_SOURCE) && $this->source < 0) { $this->error=$langs->trans("ErrorFieldRequired",$langs->trans("Source")); - dol_syslog("Commande::create ".$this->error, LOG_ERR); + dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); return -1; } @@ -655,7 +655,7 @@ class Commande extends CommonOrder $sql.= ", ".$conf->entity; $sql.= ")"; - dol_syslog("Commande::create sql=".$sql); + dol_syslog(get_class($this)."::create sql=".$sql); $resql=$this->db->query($sql); if ($resql) { @@ -1460,7 +1460,7 @@ class Commande extends CommonOrder if ($only_product) $sql .= ' AND p.fk_product_type = 0'; $sql .= ' ORDER BY l.rang'; - dol_syslog("Commande::fetch_lines sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::fetch_lines sql=".$sql,LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -1587,7 +1587,7 @@ class Commande extends CommonOrder $sql.= ' GROUP BY cd.rowid, cd.fk_product'; //print $sql; - dol_syslog("Commande::loadExpeditions sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::loadExpeditions sql=".$sql,LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -1605,7 +1605,7 @@ class Commande extends CommonOrder else { $this->error=$this->db->lasterror(); - dol_syslog("Commande::loadExpeditions ".$this->error,LOG_ERR); + dol_syslog(get_class($this)."::loadExpeditions ".$this->error,LOG_ERR); return -1; } @@ -1820,7 +1820,7 @@ class Commande extends CommonOrder $sql.= ' SET remise_absolue = '.$remise; $sql.= ' WHERE rowid = '.$this->id.' AND fk_statut = 0 ;'; - dol_syslog("Commande::set_remise_absolue sql=$sql"); + dol_syslog(get_class($this)."::set_remise_absolue sql=$sql"); if ($this->db->query($sql)) { @@ -1852,7 +1852,7 @@ class Commande extends CommonOrder $sql.= " SET date_commande = ".($date ? $this->db->idate($date) : 'null'); $sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0"; - dol_syslog("Commande::set_date sql=$sql",LOG_DEBUG); + dol_syslog(get_class($this)."::set_date sql=$sql",LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -1862,7 +1862,7 @@ class Commande extends CommonOrder else { $this->error=$this->db->error(); - dol_syslog("Commande::set_date ".$this->error,LOG_ERR); + dol_syslog(get_class($this)."::set_date ".$this->error,LOG_ERR); return -1; } } @@ -1887,7 +1887,7 @@ class Commande extends CommonOrder $sql.= " SET date_livraison = ".($date_livraison ? "'".$this->db->idate($date_livraison)."'" : 'null'); $sql.= " WHERE rowid = ".$this->id; - dol_syslog("Commande::set_date_livraison sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::set_date_livraison sql=".$sql,LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -1897,7 +1897,7 @@ class Commande extends CommonOrder else { $this->error=$this->db->error(); - dol_syslog("Commande::set_date_livraison ".$this->error,LOG_ERR); + dol_syslog(get_class($this)."::set_date_livraison ".$this->error,LOG_ERR); return -1; } } @@ -1930,7 +1930,7 @@ class Commande extends CommonOrder else { $this->error=$this->db->error(); - dol_syslog("Commande::set_availability Erreur SQL"); + dol_syslog(get_class($this)."::set_availability Erreur SQL"); return -1; } } @@ -1959,7 +1959,7 @@ class Commande extends CommonOrder else { $this->error=$this->db->error(); - dol_syslog("Commande::set_demand_reason Erreur SQL"); + dol_syslog(get_class($this)."::set_demand_reason Erreur SQL"); return -1; } } From e21e08717e0e77615f2d5d858ff3eab9eae6c65c Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Mon, 8 Apr 2013 16:06:57 +0200 Subject: [PATCH 08/16] normalize code --- htdocs/admin/supplier_invoice.php | 16 +++------------- htdocs/admin/supplier_order.php | 17 +++-------------- htdocs/core/lib/fourn.lib.php | 31 +++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 27 deletions(-) diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php index a5331bca70c..d99698473a4 100644 --- a/htdocs/admin/supplier_invoice.php +++ b/htdocs/admin/supplier_invoice.php @@ -29,6 +29,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; @@ -197,20 +198,9 @@ print_fiche_titre($langs->trans("SuppliersSetup"),$linkback,'setup'); print "
"; -$h = 0; +$head = supplierorder_admin_prepare_head(null); -$head[$h][0] = DOL_URL_ROOT."/admin/supplier_order.php"; -$head[$h][1] = $langs->trans("SupplierOrder"); -$head[$h][2] = 'Order'; -$h++; - -$head[$h][0] = DOL_URL_ROOT."/admin/supplier_invoice.php"; -$head[$h][1] = $langs->trans("SuppliersInvoice"); -$head[$h][2] = 'Invoice'; -$hselected=$h; -$h++; - -dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup")); +dol_fiche_head($head, 'invoice', $langs->trans("ModuleSetup")); // Supplier invoice numbering module diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index ab8569b15b0..f80e6c3b28b 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -29,6 +29,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; @@ -197,21 +198,9 @@ print_fiche_titre($langs->trans("SuppliersSetup"),$linkback,'setup'); print "
"; -$h = 0; +$head = supplierorder_admin_prepare_head(null); -$head[$h][0] = DOL_URL_ROOT."/admin/supplier_order.php"; -$head[$h][1] = $langs->trans("SupplierOrder"); -$head[$h][2] = 'Order'; -$hselected=$h; -$h++; - -$head[$h][0] = DOL_URL_ROOT."/admin/supplier_invoice.php"; -$head[$h][1] = $langs->trans("SuppliersInvoice"); -$head[$h][2] = 'Invoice'; - -$h++; - -dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup")); +dol_fiche_head($head, 'order', $langs->trans("ModuleSetup")); // Supplier order numbering module diff --git a/htdocs/core/lib/fourn.lib.php b/htdocs/core/lib/fourn.lib.php index f834bdd5570..06f5dc1ddb5 100644 --- a/htdocs/core/lib/fourn.lib.php +++ b/htdocs/core/lib/fourn.lib.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005-2009 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Marc Barilley + * Copyright (C) 2011-2013 Philippe Grand * * 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 @@ -148,5 +149,35 @@ function ordersupplier_prepare_head($object) return $head; } +/** + * Return array head with list of tabs to view object informations. + * + * @param Object $object order + * @return array head array with tabs + */ +function supplierorder_admin_prepare_head($object) +{ + global $langs, $conf, $user; + + $h = 0; + $head = array(); + + $head[$h][0] = DOL_URL_ROOT."/admin/supplier_order.php"; + $head[$h][1] = $langs->trans("SupplierOrder"); + $head[$h][2] = 'order'; + $h++; + + complete_head_from_modules($conf,$langs,$object,$head,$h,'supplierorder_admin'); + + $head[$h][0] = DOL_URL_ROOT."/admin/supplier_invoice.php"; + $head[$h][1] = $langs->trans("SuppliersInvoice"); + $head[$h][2] = 'invoice'; + $h++; + + complete_head_from_modules($conf,$langs,$object,$head,$h,'supplierorder_admin','remove'); + + return $head; +} + ?> \ No newline at end of file From fbe5947bc2d02bdff2600376c546392bfd5b6352 Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Mon, 8 Apr 2013 17:17:13 +0200 Subject: [PATCH 09/16] prepair for insert ExtraFields --- .../class/fournisseur.commande.class.php | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index d8487fc82b0..99a443c71db 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke * Copyright (C) 2010-2013 Juanjo Menent - * Copyright (C) 2010-2012 Philippe Grand + * Copyright (C) 2010-2013 Philippe Grand * Copyright (C) 2012 Marcos García * * This program is free software; you can redistribute it and/or modify @@ -914,7 +914,7 @@ class CommandeFournisseur extends CommonOrder */ function create($user, $notrigger=0) { - global $langs,$conf; + global $langs,$conf,$hookmanager; $this->db->begin(); @@ -1001,7 +1001,28 @@ class CommandeFournisseur extends CommonOrder // On logue creation pour historique $this->log($user, 0, time()); - if (! $notrigger) + if (! $error) + { + // Actions on extra fields (by external module or standard code) + // FIXME le hook fait double emploi avec le trigger !! + $hookmanager->initHooks(array('supplierorderdao')); + $parameters=array('socid'=>$this->id); + $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if (empty($reshook)) + { + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + { + $result=$this->insertExtraFields(); + if ($result < 0) + { + $error++; + } + } + } + else if ($reshook < 0) $error++; + } + + if (! $notrigger) { // Appel des triggers include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; From e54056b805bc42858e2db0493d97d747d459976b Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Mon, 8 Apr 2013 17:39:32 +0200 Subject: [PATCH 10/16] prepair for insert ExtraFields --- htdocs/admin/supplierorder_extrafields.php | 159 +++++++++++++++++++++ htdocs/core/lib/fourn.lib.php | 7 + 2 files changed, 166 insertions(+) create mode 100644 htdocs/admin/supplierorder_extrafields.php diff --git a/htdocs/admin/supplierorder_extrafields.php b/htdocs/admin/supplierorder_extrafields.php new file mode 100644 index 00000000000..f0a766e300f --- /dev/null +++ b/htdocs/admin/supplierorder_extrafields.php @@ -0,0 +1,159 @@ + + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2012 Florian Henry + * Copyright (C) 2013 Philippe Grand + * + * 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/admin/supplierorder_extrafields.php + * \ingroup fourn + * \brief Page to setup extra fields of supplierorder + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + + +if (!$user->admin) + accessforbidden(); + +$langs->load("admin"); +$langs->load("other"); +$langs->load("orders"); + +$extrafields = new ExtraFields($db); +$form = new Form($db); + +// List of supported format +$tmptype2label=getStaticMember(get_class($extrafields),'type2label'); +$type2label=array(''); +foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val); + +$action=GETPOST('action', 'alpha'); +$attrname=GETPOST('attrname', 'alpha'); +$elementtype='commande_fournisseur'; + +if (!$user->admin) accessforbidden(); + + +/* + * Actions + */ + +require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; + + + +/* + * View + */ + +$textobject=$langs->transnoentitiesnoconv("SupplierOrder"); + +llxHeader('',$langs->trans("SupplierOrderSetup")); + +$linkback=''.$langs->trans("BackToModuleList").''; +print_fiche_titre($langs->trans("SupplierOrderSetup"),$linkback,'setup'); +print "
\n"; + +$head = supplierorder_admin_prepare_head(null); + +dol_fiche_head($head, 'attributes', $langs->trans("ModuleSetup"), 0, 'order'); + + +print $langs->trans("DefineHereComplementaryAttributes",$textobject).'
'."\n"; +print '
'; + +// Load attribute_label +$extrafields->fetch_name_optionals_label($elementtype); + +print ""; + +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print "\n"; + +$var=True; +foreach($extrafields->attribute_type as $key => $value) +{ + $var=!$var; + print ""; + print "\n"; + print "\n"; + print "\n"; + print '\n"; + print '\n"; + print '\n"; + print '\n"; + print ""; +} + +print "
'.$langs->trans("Label").''.$langs->trans("AttributeCode").''.$langs->trans("Type").''.$langs->trans("Size").''.$langs->trans("Unique").''.$langs->trans("Required").' 
".$extrafields->attribute_label[$key]."".$key."".$type2label[$extrafields->attribute_type[$key]]."'.$extrafields->attribute_size[$key]."'.yn($extrafields->attribute_unique[$key])."'.yn($extrafields->attribute_required[$key])."'.img_edit().''; + print "  ".img_delete()."
"; + +dol_fiche_end(); + + +// Buttons +if ($action != 'create' && $action != 'edit') +{ + print '
'; + print "".$langs->trans("NewAttribute").""; + print "
"; +} + + +/* ************************************************************************** */ +/* */ +/* Creation d'un champ optionnel */ +/* */ +/* ************************************************************************** */ + +if ($action == 'create') +{ + print "
"; + print_titre($langs->trans('NewAttribute')); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; +} + +/* ************************************************************************** */ +/* */ +/* Edition d'un champ optionnel */ +/* */ +/* ************************************************************************** */ +if ($action == 'edit' && ! empty($attrname)) +{ + print "
"; + print_titre($langs->trans("FieldEdition", $attrname)); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; +} + +llxFooter(); + +$db->close(); +?> \ No newline at end of file diff --git a/htdocs/core/lib/fourn.lib.php b/htdocs/core/lib/fourn.lib.php index 06f5dc1ddb5..334830808ff 100644 --- a/htdocs/core/lib/fourn.lib.php +++ b/htdocs/core/lib/fourn.lib.php @@ -166,6 +166,13 @@ function supplierorder_admin_prepare_head($object) $head[$h][1] = $langs->trans("SupplierOrder"); $head[$h][2] = 'order'; $h++; + + complete_head_from_modules($conf,$langs,$object,$head,$h,'supplierorder_admin'); + + $head[$h][0] = DOL_URL_ROOT.'/admin/supplierorder_extrafields.php'; + $head[$h][1] = $langs->trans("ExtraFields"); + $head[$h][2] = 'attributes'; + $h++; complete_head_from_modules($conf,$langs,$object,$head,$h,'supplierorder_admin'); From 832fa1fb3193174720bef7fc72bd72cc70a99bb9 Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Mon, 8 Apr 2013 17:46:01 +0200 Subject: [PATCH 11/16] prepair for insert ExtraFields --- htdocs/admin/supplierorder_extrafields.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/supplierorder_extrafields.php b/htdocs/admin/supplierorder_extrafields.php index f0a766e300f..9322d034931 100644 --- a/htdocs/admin/supplierorder_extrafields.php +++ b/htdocs/admin/supplierorder_extrafields.php @@ -67,10 +67,10 @@ require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; $textobject=$langs->transnoentitiesnoconv("SupplierOrder"); -llxHeader('',$langs->trans("SupplierOrderSetup")); +llxHeader('',$langs->trans("SuppliersSetup")); $linkback=''.$langs->trans("BackToModuleList").''; -print_fiche_titre($langs->trans("SupplierOrderSetup"),$linkback,'setup'); +print_fiche_titre($langs->trans("SuppliersSetup"),$linkback,'setup'); print "
\n"; $head = supplierorder_admin_prepare_head(null); From 6379b74099f95ee4b9e581a8f74fc3178848ef6b Mon Sep 17 00:00:00 2001 From: fhenry Date: Mon, 8 Apr 2013 18:02:12 +0200 Subject: [PATCH 12/16] Fix bug on ODT template path for order and projects --- htdocs/admin/commande.php | 14 +++++++++++--- htdocs/admin/project.php | 9 ++++++++- htdocs/core/modules/modProjet.class.php | 2 +- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index 47b16c11e49..ebcb94110e9 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -146,7 +146,7 @@ else if ($action == 'setdoc') } } -if ($action == 'setmod') +else if ($action == 'setmod') { // TODO Verifier si module numerotation choisi peut etre active // par appel methode canBeActivated @@ -154,7 +154,7 @@ if ($action == 'setmod') dolibarr_set_const($db, "COMMANDE_ADDON",$value,'chaine',0,'',$conf->entity); } -if ($action == 'set_COMMANDE_DRAFT_WATERMARK') +else if ($action == 'set_COMMANDE_DRAFT_WATERMARK') { $draft = GETPOST("COMMANDE_DRAFT_WATERMARK"); $res = dolibarr_set_const($db, "COMMANDE_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity); @@ -171,7 +171,7 @@ if ($action == 'set_COMMANDE_DRAFT_WATERMARK') } } -if ($action == 'set_COMMANDE_FREE_TEXT') +else if ($action == 'set_COMMANDE_FREE_TEXT') { $freetext = GETPOST("COMMANDE_FREE_TEXT"); // No alpha here, we want exact string @@ -188,6 +188,14 @@ if ($action == 'set_COMMANDE_FREE_TEXT') $mesg = "".$langs->trans("Error").""; } } +else if ($action='setModuleOptions') { + if (dolibarr_set_const($db, "COMMANDE_ADDON_PDF_ODT_PATH",GETPOST('value1'),'chaine',0,'',$conf->entity)) + { + // La constante qui a ete lue en avant du nouveau set + // on passe donc par une variable pour avoir un affichage coherent + $conf->global->COMMANDE_ADDON_PDF_ODT_PATH = GETPOST('value1'); + } +} /* diff --git a/htdocs/admin/project.php b/htdocs/admin/project.php index 8bb1baae575..9f28b57be5b 100644 --- a/htdocs/admin/project.php +++ b/htdocs/admin/project.php @@ -152,7 +152,14 @@ else if ($action == 'setmod') dolibarr_set_const($db, "PROJECT_ADDON",$value,'chaine',0,'',$conf->entity); } - +else if ($action='setModuleOptions') { + if (dolibarr_set_const($db, "PROJECT_ADDON_PDF_ODT_PATH",GETPOST('value1'),'chaine',0,'',$conf->entity)) + { + // La constante qui a ete lue en avant du nouveau set + // on passe donc par une variable pour avoir un affichage coherent + $conf->global->PROJECT_ADDON_PDF_ODT_PATH = GETPOST('value1'); + } +} /* * View */ diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php index a17835ddcc6..9bd71e50dce 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -89,7 +89,7 @@ class modProjet extends DolibarrModules $r++; $this->const[$r][0] = "PROJECT_ADDON_PDF_ODT_PATH"; $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/project"; + $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/projects"; $this->const[$r][3] = ""; $this->const[$r][4] = 0; From 5b5b57d4e0f3351018e808927450478cfd9dec8a Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Mon, 8 Apr 2013 23:20:35 +0200 Subject: [PATCH 13/16] some fixes for supplier orders extrafields --- htdocs/core/lib/fourn.lib.php | 2 +- htdocs/langs/fr_FR/admin.lang | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/fourn.lib.php b/htdocs/core/lib/fourn.lib.php index 334830808ff..4d3ebbb0b05 100644 --- a/htdocs/core/lib/fourn.lib.php +++ b/htdocs/core/lib/fourn.lib.php @@ -170,7 +170,7 @@ function supplierorder_admin_prepare_head($object) complete_head_from_modules($conf,$langs,$object,$head,$h,'supplierorder_admin'); $head[$h][0] = DOL_URL_ROOT.'/admin/supplierorder_extrafields.php'; - $head[$h][1] = $langs->trans("ExtraFields"); + $head[$h][1] = $langs->trans("ExtraFieldsSupplierOrders"); $head[$h][2] = 'attributes'; $h++; diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index d1add32c505..70dc7fe2555 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -953,6 +953,7 @@ ExtraFieldsContacts=Attributs supplémentaires (contacts/adresses) ExtraFieldsMember=Attributs supplémentaires (adhérents) ExtraFieldsMemberType=Attributs supplémentaires (type d'adhérents) ExtraFieldsCustomerInvoices=Attributs supplémentaires (factures clients) +ExtraFieldsSupplierOrders=Attributs supplémentaires (commandes fournisseurs) ExtraFieldHasWrongValue=L'attribut %s a une valeur incorrecte. AlphaNumOnlyCharsAndNoSpace=uniquement caractères alphanumériques sans espace SendingMailSetup=Configuration de l'envoi par mail From 00eafa1cf22d22a6bf937a06f880a480916dd627 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 9 Apr 2013 01:25:16 +0200 Subject: [PATCH 14/16] Optimie for small screen --- htdocs/theme/eldy/style.css.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 6c497620fbe..eba9a7cc86d 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -346,6 +346,7 @@ th .button { } + /* ============================================================================== */ /* Styles to hide objects */ /* ============================================================================== */ @@ -1633,29 +1634,25 @@ div.liste_titre, tr.liste_titre, tr.liste_titre_sel font-family: ; font-weight: normal; border-bottom: 1px solid #FDFFFF; - white-space: nowrap; + white-space: ; text-align: ; } tr.liste_titre th, th.liste_titre, tr.liste_titre td, td.liste_titre { - /*border-top: 1px solid #DDDDDD;*/ font-family: ; font-weight: normal; border-bottom: 1px solid #FDFFFF; - white-space: nowrap; + white-space: ; } tr.liste_titre_sel th, th.liste_titre_sel, tr.liste_titre_sel td, td.liste_titre_sel { -/* color: #FFFFFF !important; */ font-family: ; font-weight: normal; border-bottom: 1px solid #FDFFFF; - white-space: nowrap; + white-space: ; text-decoration: underline; } input.liste_titre { - /*background: #7699A9;*/ - /*background-repeat: repeat-x;*/ background: transparent; border: 0px; } From 328801f45581f3fbc9683063806d568591449c54 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 9 Apr 2013 01:27:41 +0200 Subject: [PATCH 15/16] Hide upload on smartphones --- htdocs/admin/company.php | 6 +++--- htdocs/core/lib/functions.lib.php | 15 +++++++++++++++ htdocs/langs/en_US/admin.lang | 2 +- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index a3696b7a24d..0b1f6f41d25 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010 Juanjo Menent * Copyright (C) 2011 Philippe Grand @@ -268,7 +268,7 @@ if ($action == 'edit' || $action == 'updateedit') $var=true; print ''; - print ''."\n"; + print ''."\n"; $var=!$var; print '
'.$langs->trans("CompanyInfo").''.$langs->trans("Value").'
'.$langs->trans("CompanyInfo").''.$langs->trans("Value").'
'.$langs->trans("CompanyName").''; @@ -336,7 +336,7 @@ if ($action == 'edit' || $action == 'updateedit') // Logo $var=!$var; - print '
'.$langs->trans("Logo").' (png,jpg)'; + print ''.$langs->trans("Logo").' (png,jpg)'; print '
'; print ''; print ''; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 3fac6b67346..04c92c8be0d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -671,6 +671,21 @@ function dol_get_fiche_end($notab=0) else return ''; } +/** + * Return string to add class property on html element with pair/impair. + * + * @param string $var 0 or 1 + * @param string $moreclass More class to add + * @return string String to add class onto HTML element + */ +function dol_bc($var,$moreclass='') +{ + global $bc; + $ret=' '.$bc[$var]; + if ($moreclass) $ret=preg_replace('/class=\"/','class="'.$moreclass.' ',$ret); + return $ret; +} + /** * Return a formated address (part address/zip/town/state) according to country rules * diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 07ba4abfa1b..c941d3c1c50 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -883,7 +883,7 @@ LogEventDesc=You can enable here the logging for Dolibarr security events. Admin AreaForAdminOnly=Those features can be used by administrator users only. SystemInfoDesc=System information is miscellaneous technical information you get in read only mode and visible for administrators only. SystemAreaForAdminOnly=This area is available for administrator users only. None of the Dolibarr permissions can reduce this limit. -CompanyFundationDesc=Edit on this page all known information of the company or foundation you need to manage (For this click, on "Modify" button at bottom of page) +CompanyFundationDesc=Edit on this page all known information of the company or foundation you need to manage (For this, click on "Modify" button at bottom of page) DisplayDesc=You can choose each parameter related to the Dolibarr look and feel here AvailableModules=Available modules ToActivateModule=To activate modules, go on setup Area (Home->Setup->Modules). From 7b8be3eb875559e98b250660ee812807fb150ff7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 9 Apr 2013 01:29:29 +0200 Subject: [PATCH 16/16] Removed deprecated and not working code. --- htdocs/theme/bureau2crea/tpl/login.tpl.php | 214 ------------------ .../bureau2crea/tpl/passwordforgotten.tpl.php | 144 ------------ 2 files changed, 358 deletions(-) delete mode 100644 htdocs/theme/bureau2crea/tpl/login.tpl.php delete mode 100644 htdocs/theme/bureau2crea/tpl/passwordforgotten.tpl.php diff --git a/htdocs/theme/bureau2crea/tpl/login.tpl.php b/htdocs/theme/bureau2crea/tpl/login.tpl.php deleted file mode 100644 index 05c6aab3cdb..00000000000 --- a/htdocs/theme/bureau2crea/tpl/login.tpl.php +++ /dev/null @@ -1,214 +0,0 @@ - - * - * 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 . - * - */ - -header('Cache-Control: Public, must-revalidate'); -header("Content-type: text/html; charset=".$conf->file->character_set_client); - -?> - - - - - - - - -'.$langs->trans('Login').' '.$title.''."\n"; -print ''."\n"; -if (constant('JS_JQUERY_UI')) print ''."\n"; // JQuery -else print ''."\n"; // JQuery -// CSS forced by modules (relative url starting with /) -if (isset($conf->modules_parts['css'])) -{ - $arraycss=(array) $conf->modules_parts['css']; - foreach($arraycss as $modcss => $filescss) - { - $filescss=(array) $filescss; // To be sure filecss is an array - foreach($filescss as $cssfile) - { - // cssfile is a relative path - print ''."\n"; - } - } -} -// JQuery. Must be before other includes -$ext='.js'; -print ''."\n"; -if (constant('JS_JQUERY')) print ''."\n"; -else print ''."\n"; -print ''."\n"; -print ' -'."\n"; -if (! empty($conf->global->MAIN_HTML_HEADER)) print $conf->global->MAIN_HTML_HEADER; -print ' -'; - -?> - - - - - - -
- - - - - - - - - - - - - - - - -
- -
- Logo -
- -
- -
-
- - resArray['options'])) { - foreach ($hookmanager->resArray['options'] as $format => $option) - { - if ($format == 'div') { - echo ''; - echo $option; - } - } - } - ?> - - -
- - -
-
- - -
- - -
- -
- -'; - if ($forgetpasslink) { - echo '('; - echo $langs->trans('PasswordForgotten'); - if (! $helpcenterlink) { - echo ')'; - } - echo ''; - } - - if ($helpcenterlink) { - echo ''; - if ($forgetpasslink) { - echo ' - '; - } else { - echo '('; - } - echo $langs->trans('NeedHelpCenter').')'; - } - echo '
'; - } -?> - - - - -
- -
- - - -
- -
- - - global->MAIN_GOOGLE_AD_CLIENT) && ! empty($conf->global->MAIN_GOOGLE_AD_SLOT)) - { - ?> -
- - -
- -
- - - - - - - - -global->MAIN_HTML_FOOTER)) print $conf->global->MAIN_HTML_FOOTER; ?> - - - - - diff --git a/htdocs/theme/bureau2crea/tpl/passwordforgotten.tpl.php b/htdocs/theme/bureau2crea/tpl/passwordforgotten.tpl.php deleted file mode 100644 index 8751ed6eb84..00000000000 --- a/htdocs/theme/bureau2crea/tpl/passwordforgotten.tpl.php +++ /dev/null @@ -1,144 +0,0 @@ - - * Copyright (C) 2011-2012 Laurent Destailleur - * - * 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 . - * - */ -header('Cache-Control: Public, must-revalidate'); -header("Content-type: text/html; charset=".$conf->file->character_set_client); - -?> - - - - - - - - - -'.$langs->trans('Login').' '.$title.''."\n"; -print ''."\n"; -if (constant('JS_JQUERY_UI')) print ''."\n"; // JQuery -else print ''."\n"; // JQuery -// CSS forced by modules (relative url starting with /) -if (isset($conf->modules_parts['css'])) -{ - $arraycss=(array) $conf->modules_parts['css']; - foreach($arraycss as $modcss => $filescss) - { - $filescss=(array) $filescss; // To be sure filecss is an array - foreach($filescss as $cssfile) - { - // cssfile is a relative path - print ''."\n"; - } - } -} -// JQuery. Must be before other includes -$ext='.js'; -print ''."\n"; -if (constant('JS_JQUERY')) print ''."\n"; -else print ''."\n"; -print ''."\n"; -if (! empty($conf->global->MAIN_HTML_HEADER)) print $conf->global->MAIN_HTML_HEADER; -print ' -'; - -?> - - -
- - - -
- -
- Logo -
- -
-
- - id="username" name="username" class="flat" size="15" maxlength="25" value="" tabindex="1" /> -
- - resArray['options'])) { - foreach ($hookmanager->resArray['options'] as $format => $option) - { - if ($format == 'div') { - echo ''; - echo $option; - } - } - } - ?> - - -
- - -
-
- - -
- - - - -
- class="button" name="password" value="trans('SendNewPassword'); ?>" tabindex="4" /> -
-
- -
- -
- - - trans('SendNewPasswordDesc'); ?> - - -
- trans('AuthenticationDoesNotAllowSendNewPassword', $mode); ?> -
- -
- -
- - -
- -
- - - - - - - - \ No newline at end of file