Merge branch '6.0' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
8dfa87fcf6
@ -128,7 +128,7 @@ $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain
|
||||
|
||||
// Show message
|
||||
$message='';
|
||||
$url=$urlwithroot.'/api/index.php/login?login=<strong>auserlogin</strong>&userpassword=<strong>thepassword</strong>[&reset=1]';
|
||||
$url=$urlwithroot.'/api/index.php/login?login=<strong>auserlogin</strong>&password=<strong>thepassword</strong>[&reset=1]';
|
||||
$message.=$langs->trans("UrlToGetKeyToUseAPIs").':<br>';
|
||||
$message.=img_picto('','object_globe.png').' '.$url;
|
||||
print $message;
|
||||
|
||||
@ -125,7 +125,7 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes')
|
||||
if ($res > 0 && $newid1 > 0 && $newid2 > 0)
|
||||
{
|
||||
$db->commit();
|
||||
header("Location: ".$_SERVER["PHP_SELF"].'?id='.$id); // To avoid pb whith back
|
||||
header("Location: ".$_SERVER["PHP_SELF"].'?id='.$id.($backtopage?'&backtopage='.urlencode($backtopage):'')); // To avoid pb whith back
|
||||
exit;
|
||||
}
|
||||
else
|
||||
@ -275,13 +275,13 @@ if ($socid > 0)
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
if ($user->rights->societe->creer)
|
||||
{
|
||||
print '<br>';
|
||||
|
||||
|
||||
print load_fiche_titre($langs->trans("NewGlobalDiscount"),'','');
|
||||
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td class="titlefield fieldrequired">'.$langs->trans("AmountHT").'</td>';
|
||||
@ -293,7 +293,7 @@ if ($socid > 0)
|
||||
print '</td></tr>';
|
||||
print '<tr><td class="fieldrequired" >'.$langs->trans("NoteReason").'</td>';
|
||||
print '<td><input type="text" class="quatrevingtpercent" name="desc" value="'.GETPOST('desc').'"></td></tr>';
|
||||
|
||||
|
||||
print "</table>";
|
||||
}
|
||||
|
||||
@ -362,7 +362,7 @@ if ($socid > 0)
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.dol_print_date($db->jdate($obj->dc),'dayhour').'</td>';
|
||||
if (preg_match('/\(CREDIT_NOTE\)/',$obj->description))
|
||||
@ -408,14 +408,14 @@ if ($socid > 0)
|
||||
if ($user->rights->societe->creer || $user->rights->facture->creer)
|
||||
{
|
||||
print '<td class="nowrap">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=split&remid='.$obj->rowid.'">'.img_split($langs->trans("SplitDiscount")).'</a>';
|
||||
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 ' ';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=remove&remid='.$obj->rowid.'">'.img_delete($langs->trans("RemoveDiscount")).'</a>';
|
||||
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>';
|
||||
}
|
||||
else print '<td> </td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
if ($_GET["action"]=='split' && GETPOST('remid') == $obj->rowid)
|
||||
{
|
||||
$showconfirminfo['rowid']=$obj->rowid;
|
||||
@ -427,7 +427,7 @@ if ($socid > 0)
|
||||
else
|
||||
{
|
||||
print '<tr><td colspan="8" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
}
|
||||
$db->free($resql);
|
||||
print "</table>";
|
||||
|
||||
@ -441,7 +441,7 @@ if ($socid > 0)
|
||||
array('type' => 'text', 'name' => 'amount_ttc_2', 'label' => $langs->trans("AmountTTC").' 2', 'value' => $amount2, 'size' => '5')
|
||||
);
|
||||
$langs->load("dict");
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&remid='.$showconfirminfo['rowid'], $langs->trans('SplitDiscount'), $langs->trans('ConfirmSplitDiscount',price($showconfirminfo['amount_ttc']),$langs->transnoentities("Currency".$conf->currency)), 'confirm_split', $formquestion, 0, 0);
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&remid='.$showconfirminfo['rowid'].($backtopage?'&backtopage='.urlencode($backtopage):''), $langs->trans('SplitDiscount'), $langs->trans('ConfirmSplitDiscount',price($showconfirminfo['amount_ttc']),$langs->transnoentities("Currency".$conf->currency)), 'confirm_split', $formquestion, 0, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -590,7 +590,7 @@ if ($socid > 0)
|
||||
{
|
||||
print '<tr><td colspan="8" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
print "</table>";
|
||||
}
|
||||
else
|
||||
|
||||
@ -386,7 +386,9 @@ if (empty($reshook))
|
||||
|
||||
else if ($action == "setabsolutediscount" && $user->rights->facture->creer)
|
||||
{
|
||||
// POST[remise_id] ou POST[remise_id_for_payment]
|
||||
// POST[remise_id] or POST[remise_id_for_payment]
|
||||
|
||||
// We use the credit to reduce amount of invoice
|
||||
if (! empty($_POST["remise_id"])) {
|
||||
$ret = $object->fetch($id);
|
||||
if ($ret > 0) {
|
||||
@ -398,14 +400,28 @@ if (empty($reshook))
|
||||
dol_print_error($db, $object->error);
|
||||
}
|
||||
}
|
||||
if (! empty($_POST["remise_id_for_payment"])) {
|
||||
// We use the credit to reduce remain to pay
|
||||
if (! empty($_POST["remise_id_for_payment"]))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php';
|
||||
$discount = new DiscountAbsolute($db);
|
||||
$discount->fetch($_POST["remise_id_for_payment"]);
|
||||
|
||||
$result = $discount->link_to_invoice(0, $id);
|
||||
if ($result < 0) {
|
||||
setEventMessages($discount->error, $discount->errors, 'errors');
|
||||
//var_dump($object->getRemainToPay(0));
|
||||
//var_dump($discount->amount_ttc);exit;
|
||||
if ($discount->amount_ttc > $object->getRemainToPay(0))
|
||||
{
|
||||
// TODO Split the discount in 2 automatically
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorDiscountLargerThanRemainToPaySplitItBefore"), null, 'errors');
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$result = $discount->link_to_invoice(0, $id);
|
||||
if ($result < 0) {
|
||||
setEventMessages($discount->error, $discount->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -890,13 +906,18 @@ if (empty($reshook))
|
||||
$line->fk_facture = $object->id;
|
||||
$line->fk_parent_line = $fk_parent_line;
|
||||
|
||||
$line->subprice =-$line->subprice; // invert price for object
|
||||
$line->subprice = -$line->subprice; // invert price for object
|
||||
$line->pa_ht = $line->pa_ht; // we choosed to have buy/cost price always positive, so no revert of sign here
|
||||
$line->total_ht=-$line->total_ht;
|
||||
$line->total_tva=-$line->total_tva;
|
||||
$line->total_ttc=-$line->total_ttc;
|
||||
$line->total_localtax1=-$line->total_localtax1;
|
||||
$line->total_localtax2=-$line->total_localtax2;
|
||||
$line->total_ht = -$line->total_ht;
|
||||
$line->total_tva = -$line->total_tva;
|
||||
$line->total_ttc = -$line->total_ttc;
|
||||
$line->total_localtax1 = -$line->total_localtax1;
|
||||
$line->total_localtax2 = -$line->total_localtax2;
|
||||
|
||||
$line->multicurrency_subprice = -$line->multicurrency_subprice;
|
||||
$line->multicurrency_total_ht = -$line->multicurrency_total_ht;
|
||||
$line->multicurrency_total_tva = -$line->multicurrency_total_tva;
|
||||
$line->multicurrency_total_ttc = -$line->multicurrency_total_ttc;
|
||||
|
||||
$result = $line->insert(0, 1); // When creating credit note with same lines than source, we must ignore error if discount alreayd linked
|
||||
|
||||
@ -3224,6 +3245,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
$addrelativediscount = '<a href="' . DOL_URL_ROOT . '/comm/remise.php?id=' . $soc->id . '&backtopage=' . urlencode($_SERVER["PHP_SELF"]) . '?facid=' . $object->id . '">' . $langs->trans("EditRelativeDiscounts") . '</a>';
|
||||
$addabsolutediscount = '<a href="' . DOL_URL_ROOT . '/comm/remx.php?id=' . $soc->id . '&backtopage=' . urlencode($_SERVER["PHP_SELF"]) . '?facid=' . $object->id . '">' . $langs->trans("EditGlobalDiscounts") . '</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>';
|
||||
$viewabsolutediscount = '<a href="' . DOL_URL_ROOT . '/comm/remx.php?id=' . $soc->id . '&backtopage=' . urlencode($_SERVER["PHP_SELF"]) . '?facid=' . $object->id . '">' . $langs->trans("ViewAvailableGlobalDiscounts") . '</a>';
|
||||
|
||||
print '<!-- Discounts --><tr><td>' . $langs->trans('Discounts');
|
||||
print '</td><td>';
|
||||
@ -3233,7 +3255,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||
// print ' ('.$addrelativediscount.')';
|
||||
|
||||
// Is there commercial discount or down payment available ?
|
||||
// Is there is commercial discount or down payment available ?
|
||||
if ($absolute_discount > 0) {
|
||||
print '. ';
|
||||
if ($object->statut > 0 || $object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT) {
|
||||
@ -3258,7 +3280,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
} else {
|
||||
if ($absolute_creditnote > 0) // If not, link will be added later
|
||||
{
|
||||
if ($object->statut == 0 && $object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT)
|
||||
if ($object->statut == Facture::STATUS_DRAFT && $object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT)
|
||||
print ' (' . $addabsolutediscount . ')<br>';
|
||||
else
|
||||
print '. ';
|
||||
@ -3269,7 +3291,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
if ($absolute_creditnote > 0)
|
||||
{
|
||||
// If validated, we show link "add credit note to payment"
|
||||
if ($object->statut != 1 || $object->type == Facture::TYPE_CREDIT_NOTE) {
|
||||
if ($object->statut != Facture::STATUS_VALIDATED || $object->type == Facture::TYPE_CREDIT_NOTE) {
|
||||
if ($object->statut == 0 && $object->type != Facture::TYPE_DEPOSIT) {
|
||||
$text = $langs->trans("CompanyHasCreditNote", price($absolute_creditnote), $langs->transnoentities("Currency" . $conf->currency));
|
||||
print $form->textwithpicto($text, $langs->trans("CreditNoteDepositUse"));
|
||||
@ -3280,13 +3302,13 @@ else if ($id > 0 || ! empty($ref))
|
||||
// There is credit notes discounts available
|
||||
if (! $absolute_discount) print '<br>';
|
||||
// $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, $resteapayer);
|
||||
$more=' ('.$addcreditnote.')';
|
||||
$more=' ('.$addcreditnote. (($addcreditnote && $viewabsolutediscount) ? ' - ' : '') . $viewabsolutediscount . ')';
|
||||
$form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, 0, $more); // We allow credit note even if amount is higher
|
||||
}
|
||||
}
|
||||
if (! $absolute_discount && ! $absolute_creditnote) {
|
||||
print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
||||
if ($object->statut == 0 && $object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT)
|
||||
if ($object->statut == Facture::STATUS_DRAFT && $object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT)
|
||||
print ' (' . $addabsolutediscount . ')<br>';
|
||||
else
|
||||
print '. ';
|
||||
|
||||
@ -1577,7 +1577,7 @@ class Facture extends CommonInvoice
|
||||
$facligne->desc=$remise->description; // Description ligne
|
||||
$facligne->vat_src_code=$remise->vat_src_code;
|
||||
$facligne->tva_tx=$remise->tva_tx;
|
||||
$facligne->subprice=-$remise->amount_ht;
|
||||
$facligne->subprice = -$remise->amount_ht;
|
||||
$facligne->fk_product=0; // Id produit predefini
|
||||
$facligne->qty=1;
|
||||
$facligne->remise_percent=0;
|
||||
@ -1600,6 +1600,11 @@ class Facture extends CommonInvoice
|
||||
$facligne->total_tva = -$remise->amount_tva;
|
||||
$facligne->total_ttc = -$remise->amount_ttc;
|
||||
|
||||
$facligne->multicurrency_subprice = -$remise->multicurrency_subprice;
|
||||
$facligne->multicurrency_total_ht = -$remise->multicurrency_total_ht;
|
||||
$facligne->multicurrency_total_tva = -$remise->multicurrency_total_tva;
|
||||
$facligne->multicurrency_total_ttc = -$remise->multicurrency_total_ttc;
|
||||
|
||||
$lineid=$facligne->insert();
|
||||
if ($lineid > 0)
|
||||
{
|
||||
|
||||
@ -953,6 +953,7 @@ class BonPrelevement extends CommonObject
|
||||
{
|
||||
$prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_bons");
|
||||
$this->id = $prev_id;
|
||||
$this->ref = $ref;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -80,7 +80,7 @@ if ($action == 'create')
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("DirectDebitOrderCreated"), null);
|
||||
setEventMessages($langs->trans("DirectDebitOrderCreated", $bprev->getNomUrl(1)), null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -145,9 +145,9 @@ if ($prev_id > 0 || $ref)
|
||||
|
||||
|
||||
// List of invoices
|
||||
$sql = "SELECT pf.rowid";
|
||||
$sql.= ",f.rowid as facid, f.facnumber as ref, f.total_ttc";
|
||||
$sql.= ", s.rowid as socid, s.nom as name, pl.statut";
|
||||
$sql = "SELECT pf.rowid,";
|
||||
$sql.= " f.rowid as facid, f.facnumber as ref, f.total_ttc,";
|
||||
$sql.= " s.rowid as socid, s.nom as name, pl.statut, pl.amount as amount_requested";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."prelevement_lignes as pl";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."prelevement_facture as pf";
|
||||
@ -202,14 +202,14 @@ if ($result)
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Bill",$_SERVER["PHP_SELF"],"p.ref",'',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],"s.nom",'',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"f.total_ttc","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("AmountInvoice",$_SERVER["PHP_SELF"],"f.total_ttc","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("AmountRequested",$_SERVER["PHP_SELF"],"pl.amount_requested","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("StatusDebitCredit",$_SERVER["PHP_SELF"],"","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('');
|
||||
print "</tr>\n";
|
||||
|
||||
$var=false;
|
||||
|
||||
$total = 0;
|
||||
$totalinvoices = 0;
|
||||
$totalamount_requested = 0;
|
||||
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
@ -231,9 +231,12 @@ if ($result)
|
||||
print $thirdpartytmp->getNomUrl(1);
|
||||
print "</td>\n";
|
||||
|
||||
// Amount
|
||||
// Amount of invoice
|
||||
print '<td align="right">'.price($obj->total_ttc)."</td>\n";
|
||||
|
||||
// Amount requested
|
||||
print '<td align="right">'.price($obj->amount_requested)."</td>\n";
|
||||
|
||||
// Status of requests
|
||||
print '<td align="center">';
|
||||
|
||||
@ -256,7 +259,8 @@ if ($result)
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$total += $obj->total_ttc;
|
||||
$totalinvoices += $obj->total_ttc;
|
||||
$totalamount_requested += $obj->amount_requested;
|
||||
|
||||
$i++;
|
||||
}
|
||||
@ -267,8 +271,11 @@ if ($result)
|
||||
print '<td>'.$langs->trans("Total").'</td>';
|
||||
print '<td> </td>';
|
||||
print '<td align="right">';
|
||||
if ($total != $object->amount) print img_warning("AmountOfFileDiffersFromSumOfInvoices");
|
||||
print price($total);
|
||||
//if ($totalinvoices != $object->amount) print img_warning("AmountOfFileDiffersFromSumOfInvoices"); // It is normal to have total that differs. For an amount of invoice of 100, request to pay may be 50 only.
|
||||
if ($totalamount_requested != $object->amount) print img_warning("AmountOfFileDiffersFromSumOfInvoices");
|
||||
print "</td>\n";
|
||||
print '<td align="right">';
|
||||
print price($totalamount_requested);
|
||||
print "</td>\n";
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
@ -278,11 +278,8 @@ $sql.= " GROUP BY c.rowid, c.ref, c.datec, c.tms, c.date_contrat, c.statut, c.re
|
||||
$sql.= ' s.rowid, s.nom, s.town, s.zip, s.fk_pays, s.client, s.code_client,';
|
||||
$sql.= " typent.code,";
|
||||
$sql.= " state.code_departement, state.nom";
|
||||
// Add where from extra fields
|
||||
foreach ($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
$sql .= ', ef.'.$key;
|
||||
}
|
||||
// Add fields from extrafields
|
||||
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key : '');
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
|
||||
|
||||
@ -78,6 +78,7 @@ class DiscountAbsolute
|
||||
$sql = "SELECT sr.rowid, sr.fk_soc,";
|
||||
$sql.= " sr.fk_user,";
|
||||
$sql.= " sr.amount_ht, sr.amount_tva, sr.amount_ttc, sr.tva_tx,";
|
||||
$sql.= " sr.multicurrency_amount_ht, sr.multicurrency_amount_tva, sr.multicurrency_amount_ttc,";
|
||||
$sql.= " sr.fk_facture_line, sr.fk_facture, sr.fk_facture_source, sr.description,";
|
||||
$sql.= " sr.datec,";
|
||||
$sql.= " f.facnumber as ref_facture_source";
|
||||
@ -97,9 +98,15 @@ class DiscountAbsolute
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->fk_soc = $obj->fk_soc;
|
||||
|
||||
$this->amount_ht = $obj->amount_ht;
|
||||
$this->amount_tva = $obj->amount_tva;
|
||||
$this->amount_ttc = $obj->amount_ttc;
|
||||
|
||||
$this->multicurrency_amount_ht = $obj->multicurrency_amount_ht;
|
||||
$this->multicurrency_amount_tva = $obj->multicurrency_amount_tva;
|
||||
$this->multicurrency_amount_ttc = $obj->multicurrency_amount_ttc;
|
||||
|
||||
$this->tva_tx = $obj->tva_tx;
|
||||
$this->fk_user = $obj->fk_user;
|
||||
$this->fk_facture_line = $obj->fk_facture_line;
|
||||
|
||||
@ -1648,7 +1648,7 @@ function dol_remove_file_process($filenb,$donotupdatesession=0,$donotdeletefile=
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert an image file into anoher format.
|
||||
* Convert an image file into another format.
|
||||
* This need Imagick php extension.
|
||||
*
|
||||
* @param string $fileinput Input file name
|
||||
@ -1656,14 +1656,19 @@ function dol_remove_file_process($filenb,$donotupdatesession=0,$donotdeletefile=
|
||||
* @param string $fileoutput Output filename
|
||||
* @return int <0 if KO, 0=Nothing done, >0 if OK
|
||||
*/
|
||||
function dol_convert_file($fileinput,$ext='png',$fileoutput='')
|
||||
function dol_convert_file($fileinput, $ext='png', $fileoutput='')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
if (class_exists('Imagick'))
|
||||
{
|
||||
$image=new Imagick();
|
||||
$ret = $image->readImage($fileinput);
|
||||
try {
|
||||
$ret = $image->readImage($fileinput);
|
||||
} catch(Exception $e) {
|
||||
dol_syslog("Failed to read image using Imagick. Try to install package 'apt-get install ghostscript'.", LOG_WARNING);
|
||||
return 0;
|
||||
}
|
||||
if ($ret)
|
||||
{
|
||||
$ret = $image->setImageFormat($ext);
|
||||
|
||||
@ -46,7 +46,7 @@ if (! function_exists('json_encode'))
|
||||
*/
|
||||
function dol_json_encode($elements)
|
||||
{
|
||||
dol_syslog("For better permorfance, enable the native json in your PHP", LOG_WARNING);
|
||||
dol_syslog("For better performance, enable the native json in your PHP", LOG_WARNING);
|
||||
|
||||
$num=0;
|
||||
if (is_object($elements)) // Count number of properties for an object
|
||||
@ -225,12 +225,11 @@ if (! function_exists('json_decode'))
|
||||
* @param string $json Json encoded to PHP Object or Array
|
||||
* @param bool $assoc False return an object, true return an array. Try to always use it with true !
|
||||
* @return mixed Object or Array or false on error
|
||||
* @deprecated PHP >= 5.3 supports native json_decode
|
||||
* @see json_decode()
|
||||
*/
|
||||
function dol_json_decode($json, $assoc=false)
|
||||
{
|
||||
dol_syslog('dol_json_decode() is deprecated. Please update your code to use native json_decode().', LOG_WARNING);
|
||||
dol_syslog("For better performance, enable the native json in your PHP", LOG_WARNING);
|
||||
|
||||
$comment = false;
|
||||
|
||||
|
||||
@ -215,20 +215,22 @@ class ExpenseReport extends CommonObject
|
||||
$resql=$this->db->query($sql);
|
||||
if (!$resql) $error++;
|
||||
|
||||
foreach ($this->lines as $i => $val)
|
||||
{
|
||||
$newndfline=new ExpenseReportLine($this->db);
|
||||
$newndfline=$this->lines[$i];
|
||||
$newndfline->fk_expensereport=$this->id;
|
||||
if ($result >= 0)
|
||||
{
|
||||
$result=$newndfline->insert();
|
||||
}
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
if (is_array($this->lines) && count($this->lines)>0) {
|
||||
foreach ($this->lines as $i => $val)
|
||||
{
|
||||
$newndfline=new ExpenseReportLine($this->db);
|
||||
$newndfline=$this->lines[$i];
|
||||
$newndfline->fk_expensereport=$this->id;
|
||||
if ($result >= 0)
|
||||
{
|
||||
$result=$newndfline->insert();
|
||||
}
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
|
||||
@ -24,7 +24,7 @@ class Segment implements IteratorAggregate, Countable
|
||||
protected $images = array();
|
||||
protected $odf;
|
||||
protected $file;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -86,15 +86,15 @@ class Segment implements IteratorAggregate, Countable
|
||||
*/
|
||||
public function merge()
|
||||
{
|
||||
// To provide debug information on line number processed
|
||||
// To provide debug information on line number processed
|
||||
global $count;
|
||||
if (empty($count)) $count=1;
|
||||
else $count++;
|
||||
|
||||
|
||||
if (empty($this->savxml)) $this->savxml = $this->xml; // Sav content of line at first line merged, so we will reuse original for next steps
|
||||
$this->xml = $this->savxml;
|
||||
$tmpvars = $this->vars; // Store into $tmpvars so we won't modify this->vars when completing data with empty values
|
||||
|
||||
|
||||
// Search all tags fou into condition to complete $tmpvars, so we will proceed all tests even if not defined
|
||||
$reg='@\[!--\sIF\s([{}a-zA-Z0-9\.\,_]+)\s--\]@smU';
|
||||
preg_match_all($reg, $this->xml, $matches, PREG_SET_ORDER);
|
||||
@ -106,7 +106,7 @@ class Segment implements IteratorAggregate, Countable
|
||||
$tmpvars[$match[1]] = ''; // Not defined, so we set it to '', we just need entry into this->vars for next loop
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Conditionals substitution
|
||||
// Note: must be done before static substitution, else the variable will be replaced by its value and the conditional won't work anymore
|
||||
foreach($tmpvars as $key => $value)
|
||||
@ -133,7 +133,7 @@ class Segment implements IteratorAggregate, Countable
|
||||
$this->xml = preg_replace($reg, '', $this->xml);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->xmlParsed .= str_replace(array_keys($tmpvars), array_values($tmpvars), $this->xml);
|
||||
if ($this->hasChildren()) {
|
||||
foreach ($this->children as $child) {
|
||||
@ -143,7 +143,7 @@ class Segment implements IteratorAggregate, Countable
|
||||
}
|
||||
$reg = "/\[!--\sBEGIN\s$this->name\s--\](.*)\[!--\sEND\s$this->name\s--\]/sm";
|
||||
$this->xmlParsed = preg_replace($reg, '$1', $this->xmlParsed);
|
||||
// Miguel Erill 09704/2017 - Add macro replacement to invoice lines
|
||||
// Miguel Erill 09704/2017 - Add macro replacement to invoice lines
|
||||
$this->xmlParsed = $this->macroReplace($this->xmlParsed);
|
||||
$this->file->open($this->odf->getTmpfile());
|
||||
foreach ($this->images as $imageKey => $imageValue) {
|
||||
@ -155,28 +155,28 @@ class Segment implements IteratorAggregate, Countable
|
||||
}
|
||||
}
|
||||
$this->file->close();
|
||||
|
||||
|
||||
return $this->xmlParsed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to replace macros for invoice short and long month, invoice year
|
||||
*
|
||||
*
|
||||
* Substitution occur when the invoice is generated, not considering the invoice date
|
||||
* so do not (re)generate in a diferent date than the one that the invoice belongs to
|
||||
* Perhaps it would be better to use the invoice issued date but I still do not know
|
||||
* how to get it here
|
||||
*
|
||||
* Miguel Erill 09/04/2017
|
||||
*
|
||||
*
|
||||
* @param string $value String to convert
|
||||
*/
|
||||
public function macroReplace($text)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$patterns=array( '__CURRENTDAY__','__CURRENTDAYTEXT__','__CURRENTMONTHSHORT__','__CURRENTMONTH__','__CURRENTYEAR__' );
|
||||
$values=array( date('j'), $langs->trans(date('l')), $langs->trans(date('M')), $langs->trans(date('F')), date('Y') );
|
||||
$patterns=array('/__CURRENTDAY__/','/__CURRENTDAYTEXT__/','/__CURRENTMONTHSHORT__/','/__CURRENTMONTH__/','/__CURRENTYEAR__/');
|
||||
$values=array(date('j'), $langs->trans(date('l')), $langs->trans(date('M')), $langs->trans(date('F')), date('Y'));
|
||||
|
||||
$text=preg_replace($patterns, $values, $text);
|
||||
|
||||
@ -203,7 +203,7 @@ class Segment implements IteratorAggregate, Countable
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Assign a template variable to replace
|
||||
*
|
||||
|
||||
@ -510,6 +510,7 @@ ALTER TABLE llx_user_rights DROP FOREIGN KEY fk_user_rights_fk_user_user;
|
||||
ALTER TABLE llx_user_rights DROP INDEX uk_user_rights;
|
||||
ALTER TABLE llx_user_rights DROP INDEX fk_user;
|
||||
ALTER TABLE llx_user_rights ADD UNIQUE INDEX uk_user_rights (entity, fk_user, fk_id);
|
||||
DELETE FROM llx_user_rights WHERE fk_user NOT IN (select rowid from llx_user);
|
||||
ALTER TABLE llx_user_rights ADD CONSTRAINT fk_user_rights_fk_user_user FOREIGN KEY (fk_user) REFERENCES llx_user (rowid);
|
||||
|
||||
ALTER TABLE llx_usergroup_rights ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER rowid;
|
||||
|
||||
@ -90,6 +90,7 @@ delete from llx_livraison where ref = '';
|
||||
delete from llx_expeditiondet where fk_expedition in (select rowid from llx_expedition where ref = '');
|
||||
delete from llx_expedition where ref = '';
|
||||
delete from llx_holiday_logs where fk_user_update not IN (select rowid from llx_user);
|
||||
delete from llx_user_rights where fk_user not IN (select rowid from llx_user);
|
||||
|
||||
update llx_deplacement set dated='2010-01-01' where dated < '2000-01-01';
|
||||
|
||||
|
||||
@ -343,6 +343,7 @@ DateIsNotEnough=Date not reached yet
|
||||
InvoiceGeneratedFromTemplate=Invoice %s generated from recurring template invoice %s
|
||||
WarningInvoiceDateInFuture=Warning, the invoice date is higher than current date
|
||||
WarningInvoiceDateTooFarInFuture=Warning, the invoice date is too far from current date
|
||||
ViewAvailableGlobalDiscounts=View available discounts
|
||||
# PaymentConditions
|
||||
Statut=Status
|
||||
PaymentConditionShortRECEP=Due Upon Receipt
|
||||
|
||||
@ -200,7 +200,7 @@ ErrorObjectMustHaveStatusDraftToBeValidated=Object %s must have status 'Draft' t
|
||||
ErrorObjectMustHaveLinesToBeValidated=Object %s must have lines to be validated.
|
||||
ErrorOnlyInvoiceValidatedCanBeSentInMassAction=Only validated invoices can be sent using the "Send by email" mass action.
|
||||
ErrorChooseBetweenFreeEntryOrPredefinedProduct=You must choose if article is a predefined product or not
|
||||
|
||||
ErrorDiscountLargerThanRemainToPaySplitItBefore=The discount you try to apply is larger than remain to pay. Split the discount in 2 smaller discounts before.
|
||||
# Warnings
|
||||
WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user.
|
||||
WarningMandatorySetupNotComplete=Mandatory setup parameters are not yet defined
|
||||
|
||||
@ -12,7 +12,7 @@ WithdrawalsLines=Direct debit order lines
|
||||
RequestStandingOrderToTreat=Request for direct debit payment order to process
|
||||
RequestStandingOrderTreated=Request for direct debit payment order processed
|
||||
NotPossibleForThisStatusOfWithdrawReceiptORLine=Not yet possible. Withdraw status must be set to 'credited' before declaring reject on specific lines.
|
||||
NbOfInvoiceToWithdraw=Nb. of invoice with direct debit order
|
||||
NbOfInvoiceToWithdraw=Nb. of qualified invoice with waiting direct debit order
|
||||
NbOfInvoiceToWithdrawWithInfo=Nb. of customer invoice with direct debit payment orders having defined bank account information
|
||||
InvoiceWaitingWithdraw=Invoice waiting for direct debit
|
||||
AmountToWithdraw=Amount to withdraw
|
||||
@ -72,7 +72,7 @@ IfInvoiceNeedOnWithdrawPaymentWontBeClosed=However, if invoice has at least one
|
||||
DoStandingOrdersBeforePayments=This tab allows you to request a direct debit payment order. Once done, go into menu Bank->Direct Debit orders to manage the direct debit payment order. When payment order is closed, payment on invoice will be automatically recorded, and invoice closed if remainder to pay is null.
|
||||
WithdrawalFile=Withdrawal file
|
||||
SetToStatusSent=Set to status "File Sent"
|
||||
ThisWillAlsoAddPaymentOnInvoice=This will also apply payments to invoices and will classify them as "Paid"
|
||||
ThisWillAlsoAddPaymentOnInvoice=This will also record payments to invoices and will classify them as "Paid" if remain to pay is null
|
||||
StatisticsByLineStatus=Statistics by status of lines
|
||||
RUM=UMR
|
||||
RUMLong=Unique Mandate Reference
|
||||
@ -94,6 +94,8 @@ SEPAFrstOrRecur=Type of payment
|
||||
ModeRECUR=Reccurent payment
|
||||
ModeFRST=One-off payment
|
||||
PleaseCheckOne=Please check one only
|
||||
DirectDebitOrderCreated=Direct debit order %s created
|
||||
AmountRequested=Amount requested
|
||||
|
||||
### Notifications
|
||||
InfoCreditSubject=Payment of direct debit payment order %s by the bank
|
||||
|
||||
@ -238,6 +238,21 @@ foreach ($search_array_options as $key => $val)
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
|
||||
/* If a group by is required
|
||||
$sql.= " GROUP BY "
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
$sql.='t.'.$key.', ';
|
||||
}
|
||||
// Add fields from extrafields
|
||||
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key : '');
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
*/
|
||||
|
||||
$sql.=$db->order($sortfield,$sortorder);
|
||||
|
||||
// Count total nb of records
|
||||
|
||||
Loading…
Reference in New Issue
Block a user