From 917ddf0dee0aab915b81a38527c692fb5cc611c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Wed, 25 Dec 2013 02:40:42 +0100 Subject: [PATCH 1/3] Payments and Supplier payment pages tabs can now be extended from modules. --- ChangeLog | 1 + htdocs/compta/paiement/fiche.php | 16 ++----- htdocs/compta/paiement/info.php | 17 ++------ htdocs/core/lib/payments.lib.php | 75 ++++++++++++++++++++++++++++++++ htdocs/fourn/paiement/fiche.php | 19 +++----- htdocs/fourn/paiement/info.php | 22 +++------- 6 files changed, 97 insertions(+), 53 deletions(-) create mode 100644 htdocs/core/lib/payments.lib.php diff --git a/ChangeLog b/ChangeLog index 42fa4ba9c23..4bf6c8df79d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,7 @@ For translators: For developers: - New: Add path file of trigger into admin trigger list page. - New: More phpunit tests. +- New: Payments and supplier payment pages tabs can now be extended from modules. diff --git a/htdocs/compta/paiement/fiche.php b/htdocs/compta/paiement/fiche.php index 6d3d7157833..c937c6dc3d1 100644 --- a/htdocs/compta/paiement/fiche.php +++ b/htdocs/compta/paiement/fiche.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2013 Marcos García * * 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 @@ -29,6 +30,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT .'/core/modules/facture/modules_facture.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; if (! empty($conf->banque->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $langs->load('bills'); @@ -173,19 +175,9 @@ if ($result <= 0) $form = new Form($db); -$h=0; +$head = payment_prepare_head($object); -$head[$h][0] = $_SERVER['PHP_SELF'].'?id='.$id; -$head[$h][1] = $langs->trans("Card"); -$hselected = $h; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/compta/paiement/info.php?id='.$id; -$head[$h][1] = $langs->trans("Info"); -$h++; - - -dol_fiche_head($head, $hselected, $langs->trans("PaymentCustomerInvoice"), 0, 'payment'); +dol_fiche_head($head, 'payment', $langs->trans("PaymentCustomerInvoice"), 0, 'payment'); /* * Confirmation de la suppression du paiement diff --git a/htdocs/compta/paiement/info.php b/htdocs/compta/paiement/info.php index 4c47e1b8aef..eab917672b2 100644 --- a/htdocs/compta/paiement/info.php +++ b/htdocs/compta/paiement/info.php @@ -1,6 +1,7 @@ * Copyright (C) 2004-2009 Laurent Destailleur + * Copyright (C) 2013 Marcos García * * 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 @@ -25,6 +26,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; $langs->load("bills"); $langs->load("companies"); @@ -40,20 +42,9 @@ $paiement = new Paiement($db); $paiement->fetch($_GET["id"], $user); $paiement->info($_GET["id"]); +$head = payment_prepare_head($paiement); -$h=0; - -$head[$h][0] = DOL_URL_ROOT.'/compta/paiement/fiche.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("Card"); -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/compta/paiement/info.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("Info"); -$hselected = $h; -$h++; - - -dol_fiche_head($head, $hselected, $langs->trans("PaymentCustomerInvoice"), 0, 'payment'); +dol_fiche_head($head, 'info', $langs->trans("PaymentCustomerInvoice"), 0, 'payment'); print ''; diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php new file mode 100644 index 00000000000..dc40127818e --- /dev/null +++ b/htdocs/core/lib/payments.lib.php @@ -0,0 +1,75 @@ + + * + * 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 . + * or see http://www.gnu.org/ + */ + +function payment_prepare_head($object) { + + global $langs, $conf; + + $h = 0; + $head = array(); + + $head[$h][0] = DOL_URL_ROOT.'/compta/paiement/fiche.php?id='.$object->id; + $head[$h][1] = $langs->trans("Card"); + $head[$h][2] = 'payment'; + $h++; + + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $this->tabs = array('entity:-tabname); to remove a tab + complete_head_from_modules($conf,$langs,$object,$head,$h,'payment'); + + $head[$h][0] = DOL_URL_ROOT.'/compta/paiement/info.php?id='.$object->id; + $head[$h][1] = $langs->trans("Info"); + $head[$h][2] = 'info'; + $h++; + + complete_head_from_modules($conf,$langs,$object,$head,$h,'payment', 'remove'); + + return $head; +} + +function payment_supplier_prepare_head($object) { + + global $langs, $conf; + + $h = 0; + $head = array(); + + $head[$h][0] = DOL_URL_ROOT.'/fourn/paiement/fiche.php?id='.$object->id; + $head[$h][1] = $langs->trans("Card"); + $head[$h][2] = 'payment'; + $h++; + + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $this->tabs = array('entity:-tabname); to remove a tab + complete_head_from_modules($conf,$langs,$object,$head,$h,'payment_supplier'); + + $head[$h][0] = DOL_URL_ROOT.'/fourn/paiement/info.php?id='.$object->id; + $head[$h][1] = $langs->trans('Info'); + $head[$h][2] = 'info'; + $h++; + + complete_head_from_modules($conf,$langs,$object,$head,$h,'payment_supplier', 'remove'); + + return $head; +} \ No newline at end of file diff --git a/htdocs/fourn/paiement/fiche.php b/htdocs/fourn/paiement/fiche.php index 2c834bace60..2c21a98f5c1 100644 --- a/htdocs/fourn/paiement/fiche.php +++ b/htdocs/fourn/paiement/fiche.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005 Rodolphe Quiedeville * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2006-2010 Laurent Destailleur + * Copyright (C) 2013 Marcos García * * 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 @@ -28,6 +29,7 @@ require '../../main.inc.php'; require DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; require DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; require DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; +require DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; $langs->load('bills'); $langs->load('banks'); @@ -137,23 +139,14 @@ if ($action == 'setdatep' && ! empty($_POST['datepday'])) llxHeader(); +$result=$object->fetch($id); + $form = new Form($db); -$h=0; +$head = payment_supplier_prepare_head($object); -$head[$h][0] = $_SERVER['PHP_SELF'].'?id='.$id; -$head[$h][1] = $langs->trans('Card'); -$hselected = $h; -$h++; +dol_fiche_head($head, 'payment', $langs->trans('SupplierPayment'), 0, 'payment'); -$head[$h][0] = DOL_URL_ROOT.'/fourn/paiement/info.php?id='.$id; -$head[$h][1] = $langs->trans('Info'); -$h++; - - -dol_fiche_head($head, $hselected, $langs->trans('SupplierPayment'), 0, 'payment'); - -$result=$object->fetch($id); if ($result > 0) { /* diff --git a/htdocs/fourn/paiement/info.php b/htdocs/fourn/paiement/info.php index df5676e4b9c..7b5e3f2815c 100644 --- a/htdocs/fourn/paiement/info.php +++ b/htdocs/fourn/paiement/info.php @@ -1,6 +1,7 @@ * Copyright (C) 2004-2009 Laurent Destailleur + * Copyright (C) 2013 Marcos García * * 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 @@ -25,34 +26,25 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; +require DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; $langs->load("bills"); $langs->load("suppliers"); $langs->load("companies"); +$paiement = new PaiementFourn($db); +$paiement->fetch($_GET["id"], $user); +$paiement->info($_GET["id"]); /* * View */ llxHeader(); -$h=0; -$head[$h][0] = DOL_URL_ROOT.'/fourn/paiement/fiche.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("Card"); -$h++; +$head = payment_supplier_prepare_head($paiement); -$head[$h][0] = DOL_URL_ROOT.'/fourn/paiement/info.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("Info"); -$hselected = $h; -$h++; - -dol_fiche_head($head, $hselected, $langs->trans("SupplierPayment"), 0, 'payment'); - - -$paiement = new PaiementFourn($db); -$paiement->fetch($_GET["id"], $user); -$paiement->info($_GET["id"]); +dol_fiche_head($head, 'info', $langs->trans("SupplierPayment"), 0, 'payment'); print '
'; dol_print_object_info($paiement); From 098e6f456045ebbcb751eaee61a1e2726e270201 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Wed, 25 Dec 2013 03:17:16 +0100 Subject: [PATCH 2/3] Added new tab types in modMyModule.class.php --- dev/skeletons/modMyModule.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dev/skeletons/modMyModule.class.php b/dev/skeletons/modMyModule.class.php index b57124da396..deeb34caa66 100644 --- a/dev/skeletons/modMyModule.class.php +++ b/dev/skeletons/modMyModule.class.php @@ -131,6 +131,8 @@ class modMyModule extends DolibarrModules // 'user' to add a tab in user view // 'group' to add a tab in group view // 'contact' to add a tab in contact view + // 'payment' to add a tab in payment view + // 'payment_supplier' to add a tab in supplier payment view // 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) $this->tabs = array(); From e9ef9b6e8db5de56bada63177c85888b3bdcee98 Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Wed, 25 Dec 2013 15:02:21 +0100 Subject: [PATCH 3/3] Update llx_projet_task.sql new field "ref" present on update sql but not on the table --- htdocs/install/mysql/tables/llx_projet_task.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/tables/llx_projet_task.sql b/htdocs/install/mysql/tables/llx_projet_task.sql index 0c91a86b1a8..1b73cc71781 100644 --- a/htdocs/install/mysql/tables/llx_projet_task.sql +++ b/htdocs/install/mysql/tables/llx_projet_task.sql @@ -20,6 +20,7 @@ create table llx_projet_task ( rowid integer AUTO_INCREMENT PRIMARY KEY, + ref varchar(50), fk_projet integer NOT NULL, fk_task_parent integer DEFAULT 0 NOT NULL, datec datetime, -- date creation