Merge pull request #1357 from marcosgdf/payment_menu

Payment menu
This commit is contained in:
Laurent Destailleur 2013-12-26 16:19:49 -08:00
commit 49f3242796
7 changed files with 99 additions and 53 deletions

View File

@ -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.

View File

@ -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();

View File

@ -3,6 +3,7 @@
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
*
* 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

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
*
* 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 '<table class="border" width="100%">';

View File

@ -0,0 +1,75 @@
<?php
/**
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
*
* 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 <http://www.gnu.org/licenses/>.
* 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;
}

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
*
* 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)
{
/*

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
*
* 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 '<table width="100%"><tr><td>';
dol_print_object_info($paiement);