Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
292bcae592
@ -142,18 +142,17 @@ if ($action == 'setmanagezero') {
|
||||
}
|
||||
|
||||
if ($action == 'setdisabledirectinput') {
|
||||
$setdisabledirectinput = GETPOST('value', 'int');
|
||||
$res = dolibarr_set_const($db, "BANK_DISABLE_DIRECT_INPUT", $setdisabledirectinput, 'yesno', 0, '', $conf->entity);
|
||||
if (! $res > 0)
|
||||
$error ++;
|
||||
if (! $error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'mesgs');
|
||||
}
|
||||
$setdisabledirectinput = GETPOST('value', 'int');
|
||||
$res = dolibarr_set_const($db, "BANK_DISABLE_DIRECT_INPUT", $setdisabledirectinput, 'yesno', 0, '', $conf->entity);
|
||||
if (! $res > 0)
|
||||
$error ++;
|
||||
if (! $error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'mesgs');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -243,20 +242,20 @@ if (! empty($user->admin))
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
$var = ! $var;
|
||||
print "<tr " . $bc[$var] . ">";
|
||||
print '<td>' . $langs->trans("BANK_DISABLE_DIRECT_INPUT") . '</td>';
|
||||
if (! empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) {
|
||||
print '<td align="right"><a href="' . $_SERVER['PHP_SELF'] . '?action=setdisabledirectinput&value=0">';
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
print '</a></td>';
|
||||
} else {
|
||||
print '<td align="right"><a href="' . $_SERVER['PHP_SELF'] . '?action=setdisabledirectinput&value=1">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
print '</a></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
$var = ! $var;
|
||||
print "<tr " . $bc[$var] . ">";
|
||||
print '<td>' . $langs->trans("BANK_DISABLE_DIRECT_INPUT") . '</td>';
|
||||
if (! empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) {
|
||||
print '<td align="right"><a href="' . $_SERVER['PHP_SELF'] . '?action=setdisabledirectinput&value=0">';
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
print '</a></td>';
|
||||
} else {
|
||||
print '<td align="right"><a href="' . $_SERVER['PHP_SELF'] . '?action=setdisabledirectinput&value=1">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
print '</a></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
$var = ! $var;
|
||||
print "<tr " . $bc[$var] . ">";
|
||||
print '<td>' . $langs->trans("ACCOUNTING_MANAGE_ZERO") . '</td>';
|
||||
|
||||
@ -369,22 +369,23 @@ class AccountingAccount extends CommonObject
|
||||
*/
|
||||
function getNomUrl($withpicto = 0) {
|
||||
global $langs;
|
||||
|
||||
|
||||
$result = '';
|
||||
|
||||
|
||||
$link = '<a href="' . DOL_URL_ROOT . '/accountancy/admin/card.php?id=' . $this->id . '">';
|
||||
$linkend = '</a>';
|
||||
|
||||
|
||||
$picto = 'billr';
|
||||
|
||||
|
||||
$label = $langs->trans("Show") . ': ' . $this->account_number . ' - ' . $this->label;
|
||||
|
||||
|
||||
if ($withpicto)
|
||||
$result .= ($link . img_object($label, $picto) . $linkend);
|
||||
if ($withpicto && $withpicto != 2)
|
||||
$result .= ' ';
|
||||
if ($withpicto != 2)
|
||||
$result .= $link . $this->account_number . $linkend;
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
$result .= $link . length_accountg($this->account_number) . ' - ' . $this->label . $linkend;
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@ -1,224 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* 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/comm/propal/apercu.php
|
||||
* \ingroup propal
|
||||
* \brief Preview tab of propal
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$langs->load('propal');
|
||||
$langs->load("bills");
|
||||
$langs->load('compta');
|
||||
|
||||
// Security check
|
||||
$socid=0;
|
||||
$id = GETPOST('id','int');
|
||||
$ref = GETPOST("ref");
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'propal', $id);
|
||||
|
||||
|
||||
/*
|
||||
* View Mode
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
llxHeader();
|
||||
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$object = new Propal($db);
|
||||
|
||||
if ($object->fetch($id,$ref) > 0)
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($object->socid);
|
||||
|
||||
$head = propal_prepare_head($object);
|
||||
dol_fiche_head($head, 'preview', $langs->trans('Proposal'), 0, 'propal');
|
||||
|
||||
|
||||
/*
|
||||
* Propal
|
||||
*/
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/comm/propal/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td>' . $langs->trans('Ref') . '</td><td colspan="5">';
|
||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '');
|
||||
print '</td></tr>';
|
||||
|
||||
// Ref client
|
||||
print '<tr><td>'.$langs->trans('RefCustomer').'</td>';
|
||||
print '<td colspan="5">'.$object->ref_client.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Thirdparty
|
||||
print '<tr><td>'.$langs->trans('Company').'</td>';
|
||||
print '<td colspan="5">'.$soc->getNomUrl(1).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Status
|
||||
print '<tr><td>'.$langs->trans("Status").'</td>';
|
||||
print '<td colspan="5">'.$object->getLibStatut(4).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Discount
|
||||
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="5">';
|
||||
if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_percent);
|
||||
else print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||
$absolute_discount=$soc->getAvailableDiscounts();
|
||||
print '. ';
|
||||
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->currency));
|
||||
else print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
||||
print '.</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Date
|
||||
print '<tr><td>'.$langs->trans('Date').'</td>';
|
||||
print '<td>'.dol_print_date($object->date,'daytext').'</td>';
|
||||
|
||||
// Right part with $rowspan lines
|
||||
$rowspan=4;
|
||||
print '<td rowspan="'.$rowspan.'" valign="top" width="50%">';
|
||||
|
||||
/*
|
||||
* Documents
|
||||
*/
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
$dir_output = $conf->propal->dir_output . "/";
|
||||
$filepath = $dir_output . $objectref . "/";
|
||||
$file = $filepath . $objectref . ".pdf";
|
||||
$filedetail = $filepath . $objectref . "-detail.pdf";
|
||||
$relativepath = $objectref.'/'.$objectref.'.pdf';
|
||||
$relativepathdetail = $objectref.'/'.$objectref.'-detail.pdf';
|
||||
|
||||
// Define path to preview pdf file (preview precompiled "file.ext" are "file.ext_preview.png")
|
||||
$fileimage = $file.'_preview.png'; // If PDF has 1 page
|
||||
$fileimagebis = $file.'_preview-0.pdf.png'; // If PDF has more than one page
|
||||
$relativepathimage = $relativepath.'_preview.png';
|
||||
|
||||
$var=true;
|
||||
|
||||
// Si fichier PDF existe
|
||||
if (file_exists($file))
|
||||
{
|
||||
$encfile = urlencode($file);
|
||||
print '<table class="nobordernopadding" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Documents").'</td></tr>';
|
||||
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("Proposal").' PDF</td>';
|
||||
|
||||
print '<td><a data-ajax="false" href="'.DOL_URL_ROOT . '/document.php?modulepart=propal&file='.urlencode($relativepath).'">'.$object->ref.'.pdf</a></td>';
|
||||
|
||||
print '<td align="right">'.dol_print_size(dol_filesize($file)).'</td>';
|
||||
print '<td align="right">'.dol_print_date(dol_filemtime($file),'dayhour').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
// Conversion du PDF en image png si fichier png non existant
|
||||
if ((! file_exists($fileimage) && ! file_exists($fileimagebis)) || (filemtime($fileimage) < filemtime($file)))
|
||||
{
|
||||
if (class_exists("Imagick"))
|
||||
{
|
||||
$ret = dol_convert_file($file,'png',$fileimage);
|
||||
if ($ret < 0) $error++;
|
||||
}
|
||||
else
|
||||
{
|
||||
$langs->load("errors");
|
||||
print '<font class="error">'.$langs->trans("ErrorNoImagickReadimage").'</font>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Total HT - left part
|
||||
print '<tr><td>'.$langs->trans('AmountHT').'</td>';
|
||||
print '<td align="right" class="nowrap"><b>' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '</b></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Total VAT - left part
|
||||
print '<tr><td>'.$langs->trans('AmountVAT').'</td>';
|
||||
print '<td align="right" class="nowrap"><b>' . price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency) . '</b></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Total TTC - left part
|
||||
print '<tr><td>'.$langs->trans('AmountTTC').'</td>';
|
||||
print '<td align="right" class="nowrap"><b>' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . '</b></td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Propal non trouvee
|
||||
print $langs->trans("ErrorPropalNotFound",$_GET["id"]);
|
||||
}
|
||||
}
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td>';
|
||||
print '<div class="photolist">';
|
||||
// Si fichier png PDF d'1 page trouve
|
||||
if (file_exists($fileimage))
|
||||
{
|
||||
print '<img class="photo photowithmargin" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercupropal&file='.urlencode($relativepathimage).'">';
|
||||
}
|
||||
// Si fichier png PDF de plus d'1 page trouve
|
||||
elseif (file_exists($fileimagebis))
|
||||
{
|
||||
$multiple = preg_replace('/\.png/','',$relativepath) . "-";
|
||||
|
||||
for ($i = 0; $i < 20; $i++)
|
||||
{
|
||||
$preview = $multiple.$i.'.png';
|
||||
|
||||
if (file_exists($dir_output.$preview))
|
||||
{
|
||||
print '<img class="photo photowithmargin" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercupropal&file='.urlencode($preview).'"><p>';
|
||||
}
|
||||
}
|
||||
}
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
@ -1804,42 +1804,7 @@ if ($action == 'create')
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
/*
|
||||
print '<tr><td>' . $langs->trans('Ref') . '</td><td colspan="5">';
|
||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '');
|
||||
print '</td></tr>';
|
||||
*/
|
||||
|
||||
// Ref customer
|
||||
/*
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td class="nowrap">';
|
||||
print $langs->trans('RefCustomer') . '</td>';
|
||||
if ($action != 'refclient' && ! empty($object->brouillon))
|
||||
print '<td align="right"><a href="' . $_SERVER['PHP_SELF'] . '?action=refclient&id=' . $object->id . '">' . img_edit($langs->trans('Modify')) . '</a></td>';
|
||||
print '</td></tr></table>';
|
||||
print '</td><td colspan="5">';
|
||||
if ($user->rights->propal->creer && $action == 'refclient') {
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'?id=' . $object->id . '" method="post">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="set_ref_client">';
|
||||
print '<input type="text" class="flat" size="20" name="ref_client" value="' . $object->ref_client . '">';
|
||||
print ' <input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
|
||||
print '</form>';
|
||||
} else {
|
||||
print $object->ref_client;
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
*/
|
||||
|
||||
// Company
|
||||
/*
|
||||
print '<tr><td>' . $langs->trans('Company') . '</td><td colspan="5">' . $soc->getNomUrl(1) . '</td>';
|
||||
print '</tr>';*/
|
||||
|
||||
// Lin for thirdparty discounts
|
||||
// Link for thirdparty discounts
|
||||
print '<tr><td class="titlefield">' . $langs->trans('Discounts') . '</td><td>';
|
||||
if ($soc->remise_percent)
|
||||
print $langs->trans("CompanyHasRelativeDiscount", $soc->remise_percent);
|
||||
|
||||
@ -1,223 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* 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/commande/apercu.php
|
||||
* \ingroup commande
|
||||
* \brief Preview tab of order
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
|
||||
$langs->load('orders');
|
||||
$langs->load("bills");
|
||||
$langs->load('compta');
|
||||
|
||||
// Security check
|
||||
$socid=0;
|
||||
$id = GETPOST('id','int');
|
||||
$ref = GETPOST("ref");
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result=restrictedArea($user,'commande',$id,'');
|
||||
|
||||
|
||||
/*
|
||||
* View Mode
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
llxHeader('',$langs->trans('Order'),'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes');
|
||||
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$object = new Commande($db);
|
||||
|
||||
if ($object->fetch($id,$ref) > 0)
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($object->socid);
|
||||
|
||||
|
||||
$head = commande_prepare_head($object);
|
||||
dol_fiche_head($head, 'preview', $langs->trans("CustomerOrder"), 0, 'order');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
//$linkback = '<a href="' . DOL_URL_ROOT . '/comm/propal/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td>' . $langs->trans('Ref') . '</td><td colspan="5">';
|
||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '');
|
||||
print '</td></tr>';
|
||||
|
||||
// Ref cde client
|
||||
print '<tr><td>'.$langs->trans('RefCustomer').'</td>';
|
||||
print '<td colspan="5">'.$object->ref_client.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Client
|
||||
print '<tr><td>'.$langs->trans("Customer").'</td>';
|
||||
print '<td colspan="5">'.$soc->getNomUrl(1).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Statut
|
||||
print '<tr><td>'.$langs->trans("Status").'</td>';
|
||||
print '<td colspan="5">'.$object->getLibStatut(4).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Discount - left part
|
||||
print '<tr><td>'.$langs->trans('Discounts').'</td>';
|
||||
print '<td colspan="5">'.$object->remise_percent.'%</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Date - left part
|
||||
print '<tr><td>'.$langs->trans("Date").'</td>';
|
||||
print '<td colspan="3">'.dol_print_date($object->date,"daytext").'</td>';
|
||||
|
||||
// Right part with $rowspan lines
|
||||
$rowspan=4;
|
||||
print '<td rowspan="'.$rowspan.'" valign="top" width="50%">';
|
||||
|
||||
/*
|
||||
* Documents
|
||||
*/
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
$dir_output = $conf->commande->dir_output . "/";
|
||||
$filepath = $dir_output . $objectref . "/";
|
||||
$file = $filepath . $objectref . ".pdf";
|
||||
$filedetail = $filepath . $objectref . "-detail.pdf";
|
||||
$relativepath = $objectref.'/'.$objectref.'.pdf';
|
||||
$relativepathdetail = $objectref.'/'.$objectref.'-detail.pdf';
|
||||
|
||||
// Define path to preview pdf file (preview precompiled "file.ext" are "file.ext_preview.png")
|
||||
$fileimage = $file.'_preview.png'; // If PDF has 1 page
|
||||
$fileimagebis = $file.'_preview-0.pdf.png'; // If PDF has more than one page
|
||||
$relativepathimage = $relativepath.'_preview.png';
|
||||
|
||||
$var=true;
|
||||
|
||||
// if PDF file exist
|
||||
if (file_exists($file))
|
||||
{
|
||||
$encfile = urlencode($file);
|
||||
print '<table class="nobordernopadding" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Documents").'</td></tr>';
|
||||
|
||||
print "<tr ".$bc[$var]."><td>".$langs->trans("Order")." PDF</td>";
|
||||
|
||||
print '<td><a data-ajax="false" href="'.DOL_URL_ROOT . '/document.php?modulepart=commande&file='.urlencode($relativepath).'">'.$object->ref.'.pdf</a></td>';
|
||||
print '<td align="right">'.dol_print_size(dol_filesize($file)).'</td>';
|
||||
print '<td align="right">'.dol_print_date(dol_filemtime($file),'dayhour').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Si fichier detail PDF existe
|
||||
// TODO deprecated ?
|
||||
if (file_exists($filedetail))
|
||||
{
|
||||
print "<tr ".$bc[$var]."><td>Commande detaillee</td>";
|
||||
|
||||
print '<td><a data-ajax="false" href="'.DOL_URL_ROOT . '/document.php?modulepart=commande&file='.urlencode($relativepathdetail).'">'.$object->ref.'-detail.pdf</a></td>';
|
||||
print '<td align="right">'.dol_print_size(dol_filesize($filedetail)).'</td>';
|
||||
print '<td align="right">'.dol_print_date(dol_filemtime($filedetail),'dayhour').'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print "</table>\n";
|
||||
|
||||
// Conversion du PDF en image png si fichier png non existant
|
||||
if ((! file_exists($fileimage) && ! file_exists($fileimagebis)) || (filemtime($fileimage) < filemtime($file)))
|
||||
{
|
||||
if (class_exists("Imagick"))
|
||||
{
|
||||
$ret = dol_convert_file($file,'png',$fileimage);
|
||||
if ($ret < 0) $error++;
|
||||
}
|
||||
else
|
||||
{
|
||||
$langs->load("errors");
|
||||
print '<font class="error">'.$langs->trans("ErrorNoImagickReadimage").'</font>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
// Total HT - left part
|
||||
print '<tr><td>'.$langs->trans('AmountHT').'</td>';
|
||||
print '<td align="right" class="nowrap"><b>' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '</b></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Total VAT - left part
|
||||
print '<tr><td>'.$langs->trans('AmountVAT').'</td>';
|
||||
print '<td align="right" class="nowrap"><b>' . price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency) . '</b></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Total TTC - left part
|
||||
print '<tr><td>'.$langs->trans('AmountTTC').'</td>';
|
||||
print '<td align="right" class="nowrap"><b>' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . '</b></td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Object not found
|
||||
print $langs->trans("ErrorOrderNotFound",$id);
|
||||
}
|
||||
}
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td>';
|
||||
print '<div class="photolist">';
|
||||
// Si fichier png PDF d'1 page trouve
|
||||
if (file_exists($fileimage))
|
||||
{
|
||||
print '<img class="photo photowithmargin" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercucommande&file='.urlencode($relativepathimage).'">';
|
||||
}
|
||||
// Si fichier png PDF de plus d'1 page trouve
|
||||
elseif (file_exists($fileimagebis))
|
||||
{
|
||||
$multiple = preg_replace('/\.png/','',$relativepath) . "-";
|
||||
|
||||
for ($i = 0; $i < 20; $i++)
|
||||
{
|
||||
$preview = $multiple.$i.'.png';
|
||||
|
||||
if (file_exists($dir_output.$preview))
|
||||
{
|
||||
print '<img class="photo photowithmargin" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercucommande&file='.urlencode($preview).'"><p>';
|
||||
}
|
||||
}
|
||||
}
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
@ -4,8 +4,9 @@
|
||||
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Vinícius Nogueira <viniciusvgn@gmail.com>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-cooncept.pro>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2017 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
|
||||
@ -396,40 +397,37 @@ if ($id > 0 || ! empty($ref))
|
||||
foreach ($bankcateg->fetchAll() as $bankcategory) {
|
||||
$options[$bankcategory->id] = $bankcategory->label;
|
||||
}
|
||||
|
||||
|
||||
// Bank card
|
||||
|
||||
$head=bank_prepare_head($object);
|
||||
dol_fiche_head($head,'journal',$langs->trans("FinancialAccount"),0,'account');
|
||||
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Buttons actions
|
||||
*/
|
||||
if ($action != 'addline' && $action != 'reconcile')
|
||||
if ($action != 'reconcile')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($action != 'addline')
|
||||
{
|
||||
if (empty($conf->global->BANK_DISABLE_DIRECT_INPUT))
|
||||
{
|
||||
if ($user->rights->banque->modifier) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=addline&page='.$page.$param.'">'.$langs->trans("AddBankRecord").'</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
|
||||
}
|
||||
} else {
|
||||
print '<a class="butActionRefused" title="'.$langs->trans("FeatureDisabled").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($conf->global->BANK_DISABLE_DIRECT_INPUT))
|
||||
{
|
||||
if ($user->rights->banque->modifier) {
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&accountid='.$account.'">'.$langs->trans("AddBankRecord").'</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" title="'.$langs->trans("FeatureDisabled").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
|
||||
}
|
||||
|
||||
if ($object->canBeConciliated() > 0) {
|
||||
// If not cash account and can be reconciliate
|
||||
if ($user->rights->banque->consolidate) {
|
||||
@ -640,49 +638,6 @@ if ($resql)
|
||||
// print '</td></tr></table>';
|
||||
}
|
||||
|
||||
// Form to add a transaction with no invoice
|
||||
if ($user->rights->banque->modifier && $action == 'addline')
|
||||
{
|
||||
print load_fiche_titre($langs->trans("AddBankRecordLong"),'','');
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Date").'</td>';
|
||||
print '<td> </td>';
|
||||
print '<td>'.$langs->trans("Type").'</td>';
|
||||
print '<td>'.$langs->trans("Numero").'</td>';
|
||||
print '<td colspan="2">'.$langs->trans("Description").'</td>';
|
||||
print '<td align=right>'.$langs->trans("Debit").'</td>';
|
||||
print '<td align=right>'.$langs->trans("Credit").'</td>';
|
||||
print '<td colspan="2" align="center"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr '.$bcnd[false].'>';
|
||||
print '<td class="nowrap" colspan="2">';
|
||||
$form->select_date(empty($dateop)?-1:$dateop,'op',0,0,0,'transaction');
|
||||
print '</td>';
|
||||
print '<td class="nowrap">';
|
||||
$form->select_types_paiements((GETPOST('operation')?GETPOST('operation'):($object->courant == Account::TYPE_CASH ? 'LIQ' : '')),'operation','1,2',2,1);
|
||||
print '</td><td>';
|
||||
print '<input name="num_chq" class="flat" type="text" size="4" value="'.GETPOST("num_chq").'"></td>';
|
||||
print '<td colspan="2">';
|
||||
print '<input name="label" class="flat" type="text" size="24" value="'.GETPOST("label").'">';
|
||||
if ($options) {
|
||||
print '<br>'.$langs->trans("Rubrique").': ';
|
||||
print Form::selectarray('cat1', $options, GETPOST('cat1'), 1);
|
||||
}
|
||||
print '</td>';
|
||||
print '<td align="right"><input name="adddebit" class="flat" type="text" size="4" value="'.GETPOST("adddebit").'"></td>';
|
||||
print '<td align="right"><input name="addcredit" class="flat" type="text" size="4" value="'.GETPOST("addcredit").'"></td>';
|
||||
print '<td colspan="2" align="center">';
|
||||
print '<input type="submit" name="save" class="button" value="'.$langs->trans("Add").'"><br>';
|
||||
print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'">';
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
|
||||
/// ajax to adjust value date with plus and less picto
|
||||
print '
|
||||
<script type="text/javascript">
|
||||
|
||||
527
htdocs/compta/bank/class/paymentvarious.class.php
Normal file
527
htdocs/compta/bank/class/paymentvarious.class.php
Normal file
@ -0,0 +1,527 @@
|
||||
<?php
|
||||
/* Copyright (C) 2017 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/bank/class/paymentvarious.class.php
|
||||
* \ingroup salaries
|
||||
* \brief Class for salaries module payment
|
||||
*/
|
||||
|
||||
// Put here all includes required by your class file
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
|
||||
|
||||
|
||||
/**
|
||||
* Class to manage various payments
|
||||
*/
|
||||
class PaymentVarious extends CommonObject
|
||||
{
|
||||
//public $element='payment_various'; //!< Id that identify managed objects
|
||||
//public $table_element='payment_various'; //!< Name of table without prefix where object is stored
|
||||
|
||||
var $tms;
|
||||
var $datep;
|
||||
var $datev;
|
||||
var $sens;
|
||||
var $amount;
|
||||
var $type_payment;
|
||||
var $num_payment;
|
||||
var $label;
|
||||
var $accountancy_code;
|
||||
var $fk_bank;
|
||||
var $fk_user_author;
|
||||
var $fk_user_modif;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->element = 'payment_various';
|
||||
$this->table_element = 'payment_various';
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update database
|
||||
*
|
||||
* @param User $user User that modify
|
||||
* @param int $notrigger 0=no, 1=yes (no update trigger)
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function update($user=null, $notrigger=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$error=0;
|
||||
|
||||
// Clean parameters
|
||||
$this->fk_user=trim($this->fk_user);
|
||||
$this->amount=trim($this->amount);
|
||||
$this->label=trim($this->label);
|
||||
$this->note=trim($this->note);
|
||||
$this->fk_bank=trim($this->fk_bank);
|
||||
$this->fk_user_author=trim($this->fk_user_author);
|
||||
$this->fk_user_modif=trim($this->fk_user_modif);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."payment_salary SET";
|
||||
|
||||
$sql.= " tms=".$this->db->idate($this->tms).",";
|
||||
$sql.= " fk_user='".$this->fk_user."',";
|
||||
$sql.= " datep=".$this->db->idate($this->datep).",";
|
||||
$sql.= " datev=".$this->db->idate($this->datev).",";
|
||||
$sql.= " sens=".$this->sens.",";
|
||||
$sql.= " amount='".$this->amount."',";
|
||||
$sql.= " fk_typepayment=".$this->fk_typepayment."',";
|
||||
$sql.= " num_payment='".$this->num_payment."',";
|
||||
$sql.= " label='".$this->db->escape($this->label)."',";
|
||||
$sql.= " note='".$this->db->escape($this->note)."',";
|
||||
$sql.= " accountancy_code='".$this->db->escape($this->accountancy_code)."',";
|
||||
$sql.= " fk_bank=".($this->fk_bank > 0 ? "'".$this->fk_bank."'":"null").",";
|
||||
$sql.= " fk_user_author='".$this->fk_user_author."',";
|
||||
$sql.= " fk_user_modif='".$this->fk_user_modif."'";
|
||||
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('PAYMENT_SALARY_MODIFY',$user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load object in memory from database
|
||||
*
|
||||
* @param int $id id object
|
||||
* @param User $user User that load
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch($id, $user=null)
|
||||
{
|
||||
global $langs;
|
||||
$sql = "SELECT";
|
||||
$sql.= " v.rowid,";
|
||||
|
||||
$sql.= " v.tms,";
|
||||
$sql.= " v.datep,";
|
||||
$sql.= " v.datev,";
|
||||
$sql.= " v.sens,";
|
||||
$sql.= " v.amount,";
|
||||
$sql.= " v.fk_typepayment,";
|
||||
$sql.= " v.num_payment,";
|
||||
$sql.= " v.label,";
|
||||
$sql.= " v.note,";
|
||||
$sql.= " v.accountancy_code,";
|
||||
$sql.= " v.fk_bank,";
|
||||
$sql.= " v.fk_user_author,";
|
||||
$sql.= " v.fk_user_modif,";
|
||||
$sql.= " b.fk_account,";
|
||||
$sql.= " b.fk_type,";
|
||||
$sql.= " b.rappro";
|
||||
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."payment_various as v";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON v.fk_bank = b.rowid";
|
||||
$sql.= " WHERE v.rowid = ".$id;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows($resql))
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = $obj->rowid;
|
||||
$this->tms = $this->db->jdate($obj->tms);
|
||||
$this->fk_user = $obj->fk_user;
|
||||
$this->datep = $this->db->jdate($obj->datep);
|
||||
$this->datev = $this->db->jdate($obj->datev);
|
||||
$this->sens = $obj->sens;
|
||||
$this->amount = $obj->amount;
|
||||
$this->type_payement = $obj->fk_typepayment;
|
||||
$this->num_payment = $obj->num_payment;
|
||||
$this->label = $obj->label;
|
||||
$this->note = $obj->note;
|
||||
$this->accountancy_code = $obj->accountancy_code;
|
||||
$this->fk_bank = $obj->fk_bank;
|
||||
$this->fk_user_author = $obj->fk_user_author;
|
||||
$this->fk_user_modif = $obj->fk_user_modif;
|
||||
$this->fk_account = $obj->fk_account;
|
||||
$this->fk_type = $obj->fk_type;
|
||||
$this->rappro = $obj->rappro;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete object in database
|
||||
*
|
||||
* @param User $user User that delete
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function delete($user)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$error=0;
|
||||
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('PAYMENT_VARIOUS_DELETE',$user);
|
||||
if ($result < 0) return -1;
|
||||
// End call triggers
|
||||
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_various";
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialise an instance with random values.
|
||||
* Used to build previews or test instances.
|
||||
* id must be 0 if object instance is a specimen.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function initAsSpecimen()
|
||||
{
|
||||
$this->id=0;
|
||||
|
||||
$this->tms='';
|
||||
$this->fk_user='';
|
||||
$this->datep='';
|
||||
$this->datev='';
|
||||
$this->sens='';
|
||||
$this->amount='';
|
||||
$this->label='';
|
||||
$this->note='';
|
||||
$this->fk_bank='';
|
||||
$this->fk_user_author='';
|
||||
$this->fk_user_modif='';
|
||||
}
|
||||
|
||||
/**
|
||||
* Create in database
|
||||
*
|
||||
* @param User $user User that create
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function create($user)
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
$error=0;
|
||||
$now=dol_now();
|
||||
|
||||
// Clean parameters
|
||||
$this->amount=price2num(trim($this->amount));
|
||||
$this->label=trim($this->label);
|
||||
$this->note=trim($this->note);
|
||||
$this->fk_bank=trim($this->fk_bank);
|
||||
$this->fk_user_author=trim($this->fk_user_author);
|
||||
$this->fk_user_modif=trim($this->fk_user_modif);
|
||||
|
||||
// Check parameters
|
||||
if (! $this->label)
|
||||
{
|
||||
$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label"));
|
||||
return -3;
|
||||
}
|
||||
if ($this->amount < 0 || $this->amount == '')
|
||||
{
|
||||
$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount"));
|
||||
return -5;
|
||||
}
|
||||
if (! empty($conf->banque->enabled) && (empty($this->accountid) || $this->accountid <= 0))
|
||||
{
|
||||
$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Account"));
|
||||
return -6;
|
||||
}
|
||||
if (! empty($conf->banque->enabled) && (empty($this->type_payment) || $this->type_payment <= 0))
|
||||
{
|
||||
$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("PaymentMode"));
|
||||
return -7;
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Insert into llx_payment_various
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_various (";
|
||||
$sql.= " datep";
|
||||
$sql.= ", datev";
|
||||
$sql.= ", sens";
|
||||
$sql.= ", amount";
|
||||
$sql.= ", fk_typepayment";
|
||||
$sql.= ", num_payment";
|
||||
if ($this->note) $sql.= ", note";
|
||||
$sql.= ", label";
|
||||
$sql.= ", accountancy_code";
|
||||
$sql.= ", fk_user_author";
|
||||
$sql.= ", datec";
|
||||
$sql.= ", fk_bank";
|
||||
$sql.= ", entity";
|
||||
$sql.= ")";
|
||||
$sql.= " VALUES (";
|
||||
$sql.= "'".$this->db->idate($this->datep)."'";
|
||||
$sql.= ", '".$this->db->idate($this->datev)."'";
|
||||
$sql.= ", '".$this->sens."'";
|
||||
$sql.= ", ".$this->amount;
|
||||
$sql.= ", '".$this->type_payment."'";
|
||||
$sql.= ", '".$this->num_payment."'";
|
||||
if ($this->note) $sql.= ", '".$this->db->escape($this->note)."'";
|
||||
$sql.= ", '".$this->db->escape($this->label)."'";
|
||||
$sql.= ", '".$this->accountancy_code."'";
|
||||
$sql.= ", '".$user->id."'";
|
||||
$sql.= ", '".$this->db->idate($now)."'";
|
||||
$sql.= ", NULL";
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_various");
|
||||
|
||||
if ($this->id > 0)
|
||||
{
|
||||
if (! empty($conf->banque->enabled) && ! empty($this->amount))
|
||||
{
|
||||
// Insert into llx_bank
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
|
||||
$acc = new Account($this->db);
|
||||
$result=$acc->fetch($this->accountid);
|
||||
if ($result <= 0) dol_print_error($this->db);
|
||||
|
||||
// Insert payment into llx_bank
|
||||
// Add link 'payment_various' in bank_url between payment and bank transaction
|
||||
if ($this->sens == '0') $sign='-';
|
||||
|
||||
$bank_line_id = $acc->addline(
|
||||
$this->datep,
|
||||
$this->type_payment,
|
||||
$this->label,
|
||||
$sign.abs($this->amount),
|
||||
$this->num_payment,
|
||||
'',
|
||||
$user
|
||||
);
|
||||
|
||||
// Update fk_bank into llx_paiement.
|
||||
// So we know the payment which has generate the banking ecriture
|
||||
if ($bank_line_id > 0)
|
||||
{
|
||||
$this->update_fk_bank($bank_line_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$acc->error;
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// Add link 'payment_various' in bank_url between payment and bank transaction
|
||||
$url=DOL_URL_ROOT.'/compta/bank/various_payment/card.php?id=';
|
||||
|
||||
$result=$acc->add_url_line($bank_line_id, $this->id, $url, "(VariousPayment)", "payment_various");
|
||||
if ($result <= 0)
|
||||
{
|
||||
$this->error=$acc->error;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($result <= 0)
|
||||
{
|
||||
$this->error=$acc->error;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('PAYMENT_VARIOUS_CREATE',$user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
|
||||
}
|
||||
else $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update link between payment various and line generate into llx_bank
|
||||
*
|
||||
* @param int $id_bank Id bank account
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function update_fk_bank($id_bank)
|
||||
{
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'payment_various SET fk_bank = '.$id_bank;
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send name clicable (with possibly the picto)
|
||||
*
|
||||
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
||||
* @param string $option link option
|
||||
* @return string Chaine with URL
|
||||
*/
|
||||
function getNomUrl($withpicto=0,$option='')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$result='';
|
||||
$label=$langs->trans("ShowVariousPayment").': '.$this->ref;
|
||||
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/compta/bank/various_payment/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkend='</a>';
|
||||
|
||||
$picto='payment';
|
||||
|
||||
if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
|
||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||
if ($withpicto != 2) $result.=$link.$this->ref.$linkend;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Information on record
|
||||
*
|
||||
* @param int $id Id of record
|
||||
* @return void
|
||||
*/
|
||||
function info($id)
|
||||
{
|
||||
$sql = 'SELECT v.rowid, v.datec, v.fk_user_author';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'payment_various as v';
|
||||
$sql.= ' WHERE v.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_author)
|
||||
{
|
||||
$cuser = new User($this->db);
|
||||
$cuser->fetch($obj->fk_user_author);
|
||||
$this->user_creation = $cuser;
|
||||
}
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
if ($obj->fk_user_modif)
|
||||
{
|
||||
$muser = new User($this->db);
|
||||
$muser->fetch($obj->fk_user_modif);
|
||||
$this->user_modif = $muser;
|
||||
}
|
||||
$this->date_modif = $this->db->jdate($obj->tms);
|
||||
}
|
||||
$this->db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
@ -374,6 +374,12 @@ if ($result)
|
||||
print img_object($langs->trans('ShowUser'),'user').' ';
|
||||
print $langs->trans("User");
|
||||
print '</a>';
|
||||
}
|
||||
else if ($links[$key]['type']=='payment_various') {
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/bank/various_payment/card.php?id='.$links[$key]['url_id'].'">';
|
||||
print img_object($langs->trans('ShowVariousPayment'),'payment').' ';
|
||||
print $langs->trans("VariousPayment");
|
||||
print '</a>';
|
||||
}
|
||||
else {
|
||||
print '<a href="'.$links[$key]['url'].$links[$key]['url_id'].'">';
|
||||
|
||||
409
htdocs/compta/bank/various_payment/card.php
Normal file
409
htdocs/compta/bank/various_payment/card.php
Normal file
@ -0,0 +1,409 @@
|
||||
<?php
|
||||
/* Copyright (C) 2017 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/bank/various_expenses/card.php
|
||||
* \ingroup bank
|
||||
* \brief Page of various expenses
|
||||
*/
|
||||
|
||||
require '../../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
|
||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||
|
||||
$langs->load("compta");
|
||||
$langs->load("banks");
|
||||
$langs->load("bills");
|
||||
$langs->load("users");
|
||||
$langs->load("accountancy");
|
||||
|
||||
$id=GETPOST("id",'int');
|
||||
$action=GETPOST('action','alpha');
|
||||
$cancel=GETPOST('cancel','alpha');
|
||||
$accountid=GETPOST("accountid") > 0 ? GETPOST("accountid","int") : 0;
|
||||
$label=GETPOST("label","alpha");
|
||||
$sens=GETPOST("sens","int");
|
||||
$amount=GETPOST("amount");
|
||||
$paymenttype=GETPOST("paymenttype");
|
||||
$accountancy_code=GETPOST("accountancy_code","int");
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST("socid","int");
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'banque', '', '', '');
|
||||
|
||||
$object = new PaymentVarious($db);
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('variouscard','globalcard'));
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (! empty($cancel))
|
||||
{
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($action == 'add' && empty($cancel))
|
||||
{
|
||||
$error=0;
|
||||
|
||||
$datep=dol_mktime(12,0,0, GETPOST("datepmonth"), GETPOST("datepday"), GETPOST("datepyear"));
|
||||
$datev=dol_mktime(12,0,0, GETPOST("datevmonth"), GETPOST("datevday"), GETPOST("datevyear"));
|
||||
if (empty($datev)) $datev=$datep;
|
||||
|
||||
$object->accountid=GETPOST("accountid") > 0 ? GETPOST("accountid","int") : 0;
|
||||
$object->datev=$datev;
|
||||
$object->datep=$datep;
|
||||
$object->amount=price2num(GETPOST("amount"));
|
||||
$object->label=GETPOST("label");
|
||||
$object->note=GETPOST("note");
|
||||
$object->type_payment=GETPOST("paymenttype") > 0 ? GETPOST("paymenttype", "int") : 0;
|
||||
$object->num_payment=GETPOST("num_payment");
|
||||
$object->fk_user_author=$user->id;
|
||||
$object->accountancy_code=GETPOST("accountancy_code") > 0 ? GETPOST("accountancy_code","int") : "";
|
||||
|
||||
if (empty($datep) || empty($datev))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (empty($object->type_payment) || $object->type_payment < 0)
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PaymentMode")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (empty($object->amount))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (! empty($conf->banque->enabled) && ! $object->accountid > 0)
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankAccount")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$ret=$object->create($user);
|
||||
if ($ret > 0)
|
||||
{
|
||||
$db->commit();
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action="create";
|
||||
}
|
||||
}
|
||||
|
||||
$action='create';
|
||||
}
|
||||
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$result=$object->fetch($id);
|
||||
|
||||
if ($object->rappro == 0)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$ret=$object->delete($user);
|
||||
if ($ret > 0)
|
||||
{
|
||||
if ($object->fk_bank)
|
||||
{
|
||||
$accountline=new AccountLine($db);
|
||||
$result=$accountline->fetch($object->fk_bank);
|
||||
if ($result > 0) $result=$accountline->delete($user); // $result may be 0 if not found (when bank entry was deleted manually and fk_bank point to nothing)
|
||||
}
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
$db->commit();
|
||||
header("Location: ".DOL_URL_ROOT.'/compta/salaries/index.php');
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$object->error=$accountline->error;
|
||||
$db->rollback();
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages('Error try do delete a line linked to a conciliated bank transaction', null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader("",$langs->trans("VariousPayment"));
|
||||
|
||||
$form = new Form($db);
|
||||
if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($db);
|
||||
|
||||
if ($id)
|
||||
{
|
||||
$object = new PaymentVarious($db);
|
||||
$result = $object->fetch($id);
|
||||
if ($result <= 0)
|
||||
{
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Create mode */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
if ($action == 'create')
|
||||
{
|
||||
print '<form name="salary" action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
print load_fiche_titre($langs->trans("NewVariousPayment"),'', 'title_accountancy.png');
|
||||
|
||||
dol_fiche_head('', '');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Date payment
|
||||
print '<tr><td>';
|
||||
print fieldLabel('DatePayment','datep',1).'</td><td>';
|
||||
print $form->select_date((empty($datep)?-1:$datep),"datep",'','','','add',1,1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Date value for bank
|
||||
print '<tr><td>';
|
||||
print fieldLabel('DateValue','datev',0).'</td><td>';
|
||||
print $form->select_date((empty($datev)?-1:$datev),"datev",'','','','add',1,1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td>';
|
||||
print fieldLabel('Label','label',1).'</td><td>';
|
||||
print '<input name="label" id="label" class="minwidth300" value="'.($label?$label:$langs->trans("VariousPayment")).'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Sens
|
||||
print '<tr><td>';
|
||||
print fieldLabel('Sens','sens',1).'</td><td>';
|
||||
$sensarray=array( '0' => $langs->trans("Debit"), '1' => $langs->trans("Credit"));
|
||||
print $form->selectarray('sens',$sensarray,$sens);
|
||||
print '</td></tr>';
|
||||
|
||||
// Amount
|
||||
print '<tr><td>';
|
||||
print fieldLabel('Amount','amount',1).'</td><td>';
|
||||
print '<input name="amount" id="amount" class="minwidth100" value="'.$amount.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Bank
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
print '<tr><td>';
|
||||
print fieldLabel('BankAccount','selectaccountid',1).'</td><td>';
|
||||
$form->select_comptes($accountid,"accountid",0,'',1); // Affiche liste des comptes courant
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Type payment
|
||||
print '<tr><td>';
|
||||
print fieldLabel('PaymentMode','selectpaymenttype',1).'</td><td>';
|
||||
$form->select_types_paiements($paymenttype, "paymenttype");
|
||||
print '</td></tr>';
|
||||
|
||||
// Number
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
// Number
|
||||
print '<tr><td><label for="num_payment">'.$langs->trans('Numero');
|
||||
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
|
||||
print '</label></td>';
|
||||
print '<td><input name="num_payment" id="num_payment" type="text" value="'.GETPOST("num_payment").'"></td></tr>'."\n";
|
||||
}
|
||||
|
||||
// Accountancy account
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("AccountAccounting").'</td>';
|
||||
print '<td>';
|
||||
print $formaccountancy->select_account($accountancy_code, 'accountancy_code', 1, null, 1, 1, '');
|
||||
print '</td></tr>';
|
||||
}
|
||||
else // For external software
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("AccountAccounting").'</td>';
|
||||
print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code" value="'.$accountancy_code.'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters=array('colspan' => ' colspan="1"');
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* View mode */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
if ($id)
|
||||
{
|
||||
|
||||
$head=various_payment_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'card', $langs->trans("VariousPayment"), 0, 'payment');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/various_payment/index.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
print "<tr>";
|
||||
print '<td class="titlefield">'.$langs->trans("Ref").'</td><td>';
|
||||
print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', '');
|
||||
print '</td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->label.'</td></tr>';
|
||||
|
||||
print "<tr>";
|
||||
print '<td>'.$langs->trans("DatePayment").'</td><td>';
|
||||
print dol_print_date($object->datep,'day');
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("DateValue").'</td><td>';
|
||||
print dol_print_date($object->datev,'day');
|
||||
print '</td></tr>';
|
||||
|
||||
// Debit / Credit
|
||||
if ($object->sens == '1') $sens = $langs->trans("Credit"); else $sens = $langs->trans("Debit");
|
||||
print '<tr><td>'.$langs->trans("Sens").'</td><td>'.$sens.'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($object->amount,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
|
||||
|
||||
// Accountancy code
|
||||
print '<tr><td class="nowrap">';
|
||||
print $langs->trans("AccountAccounting");
|
||||
print '</td><td>';
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
$accountancyaccount = new AccountingAccount($db);
|
||||
$accountancyaccount->fetch('',$object->accountancy_code);
|
||||
|
||||
print $accountancyaccount->getNomUrl(1);
|
||||
// print length_accountg($object->accountancy_code);
|
||||
} else {
|
||||
print $object->accountancy_code;
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
if ($object->fk_account > 0)
|
||||
{
|
||||
$bankline=new AccountLine($db);
|
||||
$bankline->fetch($object->fk_bank);
|
||||
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('BankTransactionLine').'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $bankline->getNomUrl(1,0,'showall');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters=array('colspan' => ' colspan="1"');
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
/*
|
||||
* Action buttons
|
||||
*/
|
||||
print '<div class="tabsAction">'."\n";
|
||||
if ($object->rappro == 0)
|
||||
{
|
||||
if (! empty($user->rights->banque->delete))
|
||||
{
|
||||
print '<a class="butActionDelete" href="card.php?id='.$object->id.'&action=delete">'.$langs->trans("Delete").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.(dol_escape_htmltag($langs->trans("NotAllowed"))).'">'.$langs->trans("Delete").'</a>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.$langs->trans("LinkedToAConciliatedTransaction").'">'.$langs->trans("Delete").'</a>';
|
||||
}
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
127
htdocs/compta/bank/various_payment/document.php
Normal file
127
htdocs/compta/bank/various_payment/document.php
Normal file
@ -0,0 +1,127 @@
|
||||
<?php
|
||||
/* Copyright (C) 2017 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/>.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/compta/bank/various_payment/document.php
|
||||
* \ingroup banque
|
||||
* \brief Page of linked files onto various_payment
|
||||
*/
|
||||
|
||||
require '../../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php';
|
||||
|
||||
$langs->load("other");
|
||||
$langs->load("bank");
|
||||
$langs->load("companies");
|
||||
|
||||
$id = GETPOST('id','int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action','alpha');
|
||||
$confirm = GETPOST('confirm','alpha');
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'salaries', $id, '');
|
||||
|
||||
|
||||
// Get parameters
|
||||
$sortfield = GETPOST('sortfield','alpha');
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
$page = GETPOST('page','int');
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="name";
|
||||
|
||||
|
||||
$object = new PaymentVarious($db);
|
||||
$object->fetch($id, $ref);
|
||||
|
||||
$upload_dir = $conf->banque->dir_output.'/'.dol_sanitizeFileName($object->id);
|
||||
$modulepart='banque';
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
llxHeader("",$langs->trans("VariousPayment"));
|
||||
|
||||
|
||||
if ($object->id)
|
||||
{
|
||||
$head=various_payment_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'documents', $langs->trans("VariousPayment"), 0, 'payment');
|
||||
|
||||
|
||||
// Construit liste des fichiers
|
||||
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||
$totalsize=0;
|
||||
foreach($filearray as $key => $file)
|
||||
{
|
||||
$totalsize+=$file['size'];
|
||||
}
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/various_payment/index.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>';
|
||||
print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', '');
|
||||
print '</td></tr>';
|
||||
|
||||
// Societe
|
||||
//print "<tr><td>".$langs->trans("Company")."</td><td>".$object->client->getNomUrl(1)."</td></tr>";
|
||||
|
||||
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
$modulepart = 'banque';
|
||||
$permission = $user->rights->banque->modifier;
|
||||
$param = '&id=' . $object->id;
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("ErrorUnknown");
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
259
htdocs/compta/bank/various_payment/index.php
Normal file
259
htdocs/compta/bank/various_payment/index.php
Normal file
@ -0,0 +1,259 @@
|
||||
<?php
|
||||
/* Copyright (C) 2017 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/bank/various_payment/index.php
|
||||
* \ingroup bank
|
||||
* \brief List of various payments
|
||||
*/
|
||||
|
||||
require '../../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
|
||||
$langs->load("compta");
|
||||
$langs->load("banks");
|
||||
$langs->load("bills");
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST("socid","int");
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'banque', '', '', '');
|
||||
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$search_ref = GETPOST('search_ref','int');
|
||||
$search_user = GETPOST('search_user','alpha');
|
||||
$search_label = GETPOST('search_label','alpha');
|
||||
$search_amount = GETPOST('search_amount','alpha');
|
||||
$search_account = GETPOST('search_account','int');
|
||||
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortfield) $sortfield="v.datep";
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
$optioncss = GETPOST('optioncss','alpha');
|
||||
|
||||
$filtre=$_GET["filtre"];
|
||||
|
||||
if (empty($_REQUEST['typeid']))
|
||||
{
|
||||
$newfiltre=str_replace('filtre=','',$filtre);
|
||||
$filterarray=explode('-',$newfiltre);
|
||||
foreach($filterarray as $val)
|
||||
{
|
||||
$part=explode(':',$val);
|
||||
if ($part[0] == 'v.fk_typepayment') $typeid=$part[1];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$typeid=$_REQUEST['typeid'];
|
||||
}
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
||||
{
|
||||
$search_ref="";
|
||||
$search_label="";
|
||||
$search_amount="";
|
||||
$search_account='';
|
||||
$typeid="";
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
$form = new Form($db);
|
||||
$variousstatic = new PaymentVarious($db);
|
||||
$accountstatic = new Account($db);
|
||||
|
||||
$sql = "SELECT v.rowid, v.amount, v.label, v.datep as datep, v.datev as datev, v.fk_typepayment as type, v.num_payment, v.fk_bank,";
|
||||
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.accountancy_journal, ba.label as blabel,";
|
||||
$sql.= " pst.code as payment_code";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."payment_various as v";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON v.fk_typepayment = pst.id";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON v.fk_bank = b.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
||||
$sql.= " WHERE v.entity = ".$conf->entity;
|
||||
|
||||
// Search criteria
|
||||
if ($search_ref) $sql.=" AND v.rowid=".$search_ref;
|
||||
if ($search_label) $sql.=natural_search(array('v.label'), $search_label);
|
||||
if ($search_amount) $sql.=natural_search("v.amount", $search_amount, 1);
|
||||
if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account;
|
||||
if ($filtre) {
|
||||
$filtre=str_replace(":","=",$filtre);
|
||||
$sql .= " AND ".$filtre;
|
||||
}
|
||||
if ($typeid) {
|
||||
$sql .= " AND v.fk_typepayment=".$typeid;
|
||||
}
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
|
||||
//$sql.= " GROUP BY u.rowid, u.lastname, u.firstname, v.rowid, v.fk_user, v.amount, v.label, v.datev, v.fk_typepayment, v.num_payment, pst.code";
|
||||
$totalnboflines=0;
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$totalnboflines = $db->num_rows($result);
|
||||
}
|
||||
$sql.= $db->plimit($limit+1,$offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
$total = 0 ;
|
||||
$var=true;
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($typeid) $param.='&typeid='.$typeid;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
|
||||
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
print_barre_liste($langs->trans("VariousPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $totalnboflines, 'title_accountancy.png', 0, '', '', $limit);
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"v.rowid","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"v.label","",$param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"v.datep","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("PaymentMode"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder);
|
||||
if (! empty($conf->banque->enabled)) print_liste_field_titre($langs->trans("BankAccount"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"v.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Sens"),$_SERVER["PHP_SELF"],"v.sens","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
// Ref
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" size="3" name="search_ref" value="'.$search_ref.'">';
|
||||
print '</td>';
|
||||
// Label
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_label" value="'.$search_label.'"></td>';
|
||||
// Date
|
||||
print '<td class="liste_titre"> </td>';
|
||||
// Type
|
||||
print '<td class="liste_titre" align="left">';
|
||||
$form->select_types_paiements($typeid,'typeid','',0,0,1,16);
|
||||
print '</td>';
|
||||
// Account
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
$form->select_comptes($search_account,'search_account',0,'',1);
|
||||
print '</td>';
|
||||
}
|
||||
// Amount
|
||||
print '<td class="liste_titre" align="right"><input name="search_amount" class="flat" type="text" size="8" value="'.$search_amount.'"></td>';
|
||||
// Sens
|
||||
print '<td class="liste_titre"> </td>';
|
||||
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
$variousstatic->id=$obj->rowid;
|
||||
$variousstatic->ref=$obj->rowid;
|
||||
// Ref
|
||||
print "<td>".$variousstatic->getNomUrl(1)."</td>\n";
|
||||
// Label payment
|
||||
print "<td>".dol_trunc($obj->label,40)."</td>\n";
|
||||
// Date payment
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->datep),'day')."</td>\n";
|
||||
// Type
|
||||
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'</td>';
|
||||
// Account
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
print '<td>';
|
||||
if ($obj->fk_bank > 0)
|
||||
{
|
||||
//$accountstatic->fetch($obj->fk_bank);
|
||||
$accountstatic->id=$obj->bid;
|
||||
$accountstatic->ref=$obj->bref;
|
||||
$accountstatic->number=$obj->bnumber;
|
||||
$accountstatic->accountancy_number=$obj->account_number;
|
||||
$accountstatic->accountancy_journal=$obj->accountancy_journal;
|
||||
$accountstatic->label=$obj->blabel;
|
||||
print $accountstatic->getNomUrl(1);
|
||||
}
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
}
|
||||
// Amount
|
||||
print "<td align=\"right\">".price($obj->amount)."</td>";
|
||||
// Sens
|
||||
if ($obj->sens == '1') $sens = $langs->trans("Credit"); else $sens = $langs->trans("Debit");
|
||||
print "<td align=\"right\">".$sens."</td>";
|
||||
print "<td></td>";
|
||||
print "</tr>\n";
|
||||
|
||||
$total = $total + $obj->amount;
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$colspan=4;
|
||||
if (! empty($conf->banque->enabled)) $colspan++;
|
||||
print '<tr class="liste_total"><td colspan="'.$colspan.'" class="liste_total">'.$langs->trans("Total").'</td>';
|
||||
print '<td class="liste_total" align="right">'.price($total)."</td>";
|
||||
print "<td></td></tr>";
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
print '</form>';
|
||||
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
65
htdocs/compta/bank/various_payment/info.php
Normal file
65
htdocs/compta/bank/various_payment/info.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/* Copyright (C) 2017 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/bank/various_payment/info.php
|
||||
* \ingroup salaries
|
||||
* \brief Page with info about salaries contribution
|
||||
*/
|
||||
|
||||
require '../../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
$langs->load("compta");
|
||||
$langs->load("bills");
|
||||
$langs->load("salaries");
|
||||
|
||||
$id=GETPOST('id','int');
|
||||
$action=GETPOST("action");
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST('socid','int');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'salaries', '', '', '');
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader("",$langs->trans("VariousPayment"));
|
||||
|
||||
$object = new PaymentVarious($db);
|
||||
$result = $object->fetch($id);
|
||||
$object->info($id);
|
||||
|
||||
$head = various_payment_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'info', $langs->trans("VariousPayment"), 0, 'payment');
|
||||
|
||||
|
||||
print '<table width="100%"><tr><td>';
|
||||
dol_print_object_info($object);
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
@ -1,392 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* 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/facture/apercu.php
|
||||
* \ingroup facture
|
||||
* \brief Preview Tab of invoice
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
|
||||
$langs->load("bills");
|
||||
|
||||
// Security check
|
||||
$socid=0;
|
||||
$id = GETPOST('facid','int');
|
||||
$ref = GETPOST("ref");
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'facture', $id);
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
$title = $langs->trans('InvoiceCustomer') . " - " . $langs->trans('Preview');
|
||||
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
|
||||
llxHeader('', $title, $helpurl);
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
/* *************************************************************************** */
|
||||
/* */
|
||||
/* Mode fiche */
|
||||
/* */
|
||||
/* *************************************************************************** */
|
||||
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$object = New Facture($db);
|
||||
|
||||
if ($object->fetch($id,$ref) > 0)
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($object->socid);
|
||||
|
||||
$head = facture_prepare_head($object);
|
||||
dol_fiche_head($head, 'preview', $langs->trans("InvoiceCustomer"), 0, 'bill');
|
||||
|
||||
|
||||
$totalpaye = $object->getSommePaiement();
|
||||
|
||||
/*
|
||||
* Invoice
|
||||
*/
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td class="titlefield">' . $langs->trans('Ref') . '</td><td colspan="5">';
|
||||
$morehtmlref = '';
|
||||
$discount = new DiscountAbsolute($db);
|
||||
$result = $discount->fetch(0, $object->id);
|
||||
if ($result > 0) {
|
||||
$morehtmlref = ' (' . $langs->trans("CreditNoteConvertedIntoDiscount", $discount->getNomUrl(1, 'discount')) . ')';
|
||||
}
|
||||
if ($result < 0) {
|
||||
dol_print_error('', $discount->error);
|
||||
}
|
||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref);
|
||||
print '</td></tr>';
|
||||
|
||||
// Ref customer
|
||||
print '<tr><td>'.$langs->trans('RefCustomer').'</td>';
|
||||
print '<td colspan="5">'.$object->ref_client.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Thirdparty
|
||||
print '<tr><td>'.$langs->trans("Company").'</td>';
|
||||
print '<td colspan="5">'.$soc->getNomUrl(1,'compta').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Type
|
||||
print '<tr><td>'.$langs->trans('Type').'</td>';
|
||||
print '<td colspan="5">';
|
||||
print $object->getLibType();
|
||||
if ($object->type == Facture::TYPE_REPLACEMENT)
|
||||
{
|
||||
$facreplaced=new Facture($db);
|
||||
$facreplaced->fetch($object->fk_facture_source);
|
||||
print ' ('.$langs->transnoentities("ReplaceInvoice",$facreplaced->getNomUrl(1)).')';
|
||||
}
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE)
|
||||
{
|
||||
$facusing=new Facture($db);
|
||||
$facusing->fetch($object->fk_facture_source);
|
||||
print ' ('.$langs->transnoentities("CorrectInvoice",$facusing->getNomUrl(1)).')';
|
||||
}
|
||||
|
||||
$facidavoir=$object->getListIdAvoirFromInvoice();
|
||||
if (count($facidavoir) > 0)
|
||||
{
|
||||
print ' ('.$langs->transnoentities("InvoiceHasAvoir");
|
||||
$i=0;
|
||||
foreach($facidavoir as $id)
|
||||
{
|
||||
if ($i==0) print ' ';
|
||||
else print ',';
|
||||
$facavoir=new Facture($db);
|
||||
$facavoir->fetch($id);
|
||||
print $facavoir->getNomUrl(1);
|
||||
}
|
||||
print ')';
|
||||
}
|
||||
if ($objectidnext > 0)
|
||||
{
|
||||
$facthatreplace=new Facture($db);
|
||||
$facthatreplace->fetch($objectidnext);
|
||||
print ' ('.$langs->transnoentities("ReplacedByInvoice",$facthatreplace->getNomUrl(1)).')';
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Relative and absolute discounts
|
||||
$addabsolutediscount=' <a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$soc->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'?facid='.$object->id.'">'.$langs->trans("AddGlobalDiscount").'</a>';
|
||||
$addcreditnote=' <a href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create&socid='.$soc->id.'&type=2&backtopage='.urlencode($_SERVER["PHP_SELF"]).'?facid='.$object->id.'">'.$langs->trans("AddCreditNote").'</a>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Discounts').'</td>';
|
||||
print '<td colspan="5">';
|
||||
if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_percent);
|
||||
else print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||
|
||||
if ($absolute_discount > 0)
|
||||
{
|
||||
print '. ';
|
||||
if ($object->statut > Facture::STATUS_DRAFT || $object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT)
|
||||
{
|
||||
if ($object->statut == Facture::STATUS_DRAFT)
|
||||
{
|
||||
print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency));
|
||||
print '. ';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($object->statut < Facture::STATUS_VALIDATED || $object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT)
|
||||
{
|
||||
$text=$langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency));
|
||||
print '<br>'.$text.'.<br>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$text=$langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency));
|
||||
$text2=$langs->trans("AbsoluteDiscountUse");
|
||||
print $form->textwithpicto($text,$text2);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Remise dispo de type remise fixe (not credit note)
|
||||
$filter='fk_facture_source IS NULL';
|
||||
print '<br>';
|
||||
$form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id',$soc->id, $absolute_discount, $filter, $resteapayer, ' - '.$addabsolutediscount, 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($absolute_creditnote > 0) // If not linked will be added later
|
||||
{
|
||||
if ($object->statut == Facture::STATUS_DRAFT && $object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT) print ' - '.$addabsolutediscount.'<br>';
|
||||
else print '.';
|
||||
}
|
||||
else print '. ';
|
||||
}
|
||||
if ($absolute_creditnote > 0)
|
||||
{
|
||||
// If validated, we show link "add credit note to payment"
|
||||
if ($object->statut != Facture::STATUS_VALIDATED || $object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT)
|
||||
{
|
||||
if ($object->statut == Facture::STATUS_DRAFT && $object->type != Facture::TYPE_DEPOSIT)
|
||||
{
|
||||
$text=$langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->currency));
|
||||
print $form->textwithpicto($text,$langs->trans("CreditNoteDepositUse"));
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->currency)).'.';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Remise dispo de type avoir
|
||||
$filter='fk_facture_source IS NOT NULL';
|
||||
if (! $absolute_discount) print '<br>';
|
||||
$form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filter, $resteapayer, '', 1);
|
||||
}
|
||||
}
|
||||
if (! $absolute_discount && ! $absolute_creditnote)
|
||||
{
|
||||
print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
||||
if ($object->statut == Facture::STATUS_DRAFT && $object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT) print ' - '.$addabsolutediscount.'<br>';
|
||||
else print '. ';
|
||||
}
|
||||
/*if ($object->statut == 0 && $object->type != 2 && $object->type != 3)
|
||||
{
|
||||
if (! $absolute_discount && ! $absolute_creditnote) print '<br>';
|
||||
//print ' - ';
|
||||
print $addabsolutediscount;
|
||||
//print ' - '.$addcreditnote; // We disbale link to credit note
|
||||
}*/
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Dates
|
||||
print '<tr><td>'.$langs->trans("DateInvoice").'</td>';
|
||||
print '<td>'.dol_print_date($object->date,"daytext").'</td>';
|
||||
|
||||
// Right part with $rowspan lines
|
||||
$rowspan=5;
|
||||
if (! empty($conf->projet->enabled)) $rowspan++;
|
||||
print '<td rowspan="'.$rowspan.'" valign="top" width="50%">';
|
||||
|
||||
/*
|
||||
* Documents
|
||||
*/
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
$dir_output = $conf->facture->dir_output . "/";
|
||||
$filepath = $dir_output . $objectref . "/";
|
||||
$file = $filepath . $objectref . ".pdf";
|
||||
$filedetail = $filepath . $objectref . "-detail.pdf";
|
||||
$relativepath = $objectref.'/'.$objectref.'.pdf';
|
||||
$relativepathdetail = $objectref.'/'.$objectref.'-detail.pdf';
|
||||
|
||||
// Define path to preview pdf file (preview precompiled "file.ext" are "file.ext_preview.png")
|
||||
$fileimage = $file.'_preview.png'; // If PDF has 1 page
|
||||
$fileimagebis = $file.'_preview-0.pdf.png'; // If PDF has more than one page
|
||||
$relativepathimage = $relativepath.'_preview.png';
|
||||
|
||||
$var=true;
|
||||
|
||||
// Si fichier PDF existe
|
||||
if (file_exists($file))
|
||||
{
|
||||
$encfile = urlencode($file);
|
||||
print '<table class="nobordernopadding" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Documents").'</td></tr>';
|
||||
|
||||
print "<tr ".$bc[$var]."><td>".$langs->trans("Bill")." PDF</td>";
|
||||
|
||||
print '<td><a data-ajax="false" href="'.DOL_URL_ROOT . '/document.php?modulepart=facture&file='.urlencode($relativepath).'">'.$object->ref.'.pdf</a></td>';
|
||||
print '<td align="right">'.dol_print_size(dol_filesize($file)). '</td>';
|
||||
print '<td align="right">'.dol_print_date(dol_filemtime($file),'dayhour').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Si fichier detail PDF existe
|
||||
if (file_exists($filedetail)) // facture detaillee supplementaire
|
||||
{
|
||||
print "<tr ".$bc[$var]."><td>Facture detaillee</td>";
|
||||
|
||||
print '<td><a data-ajax="false" href="'.DOL_URL_ROOT . '/document.php?modulepart=facture&file='.urlencode($relativepathdetail).'">'.$object->ref.'-detail.pdf</a></td>';
|
||||
print '<td align="right">'.dol_print_size(dol_filesize($filedetail)).'</td>';
|
||||
print '<td align="right">'.dol_print_date(dol_filemtime($filedetail),'dayhour').'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
// Conversion du PDF en image png si fichier png non existant
|
||||
if ((! file_exists($fileimage) && ! file_exists($fileimagebis)) || (filemtime($fileimage) < filemtime($file)))
|
||||
{
|
||||
if (class_exists("Imagick"))
|
||||
{
|
||||
$ret = dol_convert_file($file,'png',$fileimage);
|
||||
if ($ret < 0) $error++;
|
||||
}
|
||||
else
|
||||
{
|
||||
$langs->load("errors");
|
||||
print '<font class="error">'.$langs->trans("ErrorNoImagickReadimage").'</font>';
|
||||
}
|
||||
}
|
||||
}
|
||||
print "</td></tr>";
|
||||
|
||||
// Total HT
|
||||
print '<tr><td>'.$langs->trans("AmountHT").'</td>';
|
||||
print '<td align="right" class="nowrap"><b>' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '</b></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Total VAT
|
||||
print '<tr><td>'.$langs->trans('AmountVAT').'</td>';
|
||||
print '<td align="right" class="nowrap"><b>' . price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency) . '</b></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Total TTC
|
||||
print '<tr><td>'.$langs->trans('AmountTTC').'</td>';
|
||||
print '<td align="right" class="nowrap"><b>' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . '</b></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Statut
|
||||
print '<tr><td>'.$langs->trans('Status').'</td>';
|
||||
print '<td align="left">'.($object->getLibStatut(4,$totalpaye)).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Projet
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
print '<tr><td>'.$langs->trans("Project").'</td>';
|
||||
print '<td>';
|
||||
if ($object->fk_project > 0)
|
||||
{
|
||||
$project = New Project($db);
|
||||
$project->fetch($object->fk_project);
|
||||
print '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'">'.$project->title.'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print ' ';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Facture non trouvee
|
||||
print $langs->trans("ErrorBillNotFound",$id);
|
||||
}
|
||||
}
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td>';
|
||||
print '<div class="photolist">';
|
||||
// Si fichier png PDF d'1 page trouve
|
||||
if (file_exists($fileimage))
|
||||
{
|
||||
print '<img class="photo photowithmargin" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercufacture&file='.urlencode($relativepathimage).'">';
|
||||
}
|
||||
// Si fichier png PDF de plus d'1 page trouve
|
||||
elseif (file_exists($fileimagebis))
|
||||
{
|
||||
$multiple = preg_replace('/\.png/','',$relativepath) . "-";
|
||||
|
||||
for ($i = 0; $i < 20; $i++)
|
||||
{
|
||||
$preview = $multiple.$i.'.png';
|
||||
|
||||
if (file_exists($dir_output.$preview))
|
||||
{
|
||||
print '<img class="photo photowithmargin" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercufacture&file='.urlencode($preview).'"><p>';
|
||||
}
|
||||
}
|
||||
}
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
@ -1210,7 +1210,12 @@ if ($resql)
|
||||
}
|
||||
|
||||
// Show total line
|
||||
if (isset($totalarray['totalhtfield']))
|
||||
if (isset($totalarray['totalhtfield'])
|
||||
|| isset($totalarray['totalvatfield'])
|
||||
|| isset($totalarray['totalttcfield'])
|
||||
|| isset($totalarray['totalamfield'])
|
||||
|| isset($totalarray['totalrtpfield'])
|
||||
)
|
||||
{
|
||||
print '<tr class="liste_total">';
|
||||
$i=0;
|
||||
|
||||
@ -6028,13 +6028,13 @@ class Form
|
||||
*/
|
||||
global $dolibarr_main_url_root;
|
||||
$ret.='<!-- Put link to gravatar -->';
|
||||
$ret.='<img class="photo'.$modulepart.($cssclass?' '.$cssclass:'').'" alt="Gravatar avatar" title="'.$email.' Gravatar avatar" border="0"'.($width?' width="'.$width.'"':'').($height?' height="'.$height.'"':'').' src="https://www.gravatar.com/avatar/'.dol_hash(strtolower(trim($email)),3).'?s='.$width.'&d='.urlencode(dol_buildpath($nophoto,3)).'">'; // gravatar need md5 hash
|
||||
$ret.='<img class="photo'.$modulepart.($cssclass?' '.$cssclass:'').'" alt="Gravatar avatar" title="'.$email.' Gravatar avatar" '.($width?' width="'.$width.'"':'').($height?' height="'.$height.'"':'').' src="https://www.gravatar.com/avatar/'.dol_hash(strtolower(trim($email)),3).'?s='.$width.'&d='.urlencode(dol_buildpath($nophoto,3)).'">'; // gravatar need md5 hash
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($conf->browser->layout != 'phone')
|
||||
{
|
||||
$ret.='<img class="photo'.$modulepart.($cssclass?' '.$cssclass:'').'" alt="No photo" border="0"'.($width?' width="'.$width.'"':'').($height?' height="'.$height.'"':'').' src="'.DOL_URL_ROOT.$nophoto.'">';
|
||||
$ret.='<img class="photo'.$modulepart.($cssclass?' '.$cssclass:'').'" alt="No photo" '.($width?' width="'.$width.'"':'').($height?' height="'.$height.'"':'').' src="'.DOL_URL_ROOT.$nophoto.'">';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -992,7 +992,7 @@ class FormFile
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
print '<input type="hidden" name="modulepart" value="'.$modulepart.'">';
|
||||
}
|
||||
print '<table width="100%" id="tablelines" class="'.($useinecm?'liste noborderbottom':'liste').'">'."\n";
|
||||
print '<table width="100%" id="tablelines" class="'.($useinecm?'liste noborder':'liste').'">'."\n";
|
||||
|
||||
print '<tr class="liste_titre nodrag nodrop">';
|
||||
print_liste_field_titre($langs->trans("Documents2"),$url,"name","",$param,'align="left"',$sortfield,$sortorder);
|
||||
|
||||
@ -134,6 +134,51 @@ function bank_admin_prepare_head($object)
|
||||
return $head;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @param Object $object Object related to tabs
|
||||
* @return array Array of tabs to shoc
|
||||
*/
|
||||
function various_payment_prepare_head($object) {
|
||||
|
||||
global $db, $langs, $conf;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/bank/various_payment/card.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$head[$h][2] = 'card';
|
||||
$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,'various_payment');
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->banque->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/bank/various_payment/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/bank/various_payment/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,'various_payment', 'remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check SWIFT informations for a bank account
|
||||
*
|
||||
|
||||
@ -1807,6 +1807,14 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
}
|
||||
$original_file=$conf->facture->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file;
|
||||
}
|
||||
else if ($modulepart == 'massfilesarea_expensereport')
|
||||
{
|
||||
if ($fuser->rights->facture->lire || preg_match('/^specimen/i',$original_file))
|
||||
{
|
||||
$accessallowed=1;
|
||||
}
|
||||
$original_file=$conf->expensereport->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping for interventions
|
||||
else if (($modulepart == 'fichinter' || $modulepart == 'ficheinter') && !empty($conf->ficheinter->dir_output))
|
||||
|
||||
@ -1006,12 +1006,15 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
|
||||
if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) $showbarcode=0;
|
||||
$modulepart='unknown';
|
||||
|
||||
if ($object->element == 'societe') $modulepart='societe';
|
||||
if ($object->element == 'contact') $modulepart='contact';
|
||||
if ($object->element == 'member') $modulepart='memberphoto';
|
||||
if ($object->element == 'user') $modulepart='userphoto';
|
||||
if ($object->element == 'product') $modulepart='product';
|
||||
|
||||
if ($object->element == 'societe') $modulepart='societe';
|
||||
if ($object->element == 'contact') $modulepart='contact';
|
||||
if ($object->element == 'member') $modulepart='memberphoto';
|
||||
if ($object->element == 'user') $modulepart='userphoto';
|
||||
if ($object->element == 'product') $modulepart='product';
|
||||
if ($object->element == 'propal') $modulepart='propal';
|
||||
if ($object->element == 'commande') $modulepart='commande';
|
||||
if ($object->element == 'facture') $modulepart='facture';
|
||||
|
||||
if ($object->element == 'product')
|
||||
{
|
||||
$width=80; $cssclass='photoref';
|
||||
@ -1037,7 +1040,56 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
|
||||
{
|
||||
if ($modulepart != 'unknown')
|
||||
{
|
||||
$phototoshow = $form->showphoto($modulepart,$object,0,0,0,'photoref','small',1,0,$maxvisiblephotos);
|
||||
// Check if a preview file is available
|
||||
if (in_array($modulepart, array('propal', 'commande', 'facture')) && class_exists("Imagick"))
|
||||
{
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
$dir_output = $conf->$modulepart->dir_output . "/";
|
||||
$filepath = $dir_output . $objectref . "/";
|
||||
$file = $filepath . $objectref . ".pdf";
|
||||
$relativepath = $objectref.'/'.$objectref.'.pdf';
|
||||
|
||||
// Define path to preview pdf file (preview precompiled "file.ext" are "file.ext_preview.png")
|
||||
$fileimage = $file.'_preview.png'; // If PDF has 1 page
|
||||
$fileimagebis = $file.'_preview-0.pdf.png'; // If PDF has more than one page
|
||||
$relativepathimage = $relativepath.'_preview.png';
|
||||
|
||||
// Si fichier PDF existe
|
||||
if (file_exists($file))
|
||||
{
|
||||
$encfile = urlencode($file);
|
||||
// Conversion du PDF en image png si fichier png non existant
|
||||
if ((! file_exists($fileimage) && ! file_exists($fileimagebis)) || (filemtime($fileimage) < filemtime($file)))
|
||||
{
|
||||
$ret = dol_convert_file($file,'png',$fileimage);
|
||||
if ($ret < 0) $error++;
|
||||
}
|
||||
|
||||
// Si fichier png PDF d'1 page trouve
|
||||
if (file_exists($fileimage))
|
||||
{
|
||||
$phototoshow = '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref">';
|
||||
$phototoshow.= '<img height="70" class="photo photowithmargin" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercu'.$modulepart.'&file='.urlencode($relativepathimage).'">';
|
||||
$phototoshow.= '</div></div>';
|
||||
}
|
||||
// Si fichier png PDF de plus d'1 page trouve
|
||||
elseif (file_exists($fileimagebis))
|
||||
{
|
||||
$preview = preg_replace('/\.png/','',$relativepath) . "-0.png";
|
||||
if (file_exists($dir_output.$preview))
|
||||
{
|
||||
$phototoshow = '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref">';
|
||||
$phototoshow.= '<img height="70" class="photo photowithmargin" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercu'.$modulepart.'&file='.urlencode($preview).'"><p>';
|
||||
$phototoshow.= '</div></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (! $phototoshow)
|
||||
{
|
||||
$phototoshow = $form->showphoto($modulepart,$object,0,0,0,'photoref','small',1,0,$maxvisiblephotos);
|
||||
}
|
||||
|
||||
if ($phototoshow)
|
||||
{
|
||||
$morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">';
|
||||
@ -1045,7 +1097,8 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
|
||||
$morehtmlleft.='</div>';
|
||||
}
|
||||
}
|
||||
elseif ($conf->browser->layout != 'phone') // Show No photo link (picto of pbject)
|
||||
|
||||
if (! $phototoshow && $conf->browser->layout != 'phone') // Show No photo link (picto of pbject)
|
||||
{
|
||||
$morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">';
|
||||
if ($object->element == 'action')
|
||||
|
||||
@ -53,14 +53,6 @@ function facture_prepare_head($object)
|
||||
$h++;
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_USE_PREVIEW_TABS))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/apercu.php?facid='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Preview');
|
||||
$head[$h][2] = 'preview';
|
||||
$h++;
|
||||
}
|
||||
|
||||
//if ($fac->mode_reglement_code == 'PRE')
|
||||
if (! empty($conf->prelevement->enabled))
|
||||
{
|
||||
|
||||
@ -60,14 +60,6 @@ function commande_prepare_head(Commande $object)
|
||||
$h++;
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_USE_PREVIEW_TABS))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/commande/apercu.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Preview");
|
||||
$head[$h][2] = 'preview';
|
||||
$h++;
|
||||
}
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
$nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
|
||||
|
||||
@ -55,13 +55,6 @@ function propal_prepare_head($object)
|
||||
$head[$h][2] = 'shipping';
|
||||
$h++;
|
||||
}
|
||||
if (! empty($conf->global->MAIN_USE_PREVIEW_TABS))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/apercu.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Preview");
|
||||
$head[$h][2] = 'preview';
|
||||
$h++;
|
||||
}
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
|
||||
@ -150,8 +150,8 @@ class MenuManager
|
||||
print '<!-- Generate menu list from menu handler '.$this->name.' -->'."\n";
|
||||
foreach($this->menu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
|
||||
{
|
||||
print '<ul class="ulmenu" data-role="listview" data-inset="true">';
|
||||
print '<li data-role="list-dividerxxx" class="lilevel0">';
|
||||
print '<ul class="ulmenu" data-inset="true">';
|
||||
print '<li class="lilevel0">';
|
||||
if ($val['enabled'] == 1)
|
||||
{
|
||||
$relurl=dol_buildpath($val['url'],1);
|
||||
@ -175,7 +175,7 @@ class MenuManager
|
||||
|| (strpos($canonrelurl,'/product/index.php') !== false || strpos($canonrelurl,'/compta/bank/index.php') !== false))
|
||||
{
|
||||
// We add sub entry
|
||||
print str_pad('',1).'<li data-role="list-dividerxxx" class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic
|
||||
print str_pad('',1).'<li class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic
|
||||
print '<a href="'.$relurl.'">';
|
||||
if ($langs->trans(ucfirst($val['mainmenu'])."Dashboard") == ucfirst($val['mainmenu'])."Dashboard") // No translation
|
||||
{
|
||||
@ -199,7 +199,7 @@ class MenuManager
|
||||
$canonurl2=preg_replace('/\?.*$/','',$val2['url']);
|
||||
//var_dump($val2['url'].' - '.$canonurl2.' - '.$val2['level']);
|
||||
if (in_array($canonurl2,array('/admin/index.php','/admin/tools/index.php','/core/tools.php'))) $relurl2='';
|
||||
if ($val2['level']==0) print str_pad('',$val2['level']+1).'<li'.($val2['level']==0?' data-role="list-dividerxxx"':'').' class="lilevel'.($val2['level']+1).' ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic
|
||||
if ($val2['level']==0) print str_pad('',$val2['level']+1).'<li class="lilevel'.($val2['level']+1).' ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic
|
||||
else print str_pad('',$val2['level']+1).'<li class="lilevel'.($val2['level']+1).'">'; // ui-btn to highlight on clic
|
||||
if ($relurl2)
|
||||
{
|
||||
|
||||
@ -159,8 +159,8 @@ class MenuManager
|
||||
print '<!-- Generate menu list from menu handler '.$this->name.' -->'."\n";
|
||||
foreach($this->menu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
|
||||
{
|
||||
print '<ul class="ulmenu" data-role="listview" data-inset="true">';
|
||||
print '<li data-role="list-dividerxxx" class="lilevel0">';
|
||||
print '<ul class="ulmenu" data-inset="true">';
|
||||
print '<li class="lilevel0">';
|
||||
|
||||
if ($val['enabled'] == 1)
|
||||
{
|
||||
@ -168,7 +168,14 @@ class MenuManager
|
||||
$relurl=preg_replace('/__LOGIN__/',$user->login,$relurl);
|
||||
$relurl=preg_replace('/__USERID__/',$user->id,$relurl);
|
||||
|
||||
print '<a class="alilevel0" href="#">'.$val['titre'].'</a>'."\n";
|
||||
|
||||
print '<a class="alilevel0" href="#">';
|
||||
|
||||
// Add font-awesome
|
||||
if ($val['level'] == 0 && $val['mainmenu'] == 'home') print '<span class="fa fa-home fa-fw paddingright" aria-hidden="true"></span>';
|
||||
|
||||
print $val['titre'];
|
||||
print '</a>'."\n";
|
||||
// Search submenu fot this mainmenu entry
|
||||
$tmpmainmenu=$val['mainmenu'];
|
||||
$tmpleftmenu='all';
|
||||
@ -187,13 +194,13 @@ class MenuManager
|
||||
|| (strpos($canonrelurl,'/product/index.php') !== false || strpos($canonrelurl,'/compta/bank/index.php') !== false))
|
||||
{
|
||||
// We add sub entry
|
||||
print str_pad('',1).'<li data-role="list-dividerxxx" class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic
|
||||
print str_pad('',1).'<li class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic
|
||||
print '<a href="'.$relurl.'"';
|
||||
//print ' data-ajax="false"';
|
||||
print '>';
|
||||
if ($langs->trans(ucfirst($val['mainmenu'])."Dashboard") == ucfirst($val['mainmenu'])."Dashboard") // No translation
|
||||
{
|
||||
if ($val['mainmenu'] == 'cashdesk') print $langs->trans("Access");
|
||||
if (in_array($val['mainmenu'], array('cashdesk', 'websites'))) print $langs->trans("Access");
|
||||
else print $langs->trans("Dashboard");
|
||||
}
|
||||
else print $langs->trans(ucfirst($val['mainmenu'])."Dashboard");
|
||||
@ -214,7 +221,7 @@ class MenuManager
|
||||
$canonurl2=preg_replace('/\?.*$/','',$val2['url']);
|
||||
//var_dump($val2['url'].' - '.$canonurl2.' - '.$val2['level']);
|
||||
if (in_array($canonurl2,array('/admin/index.php','/admin/tools/index.php','/core/tools.php'))) $relurl2='';
|
||||
if ($val2['level']==0) print str_pad('',$val2['level']+1).'<li'.($val2['level']==0?' data-role="list-dividerxxx"':'').' class="lilevel'.($val2['level']+1).' ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic
|
||||
if ($val2['level']==0) print str_pad('',$val2['level']+1).'<li class="lilevel'.($val2['level']+1).' ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic
|
||||
else print str_pad('',$val2['level']+1).'<li class="lilevel'.($val2['level']+1).'">'; // ui-btn to highlight on clic
|
||||
if ($relurl2)
|
||||
{
|
||||
|
||||
@ -244,8 +244,8 @@ class MenuManager
|
||||
{
|
||||
foreach($this->topmenu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
|
||||
{
|
||||
print '<ul class="ulmenu" data-role="listview" data-inset="true">';
|
||||
print '<li data-role="list-dividerxxx" class="lilevel0">';
|
||||
print '<ul class="ulmenu" data-inset="true">';
|
||||
print '<li class="lilevel0">';
|
||||
if ($val['enabled'] == 1)
|
||||
{
|
||||
$relurl=dol_buildpath($val['url'],1);
|
||||
@ -269,7 +269,7 @@ class MenuManager
|
||||
if ($canonrelurl != $canonnexturl && ! in_array($val['mainmenu'],array('home','tools')))
|
||||
{
|
||||
// We add sub entry
|
||||
print '<li data-role="list-dividerxxx"><a href="'.$relurl.'">'.$langs->trans("MainArea").'-'.$val['titre'].'</a></li>'."\n";
|
||||
print '<li><a href="'.$relurl.'">'.$langs->trans("MainArea").'-'.$val['titre'].'</a></li>'."\n";
|
||||
}
|
||||
foreach($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
|
||||
{
|
||||
@ -277,7 +277,7 @@ class MenuManager
|
||||
$relurl2=preg_replace('/__LOGIN__/',$user->login,$relurl2);
|
||||
$relurl2=preg_replace('/__USERID__/',$user->id,$relurl2);
|
||||
//var_dump($val2);
|
||||
print '<li'.($val2['level']==0?' data-role="list-dividerxxx"':'').'><a href="'.$relurl2.'">'.$val2['titre'].'</a></li>'."\n";
|
||||
print '<li><a href="'.$relurl2.'">'.$val2['titre'].'</a></li>'."\n";
|
||||
}
|
||||
//var_dump($submenu);
|
||||
print '</ul>';
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2014 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
@ -201,14 +201,6 @@ class modAccounting extends DolibarrModules
|
||||
"chaine",
|
||||
"csv"
|
||||
);
|
||||
/* Not required to disable this. This make not possible to do complete reconciliation.
|
||||
Also, this is not a problem, lines added manually will be reported as "not binded into accounting export module
|
||||
and will be binded manually to be created into general ledger
|
||||
$this->const[24] = array(
|
||||
"BANK_DISABLE_DIRECT_INPUT",
|
||||
"yesno",
|
||||
"1"
|
||||
);*/
|
||||
|
||||
// Tabs
|
||||
$this->tabs = array();
|
||||
|
||||
@ -303,7 +303,7 @@ if ($resql)
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array(
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
if ($user->rights->expensereport->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
if ($massaction == 'presend') $arrayofmassactions=array();
|
||||
@ -716,7 +716,7 @@ if ($resql)
|
||||
|
||||
print '</form>'."\n";
|
||||
|
||||
/*
|
||||
|
||||
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
|
||||
{
|
||||
// Show list of available documents
|
||||
@ -727,13 +727,12 @@ if ($resql)
|
||||
$genallowed=$user->rights->expensereport->lire;
|
||||
$delallowed=$user->rights->expensereport->lire;
|
||||
|
||||
print $formfile->showdocuments('massfilesarea_orders','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
|
||||
print $formfile->showdocuments('massfilesarea_expensereport','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
|
||||
}
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -124,3 +124,23 @@ INSERT INTO llx_const (name, entity, value, type, visible, note) VALUES ('USER_A
|
||||
|
||||
ALTER TABLE llx_chargesociales ADD COLUMN ref varchar(16);
|
||||
ALTER TABLE llx_chargesociales ADD COLUMN fk_projet integer DEFAULT NULL;
|
||||
|
||||
create table llx_payment_various
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
tms timestamp,
|
||||
datec datetime,
|
||||
datep date,
|
||||
datev date,
|
||||
sens smallint DEFAULT 0 NOT NULL,
|
||||
amount double(24,8) DEFAULT 0 NOT NULL,
|
||||
fk_typepayment integer NOT NULL,
|
||||
num_payment varchar(50),
|
||||
label varchar(255),
|
||||
accountancy_code varchar(32),
|
||||
entity integer DEFAULT 1 NOT NULL,
|
||||
note text,
|
||||
fk_bank integer,
|
||||
fk_user_author integer,
|
||||
fk_user_modif integer
|
||||
)ENGINE=innodb;
|
||||
|
||||
37
htdocs/install/mysql/tables/llx_payment_various.sql
Normal file
37
htdocs/install/mysql/tables/llx_payment_various.sql
Normal file
@ -0,0 +1,37 @@
|
||||
-- ===================================================================
|
||||
-- Copyright (C) 2017 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/>.
|
||||
--
|
||||
-- ===================================================================
|
||||
|
||||
create table llx_payment_various
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
tms timestamp,
|
||||
datec datetime, -- Create date
|
||||
datep date, -- date de paiement
|
||||
datev date, -- date de valeur (this field should not be here, only into bank tables)
|
||||
sens smallint DEFAULT 0 NOT NULL,-- Sens of the operation: 0 for debit operation, 1 for credit operation
|
||||
amount double(24,8) DEFAULT 0 NOT NULL,
|
||||
fk_typepayment integer NOT NULL,
|
||||
num_payment varchar(50), -- ref
|
||||
label varchar(255),
|
||||
accountancy_code varchar(32),
|
||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||
note text,
|
||||
fk_bank integer,
|
||||
fk_user_author integer, -- utilisateur qui a cree l'info
|
||||
fk_user_modif integer -- utilisateur qui a modifié l'info
|
||||
)ENGINE=innodb;
|
||||
@ -26,7 +26,7 @@ create table llx_usergroup
|
||||
datec datetime,
|
||||
tms timestamp,
|
||||
note text,
|
||||
model_pdf varchar(255) DEFAULT NULL,
|
||||
model_pdf varchar(255) DEFAULT NULL
|
||||
)ENGINE=innodb;
|
||||
|
||||
--
|
||||
|
||||
@ -149,4 +149,8 @@ CheckRejected=Check returned
|
||||
CheckRejectedAndInvoicesReopened=Check returned and invoices reopened
|
||||
BankAccountModelModule=Document templates for bank accounts
|
||||
DocumentModelSepaMandate=Template of SEPA mandate. Usefull for european countries in EEC only.
|
||||
DocumentModelBan=Template to print a page with BAN information.
|
||||
DocumentModelBan=Template to print a page with BAN information.
|
||||
NewVariousPayment=New various payment
|
||||
VariousPayment=Various payment
|
||||
VariousPayments=Various payments
|
||||
ShowVariousPayment=Show various payment
|
||||
|
||||
Loading…
Reference in New Issue
Block a user