2
0
forked from Wavyzz/dolibarr

Fix: When creating invoice from other object, discount are created

automatically
This commit is contained in:
Laurent Destailleur
2011-09-10 17:52:21 +00:00
parent 74f9c13a79
commit 605355c89c
32 changed files with 531 additions and 469 deletions

View File

@@ -1,6 +1,6 @@
<?PHP <?PHP
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* 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
@@ -30,11 +30,11 @@ $langs->load("companies");
$langs->load("orders"); $langs->load("orders");
$langs->load("bills"); $langs->load("bills");
$_socid = GETPOST("id"); $socid = GETPOST("id");
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)
{ {
$_socid = $user->societe_id; $socid = $user->societe_id;
} }
@@ -56,8 +56,16 @@ if (GETPOST("action") == 'setremise')
if ($result > 0) if ($result > 0)
{ {
Header("Location: remise.php?id=".$_GET["id"]); if (GETPOST('backtopage'))
exit; {
Header("Location: ".GETPOST('backtopage'));
exit;
}
else
{
Header("Location: remise.php?id=".$_GET["id"]);
exit;
}
} }
else else
{ {
@@ -80,21 +88,15 @@ llxHeader();
* Mode fiche * Mode fiche
* *
*********************************************************************************/ *********************************************************************************/
if ($_socid > 0) if ($socid > 0)
{ {
// On recupere les donnees societes par l'objet // On recupere les donnees societes par l'objet
$objsoc = new Societe($db); $objsoc = new Societe($db);
$objsoc->id=$_socid; $objsoc->id=$socid;
$objsoc->fetch($_socid,$to); $objsoc->fetch($socid);
if ($errmesg) dol_htmloutput_errors($errmesg);
{
print '<div class="error">'.$errmesg.'</div><br>';
}
/*
* Affichage onglets
*/
$head = societe_prepare_head($objsoc); $head = societe_prepare_head($objsoc);
dol_fiche_head($head, 'relativediscount', $langs->trans("ThirdParty"),0,'company'); dol_fiche_head($head, 'relativediscount', $langs->trans("ThirdParty"),0,'company');

View File

@@ -33,10 +33,10 @@ $langs->load("bills");
$langs->load("companies"); $langs->load("companies");
// Security check // Security check
$_socid = GETPOST("id"); $socid = GETPOST("id");
if ($user->societe_id > 0) if ($user->societe_id > 0)
{ {
$_socid = $user->societe_id; $socid = $user->societe_id;
} }
@@ -204,16 +204,16 @@ if (GETPOST("action") == 'confirm_remove' && GETPOST("confirm")=='yes')
$form=new Form($db); $form=new Form($db);
$facturestatic=new Facture($db); $facturestatic=new Facture($db);
llxHeader(); llxHeader('',$langs->trans("GlobalDiscount"));
if ($_socid > 0) if ($socid > 0)
{ {
dol_htmloutput_mesg($mesg); dol_htmloutput_mesg($mesg);
// On recupere les donnees societes par l'objet // On recupere les donnees societes par l'objet
$objsoc = new Societe($db); $objsoc = new Societe($db);
$objsoc->id=$_socid; $objsoc->id=$socid;
$objsoc->fetch($_socid,$to); $objsoc->fetch($socid);
/* /*
* Affichage onglets * Affichage onglets
@@ -256,10 +256,10 @@ if ($_socid > 0)
} }
print '<tr><td width="38%">'.$langs->trans("CustomerAbsoluteDiscountAllUsers").'</td>'; print '<tr><td width="38%">'.$langs->trans("CustomerAbsoluteDiscountAllUsers").'</td>';
print '<td>'.$remise_all.'&nbsp;'.$langs->trans("Currency".$conf->monnaie).'</td></tr>'; print '<td>'.$remise_all.'&nbsp;'.$langs->trans("Currency".$conf->monnaie).' '.$langs->trans("HT").'</td></tr>';
print '<tr><td>'.$langs->trans("CustomerAbsoluteDiscountMy").'</td>'; print '<tr><td>'.$langs->trans("CustomerAbsoluteDiscountMy").'</td>';
print '<td>'.$remise_user.'&nbsp;'.$langs->trans("Currency".$conf->monnaie).'</td></tr>'; print '<td>'.$remise_user.'&nbsp;'.$langs->trans("Currency".$conf->monnaie).' '.$langs->trans("HT").'</td></tr>';
print '</table>'; print '</table>';
print '<br>'; print '<br>';
@@ -269,7 +269,7 @@ if ($_socid > 0)
print '<td><input type="text" size="5" name="amount_ht" value="'.$_POST["amount_ht"].'">&nbsp;'.$langs->trans("Currency".$conf->monnaie).'</td></tr>'; print '<td><input type="text" size="5" name="amount_ht" value="'.$_POST["amount_ht"].'">&nbsp;'.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
print '<tr><td width="38%">'.$langs->trans("VAT").'</td>'; print '<tr><td width="38%">'.$langs->trans("VAT").'</td>';
print '<td>'; print '<td>';
print $form->load_tva('tva_tx','0','',$mysoc,''); print $form->load_tva('tva_tx',GETPOST('tva_tx'),'',$mysoc,'');
print '</td></tr>'; print '</td></tr>';
print '<tr><td>'.$langs->trans("NoteReason").'</td>'; print '<tr><td>'.$langs->trans("NoteReason").'</td>';
print '<td><input type="text" size="60" name="desc" value="'.$_POST["desc"].'"></td></tr>'; print '<td><input type="text" size="60" name="desc" value="'.$_POST["desc"].'"></td></tr>';

View File

@@ -709,14 +709,33 @@ if ($action == 'add' && $user->rights->facture->creer)
if (empty($lines) && method_exists($srcobject,'fetch_lines')) $lines = $srcobject->fetch_lines(); if (empty($lines) && method_exists($srcobject,'fetch_lines')) $lines = $srcobject->fetch_lines();
$fk_parent_line=0; $fk_parent_line=0;
$num=sizeof($lines); $num=count($lines);
for ($i=0;$i<$num;$i++) for ($i=0;$i<$num;$i++)
{ {
if ($lines[$i]->subprice < 0) if ($lines[$i]->subprice < 0)
{ {
// Negative line, we create a discount line // Negative line, we create a discount line
// TODO $discount = new DiscountAbsolute($db);
$discount->fk_soc=$object->socid;
$discount->amount_ht=abs($lines[$i]->total_ht);
$discount->amount_tva=abs($lines[$i]->total_tva);
$discount->amount_ttc=abs($lines[$i]->total_ttc);
$discount->tva_tx=$lines[$i]->tva_tx;
$discount->fk_user=$user->id;
$discount->description=$desc;
$discountid=$discount->create($user);
if ($discountid > 0)
{
$result=$object->insert_discount($discountid);
//$result=$discount->link_to_invoice($lineid,$id);
}
else
{
$mesg=$discount->error;
$error++;
break;
}
} }
else else
{ {
@@ -766,8 +785,13 @@ if ($action == 'add' && $user->rights->facture->creer)
$fk_parent_line $fk_parent_line
); );
if ($result < 0) if ($result > 0)
{ {
$lineid=$result;
}
else
{
$lineid=0;
$error++; $error++;
break; break;
} }
@@ -1659,9 +1683,12 @@ if ($action == 'create')
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="2">'; print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="2">';
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",'<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$soc->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$soc->id.'&action='.$action.'&origin='.GETPOST('origin').'&originid='.GETPOST('originid')).'">'.$soc->remise_client.'</a>'); if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",'<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$soc->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$soc->id.'&action='.$action.'&origin='.GETPOST('origin').'&originid='.GETPOST('originid')).'">'.$soc->remise_client.'</a>');
else print $langs->trans("CompanyHasNoRelativeDiscount"); else print $langs->trans("CompanyHasNoRelativeDiscount");
print ' <a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$soc->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$soc->id.'&action='.$action.'&origin='.GETPOST('origin').'&originid='.GETPOST('originid')).'">('.$langs->trans("EditRelativeDiscount").')</a>';
print '. '; print '. ';
print '<br>';
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",'<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$soc->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$soc->id.'&action='.$action.'&origin='.GETPOST('origin').'&originid='.GETPOST('originid')).'">'.price($absolute_discount).'</a>',$langs->trans("Currency".$conf->monnaie)); if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",'<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$soc->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$soc->id.'&action='.$action.'&origin='.GETPOST('origin').'&originid='.GETPOST('originid')).'">'.price($absolute_discount).'</a>',$langs->trans("Currency".$conf->monnaie));
else print $langs->trans("CompanyHasNoAbsoluteDiscount"); else print $langs->trans("CompanyHasNoAbsoluteDiscount");
print ' <a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$soc->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$soc->id.'&action='.$action.'&origin='.GETPOST('origin').'&originid='.GETPOST('originid')).'">('.$langs->trans("EditGlobalDiscounts").')</a>';
print '.'; print '.';
print '</td></tr>'; print '</td></tr>';
@@ -2127,13 +2154,15 @@ else
print '</td></tr>'; print '</td></tr>';
// Relative and absolute discounts // Relative and absolute discounts
$addabsolutediscount=' <a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$soc->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'?facid='.$object->id.'">'.$langs->trans("AddGlobalDiscount").'</a>'; $addrelativediscount='<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$soc->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'?facid='.$object->id.'">'.$langs->trans("EditRelativeDiscounts").'</a>';
$addcreditnote=' <a href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&socid='.$soc->id.'&type=2&backtopage='.urlencode($_SERVER["PHP_SELF"]).'?facid='.$object->id.'">'.$langs->trans("AddCreditNote").'</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.php?action=create&socid='.$soc->id.'&type=2&backtopage='.urlencode($_SERVER["PHP_SELF"]).'?facid='.$object->id.'">'.$langs->trans("AddCreditNote").'</a>';
print '<tr><td>'.$langs->trans('Discounts'); print '<tr><td>'.$langs->trans('Discounts');
print '</td><td colspan="5">'; print '</td><td colspan="5">';
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client); if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
else print $langs->trans("CompanyHasNoRelativeDiscount"); else print $langs->trans("CompanyHasNoRelativeDiscount");
//print ' ('.$addrelativediscount.')';
if ($absolute_discount > 0) if ($absolute_discount > 0)
{ {
@@ -2165,14 +2194,14 @@ else
// Remise dispo de type remise fixe (not credit note) // Remise dispo de type remise fixe (not credit note)
$filter='fk_facture_source IS NULL'; $filter='fk_facture_source IS NULL';
print '<br>'; print '<br>';
$html->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id',$soc->id, $absolute_discount, $filter, $resteapayer, ' - '.$addabsolutediscount); $html->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id',$soc->id, $absolute_discount, $filter, $resteapayer, ' ('.$addabsolutediscount.')');
} }
} }
else else
{ {
if ($absolute_creditnote > 0) // If not linke will be added later if ($absolute_creditnote > 0) // If not linke will be added later
{ {
if ($object->statut == 0 && $object->type != 2 && $object->type != 3) print ' - '.$addabsolutediscount.'<br>'; if ($object->statut == 0 && $object->type != 2 && $object->type != 3) print ' ('.$addabsolutediscount.')<br>';
else print '.'; else print '.';
} }
else print '. '; else print '. ';
@@ -2203,7 +2232,7 @@ else
if (! $absolute_discount && ! $absolute_creditnote) if (! $absolute_discount && ! $absolute_creditnote)
{ {
print $langs->trans("CompanyHasNoAbsoluteDiscount"); print $langs->trans("CompanyHasNoAbsoluteDiscount");
if ($object->statut == 0 && $object->type != 2 && $object->type != 3) print ' - '.$addabsolutediscount.'<br>'; if ($object->statut == 0 && $object->type != 2 && $object->type != 3) print ' ('.$addabsolutediscount.')<br>';
else print '. '; else print '. ';
} }
/*if ($object->statut == 0 && $object->type != 2 && $object->type != 3) /*if ($object->statut == 0 && $object->type != 2 && $object->type != 3)

View File

@@ -621,6 +621,9 @@ class Facture extends CommonObject
$line->desc = $object->lines[$i]->desc; $line->desc = $object->lines[$i]->desc;
$line->price = $object->lines[$i]->price; $line->price = $object->lines[$i]->price;
$line->subprice = $object->lines[$i]->subprice; $line->subprice = $object->lines[$i]->subprice;
$line->total_ht = $object->lines[$i]->total_ht;
$line->total_tva = $object->lines[$i]->total_tva;
$line->total_ttc = $object->lines[$i]->total_ttc;
$line->tva_tx = $object->lines[$i]->tva_tx; $line->tva_tx = $object->lines[$i]->tva_tx;
$line->localtax1_tx = $object->lines[$i]->localtax1_tx; $line->localtax1_tx = $object->lines[$i]->localtax1_tx;
$line->localtax2_tx = $object->lines[$i]->localtax2_tx; $line->localtax2_tx = $object->lines[$i]->localtax2_tx;
@@ -634,11 +637,6 @@ class Facture extends CommonObject
$line->special_code = $object->lines[$i]->special_code; $line->special_code = $object->lines[$i]->special_code;
$line->fk_parent_line = $object->lines[$i]->fk_parent_line; $line->fk_parent_line = $object->lines[$i]->fk_parent_line;
// TODO it's ok ?
$line->total_ht = $object->lines[$i]->total_ht;
$line->total_tva = $object->lines[$i]->total_tva;
$line->total_ttc = $object->lines[$i]->total_ttc;
$this->lines[$i] = $line; $this->lines[$i] = $line;
} }
@@ -1057,10 +1055,10 @@ class Facture extends CommonObject
/** /**
* Ajout en base d'une ligne remise fixe en ligne de facture * Add a discount line into invoice using an existing absolute discount
* *
* @param idremise Id de la remise fixe * @param int $idremise Id of absolute discount
* @return int >0 si ok, <0 si ko * @return int >0 if OK, <0 if KO
*/ */
function insert_discount($idremise) function insert_discount($idremise)
{ {
@@ -1781,30 +1779,31 @@ class Facture extends CommonObject
/** /**
* Add an invoice line into database (linked to product/service or not) * Add an invoice line into database (linked to product/service or not).
* \param facid Id de la facture * Les parametres sont deja cense etre juste et avec valeurs finales a l'appel
* \param desc Description de la ligne * de cette methode. Aussi, pour le taux tva, il doit deja avoir ete defini
* \param pu_ht Prix unitaire HT (> 0 even for credit note) * par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,produit)
* \param qty Quantite * et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue)
* \param txtva Taux de tva force, sinon -1 *
* \param txlocaltax1 Local tax 1 rate * @param facid Id de la facture
* \param txlocaltax2 Local tax 2 rate * @param desc Description de la ligne
* \param fk_product Id du produit/service predefini * @param pu_ht Prix unitaire HT (> 0 even for credit note)
* \param remise_percent Pourcentage de remise de la ligne * @param qty Quantite
* \param date_start Date de debut de validite du service * @param txtva Taux de tva force, sinon -1
* \param date_end Date de fin de validite du service * @param txlocaltax1 Local tax 1 rate
* \param ventil Code de ventilation comptable * @param txlocaltax2 Local tax 2 rate
* \param info_bits Bits de type de lignes * @param fk_product Id du produit/service predefini
* \param fk_remise_except Id remise * @param remise_percent Pourcentage de remise de la ligne
* \param price_base_type HT or TTC * @param date_start Date de debut de validite du service
* \param pu_ttc Prix unitaire TTC (> 0 even for credit note) * @param date_end Date de fin de validite du service
* \param type Type of line (0=product, 1=service) * @param ventil Code de ventilation comptable
* \param rang Position of line * @param info_bits Bits de type de lignes
* \return int >0 if OK, <0 if KO * @param fk_remise_except Id remise
* \remarks Les parametres sont deja cense etre juste et avec valeurs finales a l'appel * @param price_base_type HT or TTC
* de cette methode. Aussi, pour le taux tva, il doit deja avoir ete defini * @param pu_ttc Prix unitaire TTC (> 0 even for credit note)
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,produit) * @param type Type of line (0=product, 1=service)
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue) * @param rang Position of line
* @return int <0 if KO, Id of line if OK
*/ */
function addline($facid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits=0, $fk_remise_except='', $price_base_type='HT', $pu_ttc=0, $type=0, $rang=-1, $special_code=0, $origin='', $origin_id=0, $fk_parent_line=0) function addline($facid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits=0, $fk_remise_except='', $price_base_type='HT', $pu_ttc=0, $type=0, $rang=-1, $special_code=0, $origin='', $origin_id=0, $fk_parent_line=0)
{ {

View File

@@ -782,9 +782,10 @@ abstract class CommonObject
/** /**
* Stocke un numero de rang pour toutes les lignes de detail d'un element qui n'en ont pas. * Stocke un numero de rang pour toutes les lignes de detail d'un element qui n'en ont pas.
* *
* @param renum true to renum all already ordered lines, false to renum only not already ordered lines. * @param boolean $renum true to renum all already ordered lines, false to renum only not already ordered lines.
* @param string $rowidorder ASC or DESC
*/ */
function line_order($renum=false, $rowidorder='ASC') function line_order($renum=false, $rowidorder='ASC')
{ {
@@ -830,9 +831,9 @@ abstract class CommonObject
} }
/** /**
* Update a line to have a lower rank * Update a line to have a lower rank
* *
* @param $rowid * @param int $rowid
*/ */
function line_up($rowid) function line_up($rowid)
{ {
@@ -846,9 +847,9 @@ abstract class CommonObject
} }
/** /**
* Update a line to have a higher rank * Update a line to have a higher rank
* *
* @param $rowid * @param int $rowid
*/ */
function line_down($rowid) function line_down($rowid)
{ {
@@ -867,8 +868,8 @@ abstract class CommonObject
/** /**
* Update position of line (rang) * Update position of line (rang)
* *
* @param rowid * @param int $rowid
* @param rang * @param int $rang
*/ */
function updateRangOfLine($rowid,$rang) function updateRangOfLine($rowid,$rang)
{ {
@@ -881,9 +882,9 @@ abstract class CommonObject
} }
/** /**
* Update position of line with ajax (rang) * Update position of line with ajax (rang)
* *
* @param roworder * @param int $roworder
*/ */
function line_ajaxorder($roworder) function line_ajaxorder($roworder)
{ {
@@ -897,10 +898,10 @@ abstract class CommonObject
} }
/** /**
* Update position of line up (rang) * Update position of line up (rang)
* *
* @param rowid * @param int $rowid
* @param rang * @param int $rang
*/ */
function updateLineUp($rowid,$rang) function updateLineUp($rowid,$rang)
{ {
@@ -926,11 +927,11 @@ abstract class CommonObject
} }
/** /**
* Update position of line down (rang) * Update position of line down (rang)
* *
* @param rowid * @param int $rowid
* @param rang * @param int $rang
* @param max * @param int $max
*/ */
function updateLineDown($rowid,$rang,$max) function updateLineDown($rowid,$rang,$max)
{ {
@@ -956,10 +957,10 @@ abstract class CommonObject
} }
/** /**
* Get position of line (rang) * Get position of line (rang)
* *
* @param rowid Id of line * @param int $rowid Id of line
* @return int Value of rang in table of lines * @return int Value of rang in table of lines
*/ */
function getRangOfLine($rowid) function getRangOfLine($rowid)
{ {
@@ -974,9 +975,10 @@ abstract class CommonObject
} }
/** /**
* Get rowid of the line relative to its position * Get rowid of the line relative to its position
* *
* @return int Rowid of the line * @param int $rang Rang value
* @return int Rowid of the line
*/ */
function getIdOfLine($rang) function getIdOfLine($rang)
{ {
@@ -992,10 +994,10 @@ abstract class CommonObject
} }
/** /**
* Get max value used for position of line (rang) * Get max value used for position of line (rang)
* *
* @param fk_parent_line * @param int $fk_parent_line Parent line id
* @return int Max value of rang in table of lines * @return int Max value of rang in table of lines
*/ */
function line_max($fk_parent_line=0) function line_max($fk_parent_line=0)
{ {
@@ -1031,10 +1033,10 @@ abstract class CommonObject
} }
/** /**
* Update private note of element * Update private note of element
* *
* @param note New value for note * @param string $note New value for note
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update_note($note) function update_note($note)
{ {

View File

@@ -29,318 +29,324 @@
*/ */
class DiscountAbsolute class DiscountAbsolute
{ {
var $db; var $db;
var $error; var $error;
var $id; // Id remise
var $amount_ht; //
var $amount_tva; //
var $amount_ttc; //
var $tva_tx; //
var $fk_user; // Id utilisateur qui accorde la remise
var $description; // Description libre
var $datec; // Date creation
var $fk_facture_line; // Id invoice line when a discount linked to invoice line
var $fk_facture; // Id invoice when a discoutn linked to invoice
var $fk_facture_source; // Id facture avoir a l'origine de la remise
var $ref_facture_source; // Ref facture avoir a l'origine de la remise
/**
* Constructor
* @param DB Database handler
*/
function DiscountAbsolute($DB)
{
$this->db = $DB;
}
/**
* \brief Load object from database into memory
* \param rowid id discount to load
* \param fk_facture_source fk_facture_source
* \return int <0 if KO, =0 if not found, >0 if OK
*/
function fetch($rowid,$fk_facture_source=0)
{
// Check parameters
if (! $rowid && ! $fk_facture_source)
{
$this->error='ErrorBadParameters';
return -1;
}
$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.fk_facture_line, sr.fk_facture, sr.fk_facture_source, sr.description,";
$sql.= " sr.datec,";
$sql.= " f.facnumber as ref_facture_source";
$sql.= " FROM ".MAIN_DB_PREFIX."societe_remise_except as sr";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON sr.fk_facture_source = f.rowid";
$sql.= " WHERE";
if ($rowid) $sql.= " sr.rowid=".$rowid;
if ($fk_facture_source) $sql.= " sr.fk_facture_source=".$fk_facture_source;
dol_syslog("DiscountAbsolute::fetch sql=".$sql);
$resql = $this->db->query($sql);
if ($resql)
{
if ($this->db->num_rows($resql))
{
$obj = $this->db->fetch_object($resql);
$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->tva_tx = $obj->tva_tx;
$this->fk_user = $obj->fk_user;
$this->fk_facture_line = $obj->fk_facture_line;
$this->fk_facture = $obj->fk_facture;
$this->fk_facture_source = $obj->fk_facture_source; // Id avoir source
$this->ref_facture_source = $obj->ref_facture_source; // Ref avoir source
$this->description = $obj->description;
$this->datec = $this->db->jdate($obj->datec);
$this->db->free($resql);
return 1;
}
else
{
$this->db->free($resql);
return 0;
}
}
else
{
$this->error=$this->db->error();
return -1;
}
}
var $id; // Id remise
var $fk_soc;
var $amount_ht; //
var $amount_tva; //
var $amount_ttc; //
var $tva_tx; //
var $fk_user; // Id utilisateur qui accorde la remise
var $description; // Description libre
var $datec; // Date creation
var $fk_facture_line; // Id invoice line when a discount linked to invoice line
var $fk_facture; // Id invoice when a discoutn linked to invoice
var $fk_facture_source; // Id facture avoir a l'origine de la remise
var $ref_facture_source; // Ref facture avoir a l'origine de la remise
/** /**
* \brief Create in database * Constructor
* \param user User that create * @param DB Database handler
* \return int <0 si ko, >0 si ok
*/ */
function create($user) function DiscountAbsolute($DB)
{ {
global $conf, $langs; $this->db = $DB;
// Clean parameters
$this->amount_ht=price2num($this->amount_ht);
$this->amount_tva=price2num($this->amount_tva);
$this->amount_ttc=price2num($this->amount_ttc);
$this->tva_tx=price2num($this->tva_tx);
// Check parameters
if (empty($this->description))
{
$this->error='BadValueForPropertyDescription';
dol_syslog("DiscountAbsolute::create ".$this->error, LOG_ERR);
return -1;
}
// Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_remise_except";
$sql.= " (datec, fk_soc, fk_user, description,";
$sql.= " amount_ht, amount_tva, amount_ttc, tva_tx,";
$sql.= " fk_facture_source";
$sql.= ")";
$sql.= " VALUES (".$this->db->idate($this->datec!=''?$this->datec:dol_now()).", ".$this->fk_soc.", ".$user->id.", '".$this->db->escape($this->description)."',";
$sql.= " ".$this->amount_ht.", ".$this->amount_tva.", ".$this->amount_ttc.", ".$this->tva_tx.",";
$sql.= " ".($this->fk_facture_source?"'".$this->fk_facture_source."'":"null");
$sql.= ")";
dol_syslog("DiscountAbsolute::create sql=".$sql);
$resql=$this->db->query($sql);
if ($resql)
{
$this->id=$this->db->last_insert_id(MAIN_DB_PREFIX."societe_remise_except");
return $this->id;
}
else
{
$this->error=$this->db->lasterror().' - sql='.$sql;
dol_syslog("DiscountAbsolute::create ".$this->error, LOG_ERR);
return -1;
}
} }
/* /**
* \brief Delete object in database. If fk_facture_source is defined, we delete all familiy with same fk_facture_source. If not, only with id is removed. * \brief Load object from database into memory
* \param user Object of user asking to delete * \param rowid id discount to load
* \return int <0 if KO, >0 if OK * \param fk_facture_source fk_facture_source
*/ * \return int <0 if KO, =0 if not found, >0 if OK
function delete($user) */
{ function fetch($rowid,$fk_facture_source=0)
global $conf, $langs; {
// Check parameters
if (! $rowid && ! $fk_facture_source)
{
$this->error='ErrorBadParameters';
return -1;
}
// Check if we can remove the discount $sql = "SELECT sr.rowid, sr.fk_soc,";
if ($this->fk_facture_source) $sql.= " sr.fk_user,";
{ $sql.= " sr.amount_ht, sr.amount_tva, sr.amount_ttc, sr.tva_tx,";
$sql.="SELECT COUNT(rowid) as nb"; $sql.= " sr.fk_facture_line, sr.fk_facture, sr.fk_facture_source, sr.description,";
$sql.=" FROM ".MAIN_DB_PREFIX."societe_remise_except"; $sql.= " sr.datec,";
$sql.=" WHERE (fk_facture_line IS NOT NULL"; // Not used as absolute simple discount $sql.= " f.facnumber as ref_facture_source";
$sql.=" OR fk_facture IS NOT NULL)"; // Not used as credit note and not used as deposit $sql.= " FROM ".MAIN_DB_PREFIX."societe_remise_except as sr";
$sql.=" AND fk_facture_source = ".$this->fk_facture_source; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON sr.fk_facture_source = f.rowid";
//$sql.=" AND rowid != ".$this->id; $sql.= " WHERE";
if ($rowid) $sql.= " sr.rowid=".$rowid;
if ($fk_facture_source) $sql.= " sr.fk_facture_source=".$fk_facture_source;
dol_syslog("DiscountAbsolute::delete Check if we can remove discount sql=".$sql); dol_syslog("DiscountAbsolute::fetch sql=".$sql);
$resql=$this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
$obj = $this->db->fetch_object($resql); if ($this->db->num_rows($resql))
if ($obj->nb > 0) {
{ $obj = $this->db->fetch_object($resql);
$this->error='ErrorThisPartOrAnotherIsAlreadyUsedSoDiscountSerieCantBeRemoved';
return -2;
}
}
else
{
dol_print_error($db);
return -1;
}
}
$this->db->begin(); $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->tva_tx = $obj->tva_tx;
$this->fk_user = $obj->fk_user;
$this->fk_facture_line = $obj->fk_facture_line;
$this->fk_facture = $obj->fk_facture;
$this->fk_facture_source = $obj->fk_facture_source; // Id avoir source
$this->ref_facture_source = $obj->ref_facture_source; // Ref avoir source
$this->description = $obj->description;
$this->datec = $this->db->jdate($obj->datec);
// Delete but only if not used $this->db->free($resql);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_remise_except "; return 1;
if ($this->fk_facture_source) $sql.= " WHERE fk_facture_source = ".$this->fk_facture_source; // Delete all lines of same serie }
else $sql.= " WHERE rowid = ".$this->id; // Delete only line else
$sql.= " AND (fk_facture_line IS NULL"; // Not used as absolute simple discount {
$sql.= " AND fk_facture IS NULL)"; // Not used as credit note and not used as deposit $this->db->free($resql);
return 0;
}
}
else
{
$this->error=$this->db->error();
return -1;
}
}
dol_syslog("DiscountAbsolute::delete Delete discount sql=".$sql);
$result=$this->db->query($sql);
if ($result)
{
// If source of discount was a credit note or deposit, we change source statut.
if ($this->fk_facture_source)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."facture";
$sql.=" set paye=0, fk_statut=1";
$sql.=" WHERE (type = 2 or type = 3) AND rowid=".$this->fk_facture_source;
dol_syslog("DiscountAbsolute::delete Update credit note or deposit invoice statut sql=".$sql); /**
$result=$this->db->query($sql); * Create a discount into database
if ($result) *
{ * @param User $user User that create
$this->db->commit(); * @return int <0 if KO, >0 if OK
return 1; */
} function create($user)
else {
{ global $conf, $langs;
$this->error=$this->db->lasterror();
$this->db->rollback(); // Clean parameters
return -1; $this->amount_ht=price2num($this->amount_ht);
} $this->amount_tva=price2num($this->amount_tva);
} $this->amount_ttc=price2num($this->amount_ttc);
else $this->tva_tx=price2num($this->tva_tx);
{
$this->db->commit(); // Check parameters
return 1; if (empty($this->description))
} {
} $this->error='BadValueForPropertyDescription';
else dol_syslog("DiscountAbsolute::create ".$this->error, LOG_ERR);
{ return -1;
$this->error=$this->db->lasterror(); }
$this->db->rollback();
return -1; // Insert request
} $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_remise_except";
} $sql.= " (datec, fk_soc, fk_user, description,";
$sql.= " amount_ht, amount_tva, amount_ttc, tva_tx,";
$sql.= " fk_facture_source";
$sql.= ")";
$sql.= " VALUES (".$this->db->idate($this->datec!=''?$this->datec:dol_now()).", ".$this->fk_soc.", ".$user->id.", '".$this->db->escape($this->description)."',";
$sql.= " ".$this->amount_ht.", ".$this->amount_tva.", ".$this->amount_ttc.", ".$this->tva_tx.",";
$sql.= " ".($this->fk_facture_source?"'".$this->fk_facture_source."'":"null");
$sql.= ")";
dol_syslog("DiscountAbsolute::create sql=".$sql);
$resql=$this->db->query($sql);
if ($resql)
{
$this->id=$this->db->last_insert_id(MAIN_DB_PREFIX."societe_remise_except");
return $this->id;
}
else
{
$this->error=$this->db->lasterror().' - sql='.$sql;
dol_syslog("DiscountAbsolute::create ".$this->error, LOG_ERR);
return -1;
}
}
/**
* Delete object in database. If fk_facture_source is defined, we delete all familiy with same fk_facture_source. If not, only with id is removed
*
* @param User $user Object of user asking to delete
* @return int <0 if KO, >0 if OK
*/
function delete($user)
{
global $conf, $langs;
// Check if we can remove the discount
if ($this->fk_facture_source)
{
$sql.="SELECT COUNT(rowid) as nb";
$sql.=" FROM ".MAIN_DB_PREFIX."societe_remise_except";
$sql.=" WHERE (fk_facture_line IS NOT NULL"; // Not used as absolute simple discount
$sql.=" OR fk_facture IS NOT NULL)"; // Not used as credit note and not used as deposit
$sql.=" AND fk_facture_source = ".$this->fk_facture_source;
//$sql.=" AND rowid != ".$this->id;
dol_syslog("DiscountAbsolute::delete Check if we can remove discount sql=".$sql);
$resql=$this->db->query($sql);
if ($resql)
{
$obj = $this->db->fetch_object($resql);
if ($obj->nb > 0)
{
$this->error='ErrorThisPartOrAnotherIsAlreadyUsedSoDiscountSerieCantBeRemoved';
return -2;
}
}
else
{
dol_print_error($db);
return -1;
}
}
$this->db->begin();
// Delete but only if not used
$sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_remise_except ";
if ($this->fk_facture_source) $sql.= " WHERE fk_facture_source = ".$this->fk_facture_source; // Delete all lines of same serie
else $sql.= " WHERE rowid = ".$this->id; // Delete only line
$sql.= " AND (fk_facture_line IS NULL"; // Not used as absolute simple discount
$sql.= " AND fk_facture IS NULL)"; // Not used as credit note and not used as deposit
dol_syslog("DiscountAbsolute::delete Delete discount sql=".$sql);
$result=$this->db->query($sql);
if ($result)
{
// If source of discount was a credit note or deposit, we change source statut.
if ($this->fk_facture_source)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."facture";
$sql.=" set paye=0, fk_statut=1";
$sql.=" WHERE (type = 2 or type = 3) AND rowid=".$this->fk_facture_source;
dol_syslog("DiscountAbsolute::delete Update credit note or deposit invoice statut sql=".$sql);
$result=$this->db->query($sql);
if ($result)
{
$this->db->commit();
return 1;
}
else
{
$this->error=$this->db->lasterror();
$this->db->rollback();
return -1;
}
}
else
{
$this->db->commit();
return 1;
}
}
else
{
$this->error=$this->db->lasterror();
$this->db->rollback();
return -1;
}
}
/** /**
* \brief Link the discount to a particular invoice line or a particular invoice * Link the discount to a particular invoice line or a particular invoice
* \param rowidline Invoice line id *
* \param rowidinvoice Invoice id * @param int $rowidline Invoice line id
* \return int <0 ko, >0 ok * @param int $rowidinvoice Invoice id
*/ * @return int <0 if KO, >0 if OK
function link_to_invoice($rowidline,$rowidinvoice) */
{ function link_to_invoice($rowidline,$rowidinvoice)
// Check parameters {
if (! $rowidline && ! $rowidinvoice) // Check parameters
{ if (! $rowidline && ! $rowidinvoice)
$this->error='ErrorBadParameters'; {
return -1; $this->error='ErrorBadParameters';
} return -1;
if ($rowidline && $rowidinvoice) }
{ if ($rowidline && $rowidinvoice)
$this->error='ErrorBadParameters'; {
return -2; $this->error='ErrorBadParameters';
} return -2;
}
$sql ="UPDATE ".MAIN_DB_PREFIX."societe_remise_except"; $sql ="UPDATE ".MAIN_DB_PREFIX."societe_remise_except";
if ($rowidline) $sql.=" SET fk_facture_line = ".$rowidline; if ($rowidline) $sql.=" SET fk_facture_line = ".$rowidline;
if ($rowidinvoice) $sql.=" SET fk_facture = ".$rowidinvoice; if ($rowidinvoice) $sql.=" SET fk_facture = ".$rowidinvoice;
$sql.=" WHERE rowid = ".$this->id; $sql.=" WHERE rowid = ".$this->id;
dol_syslog("DiscountAbsolute::link_to_invoice sql=".$sql,LOG_DEBUG); dol_syslog("DiscountAbsolute::link_to_invoice sql=".$sql,LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
return 1; $this->fk_facture_source=$rowidline;
} $this->fk_facture=$rowidinvoice;
else return 1;
{ }
$this->error=$this->db->error(); else
dol_syslog("DiscountAbsolute::link_to_invoice ".$this->error,LOG_ERR); {
return -3; $this->error=$this->db->error();
} dol_syslog("DiscountAbsolute::link_to_invoice ".$this->error,LOG_ERR);
} return -3;
}
}
/** /**
* \brief Link the discount to a particular invoice line or a particular invoice * \brief Link the discount to a particular invoice line or a particular invoice
* \remarks Do not call this if discount is linked to a reconcialiated invoice * \remarks Do not call this if discount is linked to a reconcialiated invoice
* \param rowidline Invoice line id * \param rowidline Invoice line id
* \param rowidinvoice Invoice id * \param rowidinvoice Invoice id
* \return int <0 if KO, >0 if OK * \return int <0 if KO, >0 if OK
*/ */
function unlink_invoice() function unlink_invoice()
{ {
$sql ="UPDATE ".MAIN_DB_PREFIX."societe_remise_except"; $sql ="UPDATE ".MAIN_DB_PREFIX."societe_remise_except";
$sql.=" SET fk_facture_line = NULL, fk_facture = NULL"; $sql.=" SET fk_facture_line = NULL, fk_facture = NULL";
$sql.=" WHERE rowid = ".$this->id; $sql.=" WHERE rowid = ".$this->id;
dol_syslog("DiscountAbsolute::unlink_invoice sql=".$sql,LOG_DEBUG); dol_syslog("DiscountAbsolute::unlink_invoice sql=".$sql,LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
return 1; return 1;
} }
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog("DiscountAbsolute::link_to_invoice ".$this->error,LOG_ERR); dol_syslog("DiscountAbsolute::link_to_invoice ".$this->error,LOG_ERR);
return -3; return -3;
} }
} }
/** /**
* \brief Renvoie montant TTC des reductions/avoirs en cours disponibles pour une société, un user ou autre * \brief Renvoie montant TTC des reductions/avoirs en cours disponibles pour une société, un user ou autre
* \param company Object third party for filter * \param company Object third party for filter
* \param user Filtre sur un user auteur des remises * \param user Filtre sur un user auteur des remises
* \param filter Filtre autre * \param filter Filtre autre
* \param maxvalue Filter on max value for discount * \param maxvalue Filter on max value for discount
* \return int <0 si ko, montant avoir sinon * \return int <0 si ko, montant avoir sinon
*/ */
function getAvailableDiscounts($company='', $user='',$filter='', $maxvalue=0) function getAvailableDiscounts($company='', $user='',$filter='', $maxvalue=0)
{ {
$sql = "SELECT SUM(rc.amount_ttc) as amount"; $sql = "SELECT SUM(rc.amount_ttc) as amount";
// $sql = "SELECT rc.amount_ttc as amount"; // $sql = "SELECT rc.amount_ttc as amount";
$sql.= " FROM ".MAIN_DB_PREFIX."societe_remise_except as rc"; $sql.= " FROM ".MAIN_DB_PREFIX."societe_remise_except as rc";
$sql.= " WHERE (rc.fk_facture IS NULL AND rc.fk_facture_line IS NULL)"; // Available $sql.= " WHERE (rc.fk_facture IS NULL AND rc.fk_facture_line IS NULL)"; // Available
if (is_object($company)) $sql.= " AND rc.fk_soc = ".$company->id; if (is_object($company)) $sql.= " AND rc.fk_soc = ".$company->id;
if (is_object($user)) $sql.= " AND rc.fk_user = ".$user->id; if (is_object($user)) $sql.= " AND rc.fk_user = ".$user->id;
if ($filter) $sql.=' AND '.$filter; if ($filter) $sql.=' AND '.$filter;
if ($maxvalue) $sql.=' AND rc.amount_ttc <= '.price2num($maxvalue); if ($maxvalue) $sql.=' AND rc.amount_ttc <= '.price2num($maxvalue);
@@ -350,100 +356,100 @@ class DiscountAbsolute
if ($resql) if ($resql)
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
//while ($obj) //while ($obj)
//{ //{
//print 'zz'.$obj->amount; //print 'zz'.$obj->amount;
//$obj = $this->db->fetch_object($resql); //$obj = $this->db->fetch_object($resql);
//} //}
return $obj->amount; return $obj->amount;
} }
return -1; return -1;
} }
/** /**
* \brief Return amount (with tax) of all credit notes and deposits invoices used by invoice * \brief Return amount (with tax) of all credit notes and deposits invoices used by invoice
* \return int <0 if KO, Sum of credit notes and deposits amount otherwise * \return int <0 if KO, Sum of credit notes and deposits amount otherwise
*/ */
function getSumCreditNotesUsed($invoice) function getSumCreditNotesUsed($invoice)
{ {
$sql = 'SELECT sum(rc.amount_ttc) as amount'; $sql = 'SELECT sum(rc.amount_ttc) as amount';
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc, '.MAIN_DB_PREFIX.'facture as f'; $sql.= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc, '.MAIN_DB_PREFIX.'facture as f';
$sql.= ' WHERE rc.fk_facture_source=f.rowid AND rc.fk_facture = '.$invoice->id; $sql.= ' WHERE rc.fk_facture_source=f.rowid AND rc.fk_facture = '.$invoice->id;
$sql.= ' AND f.type = 2'; $sql.= ' AND f.type = 2';
dol_syslog("DiscountAbsolute::getSumCreditNotesUsed sql=".$sql,LOG_DEBUG); dol_syslog("DiscountAbsolute::getSumCreditNotesUsed sql=".$sql,LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
return $obj->amount; return $obj->amount;
} }
else else
{ {
return -1; return -1;
} }
} }
/** /**
* \brief Return amount (with tax) of all deposits invoices used by invoice * \brief Return amount (with tax) of all deposits invoices used by invoice
* \return int <0 if KO, Sum of credit notes and deposits amount otherwise * \return int <0 if KO, Sum of credit notes and deposits amount otherwise
*/ */
function getSumDepositsUsed($invoice) function getSumDepositsUsed($invoice)
{ {
$sql = 'SELECT sum(rc.amount_ttc) as amount'; $sql = 'SELECT sum(rc.amount_ttc) as amount';
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc, '.MAIN_DB_PREFIX.'facture as f'; $sql.= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc, '.MAIN_DB_PREFIX.'facture as f';
$sql.= ' WHERE rc.fk_facture_source=f.rowid AND rc.fk_facture = '.$invoice->id; $sql.= ' WHERE rc.fk_facture_source=f.rowid AND rc.fk_facture = '.$invoice->id;
$sql.= ' AND f.type = 3'; $sql.= ' AND f.type = 3';
dol_syslog("DiscountAbsolute::getSumDepositsUsed sql=".$sql,LOG_DEBUG); dol_syslog("DiscountAbsolute::getSumDepositsUsed sql=".$sql,LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
return $obj->amount; return $obj->amount;
} }
else else
{ {
return -1; return -1;
} }
} }
/** /**
* \brief Return clicable ref of object (with picto or not) * \brief Return clicable ref of object (with picto or not)
* \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul * \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
* \param option Sur quoi pointe le lien * \param option Sur quoi pointe le lien
* \return string Chaine avec URL * \return string Chaine avec URL
*/ */
function getNomUrl($withpicto,$option='invoice') function getNomUrl($withpicto,$option='invoice')
{ {
global $langs; global $langs;
$result=''; $result='';
if ($option == 'invoice') if ($option == 'invoice')
{ {
$lien = '<a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$this->fk_facture_source.'">'; $lien = '<a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$this->fk_facture_source.'">';
$lienfin='</a>'; $lienfin='</a>';
$label=$langs->trans("ShowDiscount").': '.$this->ref_facture_source; $label=$langs->trans("ShowDiscount").': '.$this->ref_facture_source;
$ref=$this->ref_facture_source; $ref=$this->ref_facture_source;
$picto='bill'; $picto='bill';
} }
if ($option == 'discount') if ($option == 'discount')
{ {
$lien = '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$this->fk_soc.'">'; $lien = '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$this->fk_soc.'">';
$lienfin='</a>'; $lienfin='</a>';
$label=$langs->trans("Discount"); $label=$langs->trans("Discount");
$ref=$langs->trans("Discount"); $ref=$langs->trans("Discount");
$picto='generic'; $picto='generic';
} }
if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin); if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin);
if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto && $withpicto != 2) $result.=' ';
$result.=$lien.$ref.$lienfin; $result.=$lien.$ref.$lienfin;
return $result; return $result;
} }
} }
?> ?>

