VAT payment card - Uniformize presentation
This commit is contained in:
parent
612c7fde5e
commit
b1c007aa75
@ -27,6 +27,7 @@
|
|||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/vat.lib.php';
|
||||||
|
|
||||||
$langs->load("compta");
|
$langs->load("compta");
|
||||||
$langs->load("banks");
|
$langs->load("banks");
|
||||||
@ -38,7 +39,7 @@ $refund=GETPOST("refund","int");
|
|||||||
if (empty($refund)) $refund=0;
|
if (empty($refund)) $refund=0;
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
|
$socid = GETPOST('socid','int');
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$result = restrictedArea($user, 'tax', '', '', 'charges');
|
$result = restrictedArea($user, 'tax', '', '', 'charges');
|
||||||
|
|
||||||
@ -179,8 +180,9 @@ if ($action == 'delete')
|
|||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
$title=$langs->trans("VAT") . " - " . $langs->trans("Card");
|
||||||
llxHeader();
|
$help_url='';
|
||||||
|
llxHeader("",$title,$helpurl);
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
@ -305,11 +307,7 @@ if ($action == 'create')
|
|||||||
|
|
||||||
if ($id)
|
if ($id)
|
||||||
{
|
{
|
||||||
$h = 0;
|
$head=vat_prepare_head($object);
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/compta/tva/card.php?id='.$object->id;
|
|
||||||
$head[$h][1] = $langs->trans('Card');
|
|
||||||
$head[$h][2] = 'card';
|
|
||||||
$h++;
|
|
||||||
|
|
||||||
dol_fiche_head($head, 'card', $langs->trans("VATPayment"), 0, 'payment');
|
dol_fiche_head($head, 'card', $langs->trans("VATPayment"), 0, 'payment');
|
||||||
|
|
||||||
|
|||||||
@ -671,4 +671,52 @@ class Tva extends CommonObject
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Informations of vat payment object
|
||||||
|
*
|
||||||
|
* @param int $id Id of vat payment
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
function info($id)
|
||||||
|
{
|
||||||
|
$sql = "SELECT t.rowid, t.tms as datec, t.fk_user_creat";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."tva as t";
|
||||||
|
$sql.= " WHERE t.rowid = ".$id;
|
||||||
|
|
||||||
|
dol_syslog(get_class($this)."::info", LOG_DEBUG);
|
||||||
|
$result=$this->db->query($sql);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
if ($this->db->num_rows($result))
|
||||||
|
{
|
||||||
|
$obj = $this->db->fetch_object($result);
|
||||||
|
|
||||||
|
$this->id = $obj->rowid;
|
||||||
|
|
||||||
|
if ($obj->fk_user_creat) {
|
||||||
|
$cuser = new User($this->db);
|
||||||
|
$cuser->fetch($obj->fk_user_creat);
|
||||||
|
$this->user_creation = $cuser;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($obj->fk_user_modif) {
|
||||||
|
$muser = new User($this->db);
|
||||||
|
$muser->fetch($obj->fk_user_modif);
|
||||||
|
$this->user_modification = $muser;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->date_creation = $this->db->jdate($obj->datec);
|
||||||
|
$this->date_modification = $this->db->jdate($obj->datec);
|
||||||
|
$this->import_key = $obj->import_key;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->free($result);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($this->db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
64
htdocs/compta/tva/info.php
Normal file
64
htdocs/compta/tva/info.php
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2016 Alexandre Spangaro <aspangaro@zendsi.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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/compta/tva/info.php
|
||||||
|
* \ingroup tax
|
||||||
|
* \brief Page with info about vat
|
||||||
|
*/
|
||||||
|
|
||||||
|
require '../../main.inc.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/vat.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
|
|
||||||
|
$langs->load("compta");
|
||||||
|
$langs->load("bills");
|
||||||
|
|
||||||
|
$id=GETPOST('id','int');
|
||||||
|
$action=GETPOST("action");
|
||||||
|
|
||||||
|
// Security check
|
||||||
|
$socid = GETPOST('socid','int');
|
||||||
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
|
$result = restrictedArea($user, 'tax', '', '', 'charges');
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
$title=$langs->trans("VAT") . " - " . $langs->trans("Info");
|
||||||
|
$help_url='';
|
||||||
|
llxHeader("",$title,$helpurl);
|
||||||
|
|
||||||
|
$object = new Tva($db);
|
||||||
|
$object->fetch($id);
|
||||||
|
$object->info($id);
|
||||||
|
|
||||||
|
$head = vat_prepare_head($object);
|
||||||
|
|
||||||
|
dol_fiche_head($head, 'info', $langs->trans("VATPayment"), 0, 'payment');
|
||||||
|
|
||||||
|
print '<table width="100%"><tr><td>';
|
||||||
|
dol_print_object_info($object);
|
||||||
|
print '</td></tr></table>';
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
llxFooter();
|
||||||
|
|
||||||
|
$db->close();
|
||||||
57
htdocs/core/lib/vat.lib.php
Normal file
57
htdocs/core/lib/vat.lib.php
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2016 Alexandre Spangaro <aspangaro@zendsi.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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/core/lib/vat.lib.php
|
||||||
|
* \ingroup tax
|
||||||
|
* \brief Library for tax module (VAT)
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepare array with list of tabs
|
||||||
|
*
|
||||||
|
* @param Object $object Object related to tabs
|
||||||
|
* @return array Array of tabs to show
|
||||||
|
*/
|
||||||
|
function vat_prepare_head($object)
|
||||||
|
{
|
||||||
|
global $db, $langs, $conf;
|
||||||
|
|
||||||
|
$tab = 0;
|
||||||
|
$head = array();
|
||||||
|
|
||||||
|
$head[$tab][0] = DOL_URL_ROOT.'/compta/tva/card.php?id='.$object->id;
|
||||||
|
$head[$tab][1] = $langs->trans('Card');
|
||||||
|
$head[$tab][2] = 'card';
|
||||||
|
$tab++;
|
||||||
|
|
||||||
|
// 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, $tab,'vat');
|
||||||
|
|
||||||
|
$head[$tab][0] = DOL_URL_ROOT.'/compta/tva/info.php?id='.$object->id;
|
||||||
|
$head[$tab][1] = $langs->trans("Info");
|
||||||
|
$head[$tab][2] = 'info';
|
||||||
|
$tab++;
|
||||||
|
|
||||||
|
complete_head_from_modules($conf,$langs,$object,$head,$tab,'vat','remove');
|
||||||
|
|
||||||
|
return $head;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user