Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into develop

This commit is contained in:
markus 2019-02-19 11:32:46 +01:00
commit 23b2945f53
13 changed files with 172 additions and 203 deletions

View File

@ -87,8 +87,8 @@ $arrayfields=array(
'c.dateadh'=>array('label'=>$langs->trans("DateSubscription"), 'checked'=>1, 'position'=>100),
'c.datef'=>array('label'=>$langs->trans("EndSubscription"), 'checked'=>1, 'position'=>101),
'd.amount'=>array('label'=>$langs->trans("Amount"), 'checked'=>1, 'position'=>102),
'd.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'd.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
'c.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'c.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
// 'd.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000)
);
@ -367,13 +367,13 @@ $parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (! empty($arrayfields['d.datec']['checked']))
if (! empty($arrayfields['c.datec']['checked']))
{
print '<td class="liste_titre">';
print '</td>';
}
// Date modification
if (! empty($arrayfields['d.tms']['checked']))
if (! empty($arrayfields['c.tms']['checked']))
{
print '<td class="liste_titre">';
print '</td>';
@ -436,9 +436,9 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (! empty($arrayfields['d.datec']['checked'])) print_liste_field_titre($arrayfields['d.datec']['label'], $_SERVER["PHP_SELF"], "d.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
if (! empty($arrayfields['d.tms']['checked'])) print_liste_field_titre($arrayfields['d.tms']['label'], $_SERVER["PHP_SELF"], "d.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
if (! empty($arrayfields['c.datec']['checked'])) print_liste_field_titre($arrayfields['c.datec']['label'], $_SERVER["PHP_SELF"], "c.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
if (! empty($arrayfields['c.tms']['checked'])) print_liste_field_titre($arrayfields['c.tms']['label'], $_SERVER["PHP_SELF"], "c.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
print "</tr>\n";
@ -553,7 +553,7 @@ while ($i < min($num, $limit))
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (! empty($arrayfields['d.datec']['checked']))
if (! empty($arrayfields['c.datec']['checked']))
{
print '<td align="center" class="nowrap">';
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
@ -561,7 +561,7 @@ while ($i < min($num, $limit))
if (! $i) $totalarray['nbfield']++;
}
// Date modification
if (! empty($arrayfields['d.tms']['checked']))
if (! empty($arrayfields['c.tms']['checked']))
{
print '<td align="center" class="nowrap">';
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -411,7 +411,7 @@ if ($socid > 0)
print load_fiche_titre($langs->trans("CustomerDiscounts"), '', '');
}
$sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,";
$sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
$sql.= " rc.datec as dc, rc.description,";
$sql.= " rc.fk_facture_source,";
$sql.= " u.login, u.rowid as user_id,";
@ -433,11 +433,19 @@ if ($socid > 0)
print '<tr class="liste_titre">';
print '<td class="widthdate">'.$langs->trans("Date").'</td>'; // Need 120+ for format with AM/PM
print '<td>'.$langs->trans("ReasonDiscount").'</td>';
print '<td width="150" class="nowrap">'.$langs->trans("ConsumedBy").'</td>';
print '<td width="120" class="right">'.$langs->trans("AmountHT").'</td>';
print '<td width="80" class="right">'.$langs->trans("VATRate").'</td>';
print '<td width="120" class="right">'.$langs->trans("AmountTTC").'</td>';
print '<td width="100" align="center">'.$langs->trans("DiscountOfferedBy").'</td>';
print '<td class="nowrap">'.$langs->trans("ConsumedBy").'</td>';
print '<td class="right">'.$langs->trans("AmountHT").'</td>';
if (! empty($conf->multicurrency->enabled))
{
print '<td class="right">'.$langs->trans("MulticurrencyAmountHT").'</td>';
}
print '<td class="right">'.$langs->trans("VATRate").'</td>';
print '<td class="right">'.$langs->trans("AmountTTC").'</td>';
if (! empty($conf->multicurrency->enabled))
{
print '<td class="right">'.$langs->trans("MulticurrencyAmountTTC").'</td>';
}
print '<td width="100" class="center">'.$langs->trans("DiscountOfferedBy").'</td>';
print '<td width="50">&nbsp;</td>';
print '</tr>';
@ -455,7 +463,7 @@ if ($socid > 0)
print '<td>'.dol_print_date($db->jdate($obj->dc), 'dayhour').'</td>';
if (preg_match('/\(CREDIT_NOTE\)/', $obj->description))
{
print '<td class="nowrap">';
print '<td class="minwidth100">';
$facturestatic->id=$obj->fk_facture_source;
$facturestatic->ref=$obj->ref;
$facturestatic->type=$obj->type;
@ -464,7 +472,7 @@ if ($socid > 0)
}
elseif (preg_match('/\(DEPOSIT\)/', $obj->description))
{
print '<td class="nowrap">';
print '<td class="minwidth100">';
$facturestatic->id=$obj->fk_facture_source;
$facturestatic->ref=$obj->ref;
$facturestatic->type=$obj->type;
@ -473,7 +481,7 @@ if ($socid > 0)
}
elseif (preg_match('/\(EXCESS RECEIVED\)/', $obj->description))
{
print '<td class="nowrap">';
print '<td class="minwidth100">';
$facturestatic->id=$obj->fk_facture_source;
$facturestatic->ref=$obj->ref;
$facturestatic->type=$obj->type;
@ -482,14 +490,22 @@ if ($socid > 0)
}
else
{
print '<td>';
print '<td class="minwidth100">';
print $obj->description;
print '</td>';
}
print '<td class="nowrap">'.$langs->trans("NotConsumed").'</td>';
print '<td class="right">'.price($obj->amount_ht).'</td>';
print '<td class="right">'.price2num($obj->tva_tx, 'MU').'%</td>';
if (! empty($conf->multicurrency->enabled))
{
print '<td class="right">'.price($obj->multicurrency_amount_ht).'</td>';
}
print '<td class="right">'.vatrate($obj->tva_tx, true).'</td>';
print '<td class="right">'.price($obj->amount_ttc).'</td>';
if (! empty($conf->multicurrency->enabled))
{
print '<td class="right">'.price($obj->multicurrency_amount_ttc).'</td>';
}
print '<td align="center">';
print '<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"), 'user').' '.$obj->login.'</a>';
print '</td>';
@ -497,7 +513,7 @@ if ($socid > 0)
{
print '<td class="nowrap">';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=split&remid='.$obj->rowid.($backtopage?'&backtopage='.urlencode($backtopage):'').'">'.img_split($langs->trans("SplitDiscount")).'</a>';
print ' &nbsp; ';
//print ' &nbsp; ';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=remove&remid='.$obj->rowid.($backtopage?'&backtopage='.urlencode($backtopage):'').'">'.img_delete($langs->trans("RemoveDiscount")).'</a>';
print '</td>';
}
@ -550,7 +566,7 @@ if ($socid > 0)
/*
* Liste remises fixes fournisseur restant en cours (= liees a aucune facture ni ligne de facture)
*/
$sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,";
$sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
$sql.= " rc.datec as dc, rc.description,";
$sql.= " rc.fk_invoice_supplier_source,";
$sql.= " u.login, u.rowid as user_id,";
@ -572,11 +588,19 @@ if ($socid > 0)
print '<tr class="liste_titre">';
print '<td class="widthdate">'.$langs->trans("Date").'</td>'; // Need 120+ for format with AM/PM
print '<td>'.$langs->trans("ReasonDiscount").'</td>';
print '<td width="150" class="nowrap">'.$langs->trans("ConsumedBy").'</td>';
print '<td width="120" class="right">'.$langs->trans("AmountHT").'</td>';
print '<td width="80" class="right">'.$langs->trans("VATRate").'</td>';
print '<td width="120" class="right">'.$langs->trans("AmountTTC").'</td>';
print '<td width="100" align="center">'.$langs->trans("DiscountOfferedBy").'</td>';
print '<td class="nowrap">'.$langs->trans("ConsumedBy").'</td>';
print '<td class="right">'.$langs->trans("AmountHT").'</td>';
if (! empty($conf->multicurrency->enabled))
{
print '<td class="right">'.$langs->trans("MulticurrencyAmountHT").'</td>';
}
print '<td class="right">'.$langs->trans("VATRate").'</td>';
print '<td class="right">'.$langs->trans("AmountTTC").'</td>';
if (! empty($conf->multicurrency->enabled))
{
print '<td class="right">'.$langs->trans("MulticurrencyAmountTTC").'</td>';
}
print '<td width="100" class="center">'.$langs->trans("DiscountOfferedBy").'</td>';
print '<td width="50">&nbsp;</td>';
print '</tr>';
@ -594,7 +618,7 @@ if ($socid > 0)
print '<td>'.dol_print_date($db->jdate($obj->dc), 'dayhour').'</td>';
if (preg_match('/\(CREDIT_NOTE\)/', $obj->description))
{
print '<td class="nowrap">';
print '<td class="minwidth100">';
$facturefournstatic->id=$obj->fk_invoice_supplier_source;
$facturefournstatic->ref=$obj->ref;
$facturefournstatic->type=$obj->type;
@ -603,7 +627,7 @@ if ($socid > 0)
}
elseif (preg_match('/\(DEPOSIT\)/', $obj->description))
{
print '<td class="nowrap">';
print '<td class="minwidth100">';
$facturefournstatic->id=$obj->fk_invoice_supplier_source;
$facturefournstatic->ref=$obj->ref;
$facturefournstatic->type=$obj->type;
@ -612,7 +636,7 @@ if ($socid > 0)
}
elseif (preg_match('/\(EXCESS PAID\)/', $obj->description))
{
print '<td class="nowrap">';
print '<td class="minwidth100">';
$facturefournstatic->id=$obj->fk_invoice_supplier_source;
$facturefournstatic->ref=$obj->ref;
$facturefournstatic->type=$obj->type;
@ -621,22 +645,30 @@ if ($socid > 0)
}
else
{
print '<td>';
print '<td class="minwidth100">';
print $obj->description;
print '</td>';
}
print '<td class="nowrap">'.$langs->trans("NotConsumed").'</td>';
print '<td class="right">'.price($obj->amount_ht).'</td>';
print '<td class="right">'.price2num($obj->tva_tx, 'MU').'%</td>';
if (! empty($conf->multicurrency->enabled))
{
print '<td class="right">'.price($obj->multicurrency_amount_ht).'</td>';
}
print '<td class="right">'.vatrate($obj->tva_tx, true).'</td>';
print '<td class="right">'.price($obj->amount_ttc).'</td>';
print '<td align="center">';
if (! empty($conf->multicurrency->enabled))
{
print '<td class="right">'.price($obj->multicurrency_amount_ttc).'</td>';
}
print '<td class="center">';
print '<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"), 'user').' '.$obj->login.'</a>';
print '</td>';
if ($user->rights->societe->creer || $user->rights->facture->creer)
{
print '<td class="nowrap">';
print '<td class="center nowrap">';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=split&remid='.$obj->rowid.($backtopage?'&backtopage='.urlencode($backtopage):'').'">'.img_split($langs->trans("SplitDiscount")).'</a>';
print ' &nbsp; ';
//print ' &nbsp; ';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=remove&remid='.$obj->rowid.($backtopage?'&backtopage='.urlencode($backtopage):'').'">'.img_delete($langs->trans("RemoveDiscount")).'</a>';
print '</td>';
}
@ -700,7 +732,7 @@ if ($socid > 0)
}
// Remises liees a lignes de factures
$sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,";
$sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
$sql.= " rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture,";
$sql.= " rc.fk_facture_source,";
$sql.= " u.login, u.rowid as user_id,";
@ -745,11 +777,19 @@ if ($socid > 0)
print '<tr class="liste_titre">';
print '<td class="widthdate">'.$langs->trans("Date").'</td>'; // Need 120+ for format with AM/PM
print '<td>'.$langs->trans("ReasonDiscount").'</td>';
print '<td width="150" class="nowrap">'.$langs->trans("ConsumedBy").'</td>';
print '<td width="120" class="right">'.$langs->trans("AmountHT").'</td>';
print '<td width="80" class="right">'.$langs->trans("VATRate").'</td>';
print '<td width="120" class="right">'.$langs->trans("AmountTTC").'</td>';
print '<td width="100" align="center">'.$langs->trans("Author").'</td>';
print '<td class="nowrap">'.$langs->trans("ConsumedBy").'</td>';
print '<td class="right">'.$langs->trans("AmountHT").'</td>';
if (! empty($conf->multicurrency->enabled))
{
print '<td class="right">'.$langs->trans("MulticurrencyAmountHT").'</td>';
}
print '<td class="right">'.$langs->trans("VATRate").'</td>';
print '<td class="right">'.$langs->trans("AmountTTC").'</td>';
if (! empty($conf->multicurrency->enabled))
{
print '<td class="right">'.$langs->trans("MulticurrencyAmountTTC").'</td>';
}
print '<td width="100" class="center">'.$langs->trans("Author").'</td>';
print '<td width="50">&nbsp;</td>';
print '</tr>';
@ -788,7 +828,7 @@ if ($socid > 0)
print '<td>'.dol_print_date($db->jdate($obj->dc), 'dayhour').'</td>';
if (preg_match('/\(CREDIT_NOTE\)/', $obj->description))
{
print '<td class="nowrap">';
print '<td class="minwidth100">';
$facturestatic->id=$obj->fk_facture_source;
$facturestatic->ref=$obj->ref;
$facturestatic->type=$obj->type;
@ -797,7 +837,7 @@ if ($socid > 0)
}
elseif (preg_match('/\(DEPOSIT\)/', $obj->description))
{
print '<td class="nowrap">';
print '<td class="minwidth100">';
$facturestatic->id=$obj->fk_facture_source;
$facturestatic->ref=$obj->ref;
$facturestatic->type=$obj->type;
@ -806,7 +846,7 @@ if ($socid > 0)
}
elseif (preg_match('/\(EXCESS RECEIVED\)/', $obj->description))
{
print '<td class="nowrap">';
print '<td class="minwidth100">';
$facturestatic->id=$obj->fk_facture_source;
$facturestatic->ref=$obj->ref;
$facturestatic->type=$obj->type;
@ -815,15 +855,23 @@ if ($socid > 0)
}
else
{
print '<td>';
print '<td class="minwidth100">';
print $obj->description;
print '</td>';
}
print '<td align="left" class="nowrap"><a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"), 'bill').' '.$obj->ref.'</a></td>';
print '<td class="left nowrap"><a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"),'bill').' '.$obj->ref.'</a></td>';
print '<td class="right">'.price($obj->amount_ht).'</td>';
print '<td class="right">'.price2num($obj->tva_tx, 'MU').'%</td>';
if (! empty($conf->multicurrency->enabled))
{
print '<td class="right">'.price($obj->multicurrency_amount_ht).'</td>';
}
print '<td class="right">'.vatrate($obj->tva_tx, true).'</td>';
print '<td class="right">'.price($obj->amount_ttc).'</td>';
print '<td align="center">';
if (! empty($conf->multicurrency->enabled))
{
print '<td class="right">'.price($obj->multicurrency_amount_ttc).'</td>';
}
print '<td class="center">';
print '<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"), 'user').' '.$obj->login.'</a>';
print '</td>';
print '<td>&nbsp;</td>';
@ -854,7 +902,7 @@ if ($socid > 0)
}
// Remises liees a lignes de factures
$sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,";
$sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
$sql.= " rc.datec as dc, rc.description, rc.fk_invoice_supplier_line, rc.fk_invoice_supplier,";
$sql.= " rc.fk_invoice_supplier_source,";
$sql.= " u.login, u.rowid as user_id,";
@ -899,11 +947,19 @@ if ($socid > 0)
print '<tr class="liste_titre">';
print '<td class="widthdate">'.$langs->trans("Date").'</td>'; // Need 120+ for format with AM/PM
print '<td>'.$langs->trans("ReasonDiscount").'</td>';
print '<td width="150" class="nowrap">'.$langs->trans("ConsumedBy").'</td>';
print '<td width="120" class="right">'.$langs->trans("AmountHT").'</td>';
print '<td width="80" class="right">'.$langs->trans("VATRate").'</td>';
print '<td width="120" class="right">'.$langs->trans("AmountTTC").'</td>';
print '<td width="100" align="center">'.$langs->trans("Author").'</td>';
print '<td class="nowrap">'.$langs->trans("ConsumedBy").'</td>';
print '<td class="right">'.$langs->trans("AmountHT").'</td>';
if (! empty($conf->multicurrency->enabled))
{
print '<td class="right">'.$langs->trans("MulticurrencyAmountHT").'</td>';
}
print '<td class="right">'.$langs->trans("VATRate").'</td>';
print '<td class="right">'.$langs->trans("AmountTTC").'</td>';
if (! empty($conf->multicurrency->enabled))
{
print '<td class="right">'.$langs->trans("MulticurrencyAmountTTC").'</td>';
}
print '<td width="100" class="center">'.$langs->trans("Author").'</td>';
print '<td width="50">&nbsp;</td>';
print '</tr>';
@ -942,7 +998,7 @@ if ($socid > 0)
print '<td>'.dol_print_date($db->jdate($obj->dc), 'dayhour').'</td>';
if (preg_match('/\(CREDIT_NOTE\)/', $obj->description))
{
print '<td class="nowrap">';
print '<td class="minwidth100">';
$facturefournstatic->id=$obj->fk_invoice_supplier_source;
$facturefournstatic->ref=$obj->ref;
$facturefournstatic->type=$obj->type;
@ -951,7 +1007,7 @@ if ($socid > 0)
}
elseif (preg_match('/\(DEPOSIT\)/', $obj->description))
{
print '<td class="nowrap">';
print '<td class="minwidth100">';
$facturefournstatic->id=$obj->fk_invoice_supplier_source;
$facturefournstatic->ref=$obj->ref;
$facturefournstatic->type=$obj->type;
@ -960,7 +1016,7 @@ if ($socid > 0)
}
elseif (preg_match('/\(EXCESS PAID\)/', $obj->description))
{
print '<td class="nowrap">';
print '<td class="minwidth100">';
$facturefournstatic->id=$obj->fk_invoice_supplier_source;
$facturefournstatic->ref=$obj->ref;
$facturefournstatic->type=$obj->type;
@ -969,14 +1025,22 @@ if ($socid > 0)
}
else
{
print '<td>';
print '<td class="minwidth100">';
print $obj->description;
print '</td>';
}
print '<td align="left" class="nowrap"><a href="'.DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"), 'bill').' '.$obj->ref.'</a></td>';
print '<td class="left nowrap"><a href="'.DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"),'bill').' '.$obj->ref.'</a></td>';
print '<td class="right">'.price($obj->amount_ht).'</td>';
print '<td class="right">'.price2num($obj->tva_tx, 'MU').'%</td>';
if (! empty($conf->multicurrency->enabled))
{
print '<td class="right">'.price($obj->multicurrency_amount_ht).'</td>';
}
print '<td class="right">'.vatrate($obj->tva_tx, true).'</td>';
print '<td class="right">'.price($obj->amount_ttc).'</td>';
if (! empty($conf->multicurrency->enabled))
{
print '<td class="right">'.price($obj->multicurrency_amount_ttc).'</td>';
}
print '<td align="center">';
print '<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"), 'user').' '.$obj->login.'</a>';
print '</td>';

View File

@ -696,6 +696,7 @@ if (empty($reshook))
$db->begin();
$amount_ht = $amount_tva = $amount_ttc = array();
$multicurrency_amount_ht = $multicurrency_amount_tva = $multicurrency_amount_ttc = array();
// Loop on each vat rate
$i = 0;
@ -709,7 +710,7 @@ if (empty($reshook))
$multicurrency_amount_ht[$line->tva_tx] += $line->multicurrency_total_ht;
$multicurrency_amount_tva[$line->tva_tx] += $line->multicurrency_total_tva;
$multicurrency_amount_ttc[$line->tva_tx] += $line->multicurrency_total_ttc;
$i ++;
$i++;
}
}
@ -4671,6 +4672,13 @@ elseif ($id > 0 || ! empty($ref))
}
}
// POS Ticket
if (! empty($conf->takepos->enabled) && $object->module_source != '')
{
$receipt_url=DOL_URL_ROOT."/takepos/receipt.php";
print '<div class="inline-block divButAction"><a target="_blank" class="butAction" href="' . $receipt_url . '?facid=' . $object->id.'">' . $langs->trans('POSTicket') .'</a></div>';
}
// Classify paid
if ($object->statut == 1 && $object->paye == 0 && $usercanissuepayment && (($object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT && $resteapayer <= 0) || ($object->type == Facture::TYPE_CREDIT_NOTE && $resteapayer >= 0))
|| ($object->type == Facture::TYPE_DEPOSIT && $object->paye == 0 && $object->total_ttc > 0 && $resteapayer == 0 && $usercanissuepayment && empty($discount->id))

View File

@ -253,11 +253,13 @@ if (empty($reshook))
$paiement->amounts = $amounts; // Array with all payments dispatching with invoice id
$paiement->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching
$paiement->paiementid = dol_getIdFromCode($db, GETPOST('paiementcode'), 'c_paiement', 'code', 'id', 1);
$paiement->num_paiement = GETPOST('num_paiement');
$paiement->note = GETPOST('comment');
$paiement->num_paiement = GETPOST('num_paiement', 'alpha');
$paiement->note = GETPOST('comment', 'alpha');
if (! $error)
{
// Create payment and update this->multicurrency_amounts if this->amounts filled or
// this->amounts if this->multicurrency_amounts filled.
$paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices')=='on'?1:0), $thirdparty); // This include closing invoices and regenerating documents
if ($paiement_id < 0)
{
@ -635,7 +637,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
// Date
print '<td align="center">'.dol_print_date($db->jdate($objp->df), 'day')."</td>\n";
// Date Max Payment
// Due date
if ($objp->dlr > 0 )
{
print '<td align="center">';
@ -650,7 +652,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
}
else
{
print '<td align="center"><b>--</b></td>';
print '<td align="center"></td>';
}
// Currency
@ -673,12 +675,12 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
}
print '</td>';
// Multicurrency Price
// Multicurrency remain to pay
print '<td align="right">';
if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) print price($sign * $multicurrency_remaintopay);
print '</td>';
print '<td align="right">';
print '<td class="right nowraponall">';
// Add remind multicurrency amount
$namef = 'multicurrency_amount_'.$objp->facid;
@ -690,12 +692,12 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
{
if (!empty($conf->use_javascript_ajax))
print img_picto("Auto fill", 'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $multicurrency_remaintopay)."'");
print '<input type=hidden class="multicurrency_remain" name="'.$nameRemain.'" value="'.$multicurrency_remaintopay.'">';
print '<input type="text" size="8" class="multicurrency_amount" name="'.$namef.'" value="'.$_POST[$namef].'">';
print '<input type="text" class="maxwidth75 multicurrency_amount" name="'.$namef.'" value="'.$_POST[$namef].'">';
print '<input type="hidden" class="multicurrency_remain" name="'.$nameRemain.'" value="'.$multicurrency_remaintopay.'">';
}
else
{
print '<input type="text" size="8" name="'.$namef.'_disabled" value="'.$_POST[$namef].'" disabled>';
print '<input type="text" class="maxwidth75" name="'.$namef.'_disabled" value="'.$_POST[$namef].'" disabled>';
print '<input type="hidden" name="'.$namef.'" value="'.$_POST[$namef].'">';
}
}
@ -716,7 +718,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
//$test= price(price2num($objp->total_ttc - $paiement - $creditnotes - $deposits));
// Amount
print '<td align="right">';
print '<td class="right nowraponall">';
// Add remind amount
$namef = 'amount_'.$objp->facid;
@ -726,12 +728,12 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
{
if (!empty($conf->use_javascript_ajax))
print img_picto("Auto fill", 'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $remaintopay)."'");
print '<input type="text" class="maxwidth75 amount" name="'.$namef.'" value="'.dol_escape_htmltag(GETPOST($namef)).'">';
print '<input type="hidden" class="remain" name="'.$nameRemain.'" value="'.$remaintopay.'">';
print '<input type="text" size="8" class="amount" name="'.$namef.'" value="'.dol_escape_htmltag(GETPOST($namef)).'">';
}
else
{
print '<input type="text" size="8" name="'.$namef.'_disabled" value="'.dol_escape_htmltag(GETPOST($namef)).'" disabled>';
print '<input type="text" class="maxwidth75" name="'.$namef.'_disabled" value="'.dol_escape_htmltag(GETPOST($namef)).'" disabled>';
print '<input type="hidden" name="'.$namef.'" value="'.dol_escape_htmltag(GETPOST($namef)).'">';
}
print "</td>";

View File

@ -366,6 +366,7 @@ class Paiement extends CommonObject
if ($invoice->type == Facture::TYPE_DEPOSIT)
{
$amount_ht = $amount_tva = $amount_ttc = array();
$multicurrency_amount_ht = $multicurrency_amount_tva = $multicurrency_amount_ttc = array();
// Insert one discount by VAT rate category
$discount = new DiscountAbsolute($this->db);
@ -384,6 +385,9 @@ class Paiement extends CommonObject
$amount_ht[$line->tva_tx] += $line->total_ht;
$amount_tva[$line->tva_tx] += $line->total_tva;
$amount_ttc[$line->tva_tx] += $line->total_ttc;
$multicurrency_amount_ht[$line->tva_tx] += $line->multicurrency_total_ht;
$multicurrency_amount_tva[$line->tva_tx] += $line->multicurrency_total_tva;
$multicurrency_amount_ttc[$line->tva_tx] += $line->multicurrency_total_ttc;
$i++;
}
}
@ -392,6 +396,9 @@ class Paiement extends CommonObject
$discount->amount_ht = abs($amount_ht[$tva_tx]);
$discount->amount_tva = abs($amount_tva[$tva_tx]);
$discount->amount_ttc = abs($amount_ttc[$tva_tx]);
$discount->multicurrency_amount_ht = abs($multicurrency_amount_ht[$tva_tx]);
$discount->multicurrency_amount_tva = abs($multicurrency_amount_tva[$tva_tx]);
$discount->multicurrency_amount_ttc = abs($multicurrency_amount_ttc[$tva_tx]);
$discount->tva_tx = abs($tva_tx);
$result = $discount->create($user);
@ -1110,7 +1117,7 @@ class Paiement extends CommonObject
/**
* get the right way of payment
*
* @return string 'dolibarr' if standard comportment or paid in dolibarr currency, 'customer' if payment received from multicurrency inputs
* @return string 'dolibarr' if standard comportment or paid in main currency, 'customer' if payment received from multicurrency inputs
*/
function getWay()
{

View File

@ -53,10 +53,13 @@ class DiscountAbsolute
*/
public $fk_soc;
public $discount_type; // 0 => customer discount, 1 => supplier discount
public $amount_ht; //
public $discount_type; // 0 => customer discount, 1 => supplier discount
public $amount_ht; //
public $amount_tva; //
public $amount_ttc; //
public $multicurrency_amount_ht;
public $multicurrency_amount_tva;
public $multicurrency_amount_ttc;
public $tva_tx; // Vat rate
/**

View File

@ -86,7 +86,7 @@ class modTakePos extends DolibarrModules
'tpl' => 0, // Set this to 1 if module overwrite template dir (core/tpl)
'barcode' => 0, // Set this to 1 if module has its own barcode directory (core/modules/barcode)
'models' => 0, // Set this to 1 if module has its own models directory (core/modules/xxx)
'hooks' => array('data'=>array('invoicecard'), 'entity'=>'0') // Set here all hooks context managed by module. To find available hook context, make a "grep -r '>initHooks(' *" on source code. You can also set hook context 'all'
'hooks' => array() // Set here all hooks context managed by module. To find available hook context, make a "grep -r '>initHooks(' *" on source code. You can also set hook context 'all'
);
// Data directories to create when module is enabled.

View File

@ -4470,6 +4470,7 @@ function migrate_delete_old_files($db, $langs, $conf)
'/societe/class/api_contact.class.php',
'/societe/class/api_thirdparty.class.php',
'/support/online.php',
'/takepos/class/actions_takepos.class.php'
);
foreach ($filetodeletearray as $filetodelete) {

View File

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<phpdoc>
<title>MyModule</title>
<parser>
<target>build/phpdoc</target>
<encoding>utf8</encoding>
<markers>
<item>TODO</item>
<item>FIXME</item>
</markers>
<extensions>
<extension>php</extension>
<extension>css</extension>
<extension>js</extension>
</extensions>
</parser>
<transformer>
<target>doc/code/phpdoc</target>
</transformer>
<transformations>
<template name="responsive"/>
</transformations>
<files>
<directory>.</directory>
<ignore>build/*</ignore>
<ignore>dev/*</ignore>
<ignore>doc/*</ignore>
<ignore>vendor/*</ignore>
</files>
</phpdoc>

View File

@ -428,7 +428,7 @@ if ($action == 'charge' && ! empty($conf->stripe->enabled))
'dol_version' => DOL_VERSION,
'dol_entity' => $conf->entity,
'dol_company' => $mysoc->name, // Usefull when using multicompany
'ipaddress'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR'])
'ipaddress'=> getUserRemoteIP()
);
if (! empty($thirdparty_id)) $metadata["dol_thirdparty_id"] = $thirdparty_id;
@ -602,7 +602,7 @@ $charge = \Stripe\Charge::create(array(
$_SESSION["FinalPaymentAmt"] = $amount;
$_SESSION["currencyCodeType"] = $currency;
$_SESSION["paymentType"] = '';
$_SESSION['ipaddress'] = $_SERVER['REMOTE_ADDR']; // Payer ip
$_SESSION['ipaddress'] = getUserRemoteIP(); // Payer ip
$_SESSION['payerID'] = is_object($customer)?$customer->id:'';
$_SESSION['TRANSACTIONID'] = is_object($charge)?$charge->id:'';

View File

@ -261,14 +261,14 @@ print '</td></tr>';
print '<tr class="oddeven"><td>';
print $langs->trans("BankAccount").'</td><td>';
print $form->select_comptes($conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS, 'STRIPE_BANK_ACCOUNT_FOR_PAYMENTS', 0, '', 1);
$form->select_comptes($conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS, 'STRIPE_BANK_ACCOUNT_FOR_PAYMENTS', 0, '', 1);
print '</td></tr>';
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // What is this for ?
{
print '<tr class="oddeven"><td>';
print $langs->trans("BankAccountForBankTransfer").'</td><td>';
print $form->select_comptes($conf->global->STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS, 'STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS', 0, '', 1);
$form->select_comptes($conf->global->STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS, 'STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS', 0, '', 1);
print '</td></tr>';
}

View File

@ -1,87 +0,0 @@
<?php
/* Copyright (C) 2018 SuperAdmin
*
* 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 takepos/class/actions_takepos.class.php
* \ingroup takepos
* \brief Hooks of takepos module
*/
/**
* Class ActionsTakePos
*/
class ActionsTakePos
{
/**
* @var DoliDB Database handler.
*/
public $db;
/**
* @var string Error
*/
public $error = '';
/**
* @var array Errors
*/
public $errors = array();
/**
* @var array Hook results. Propagated to $hookmanager->resArray for later reuse
*/
public $results = array();
/**
* @var string String displayed by executeHook() immediately after return
*/
public $resprints;
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
{
$this->db = $db;
}
/**
* Overloading the doActions function : replacing the parent's function with the one below
*
* @param array() $parameters Hook metadatas (context, etc...)
* @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...)
* @param string $action Current action (if set). Generally create or edit or null
* @param HookManager $hookmanager Hook manager propagated to allow calling another hook
* @return int < 0 on error, 0 on success, 1 to replace standard code
*/
public function addMoreActionsButtons($parameters, &$object, &$action, $hookmanager)
{
global $conf, $user, $langs;
/* print_r($parameters); print_r($object); echo "action: " . $action; */
if (in_array($parameters['currentcontext'], array('invoicecard'))) // do something only for the context 'somecontext1' or 'somecontext2'
{
$receipt_url=DOL_URL_ROOT."/takepos/receipt.php";
$this->resprints = '<div class="inline-block divButAction"><a target="_blank" class="butAction" href="' . $receipt_url . '?facid=' . $object->id.'">' . $langs->trans('Ticket') .'</a></div>';
}
return 0; // or return 1 to replace standard code
}
}

View File

@ -78,7 +78,7 @@ if ($action == 'valid' && $user->rights->facture->creer)
$payment->datepaye=$now;
$payment->bank_account=$bankaccount;
$payment->amounts[$invoice->id]=$invoice->total_ttc;
if ($pay=="cash") $payment->paiementid=4;
elseif ($pay=="card") $payment->paiementid=6;
elseif ($pay=="cheque") $payment->paiementid=7;
@ -86,7 +86,7 @@ if ($action == 'valid' && $user->rights->facture->creer)
$payment->create($user);
$payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', '');
$invoice->set_paid($user);
}
@ -321,7 +321,8 @@ if ($placeid > 0) {
foreach($invoice->lines as $line)
{
print '<tr class="drag drop oddeven';
if ($line->special_code == "3") { print ' order';
if ($line->special_code == "3") {
print ' order';
}
print '" id="' . $line->rowid . '">';
print '<td align="left">' . $line->product_label . $line->desc . '</td>';
@ -334,7 +335,7 @@ if ($placeid > 0) {
print '</table>';
print '<p style="font-size:120%;" align="right"><b>'.$langs->trans('TotalTTC');
if($conf->global->TAKEPOS_BAR_RESTAURANT) print " ".$langs->trans('Place')." ".$place;
print ': '.price($invoice->total_ttc, 1, '', 1, - 1, - 1, $conf->currency).'&nbsp;</b></p>';