Fix: strict mode safari

This commit is contained in:
Regis Houssin 2012-08-16 19:18:24 +02:00
parent a25814022b
commit 97474bf77f
8 changed files with 487 additions and 485 deletions

View File

@ -262,7 +262,7 @@ $var=true;
</tr> </tr>
<tr <?php $var = ! $var; print $bc[$var]; ?>> <tr <?php $var = ! $var; print $bc[$var]; ?>>
<td>Cached keys</td> <td>Cached keys</td>
<td align="right"><?php print $info['cachedKeys']; ?></td> <td align="right"><?php print (isset($info['cachedKeys'])?$info['cachedKeys']:''); ?></td>
</tr> </tr>
</table> </table>
<?php <?php

View File

@ -28,26 +28,26 @@
* \brief Page to create/see an invoice * \brief Page to create/see an invoice
*/ */
require('../main.inc.php'); require '../main.inc.php';
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php"); require DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php"); require DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
require_once(DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php'); require DOL_DOCUMENT_ROOT . '/core/modules/facture/modules_facture.php';
require_once(DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'); require DOL_DOCUMENT_ROOT . '/core/class/discount.class.php';
require_once(DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'); require DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
require_once(DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'); require DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php"); require DOL_DOCUMENT_ROOT . '/core/lib/invoice.lib.php';
require_once(DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'); require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php"); require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
if (! empty($conf->commande->enabled)) require_once(DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php');
if (! empty($conf->projet->enabled)) if (! empty($conf->commande->enabled)) {
{ require DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php';
require_once(DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'); }
require_once(DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'); if (! empty($conf->projet->enabled)) {
require DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
require DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';
} }
$langs->load('bills'); $langs->load('bills');
//print 'ee'.$langs->trans('BillsCustomer');exit;
$langs->load('companies'); $langs->load('companies');
$langs->load('products'); $langs->load('products');
$langs->load('main'); $langs->load('main');
@ -2374,7 +2374,7 @@ else if ($id > 0 || ! empty($ref))
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('RefCustomer'); print $langs->trans('RefCustomer');
print '</td>'; print '</td>';
if ($action != 'refclient' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER['PHP_SELF'].'?action=refclient&amp;id='.$object->id.'">'.img_edit($langs->trans('Modify')).'</a></td>'; if ($action != 'refclient' && ! empty($object->brouillon)) print '<td align="right"><a href="'.$_SERVER['PHP_SELF'].'?action=refclient&amp;id='.$object->id.'">'.img_edit($langs->trans('Modify')).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td>'; print '</td>';
print '<td colspan="5">'; print '<td colspan="5">';
@ -2547,7 +2547,7 @@ else if ($id > 0 || ! empty($ref))
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('Date'); print $langs->trans('Date');
print '</td>'; print '</td>';
if ($object->type != 2 && $action != 'editinvoicedate' && $object->brouillon && $user->rights->facture->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editinvoicedate&amp;facid='.$object->id.'">'.img_edit($langs->trans('SetDate'),1).'</a></td>'; if ($object->type != 2 && $action != 'editinvoicedate' && ! empty($object->brouillon) && $user->rights->facture->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editinvoicedate&amp;facid='.$object->id.'">'.img_edit($langs->trans('SetDate'),1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
@ -2770,7 +2770,7 @@ else if ($id > 0 || ! empty($ref))
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('DateMaxPayment'); print $langs->trans('DateMaxPayment');
print '</td>'; print '</td>';
if ($object->type != 2 && $action != 'editpaymentterm' && $object->brouillon && $user->rights->facture->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editpaymentterm&amp;facid='.$object->id.'">'.img_edit($langs->trans('SetDate'),1).'</a></td>'; if ($object->type != 2 && $action != 'editpaymentterm' && ! empty($object->brouillon) && $user->rights->facture->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editpaymentterm&amp;facid='.$object->id.'">'.img_edit($langs->trans('SetDate'),1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
if ($object->type != 2) if ($object->type != 2)
@ -2782,7 +2782,7 @@ else if ($id > 0 || ! empty($ref))
else else
{ {
print dol_print_date($object->date_lim_reglement,'daytext'); print dol_print_date($object->date_lim_reglement,'daytext');
if ($object->date_lim_reglement < ($now - $conf->facture->client->warning_delay) && ! $object->paye && $object->statut == 1 && ! $object->am) print img_warning($langs->trans('Late')); if ($object->date_lim_reglement < ($now - $conf->facture->client->warning_delay) && ! $object->paye && $object->statut == 1 && ! isset($object->am)) print img_warning($langs->trans('Late'));
} }
} }
else else
@ -2796,7 +2796,7 @@ else if ($id > 0 || ! empty($ref))
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentConditionsShort'); print $langs->trans('PaymentConditionsShort');
print '</td>'; print '</td>';
if ($object->type != 2 && $action != 'editconditions' && $object->brouillon && $user->rights->facture->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&amp;facid='.$object->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>'; if ($object->type != 2 && $action != 'editconditions' && ! empty($object->brouillon) && $user->rights->facture->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&amp;facid='.$object->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
if ($object->type != 2) if ($object->type != 2)
@ -2821,7 +2821,7 @@ else if ($id > 0 || ! empty($ref))
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentMode'); print $langs->trans('PaymentMode');
print '</td>'; print '</td>';
if ($action != 'editmode' && $object->brouillon && $user->rights->facture->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;facid='.$object->id.'">'.img_edit($langs->trans('SetMode'),1).'</a></td>'; if ($action != 'editmode' && ! empty($object->brouillon) && $user->rights->facture->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;facid='.$object->id.'">'.img_edit($langs->trans('SetMode'),1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
if ($action == 'editmode') if ($action == 'editmode')
@ -2868,7 +2868,7 @@ else if ($id > 0 || ! empty($ref))
print '<td align="left" colspan="3">'.($object->getLibStatut(4,$totalpaye)).'</td></tr>'; print '<td align="left" colspan="3">'.($object->getLibStatut(4,$totalpaye)).'</td></tr>';
// Project // Project
if ($conf->projet->enabled) if (! empty($conf->projet->enabled))
{ {
$langs->load('projects'); $langs->load('projects');
print '<tr>'; print '<tr>';

View File

@ -2996,12 +2996,10 @@ class Facture extends CommonInvoice
function getLinesArray() function getLinesArray()
{ {
$sql = 'SELECT l.rowid, l.description, l.fk_product, l.product_type, l.qty, l.tva_tx,'; $sql = 'SELECT l.rowid, l.description, l.fk_product, l.product_type, l.qty, l.tva_tx,';
$sql.= ' l.fk_remise_except,'; $sql.= ' l.fk_remise_except, localtax1_tx, localtax2_tx,';
$sql.= ' l.remise_percent, l.subprice, l.info_bits, l.rang, l.special_code, l.fk_parent_line,'; $sql.= ' l.remise_percent, l.subprice, l.info_bits, l.rang, l.special_code, l.fk_parent_line,';
$sql.= ' l.total_ht, l.total_tva, l.total_ttc, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht,'; $sql.= ' l.total_ht, l.total_tva, l.total_ttc, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht,';
$sql.= ' l.date_start,'; $sql.= ' l.date_start, l.date_end,';
$sql.= ' l.date_end,';
$sql.= ' l.product_type,';
$sql.= ' p.ref as product_ref, p.fk_product_type, p.label as product_label,'; $sql.= ' p.ref as product_ref, p.fk_product_type, p.label as product_label,';
$sql.= ' p.description as product_desc'; $sql.= ' p.description as product_desc';
$sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet as l'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet as l';

View File

@ -38,10 +38,11 @@ $langs->load('other');
$langs->load("bills"); $langs->load("bills");
$action = GETPOST('action'); $id=(GETPOST('id','int')?GETPOST('id','int'):GETPOST('facid','int')); // For backward compatibility
$confirm = GETPOST('confirm'); $ref=GETPOST('ref','alpha');
$id = GETPOST('facid','int'); $socid=GETPOST('socid','int');
$ref = GETPOST('ref'); $action=GETPOST('action','alpha');
$confirm=GETPOST('confirm', 'alpha');
// Security check // Security check
if ($user->societe_id) if ($user->societe_id)
@ -70,7 +71,7 @@ $object = new Facture($db);
*/ */
// Envoi fichier // Envoi fichier
if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
{ {
if ($object->fetch($id)) if ($object->fetch($id))
{ {
@ -106,8 +107,6 @@ llxHeader();
$form = new Form($db); $form = new Form($db);
$id = $_GET['facid']?$_GET['facid']:$_GET['id'];
$ref= $_GET['ref'];
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
{ {
if ($object->fetch($id,$ref) > 0) if ($object->fetch($id,$ref) > 0)

View File

@ -1,8 +1,9 @@
<?php <?php
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -36,45 +37,56 @@ $langs->load("bills");
$langs->load("banks"); $langs->load("banks");
$langs->load("withdrawals"); $langs->load("withdrawals");
// Security check $id=(GETPOST('id','int')?GETPOST('id','int'):GETPOST('facid','int')); // For backward compatibility
if ($user->societe_id > 0) $ref=GETPOST('ref','alpha');
{ $socid=GETPOST('socid','int');
$action = ''; $action=GETPOST('action','alpha');
$socid = $user->societe_id;
} $fieldid = (! empty($ref)?'facnumber':'rowid');
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid);
$object = new Facture($db); $object = new Facture($db);
// Load object
if ($id > 0 || ! empty($ref))
{
$ret=$object->fetch($id, $ref);
if ($ret > 0)
{
$object->fetch_thirdparty();
}
}
/* /*
* Actions * Actions
*/ */
if ($_GET["action"] == "new") if ($action == "new")
{ {
if ($object->fetch($_GET["facid"])) if ($object->id > 0)
{ {
$result = $object->demande_prelevement($user); $result = $object->demande_prelevement($user);
if ($result > 0) if ($result > 0)
{ {
Header("Location: prelevement.php?facid=".$object->id); Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit; exit;
} }
else else
{ {
$mesg='<div class="error">'.$object->error.'</div>'; setEventMessage($object->error, 'errors');
} }
} }
} }
if ($_GET["action"] == "delete") if ($action == "delete")
{ {
if ($object->fetch($_GET["facid"])) if ($object->id > 0)
{ {
$result = $object->demande_prelevement_delete($user,$_GET["did"]); $result = $object->demande_prelevement_delete($user, GETPOST('did'));
if ($result == 0) if ($result == 0)
{ {
Header("Location: prelevement.php?facid=".$object->id); Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit; exit;
} }
} }
@ -87,7 +99,7 @@ if ($_GET["action"] == "delete")
$now=dol_now(); $now=dol_now();
llxHeader('',$langs->trans("Bill")); llxHeader('', $langs->trans("Bill"));
$form = new Form($db); $form = new Form($db);
@ -97,477 +109,465 @@ $form = new Form($db);
/* */ /* */
/* *************************************************************************** */ /* *************************************************************************** */
if ($_REQUEST["facid"] > 0 || $_REQUEST["ref"]) if ($object->id > 0)
{ {
if ($object->fetch($_REQUEST["facid"], $_REQUEST["ref"]) > 0) $totalpaye = $object->getSommePaiement();
{ $totalcreditnotes = $object->getSumCreditNotesUsed();
dol_htmloutput_mesg($mesg); $totaldeposits = $object->getSumDepositsUsed();
//print "totalpaye=".$totalpaye." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits;
$soc = new Societe($db); // We can also use bcadd to avoid pb with floating points
$soc->fetch($object->socid); // For example print 239.2 - 229.3 - 9.9; does not return 0.
//$resteapayer=bcadd($object->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT);
//$resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
$resteapayer = price2num($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits,'MT');
$totalpaye = $object->getSommePaiement(); if ($object->paye) $resteapayer=0;
$totalcreditnotes = $object->getSumCreditNotesUsed(); $resteapayeraffiche=$resteapayer;
$totaldeposits = $object->getSumDepositsUsed();
//print "totalpaye=".$totalpaye." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits;
// We can also use bcadd to avoid pb with floating points $absolute_discount=$object->thirdparty->getAvailableDiscounts('','fk_facture_source IS NULL');
// For example print 239.2 - 229.3 - 9.9; does not return 0. $absolute_creditnote=$object->thirdparty->getAvailableDiscounts('','fk_facture_source IS NOT NULL');
//$resteapayer=bcadd($object->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT); $absolute_discount=price2num($absolute_discount,'MT');
//$resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT); $absolute_creditnote=price2num($absolute_creditnote,'MT');
$resteapayer = price2num($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits,'MT');
if ($object->paye) $resteapayer=0; $author = new User($db);
$resteapayeraffiche=$resteapayer; if ($object->user_author)
{
$author->fetch($object->user_author);
}
$absolute_discount=$soc->getAvailableDiscounts('','fk_facture_source IS NULL'); $head = facture_prepare_head($object);
$absolute_creditnote=$soc->getAvailableDiscounts('','fk_facture_source IS NOT NULL');
$absolute_discount=price2num($absolute_discount,'MT');
$absolute_creditnote=price2num($absolute_creditnote,'MT');
$author = new User($db); dol_fiche_head($head, 'standingorders', $langs->trans('InvoiceCustomer'),0,'bill');
if ($object->user_author)
{
$author->fetch($object->user_author);
}
$head = facture_prepare_head($object); /*
* Facture
*/
print '<table class="border" width="100%">';
dol_fiche_head($head, 'standingorders', $langs->trans('InvoiceCustomer'),0,'bill'); $linkback = '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
/* // Ref
* Facture print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td colspan="5">';
*/ $morehtmlref='';
print '<table class="border" width="100%">'; $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>";
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>'; // Ref customer
print '<tr><td width="20%">';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('RefCustomer');
print '</td>';
print '</tr></table>';
print '</td>';
print '<td colspan="5">';
print $object->ref_client;
print '</td></tr>';
// Ref // Third party
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td colspan="5">'; print '<tr><td>'.$langs->trans('Company').'</td>';
$morehtmlref=''; print '<td colspan="5">'.$object->thirdparty->getNomUrl(1,'compta');
$discount=new DiscountAbsolute($db); print ' &nbsp; (<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->socid.'">'.$langs->trans('OtherBills').'</a>)</td>';
$result=$discount->fetch(0,$object->id); print '</tr>';
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 // Type
print '<tr><td width="20%">'; print '<tr><td>'.$langs->trans('Type').'</td><td colspan="5">';
print '<table class="nobordernopadding" width="100%"><tr><td>'; print $object->getLibType();
print $langs->trans('RefCustomer'); if ($object->type == 1)
print '</td>'; {
print '</tr></table>'; $facreplaced=new Facture($db);
print '</td>'; $facreplaced->fetch($object->fk_facture_source);
print '<td colspan="5">'; print ' ('.$langs->transnoentities("ReplaceInvoice",$facreplaced->getNomUrl(1)).')';
print $object->ref_client; }
print '</td></tr>'; if ($object->type == 2)
{
$facusing=new Facture($db);
$facusing->fetch($object->fk_facture_source);
print ' ('.$langs->transnoentities("CorrectInvoice",$facusing->getNomUrl(1)).')';
}
// Third party $facidavoir=$object->getListIdAvoirFromInvoice();
print '<tr><td>'.$langs->trans('Company').'</td>'; if (count($facidavoir) > 0)
print '<td colspan="5">'.$soc->getNomUrl(1,'compta'); {
print ' &nbsp; (<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->socid.'">'.$langs->trans('OtherBills').'</a>)</td>'; print ' ('.$langs->transnoentities("InvoiceHasAvoir");
print '</tr>'; $i=0;
foreach($facidavoir as $id)
{
if ($i==0) print ' ';
else print ',';
$facavoir=new Facture($db);
$facavoir->fetch($id);
print $facavoir->getNomUrl(1);
}
print ')';
}
// FIXME $facidnext not defined
/*
if ($facidnext > 0)
{
$facthatreplace=new Facture($db);
$facthatreplace->fetch($facidnext);
print ' ('.$langs->transnoentities("ReplacedByInvoice",$facthatreplace->getNomUrl(1)).')';
}
*/
print '</td></tr>';
// Type // Discounts
print '<tr><td>'.$langs->trans('Type').'</td><td colspan="5">'; print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="5">';
print $object->getLibType(); if ($object->thirdparty->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$object->thirdparty->remise_client);
if ($object->type == 1) else print $langs->trans("CompanyHasNoRelativeDiscount");
{ print '. ';
$facreplaced=new Facture($db); if ($absolute_discount > 0)
$facreplaced->fetch($object->fk_facture_source); {
print ' ('.$langs->transnoentities("ReplaceInvoice",$facreplaced->getNomUrl(1)).')'; if ($object->statut > 0 || $object->type == 2 || $object->type == 3)
} {
if ($object->type == 2) if ($object->statut == 0)
{ {
$facusing=new Facture($db); print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency)).'. ';
$facusing->fetch($object->fk_facture_source); }
print ' ('.$langs->transnoentities("CorrectInvoice",$facusing->getNomUrl(1)).')'; else
} {
if ($object->statut < 1 || $object->type == 2 || $object->type == 3)
{
$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 non avoir
$filter='fk_facture_source IS NULL';
print '<br>';
$form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$object->id,0,'remise_id',$object->thirdparty->id,$absolute_discount,$filter,$resteapayer);
}
}
if ($absolute_creditnote > 0)
{
// If validated, we show link "add credit note to payment"
if ($object->statut != 1 || $object->type == 2 || $object->type == 3)
{
if ($object->statut == 0 && $object->type != 3)
{
$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"].'?id='.$object->id,0,'remise_id_for_payment',$object->thirdparty->id,$absolute_creditnote,$filter,$resteapayer);
}
}
if (! $absolute_discount && ! $absolute_creditnote) print $langs->trans("CompanyHasNoAbsoluteDiscount").'.';
print '</td></tr>';
$facidavoir=$object->getListIdAvoirFromInvoice(); // Date invoice
if (count($facidavoir) > 0) print '<tr><td>';
{ print '<table class="nobordernopadding" width="100%"><tr><td>';
print ' ('.$langs->transnoentities("InvoiceHasAvoir"); print $langs->trans('Date');
$i=0; print '</td>';
foreach($facidavoir as $id) if ($object->type != 2 && $action != 'editinvoicedate' && ! empty($object->brouillon) && $user->rights->facture->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editinvoicedate&amp;id='.$object->id.'">'.img_edit($langs->trans('SetDate'),1).'</a></td>';
{ print '</tr></table>';
if ($i==0) print ' '; print '</td><td colspan="3">';
else print ',';
$facavoir=new Facture($db);
$facavoir->fetch($id);
print $facavoir->getNomUrl(1);
}
print ')';
}
if ($facidnext > 0)
{
$facthatreplace=new Facture($db);
$facthatreplace->fetch($facidnext);
print ' ('.$langs->transnoentities("ReplacedByInvoice",$facthatreplace->getNomUrl(1)).')';
}
print '</td></tr>';
// Discounts if ($object->type != 2)
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="5">'; {
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client); if ($action == 'editinvoicedate')
else print $langs->trans("CompanyHasNoRelativeDiscount"); {
print '. '; $form->form_date($_SERVER['PHP_SELF'].'?id='.$object->id,$object->date,'invoicedate');
if ($absolute_discount > 0) }
{ else
if ($object->statut > 0 || $object->type == 2 || $object->type == 3) {
{ print dol_print_date($object->date,'daytext');
if ($object->statut == 0) }
{ }
print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency)).'. '; else
} {
else print dol_print_date($object->date,'daytext');
{ }
if ($object->statut < 1 || $object->type == 2 || $object->type == 3) print '</td>';
{ print '</tr>';
$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 non avoir
$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);
}
}
if ($absolute_creditnote > 0)
{
// If validated, we show link "add credit note to payment"
if ($object->statut != 1 || $object->type == 2 || $object->type == 3)
{
if ($object->statut == 0 && $object->type != 3)
{
$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);
}
}
if (! $absolute_discount && ! $absolute_creditnote) print $langs->trans("CompanyHasNoAbsoluteDiscount").'.';
print '</td></tr>';
// Date invoice // Date payment term
print '<tr><td>'; print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('Date'); print $langs->trans('DateMaxPayment');
print '</td>'; print '</td>';
if ($object->type != 2 && $_GET['action'] != 'editinvoicedate' && $object->brouillon && $user->rights->facture->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editinvoicedate&amp;facid='.$object->id.'">'.img_edit($langs->trans('SetDate'),1).'</a></td>'; if ($object->type != 2 && $action != 'editpaymentterm' && ! empty($object->brouillon) && $user->rights->facture->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editpaymentterm&amp;id='.$object->id.'">'.img_edit($langs->trans('SetDate'),1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
if ($object->type != 2)
{
if ($action == 'editpaymentterm')
{
$form->form_date($_SERVER['PHP_SELF'].'?id='.$object->id,$object->date_lim_reglement,'paymentterm');
}
else
{
print dol_print_date($object->date_lim_reglement,'daytext');
if ($object->date_lim_reglement < ($now - $conf->facture->client->warning_delay) && ! $object->paye && $object->statut == 1 && ! isset($object->am)) print img_warning($langs->trans('Late'));
}
}
else
{
print '&nbsp;';
}
print '</td></tr>';
if ($object->type != 2) // Conditions de reglement
{ print '<tr><td>';
if ($_GET['action'] == 'editinvoicedate') print '<table class="nobordernopadding" width="100%"><tr><td>';
{ print $langs->trans('PaymentConditionsShort');
$form->form_date($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->date,'invoicedate'); print '</td>';
} if ($object->type != 2 && $action != 'editconditions' && ! empty($object->brouillon) && $user->rights->facture->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&amp;id='.$object->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>';
else print '</tr></table>';
{ print '</td><td colspan="3">';
print dol_print_date($object->date,'daytext'); if ($object->type != 2)
} {
} if ($action == 'editconditions')
else {
{ $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'cond_reglement_id');
print dol_print_date($object->date,'daytext'); }
} else
print '</td>'; {
print '</tr>'; $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'none');
}
}
else
{
print '&nbsp;';
}
print '</td></tr>';
// Date payment term // Mode de reglement
print '<tr><td>'; print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('DateMaxPayment'); print $langs->trans('PaymentMode');
print '</td>'; print '</td>';
if ($object->type != 2 && $_GET['action'] != 'editpaymentterm' && $object->brouillon && $user->rights->facture->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editpaymentterm&amp;facid='.$object->id.'">'.img_edit($langs->trans('SetDate'),1).'</a></td>'; if ($action != 'editmode' && ! empty($object->brouillon) && $user->rights->facture->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;id='.$object->id.'">'.img_edit($langs->trans('SetMode'),1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
if ($object->type != 2) if ($action == 'editmode')
{ {
if ($_GET['action'] == 'editpaymentterm') $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'mode_reglement_id');
{ }
$form->form_date($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->date_lim_reglement,'paymentterm'); else
} {
else $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'none');
{ }
print dol_print_date($object->date_lim_reglement,'daytext'); print '</td></tr>';
if ($object->date_lim_reglement < ($now - $conf->facture->client->warning_delay) && ! $object->paye && $object->statut == 1 && ! $object->am) print img_warning($langs->trans('Late'));
}
}
else
{
print '&nbsp;';
}
print '</td></tr>';
// Conditions de reglement // Montants
print '<tr><td>'; print '<tr><td>'.$langs->trans('AmountHT').'</td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<td align="right" colspan="2" nowrap>'.price($object->total_ht).'</td>';
print $langs->trans('PaymentConditionsShort'); print '<td>'.$langs->trans('Currency'.$conf->currency).'</td></tr>';
print '</td>'; print '<tr><td>'.$langs->trans('AmountVAT').'</td><td align="right" colspan="2" nowrap>'.price($object->total_tva).'</td>';
if ($object->type != 2 && $_GET['action'] != 'editconditions' && $object->brouillon && $user->rights->facture->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&amp;facid='.$object->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>'; print '<td>'.$langs->trans('Currency'.$conf->currency).'</td></tr>';
print '</tr></table>';
print '</td><td colspan="3">';
if ($object->type != 2)
{
if ($_GET['action'] == 'editconditions')
{
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->cond_reglement_id,'cond_reglement_id');
}
else
{
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->cond_reglement_id,'none');
}
}
else
{
print '&nbsp;';
}
print '</td></tr>';
// Mode de reglement // Amount Local Taxes
print '<tr><td>'; if ($mysoc->country_code=='ES')
print '<table class="nobordernopadding" width="100%"><tr><td>'; {
print $langs->trans('PaymentMode'); if ($mysoc->localtax1_assuj=="1") //Localtax1 RE
print '</td>'; {
if ($_GET['action'] != 'editmode' && $object->brouillon && $user->rights->facture->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;facid='.$object->id.'">'.img_edit($langs->trans('SetMode'),1).'</a></td>'; print '<tr><td>'.$langs->transcountry("AmountLT1",$mysoc->country_code).'</td>';
print '</tr></table>'; print '<td align="right" colspan="2" nowrap>'.price($object->total_localtax1).'</td>';
print '</td><td colspan="3">'; print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
if ($_GET['action'] == 'editmode') }
{ if ($mysoc->localtax2_assuj=="1") //Localtax2 IRPF
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->mode_reglement_id,'mode_reglement_id'); {
} print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->country_code).'</td>';
else print '<td align="right" colspan="2" nowrap>'.price($object->total_localtax2).'</td>';
{ print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->mode_reglement_id,'none'); }
} }
print '</td></tr>';
// Montants print '<tr><td>'.$langs->trans('AmountTTC').'</td><td align="right" colspan="2" nowrap>'.price($object->total_ttc).'</td>';
print '<tr><td>'.$langs->trans('AmountHT').'</td>'; print '<td>'.$langs->trans('Currency'.$conf->currency).'</td></tr>';
print '<td align="right" colspan="2" nowrap>'.price($object->total_ht).'</td>';
print '<td>'.$langs->trans('Currency'.$conf->currency).'</td></tr>';
print '<tr><td>'.$langs->trans('AmountVAT').'</td><td align="right" colspan="2" nowrap>'.price($object->total_tva).'</td>';
print '<td>'.$langs->trans('Currency'.$conf->currency).'</td></tr>';
// Amount Local Taxes // Statut
if ($mysoc->country_code=='ES') print '<tr><td>'.$langs->trans('Status').'</td>';
{ print '<td align="left" colspan="3">'.($object->getLibStatut(4,$totalpaye)).'</td></tr>';
if ($mysoc->localtax1_assuj=="1") //Localtax1 RE
{
print '<tr><td>'.$langs->transcountry("AmountLT1",$mysoc->country_code).'</td>';
print '<td align="right" colspan="2" nowrap>'.price($object->total_localtax1).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
}
if ($mysoc->localtax2_assuj=="1") //Localtax2 IRPF
{
print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->country_code).'</td>';
print '<td align="right" colspan="2" nowrap>'.price($object->total_localtax2).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
}
}
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td align="right" colspan="2" nowrap>'.price($object->total_ttc).'</td>'; print '<tr><td>'.$langs->trans("RIB").'</td><td colspan="5">';
print '<td>'.$langs->trans('Currency'.$conf->currency).'</td></tr>'; print $object->thirdparty->display_rib();
print '</td></tr>';
// Statut print '</table>';
print '<tr><td>'.$langs->trans('Status').'</td>';
print '<td align="left" colspan="3">'.($object->getLibStatut(4,$totalpaye)).'</td></tr>';
print '<tr><td>'.$langs->trans("RIB").'</td><td colspan="5">'; dol_fiche_end();
print $soc->display_rib();
print '</td></tr>';
print '</table>';
dol_fiche_end();
/* /*
* Withdrawal request * Withdrawal request
*/ */
$sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande"; $sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
$sql .= " , pfd.date_traite as date_traite"; $sql .= " , pfd.date_traite as date_traite";
$sql .= " , pfd.amount"; $sql .= " , pfd.amount";
$sql .= " , u.rowid as user_id, u.name, u.firstname, u.login"; $sql .= " , u.rowid as user_id, u.name, u.firstname, u.login";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= " , ".MAIN_DB_PREFIX."user as u"; $sql .= " , ".MAIN_DB_PREFIX."user as u";
$sql .= " WHERE fk_facture = ".$object->id; $sql .= " WHERE fk_facture = ".$object->id;
$sql .= " AND pfd.fk_user_demande = u.rowid"; $sql .= " AND pfd.fk_user_demande = u.rowid";
$sql .= " AND pfd.traite = 0"; $sql .= " AND pfd.traite = 0";
$sql .= " ORDER BY pfd.date_demande DESC"; $sql .= " ORDER BY pfd.date_demande DESC";
$result_sql = $db->query($sql); $result_sql = $db->query($sql);
if ($result_sql) if ($result_sql)
{ {
$num = $db->num_rows($result_sql); $num = $db->num_rows($result_sql);
} }
/* /*
* Buttons * Buttons
*/ */
print "\n<div class=\"tabsAction\">\n"; print "\n<div class=\"tabsAction\">\n";
// Add a withdraw request // Add a withdraw request
if ($object->statut > 0 && $object->paye == 0 && $num == 0) if ($object->statut > 0 && $object->paye == 0 && $num == 0)
{ {
if ($user->rights->prelevement->bons->creer) if ($user->rights->prelevement->bons->creer)
{ {
print '<a class="butAction" href="prelevement.php?facid='.$object->id.'&amp;action=new">'.$langs->trans("MakeWithdrawRequest").'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=new">'.$langs->trans("MakeWithdrawRequest").'</a>';
} }
else else
{ {
print '<a class="butActionRefused" href="#">'.$langs->trans("MakeWithdrawRequest").'</a>'; print '<a class="butActionRefused" href="#">'.$langs->trans("MakeWithdrawRequest").'</a>';
} }
} }
print "</div><br>\n"; print "</div><br>\n";
print $langs->trans("DoStandingOrdersBeforePayments").'<br>'; print $langs->trans("DoStandingOrdersBeforePayments").'<br>';
/* /*
* Withdrawals * Withdrawals
*/ */
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td align="left">'.$langs->trans("DateRequest").'</td>'; print '<td align="left">'.$langs->trans("DateRequest").'</td>';
print '<td align="center">'.$langs->trans("DateProcess").'</td>'; print '<td align="center">'.$langs->trans("DateProcess").'</td>';
print '<td align="center">'.$langs->trans("Amount").'</td>'; print '<td align="center">'.$langs->trans("Amount").'</td>';
print '<td align="center">'.$langs->trans("WithdrawalReceipt").'</td>'; print '<td align="center">'.$langs->trans("WithdrawalReceipt").'</td>';
print '<td align="center">'.$langs->trans("User").'</td><td>&nbsp;</td><td>&nbsp;</td>'; print '<td align="center">'.$langs->trans("User").'</td><td>&nbsp;</td><td>&nbsp;</td>';
print '</tr>'; print '</tr>';
$var=True; $var=True;
if ($result_sql) if ($result_sql)
{ {
$i = 0; $i = 0;
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($result_sql); $obj = $db->fetch_object($result_sql);
$var=!$var; $var=!$var;
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
print '<td align="left">'.dol_print_date($db->jdate($obj->date_demande),'day')."</td>\n"; print '<td align="left">'.dol_print_date($db->jdate($obj->date_demande),'day')."</td>\n";
print '<td align="center">'.$langs->trans("OrderWaiting").'</td>'; print '<td align="center">'.$langs->trans("OrderWaiting").'</td>';
print '<td align="center">'.price($obj->amount).'</td>'; print '<td align="center">'.price($obj->amount).'</td>';
print '<td align="center">-</td>'; print '<td align="center">-</td>';
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a></td>'; print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a></td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '<td>'; print '<td>';
print '<a href="prelevement.php?facid='.$object->id.'&amp;action=delete&amp;did='.$obj->rowid.'">'; print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=delete&amp;did='.$obj->rowid.'">';
print img_delete(); print img_delete();
print '</a></td>'; print '</a></td>';
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
} }
$db->free($result_sql); $db->free($result_sql);
} }
else else
{ {
dol_print_error($db); dol_print_error($db);
} }
$sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande,"; $sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande,";
$sql.= " pfd.date_traite, pfd.fk_prelevement_bons, pfd.amount,"; $sql.= " pfd.date_traite, pfd.fk_prelevement_bons, pfd.amount,";
$sql.= " pb.ref,"; $sql.= " pb.ref,";
$sql.= " u.rowid as user_id, u.name, u.firstname, u.login"; $sql.= " u.rowid as user_id, u.name, u.firstname, u.login";
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd,"; $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd,";
$sql.= " ".MAIN_DB_PREFIX."prelevement_bons as pb,"; $sql.= " ".MAIN_DB_PREFIX."prelevement_bons as pb,";
$sql.= " ".MAIN_DB_PREFIX."user as u"; $sql.= " ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE fk_facture = ".$object->id; $sql.= " WHERE fk_facture = ".$object->id;
$sql.= " AND pfd.fk_user_demande = u.rowid"; $sql.= " AND pfd.fk_user_demande = u.rowid";
$sql.= " AND pb.rowid = pfd.fk_prelevement_bons"; $sql.= " AND pb.rowid = pfd.fk_prelevement_bons";
$sql.= " AND pfd.traite = 1"; $sql.= " AND pfd.traite = 1";
$sql.= " ORDER BY pfd.date_demande DESC"; $sql.= " ORDER BY pfd.date_demande DESC";
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$var=!$var; $var=!$var;
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
print '<td align="left">'.dol_print_date($db->jdate($obj->date_demande),'day')."</td>\n"; print '<td align="left">'.dol_print_date($db->jdate($obj->date_demande),'day')."</td>\n";
print '<td align="center">'.dol_print_date($db->jdate($obj->date_traite),'day')."</td>\n"; print '<td align="center">'.dol_print_date($db->jdate($obj->date_traite),'day')."</td>\n";
print '<td align="center">'.price($obj->amount).'</td>'; print '<td align="center">'.price($obj->amount).'</td>';
print '<td align="center">'; print '<td align="center">';
$withdrawreceipt=new BonPrelevement($db); $withdrawreceipt=new BonPrelevement($db);
$withdrawreceipt->id=$obj->fk_prelevement_bons; $withdrawreceipt->id=$obj->fk_prelevement_bons;
$withdrawreceipt->ref=$obj->ref; $withdrawreceipt->ref=$obj->ref;
print $withdrawreceipt->getNomUrl(1); print $withdrawreceipt->getNomUrl(1);
print "</td>\n"; print "</td>\n";
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a></td>'; print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a></td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
} }
$db->free($result); $db->free($result);
} }
else else
{ {
dol_print_error($db); dol_print_error($db);
} }
print "</table>"; print "</table>";
}
else
{
/* Invoice not found */
print $langs->trans("ErrorBillNotFound",$_GET["facid"]);
}
} }
$db->close();
llxFooter(); llxFooter();
$db->close();
?> ?>

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* *
@ -28,7 +28,9 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"); require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"); require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php");
require_once(DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'); require_once(DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php');
if ($conf->esaeb->enabled) dol_include_once('/esaeb/class/esaeb19.class.php'); // FIXME don't include external module class
if (! empty($conf->esaeb->enabled))
dol_include_once('/esaeb/class/esaeb19.class.php');
/** /**

View File

@ -17,10 +17,10 @@
* *
*/ */
/** /**
* \file htdocs/compta/prelevement/facturesrejets.php * \file htdocs/compta/prelevement/facturesrejets.php
* \ingroup prelevement * \ingroup prelevement
* \brief Invoice reject * \brief Invoice reject
*/ */
require("../bank/pre.inc.php"); require("../bank/pre.inc.php");

View File

@ -1,8 +1,8 @@
<?php <?php
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -73,18 +73,21 @@ llxHeader();
$sql = "SELECT"; $sql = "SELECT";
$sql.= " f.ref, f.rowid as fichid, f.fk_statut, f.description,"; $sql.= " f.ref, f.rowid as fichid, f.fk_statut, f.description,";
$sql.= " fd.description as descriptiondetail, fd.date as dp, fd.duree,"; $sql.= " fd.description as descriptiondetail, fd.date as dp, fd.duree,";
$sql.= " s.nom, s.rowid as socid"; $sql.= " s.nom, s.rowid as socid, s.client";
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s"; $sql.= " FROM (".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (! $user->rights->societe->client->voir && empty($socid))
$sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= ", ".MAIN_DB_PREFIX."fichinter as f)"; $sql.= ", ".MAIN_DB_PREFIX."fichinter as f)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as fd ON fd.fk_fichinter = f.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as fd ON fd.fk_fichinter = f.rowid";
$sql.= " WHERE f.fk_soc = s.rowid "; $sql.= " WHERE f.fk_soc = s.rowid ";
$sql.= " AND f.entity = ".$conf->entity; $sql.= " AND f.entity = ".$conf->entity;
if ($search_ref) $sql .= " AND f.ref like '%".$db->escape($search_ref)."%'"; if ($search_ref) $sql .= " AND f.ref LIKE '%".$db->escape($search_ref)."%'";
if ($search_company) $sql .= " AND s.nom like '%".$db->escape($search_company)."%'"; if ($search_company) $sql .= " AND s.nom LIKE '%".$db->escape($search_company)."%'";
if ($search_desc) $sql .= " AND (f.description like '%".$db->escape($search_desc)."%' OR fd.description like '%".$db->escape($search_desc)."%')"; if ($search_desc) $sql .= " AND (f.description LIKE '%".$db->escape($search_desc)."%' OR fd.description LIKE '%".$db->escape($search_desc)."%')";
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if (! $user->rights->societe->client->voir && empty($socid))
if ($socid) $sql.= " AND s.rowid = " . $socid; $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid)
$sql.= " AND s.rowid = " . $socid;
$sql.= " ORDER BY ".$sortfield." ".$sortorder; $sql.= " ORDER BY ".$sortfield." ".$sortorder;
$sql.= $db->plimit($limit+1, $offset); $sql.= $db->plimit($limit+1, $offset);
@ -96,12 +99,12 @@ if ($result)
$interventionstatic=new Fichinter($db); $interventionstatic=new Fichinter($db);
$urlparam="&amp;socid=$socid"; $urlparam="&amp;socid=$socid";
print_barre_liste($langs->trans("ListOfInterventions"), $page, "list.php",$urlparam,$sortfield,$sortorder,'',$num); print_barre_liste($langs->trans("ListOfInterventions"), $page, $_SERVER['PHP_SELF'], $urlparam, $sortfield, $sortorder, '', $num);
print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">'."\n"; print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">'."\n";
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print "<tr class=\"liste_titre\">"; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.ref","",$urlparam,'width="15%"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.ref","",$urlparam,'width="15%"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","",$urlparam,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","",$urlparam,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Description"),$_SERVER["PHP_SELF"],"f.description","",$urlparam,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Description"),$_SERVER["PHP_SELF"],"f.description","",$urlparam,'',$sortfield,$sortorder);