View File

@@ -23,7 +23,6 @@
* \ingroup ficheinter * \ingroup ficheinter
* \brief Fichier de la classe des gestion des fiches interventions * \brief Fichier de la classe des gestion des fiches interventions
*/ */
require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php"); require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
@@ -61,7 +60,8 @@ class Fichinter extends CommonObject
/** /**
* Class constructor * Class constructor
* @param DB Data base handler access *
* @param DoliDB $DB Data base handler access
*/ */
function Fichinter($DB) function Fichinter($DB)
{ {

View File

@@ -221,6 +221,7 @@ NewGlobalDiscount=تحديد خصم جديد
NewRelativeDiscount=خصم جديد النسبية NewRelativeDiscount=خصم جديد النسبية
NoteReason=ملاحظة / السبب NoteReason=ملاحظة / السبب
ReasonDiscount=السبب ReasonDiscount=السبب
AddDiscount=إضافة الخصم
AddGlobalDiscount=إضافة الخصم AddGlobalDiscount=إضافة الخصم
DiscountOfferedBy=التي تمنحها DiscountOfferedBy=التي تمنحها
DiscountStillRemaining=خصم لا يزالون DiscountStillRemaining=خصم لا يزالون

View File

@@ -234,6 +234,7 @@ GlobalDiscount=Descompte fixe
CreditNote=Abonament CreditNote=Abonament
CreditNotes=Abonaments CreditNotes=Abonaments
AddDiscount=Crear descompte fix AddDiscount=Crear descompte fix
AddGlobalDiscount=Crear descompte fixe
AddCreditNote=Crear factura de pagament AddCreditNote=Crear factura de pagament
Deposit=Bestreta Deposit=Bestreta
Deposits=Bestretes Deposits=Bestretes
@@ -245,7 +246,6 @@ NewGlobalDiscount=Nou descompte fixe
NewRelativeDiscount=Nou descompte NewRelativeDiscount=Nou descompte
NoteReason=Nota/Motiu NoteReason=Nota/Motiu
ReasonDiscount=Motiu ReasonDiscount=Motiu
AddGlobalDiscount=Afegir descompte fixe
DiscountOfferedBy=Acordat per DiscountOfferedBy=Acordat per
DiscountStillRemaining=Descomptes fixes pendents DiscountStillRemaining=Descomptes fixes pendents
DiscountAlreadyCounted=Descomptes fixes ja aplicats DiscountAlreadyCounted=Descomptes fixes ja aplicats

View File

@@ -219,6 +219,7 @@ DiscountFromCreditNote=Discount fra kreditnota %s
NewGlobalDiscount=Ny discount NewGlobalDiscount=Ny discount
NoteReason=Bemærk / Grund NoteReason=Bemærk / Grund
ReasonDiscount=Årsag ReasonDiscount=Årsag
AddDiscount=Tilføj rabat
AddGlobalDiscount=Tilføj rabat AddGlobalDiscount=Tilføj rabat
DiscountOfferedBy=Ydet af DiscountOfferedBy=Ydet af
DiscountStillRemaining=Discount stadig resterende DiscountStillRemaining=Discount stadig resterende

View File

@@ -215,6 +215,7 @@ DiscountFromCreditNote=Rabatt aus Gutschrift %s
NewGlobalDiscount=Neue Rabattregel NewGlobalDiscount=Neue Rabattregel
NoteReason=Anmerkung/Begründung NoteReason=Anmerkung/Begründung
ReasonDiscount=Rabattgrund ReasonDiscount=Rabattgrund
AddDiscount=Rabattregel hinzufügen
AddGlobalDiscount=Rabattregel hinzufügen AddGlobalDiscount=Rabattregel hinzufügen
DiscountOfferedBy=Rabatt angeboten von DiscountOfferedBy=Rabatt angeboten von
DiscountStillRemaining=Noch verbleibender Rabatt DiscountStillRemaining=Noch verbleibender Rabatt

View File

@@ -215,6 +215,7 @@ DiscountFromCreditNote=Rabatt aus Gutschrift %s
NewGlobalDiscount=Neue Rabattregel NewGlobalDiscount=Neue Rabattregel
NoteReason=Anmerkung/Begründung NoteReason=Anmerkung/Begründung
ReasonDiscount=Rabattgrund ReasonDiscount=Rabattgrund
AddDiscount=Rabattregel hinzufügen
AddGlobalDiscount=Rabattregel hinzufügen AddGlobalDiscount=Rabattregel hinzufügen
DiscountOfferedBy=Rabatt angeboten von DiscountOfferedBy=Rabatt angeboten von
DiscountStillRemaining=Noch verbleibender Rabatt DiscountStillRemaining=Noch verbleibender Rabatt

View File

@@ -244,7 +244,6 @@ NewGlobalDiscount=Νέα απόλυτη έκπτωση
NewRelativeDiscount=Νέα σχετική έκπτωση NewRelativeDiscount=Νέα σχετική έκπτωση
NoteReason=Σημείωση/Αιτία NoteReason=Σημείωση/Αιτία
ReasonDiscount=Αιτία ReasonDiscount=Αιτία
AddGlobalDiscount=Προσθήκη έκπτωσης
DiscountOfferedBy=Granted by DiscountOfferedBy=Granted by
DiscountStillRemaining=Η έκπτωση παραμένει DiscountStillRemaining=Η έκπτωση παραμένει
DiscountAlreadyCounted=Η έκπτωση υπολογίστηκε ήδη DiscountAlreadyCounted=Η έκπτωση υπολογίστηκε ήδη
@@ -426,6 +425,7 @@ DisabledBecauseNotErasable=Άτομα με ειδικές ανάγκες, επε
NumberOfBillsByMonth=Nb των τιμολογίων ανά μήνα NumberOfBillsByMonth=Nb των τιμολογίων ανά μήνα
AmountOfBillsByMonthHT=Ποσό των τιμολογίων ανά μήνα (μετά από φόρους) AmountOfBillsByMonthHT=Ποσό των τιμολογίων ανά μήνα (μετά από φόρους)
AddDiscount=Δημιουργία απόλυτη έκπτωση AddDiscount=Δημιουργία απόλυτη έκπτωση
AddGlobalDiscount=Προσθήκη έκπτωσης
AddCreditNote=Δημιουργία πιστωτικό σημείωμα AddCreditNote=Δημιουργία πιστωτικό σημείωμα
InvoiceNotChecked=Δεν έχει επιλεγεί τιμολόγιο InvoiceNotChecked=Δεν έχει επιλεγεί τιμολόγιο
ShowUnpaidAll=Εμφάνιση όλων των απλήρωτων τιμολογίων ShowUnpaidAll=Εμφάνιση όλων των απλήρωτων τιμολογίων

View File

@@ -232,7 +232,11 @@ Reductions=Reductions
ReductionsShort=Reduc. ReductionsShort=Reduc.
Discount=Discount Discount=Discount
Discounts=Discounts Discounts=Discounts
AddDiscount=Create absolute discount AddDiscount=Create discount
AddRelativeDiscount=Create relative discount
EditRelativelDiscount=Edit relatvie discount
AddGlobalDiscount=Create absolute discount
EditGlobalDiscounts=Edit absolute discounts
AddCreditNote=Create credit note AddCreditNote=Create credit note
ShowDiscount=Show discount ShowDiscount=Show discount
RelativeDiscount=Relative discount RelativeDiscount=Relative discount
@@ -249,7 +253,6 @@ NewGlobalDiscount=New absolute discount
NewRelativeDiscount=New relative discount NewRelativeDiscount=New relative discount
NoteReason=Note/Reason NoteReason=Note/Reason
ReasonDiscount=Reason ReasonDiscount=Reason
AddGlobalDiscount=Add discount
DiscountOfferedBy=Granted by DiscountOfferedBy=Granted by
DiscountStillRemaining=Discounts still remaining DiscountStillRemaining=Discounts still remaining
DiscountAlreadyCounted=Discounts already counted DiscountAlreadyCounted=Discounts already counted

View File

@@ -234,6 +234,7 @@ GlobalDiscount=Descuento fijo
CreditNote=Abono CreditNote=Abono
CreditNotes=Abonos CreditNotes=Abonos
AddDiscount=Crear descuento fijo AddDiscount=Crear descuento fijo
AddGlobalDiscount=Crear descuento fijo
AddCreditNote=Crear factura de abono AddCreditNote=Crear factura de abono
Deposit=Anticipo Deposit=Anticipo
Deposits=Anticipos Deposits=Anticipos
@@ -245,7 +246,6 @@ NewGlobalDiscount=Nuevo descuento fijo
NewRelativeDiscount=Nuevo descuento NewRelativeDiscount=Nuevo descuento
NoteReason=Nota/Motivo NoteReason=Nota/Motivo
ReasonDiscount=Motivo ReasonDiscount=Motivo
AddGlobalDiscount=Añadir descuento fijo
DiscountOfferedBy=Acordado por DiscountOfferedBy=Acordado por
DiscountStillRemaining=Descuentos fijos pendientes DiscountStillRemaining=Descuentos fijos pendientes
DiscountAlreadyCounted=Descuentos fijos ya aplicados DiscountAlreadyCounted=Descuentos fijos ya aplicados

View File

@@ -221,6 +221,7 @@ NewGlobalDiscount=تحديد خصم جديد
NewRelativeDiscount=خصم جديد النسبية NewRelativeDiscount=خصم جديد النسبية
NoteReason=ملاحظة / السبب NoteReason=ملاحظة / السبب
ReasonDiscount=السبب ReasonDiscount=السبب
AddDiscount=إضافة الخصم
AddGlobalDiscount=إضافة الخصم AddGlobalDiscount=إضافة الخصم
DiscountOfferedBy=التي تمنحها DiscountOfferedBy=التي تمنحها
DiscountStillRemaining=خصم لا يزالون DiscountStillRemaining=خصم لا يزالون

View File

@@ -215,6 +215,7 @@ DiscountFromCreditNote=Alennus menoilmoitus %s
NewGlobalDiscount=Uusi edullisista NewGlobalDiscount=Uusi edullisista
NoteReason=Huomautus / syy NoteReason=Huomautus / syy
ReasonDiscount=Perustelu ReasonDiscount=Perustelu
AddDiscount=Lisää edullisista
AddGlobalDiscount=Lisää edullisista AddGlobalDiscount=Lisää edullisista
DiscountOfferedBy=Myöntämä DiscountOfferedBy=Myöntämä
DiscountStillRemaining=Discount vielä jäljellä DiscountStillRemaining=Discount vielä jäljellä

View File

@@ -233,7 +233,11 @@ RelativeDiscount=Remise relative
GlobalDiscount=Remise fixe GlobalDiscount=Remise fixe
CreditNote=Avoir CreditNote=Avoir
CreditNotes=Avoirs CreditNotes=Avoirs
AddDiscount=Créer remise fixe AddDiscount=Editer remises
AddRelativeDiscount=Créer remise relative
EditRelativeDiscount=Editer remise relative
AddGlobalDiscount=Créer remise fixe
EditGlobalDiscounts=Editer remises fixes
AddCreditNote=Créer facture avoir AddCreditNote=Créer facture avoir
Deposit=Acompte Deposit=Acompte
Deposits=Acomptes Deposits=Acomptes
@@ -245,7 +249,6 @@ NewGlobalDiscount=Nouvelle remise fixe
NewRelativeDiscount=Nouvelle remise relative NewRelativeDiscount=Nouvelle remise relative
NoteReason=Note/Motif NoteReason=Note/Motif
ReasonDiscount=Motif ReasonDiscount=Motif
AddGlobalDiscount=Ajouter remise fixe
DiscountOfferedBy=Accordé par DiscountOfferedBy=Accordé par
DiscountStillRemaining=Remises restant en cours DiscountStillRemaining=Remises restant en cours
DiscountAlreadyCounted=Remises déjà appliquées DiscountAlreadyCounted=Remises déjà appliquées

View File

@@ -219,7 +219,6 @@ DiscountFromCreditNote =Sconto da nota di credito per %s
NewGlobalDiscount =Nuovo sconto NewGlobalDiscount =Nuovo sconto
NoteReason =Note / Motivo NoteReason =Note / Motivo
ReasonDiscount =Motivo ReasonDiscount =Motivo
AddGlobalDiscount =Aggiungi sconto
DiscountOfferedBy =Concessi da DiscountOfferedBy =Concessi da
DiscountStillRemaining =Sconto ancora disponibile DiscountStillRemaining =Sconto ancora disponibile
DiscountAlreadyCounted =Sconto già applicato DiscountAlreadyCounted =Sconto già applicato
@@ -436,7 +435,8 @@ BillsSuppliersUnpaidForCompany=Fornitore di fatture non pagate per %s
BillsLate=Ritardi nei pagamenti BillsLate=Ritardi nei pagamenti
DisabledBecauseNotErasable=Disabili perché non possono essere cancellati DisabledBecauseNotErasable=Disabili perché non possono essere cancellati
AmountOfBillsByMonthHT=Importo delle fatture per mese (al netto delle imposte) AmountOfBillsByMonthHT=Importo delle fatture per mese (al netto delle imposte)
AddDiscount=Creare sconto assoluto AddDiscount=Creare sconto
AddGlobalDiscount=Creare sconto assoluto
AddCreditNote=Crea nota di credito AddCreditNote=Crea nota di credito
InvoiceNotChecked=Fattura non selezionati InvoiceNotChecked=Fattura non selezionati
ShowUnpaidAll=Mostra tutte le fatture non pagate ShowUnpaidAll=Mostra tutte le fatture non pagate

View File

@@ -223,6 +223,7 @@ DiscountFromCreditNote=Rabatt fra kreditnota %s
NewGlobalDiscount=Ny rabatt NewGlobalDiscount=Ny rabatt
NoteReason=Notat/Årsak NoteReason=Notat/Årsak
ReasonDiscount=Årsak ReasonDiscount=Årsak
AddDiscount=Legg til rabatt
AddGlobalDiscount=Legg til rabatt AddGlobalDiscount=Legg til rabatt
DiscountOfferedBy=Innrømmet av DiscountOfferedBy=Innrømmet av
DiscountStillRemaining=Gjenstående rabatt DiscountStillRemaining=Gjenstående rabatt

View File

@@ -188,6 +188,7 @@ CreditNotes=Creditnota's
NewGlobalDiscount=Nieuwe korting NewGlobalDiscount=Nieuwe korting
NoteReason=Nota/Reden NoteReason=Nota/Reden
ReasonDiscount=Reden ReasonDiscount=Reden
AddDiscount=Korting toevoegen
AddGlobalDiscount=Korting toevoegen AddGlobalDiscount=Korting toevoegen
DiscountOfferedBy=Verleend door DiscountOfferedBy=Verleend door
DiscountStillRemaining=Korting nog steeds geldig / nog niet gerekend DiscountStillRemaining=Korting nog steeds geldig / nog niet gerekend

View File

@@ -240,6 +240,7 @@ NewGlobalDiscount=Nieuwe korting
NewRelativeDiscount=Nieuwe relatieve korting NewRelativeDiscount=Nieuwe relatieve korting
NoteReason=Opmerking/Reden NoteReason=Opmerking/Reden
ReasonDiscount=Reden ReasonDiscount=Reden
AddDiscount=Toevoegen korting
AddGlobalDiscount=Toevoegen korting AddGlobalDiscount=Toevoegen korting
DiscountOfferedBy=Verleend door DiscountOfferedBy=Verleend door
DiscountStillRemaining=Kortingen nog steeds vast DiscountStillRemaining=Kortingen nog steeds vast

View File

@@ -220,6 +220,7 @@ DiscountFromCreditNote=Rabat od kredytu pamiętać %s
NewGlobalDiscount=Nowe zniżki NewGlobalDiscount=Nowe zniżki
NoteReason=Uwaga / Reason NoteReason=Uwaga / Reason
ReasonDiscount=Powód ReasonDiscount=Powód
AddDiscount=Dodaj zniżki
AddGlobalDiscount=Dodaj zniżki AddGlobalDiscount=Dodaj zniżki
DiscountOfferedBy=Przyznane przez DiscountOfferedBy=Przyznane przez
DiscountStillRemaining=Rabat nadal pozostały DiscountStillRemaining=Rabat nadal pozostały

View File

@@ -242,6 +242,7 @@ CreditNoteDepositUse=O projeto deve ser validado para utilizar este tipo de cré
NewGlobalDiscount=Novo Desconto fixo NewGlobalDiscount=Novo Desconto fixo
NoteReason=Nota/Motivo NoteReason=Nota/Motivo
ReasonDiscount=Motivo ReasonDiscount=Motivo
AddDiscount=Adicionar Desconto
AddGlobalDiscount=Adicionar Desconto Fixo AddGlobalDiscount=Adicionar Desconto Fixo
DiscountOfferedBy=Acordado por DiscountOfferedBy=Acordado por
DiscountStillRemaining=Descontos fixos Pendentes DiscountStillRemaining=Descontos fixos Pendentes

View File

@@ -232,6 +232,7 @@ DiscountFromDeposit=Pagamentos a partir de depósito na factura %s
NewGlobalDiscount=Novo Desconto fixo NewGlobalDiscount=Novo Desconto fixo
NoteReason=Nota/Motivo NoteReason=Nota/Motivo
ReasonDiscount=Motivo ReasonDiscount=Motivo
AddDiscount=Adicionar Desconto
AddGlobalDiscount=Adicionar Desconto fixo AddGlobalDiscount=Adicionar Desconto fixo
DiscountOfferedBy=Acordado por DiscountOfferedBy=Acordado por
DiscountStillRemaining=Descontos fixos Pendentes DiscountStillRemaining=Descontos fixos Pendentes

View File

@@ -217,6 +217,7 @@ DiscountFromCreditNote=Reducere de la nota de credit %s
NewGlobalDiscount=Noua reducere NewGlobalDiscount=Noua reducere
NoteReason=Notă / Motiv NoteReason=Notă / Motiv
ReasonDiscount=Motiv ReasonDiscount=Motiv
AddDiscount=Adauga discount
AddGlobalDiscount=Adauga discount AddGlobalDiscount=Adauga discount
DiscountOfferedBy=Acordate de către DiscountOfferedBy=Acordate de către
DiscountStillRemaining=Reducere rămânând DiscountStillRemaining=Reducere rămânând

View File

@@ -216,7 +216,6 @@ DiscountFromCreditNote=Скидка из кредитового авизо %s
NewGlobalDiscount=Новая фиксированная скидка NewGlobalDiscount=Новая фиксированная скидка
NoteReason=Примечание / Основание NoteReason=Примечание / Основание
ReasonDiscount=Основание ReasonDiscount=Основание
AddGlobalDiscount=Добавить скидку
DiscountOfferedBy=Предоставлена DiscountOfferedBy=Предоставлена
DiscountStillRemaining=Остаток скидки DiscountStillRemaining=Остаток скидки
DiscountAlreadyCounted=Скидка уже рассчитана DiscountAlreadyCounted=Скидка уже рассчитана
@@ -418,6 +417,7 @@ ShowUnpaidAll=Показать все неоплаченные счета-фак
NumberOfBillsByMonth=Кол-во счетов-фактур по месяцам NumberOfBillsByMonth=Кол-во счетов-фактур по месяцам
AmountOfBillsByMonthHT=Сумма счетов-фактур за месяц (за вычетом налога) AmountOfBillsByMonthHT=Сумма счетов-фактур за месяц (за вычетом налога)
AddDiscount=Создать абсолютную скидку AddDiscount=Создать абсолютную скидку
AddGlobalDiscount=Добавить скидку
AddCreditNote=Создать кредитовое авизо AddCreditNote=Создать кредитовое авизо
ClosePaidInvoicesAutomatically=Классифицировать как 'Оплачен' все полностью оплаченные счета-фактуры. ClosePaidInvoicesAutomatically=Классифицировать как 'Оплачен' все полностью оплаченные счета-фактуры.
AllCompletelyPayedInvoiceWillBeClosed=Все счета, без остатка к оплате будут автоматически закрыты со статусом "Оплачен". AllCompletelyPayedInvoiceWillBeClosed=Все счета, без остатка к оплате будут автоматически закрыты со статусом "Оплачен".

View File

@@ -247,6 +247,7 @@ NewGlobalDiscount=Nov fiksni popust
NewRelativeDiscount=Nov relativni popust NewRelativeDiscount=Nov relativni popust
NoteReason=Opomba/Razlog NoteReason=Opomba/Razlog
ReasonDiscount=Razlog ReasonDiscount=Razlog
AddDiscount=Dodaj popust
AddGlobalDiscount=Dodaj popust AddGlobalDiscount=Dodaj popust
DiscountOfferedBy=Odobril DiscountOfferedBy=Odobril
DiscountStillRemaining=Popust še vedno ostaja DiscountStillRemaining=Popust še vedno ostaja

View File

@@ -252,6 +252,7 @@ NewGlobalDiscount=Ny fix rabatt
NewRelativeDiscount=Nya relativa rabatt NewRelativeDiscount=Nya relativa rabatt
NoteReason=Not / Reason NoteReason=Not / Reason
ReasonDiscount=Reason ReasonDiscount=Reason
AddDiscount=Lägg rabatt
AddGlobalDiscount=Lägg rabatt AddGlobalDiscount=Lägg rabatt
DiscountOfferedBy=Beviljats av DiscountOfferedBy=Beviljats av
DiscountStillRemaining=Rabatt återstår fortfarande DiscountStillRemaining=Rabatt återstår fortfarande

View File

@@ -253,6 +253,7 @@ NewGlobalDiscount=Yeni düzeltme indirim
NewRelativeDiscount=Yeni göreli indirim NewRelativeDiscount=Yeni göreli indirim
NoteReason=Not / Nedeni NoteReason=Not / Nedeni
ReasonDiscount=Neden ReasonDiscount=Neden
AddDiscount=Indirimli ekle
AddGlobalDiscount=Indirimli ekle AddGlobalDiscount=Indirimli ekle
DiscountOfferedBy=Tarafından verilen DiscountOfferedBy=Tarafından verilen
DiscountStillRemaining=Indirimli hareketsiz kalan DiscountStillRemaining=Indirimli hareketsiz kalan

View File

@@ -251,6 +251,7 @@ NewGlobalDiscount=新的修补程序折扣
NewRelativeDiscount=新的相对折扣 NewRelativeDiscount=新的相对折扣
NoteReason=备注/原因 NoteReason=备注/原因
ReasonDiscount=原因 ReasonDiscount=原因
AddDiscount=添加折扣
AddGlobalDiscount=添加折扣 AddGlobalDiscount=添加折扣
DiscountOfferedBy=获 DiscountOfferedBy=获
DiscountStillRemaining=折扣尚存 DiscountStillRemaining=折扣尚存

View File

@@ -1625,7 +1625,8 @@ function img_object($alt, $picto, $options='', $pictoisfullpath=0)
* Show picto whatever it's its name (generic function) * Show picto whatever it's its name (generic function)
* *
* @param alt Text on alt and title of image * @param alt Text on alt and title of image
* @param picto Name of image file to show (If no extension provided, we use '.png'). Image must be stored into img directory. * @param picto Name of image file to show ('filenew', ...)
* If no extension provided, we use '.png'. Image must be stored into theme/xxx/img directory.
* Example: picto.png if picto.png is stored into htdocs/theme/mytheme/img * Example: picto.png if picto.png is stored into htdocs/theme/mytheme/img
* Example: picto.png@mymodule if picto.png is stored into htdocs/mymodule/img * Example: picto.png@mymodule if picto.png is stored into htdocs/mymodule/img
* Example: /mydir/mysubdir/picto.png if picto.png is stored into htdocs/mydir/mysubdir (pictoisfullpath must be set to 1) * Example: /mydir/mysubdir/picto.png if picto.png is stored into htdocs/mydir/mysubdir (pictoisfullpath must be set to 1)