| '.$langs->trans("Ref").' | ';
print '';
-if ($_GET["account"])
+if (!empty($id))
{
if (! preg_match('/,/', $id))
{
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index aa51c63374d..73127f9a1f2 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -108,7 +108,7 @@ class Facture extends CommonInvoice
var $specimen;
var $fac_rec;
-
+
// Multicurrency
var $fk_multicurrency;
var $multicurrency_code;
@@ -136,7 +136,7 @@ class Facture extends CommonInvoice
* @var array Table of previous situations
*/
public $tab_previous_situation_invoice=array();
-
+
/**
* @var array Table of next situations
*/
@@ -249,7 +249,7 @@ class Facture extends CommonInvoice
$this->fk_multicurrency = 0;
$this->multicurrency_tx = 1;
}
-
+
dol_syslog(get_class($this)."::create user=".$user->id);
// Check parameters
@@ -280,7 +280,7 @@ class Facture extends CommonInvoice
$result=$_facrec->fetch($this->fac_rec);
$this->socid = $_facrec->socid;
-
+
// Fields coming from GUI (priority on template). TODO Value of template should be used as default value on GUI so we can use here always value from GUI
$this->fk_project = GETPOST('projectid','int') > 0 ? GETPOST('projectid','int') : $_facrec->fk_project;
$this->note_public = GETPOST('note_public') ? GETPOST('note_public') : $_facrec->note_public;
@@ -289,7 +289,7 @@ class Facture extends CommonInvoice
$this->cond_reglement_id = GETPOST('cond_reglement_id') > 0 ? GETPOST('cond_reglement_id') : $_facrec->cond_reglement_id;
$this->mode_reglement_id = GETPOST('mode_reglement_id') > 0 ? GETPOST('mode_reglement_id') : $_facrec->mode_reglement_id;
$this->fk_account = GETPOST('fk_account') > 0 ? GETPOST('fk_account') : $_facrec->fk_account;
-
+
// Fields always coming from template
$this->remise_absolue = $_facrec->remise_absolue;
$this->remise_percent = $_facrec->remise_percent;
@@ -302,13 +302,13 @@ class Facture extends CommonInvoice
$this->note_public=trim($this->note_public);
$this->note_private=trim($this->note_private);
$this->note_private=dol_concatdesc($this->note_private, $langs->trans("GeneratedFromRecurringInvoice", $_facrec->ref));
-
+
//if (! $this->remise) $this->remise = 0;
if (! $this->mode_reglement_id) $this->mode_reglement_id = 0;
$this->brouillon = 1;
-
+
$forceduedate = $this->calculate_date_lim_reglement();
-
+
// For recurrn invoices, update date and number of last generation of recurring template invoice, before inserting new invoice
if ($_facrec->frequency > 0)
{
@@ -658,7 +658,7 @@ class Facture extends CommonInvoice
function createFromCurrent($user,$invertdetail=0)
{
global $conf;
-
+
// Charge facture source
$facture=new Facture($this->db);
@@ -712,15 +712,15 @@ class Facture extends CommonInvoice
elseif ($this->type == self::TYPE_SITUATION && !empty($conf->global->INVOICE_USE_SITUATION))
{
$this->fetchObjectLinked('', '', $object->id, 'facture');
-
- foreach ($this->linkedObjectsIds as $typeObject => $Tfk_object)
+
+ foreach ($this->linkedObjectsIds as $typeObject => $Tfk_object)
{
- foreach ($Tfk_object as $fk_object)
+ foreach ($Tfk_object as $fk_object)
{
$facture->add_object_linked($typeObject, $fk_object);
}
}
-
+
$facture->add_object_linked('facture', $this->fk_facture_source);
}
@@ -1107,7 +1107,7 @@ class Facture extends CommonInvoice
$this->multicurrency_total_ht = $obj->multicurrency_total_ht;
$this->multicurrency_total_tva = $obj->multicurrency_total_tva;
$this->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
-
+
if ($this->type == self::TYPE_SITUATION && $fetch_situation)
{
$this->fetchPreviousNextSituationInvoice();
@@ -1229,7 +1229,7 @@ class Facture extends CommonInvoice
$line->situation_percent= $objp->situation_percent;
$line->fk_prev_id = $objp->fk_prev_id;
$line->fk_unit = $objp->fk_unit;
-
+
// Multicurrency
$line->fk_multicurrency = $objp->fk_multicurrency;
$line->multicurrency_code = $objp->multicurrency_code;
@@ -1237,7 +1237,7 @@ class Facture extends CommonInvoice
$line->multicurrency_total_ht = $objp->multicurrency_total_ht;
$line->multicurrency_total_tva = $objp->multicurrency_total_tva;
$line->multicurrency_total_ttc = $objp->multicurrency_total_ttc;
-
+
$this->lines[$i] = $line;
$i++;
@@ -1255,17 +1255,17 @@ class Facture extends CommonInvoice
/**
* Fetch previous and next situations invoices
*
- * @return void
+ * @return void
*/
function fetchPreviousNextSituationInvoice()
{
global $conf;
-
+
$this->tab_previous_situation_invoice = array();
$this->tab_next_situation_invoice = array();
-
+
$sql = 'SELECT rowid, situation_counter FROM '.MAIN_DB_PREFIX.'facture WHERE rowid <> '.$this->id.' AND entity = '.$conf->entity.' AND situation_cycle_ref = '.(int) $this->situation_cycle_ref.' ORDER BY situation_counter ASC';
-
+
dol_syslog(get_class($this).'::fetchPreviousNextSituationInvoice ', LOG_DEBUG);
$result = $this->db->query($sql);
if ($result && $this->db->num_rows($result) > 0)
@@ -1274,13 +1274,13 @@ class Facture extends CommonInvoice
{
$invoice = new Facture($this->db);
if ($invoice->fetch($objp->rowid) > 0)
- {
+ {
if ($objp->situation_counter < $this->situation_counter) $this->tab_previous_situation_invoice[] = $invoice;
else $this->tab_next_situation_invoice[] = $invoice;
}
}
}
-
+
}
/**
@@ -2061,7 +2061,7 @@ class Facture extends CommonInvoice
$this->brouillon=0;
$this->date_validation=$now;
$i = 0;
-
+
if (!empty($conf->global->INVOICE_USE_SITUATION))
{
$final = True;
@@ -2094,7 +2094,7 @@ class Facture extends CommonInvoice
/**
* Update price of next invoice
- *
+ *
* @param Translate $langs Translate object
* @return bool false if KO, true if OK
*/
@@ -2103,13 +2103,13 @@ class Facture extends CommonInvoice
foreach ($this->tab_next_situation_invoice as $next_invoice)
{
$is_last = $next_invoice->is_last_in_cycle();
-
- if ($next_invoice->brouillon && $is_last != 1)
+
+ if ($next_invoice->brouillon && $is_last != 1)
{
$this->error = $langs->trans('updatePriceNextInvoiceErrorUpdateline', $next_invoice->ref);
return false;
}
-
+
$next_invoice->brouillon = 1;
foreach ($next_invoice->lines as $line)
{
@@ -2117,17 +2117,17 @@ class Facture extends CommonInvoice
$line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type,
$line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent,
$line->fk_unit);
-
- if ($result < 0)
+
+ if ($result < 0)
{
$this->error = $langs->trans('updatePriceNextInvoiceErrorUpdateline', $next_invoice->ref);
return false;
}
}
-
+
break; // Only the next invoice and not each next invoice
}
-
+
return true;
}
@@ -2280,7 +2280,7 @@ class Facture extends CommonInvoice
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0;
if (empty($fk_prev_id)) $fk_prev_id = 'null';
if (! isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '') $situation_percent = 100;
-
+
$remise_percent=price2num($remise_percent);
$qty=price2num($qty);
$pu_ht=price2num($pu_ht);
@@ -2342,7 +2342,7 @@ class Facture extends CommonInvoice
$multicurrency_total_ht = $tabprice[16];
$multicurrency_total_tva = $tabprice[17];
$multicurrency_total_ttc = $tabprice[18];
-
+
// Rank to use
$rangtouse = $rang;
if ($rangtouse == -1)
@@ -2355,14 +2355,14 @@ class Facture extends CommonInvoice
$this->line=new FactureLigne($this->db);
$this->line->context = $this->context;
-
+
$this->line->fk_facture=$this->id;
$this->line->label=$label; // deprecated
$this->line->desc=$desc;
-
+
$this->line->qty= ($this->type==self::TYPE_CREDIT_NOTE?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative
$this->line->subprice= ($this->type==self::TYPE_CREDIT_NOTE?-abs($pu_ht):$pu_ht); // For credit note, unit price always negative, always positive otherwise
-
+
$this->line->tva_tx=$txtva;
$this->line->localtax1_tx=$txlocaltax1;
$this->line->localtax2_tx=$txlocaltax2;
@@ -2374,7 +2374,7 @@ class Facture extends CommonInvoice
$this->line->total_tva= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_tva):$total_tva); // For credit note and if qty is negative, total is negative
$this->line->total_localtax1=(($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_localtax1):$total_localtax1); // For credit note and if qty is negative, total is negative
$this->line->total_localtax2=(($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_localtax2):$total_localtax2); // For credit note and if qty is negative, total is negative
-
+
$this->line->fk_product=$fk_product;
$this->line->product_type=$product_type;
$this->line->remise_percent=$remise_percent;
@@ -2384,7 +2384,7 @@ class Facture extends CommonInvoice
$this->line->rang=$rangtouse;
$this->line->info_bits=$info_bits;
$this->line->fk_remise_except=$fk_remise_except;
-
+
$this->line->special_code=$special_code;
$this->line->fk_parent_line=$fk_parent_line;
$this->line->origin=$origin;
@@ -2396,7 +2396,7 @@ class Facture extends CommonInvoice
// infos marge
$this->line->fk_fournprice = $fk_fournprice;
$this->line->pa_ht = $pa_ht;
-
+
// Multicurrency
$this->line->fk_multicurrency = $this->fk_multicurrency;
$this->line->multicurrency_code = $this->multicurrency_code;
@@ -2404,7 +2404,7 @@ class Facture extends CommonInvoice
$this->line->multicurrency_total_ht = $multicurrency_total_ht;
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
-
+
if (is_array($array_options) && count($array_options)>0) {
$this->line->array_options=$array_options;
}
@@ -2489,7 +2489,7 @@ class Facture extends CommonInvoice
return -3;
}
}
-
+
$this->db->begin();
// Clean parameters
@@ -2515,7 +2515,7 @@ class Facture extends CommonInvoice
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty, $mysoc);
$txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate.
-
+
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, $situation_percent, $this->multicurrency_tx);
$total_ht = $tabprice[0];
@@ -2531,7 +2531,7 @@ class Facture extends CommonInvoice
$multicurrency_total_ht = $tabprice[16];
$multicurrency_total_tva = $tabprice[17];
$multicurrency_total_ttc = $tabprice[18];
-
+
// Old properties: $price, $remise (deprecated)
$price = $pu;
$remise = 0;
@@ -2607,7 +2607,7 @@ class Facture extends CommonInvoice
$this->line->multicurrency_total_ht = $multicurrency_total_ht;
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
-
+
if (is_array($array_options) && count($array_options)>0) {
$this->line->array_options=$array_options;
}
@@ -2638,28 +2638,28 @@ class Facture extends CommonInvoice
}
/**
- * Check if the percent edited is lower of next invoice line
- *
+ * Check if the percent edited is lower of next invoice line
+ *
* @param int $idline id of line to check
* @param float $situation_percent progress percentage need to be test
* @return false if KO, true if OK
*/
function checkProgressLine($idline, $situation_percent)
{
- $sql = 'SELECT fd.situation_percent FROM '.MAIN_DB_PREFIX.'facturedet fd
- INNER JOIN '.MAIN_DB_PREFIX.'facture f ON (fd.fk_facture = f.rowid)
- WHERE fd.fk_prev_id = '.$idline.'
+ $sql = 'SELECT fd.situation_percent FROM '.MAIN_DB_PREFIX.'facturedet fd
+ INNER JOIN '.MAIN_DB_PREFIX.'facture f ON (fd.fk_facture = f.rowid)
+ WHERE fd.fk_prev_id = '.$idline.'
AND f.fk_statut <> 0';
-
+
$result = $this->db->query($sql);
if (! $result)
{
$this->error=$this->db->error();
return false;
}
-
+
$obj = $this->db->fetch_object($result);
-
+
if ($obj === null) return true;
else return $situation_percent < $obj->situation_percent;
}
@@ -2674,7 +2674,7 @@ class Facture extends CommonInvoice
function update_percent($line, $percent)
{
global $mysoc,$user;
-
+
include_once(DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php');
// Cap percentages to 100
@@ -3555,6 +3555,10 @@ class Facture extends CommonInvoice
$prodids[$i] = $row[0];
}
}
+ //Avoid php warning Warning: mt_rand(): max(0) is smaller than min(1) when no product exists
+ if (empty($num_prods)) {
+ $num_prods=1;
+ }
// Initialize parameters
$this->id=0;
@@ -3788,7 +3792,7 @@ class Facture extends CommonInvoice
function get_prev_sits()
{
global $conf;
-
+
$sql = 'SELECT rowid FROM ' . MAIN_DB_PREFIX . 'facture';
$sql .= ' where situation_cycle_ref = ' . $this->situation_cycle_ref;
$sql .= ' and situation_counter < ' . $this->situation_counter;
@@ -3818,9 +3822,9 @@ class Facture extends CommonInvoice
*/
function setFinal()
{
-
+
$this->db->begin();
-
+
$this->situation_final = 1;
$sql = 'update ' . MAIN_DB_PREFIX . 'facture set situation_final = ' . $this->situation_final . ' where rowid = ' . $this->id;
$resql = $this->db->query($sql);
@@ -3845,12 +3849,12 @@ class Facture extends CommonInvoice
function is_last_in_cycle()
{
global $conf;
-
+
if (!empty($this->situation_cycle_ref)) {
// No point in testing anything if we're not inside a cycle
$sql = 'SELECT max(situation_counter) FROM ' . MAIN_DB_PREFIX . 'facture WHERE situation_cycle_ref = ' . $this->situation_cycle_ref . ' AND entity = ' . ($this->entity > 0 ? $this->entity : $conf->entity);
$resql = $this->db->query($sql);
-
+
if ($resql && $resql->num_rows > 0) {
$res = $this->db->fetch_array($resql);
$last = $res['max(situation_counter)'];
@@ -3895,7 +3899,7 @@ class Facture extends CommonInvoice
// Paid invoices have status STATUS_CLOSED
if ($this->statut != Facture::STATUS_VALIDATED) return false;
-
+
return $this->date_lim_reglement < ($now - $conf->facture->client->warning_delay);
}
}
@@ -3984,7 +3988,7 @@ class FactureLigne extends CommonInvoiceLine
var $multicurrency_total_ht;
var $multicurrency_total_tva;
var $multicurrency_total_ttc;
-
+
/**
* Load invoice line from database
*
@@ -4074,7 +4078,7 @@ class FactureLigne extends CommonInvoiceLine
$error=0;
$pa_ht_isemptystring = (empty($this->pa_ht) && $this->pa_ht == ''); // If true, we can use a default value. If this->pa_ht = '0', we must use '0'.
-
+
dol_syslog(get_class($this)."::insert rang=".$this->rang, LOG_DEBUG);
// Clean parameters
@@ -4100,9 +4104,9 @@ class FactureLigne extends CommonInvoiceLine
if (empty($this->multicurrency_total_ht)) $this->multicurrency_total_ht=0;
if (empty($this->multicurrency_total_tva)) $this->multicurrency_total_tva=0;
if (empty($this->multicurrency_total_ttc)) $this->multicurrency_total_ttc=0;
-
+
// if buy price not defined, define buyprice as configured in margin admin
- if ($this->pa_ht == 0 && $pa_ht_isemptystring)
+ if ($this->pa_ht == 0 && $pa_ht_isemptystring)
{
if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0)
{
@@ -4286,7 +4290,7 @@ class FactureLigne extends CommonInvoiceLine
$error=0;
$pa_ht_isemptystring = (empty($this->pa_ht) && $this->pa_ht == ''); // If true, we can use a default value. If this->pa_ht = '0', we must use '0'.
-
+
// Clean parameters
$this->desc=trim($this->desc);
if (empty($this->tva_tx)) $this->tva_tx=0;
@@ -4308,7 +4312,7 @@ class FactureLigne extends CommonInvoiceLine
if ($this->product_type < 0) return -1;
// if buy price not defined, define buyprice as configured in margin admin
- if ($this->pa_ht == 0 && $pa_ht_isemptystring)
+ if ($this->pa_ht == 0 && $pa_ht_isemptystring)
{
if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0)
{
@@ -4355,13 +4359,13 @@ class FactureLigne extends CommonInvoiceLine
if (! empty($this->rang)) $sql.= ", rang=".$this->rang;
$sql .= ", situation_percent=" . $this->situation_percent;
$sql .= ", fk_unit=".(!$this->fk_unit ? 'NULL' : $this->fk_unit);
-
+
// Multicurrency
$sql.= " , multicurrency_subprice=".price2num($this->multicurrency_subprice)."";
$sql.= " , multicurrency_total_ht=".price2num($this->multicurrency_total_ht)."";
$sql.= " , multicurrency_total_tva=".price2num($this->multicurrency_total_tva)."";
$sql.= " , multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc)."";
-
+
$sql.= " WHERE rowid = ".$this->rowid;
dol_syslog(get_class($this)."::update", LOG_DEBUG);
@@ -4477,7 +4481,7 @@ class FactureLigne extends CommonInvoiceLine
/**
* Returns situation_percent of the previous line.
- * Warning: If invoice is a replacement invoice, this->fk_prev_id is id of the replaced line.
+ * Warning: If invoice is a replacement invoice, this->fk_prev_id is id of the replaced line.
*
* @param int $invoiceid Invoice id
* @return int >= 0
diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php
index 31d9e4d67c1..0b18a40d022 100644
--- a/htdocs/compta/prelevement/class/bonprelevement.class.php
+++ b/htdocs/compta/prelevement/class/bonprelevement.class.php
@@ -919,7 +919,10 @@ class BonPrelevement extends CommonObject
$row = $this->db->fetch_row($resql);
$ref = "T".$ref.str_pad(dol_substr("00".intval($row[0])+1,0,2),2,"0",STR_PAD_LEFT);
- $this->filename = $conf->prelevement->dir_output.'/receipts/'.$ref.'.xml';
+ $dir=$conf->prelevement->dir_output.'/receipts';
+ if (! is_dir($dir)) dol_mkdir($dir);
+
+ $this->filename = $dir.'/receipts/'.$ref.'.xml';
// Create withdraw receipt in database
$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons (";
@@ -935,10 +938,6 @@ class BonPrelevement extends CommonObject
{
$prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_bons");
$this->id = $prev_id;
-
- $dir=$conf->prelevement->dir_output.'/receipts';
- $file=$filebonprev;
- if (! is_dir($dir)) dol_mkdir($dir);
}
else
{
@@ -1034,7 +1033,7 @@ class BonPrelevement extends CommonObject
// Generation of SEPA file
$this->generate();
}
- dol_syslog(__METHOD__."::End withdraw receipt, file ".$filebonprev, LOG_DEBUG);
+ dol_syslog(__METHOD__."::End withdraw receipt, file ".$this->filename, LOG_DEBUG);
}
/*
diff --git a/htdocs/core/boxes/box_actions.php b/htdocs/core/boxes/box_actions.php
index 1f5e8493d7b..82aacf2d8a0 100644
--- a/htdocs/core/boxes/box_actions.php
+++ b/htdocs/core/boxes/box_actions.php
@@ -167,13 +167,15 @@ class box_actions extends ModeleBoxes
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
+ * @param int $nooutput No print, only return string
* @return void
*/
- function showBox($head = null, $contents = null)
- {
+ function showBox($head = null, $contents = null, $nooutput=0)
+ {
global $langs, $conf;
parent::showBox($this->info_box_head, $this->info_box_contents);
- if (! empty($conf->global->SHOW_DIALOG_HOMEPAGE))
+ $out='';
+ if (! empty($conf->global->SHOW_DIALOG_HOMEPAGE))
{
$actioncejour=false;
$contents=$this->info_box_contents;
@@ -183,8 +185,8 @@ class box_actions extends ModeleBoxes
$bcx[1] = 'class="box_impair"';
if ($contents[0][0]['text'] != $langs->trans("NoActionsToDo"))
{
- print 'trans("ActionsToDo").'">';
- print ' ';
+ $out.= 'trans("ActionsToDo").'">';
+ $out.= ' ';
for ($line=0, $n=$nblines; $line < $n; $line++)
{
if (isset($contents[$line]))
@@ -202,40 +204,45 @@ class box_actions extends ModeleBoxes
$urlsoc=$contents[$line][3]['url'];
$dateligne=$contents[$line][4]['text'];
$percentage=$contents[$line][5]['text'];
- print '';
- print '| ';
- print img_object("",$logo);
- print ' | ';
- print ''.$label.' | ';
- print ''.img_object("",$logosoc)." ".$nomsoc.' | ';
- print ''.$dateligne.' | ';
- print ''.$percentage.' | ';
- print ' ';
+ $out.= '';
+ $out.= '| ';
+ $out.= img_object("",$logo);
+ $out.= ' | ';
+ $out.= ''.$label.' | ';
+ $out.= ''.img_object("",$logosoc)." ".$nomsoc.' | ';
+ $out.= ''.$dateligne.' | ';
+ $out.= ''.$percentage.' | ';
+ $out.= ' ';
}
}
- print ' ';
+ $out.= ' ';
}
- print ' ';
+ $out.= '';
if ($actioncejour)
{
- print '';
+ $out.= '';
}
else
{
- print '';
+ $out.= '';
}
}
+
+ if ($nooutput) return $out;
+ else print $out;
+
+ return '';
}
}
diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php
index f7e09d33583..34666507488 100644
--- a/htdocs/core/boxes/box_activity.php
+++ b/htdocs/core/boxes/box_activity.php
@@ -455,10 +455,11 @@ class box_activity extends ModeleBoxes
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
+ * @param int $nooutput No print, only return string
* @return void
*/
- function showBox($head = null, $contents = null)
- {
- parent::showBox($this->info_box_head, $this->info_box_contents);
+ function showBox($head = null, $contents = null, $nooutput=0)
+ {
+ parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}
diff --git a/htdocs/core/boxes/box_bookmarks.php b/htdocs/core/boxes/box_bookmarks.php
index 88adb744ceb..e99a0b30387 100644
--- a/htdocs/core/boxes/box_bookmarks.php
+++ b/htdocs/core/boxes/box_bookmarks.php
@@ -135,11 +135,12 @@ class box_bookmarks extends ModeleBoxes
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
+ * @param int $nooutput No print, only return string
* @return void
*/
- function showBox($head = null, $contents = null)
- {
- parent::showBox($this->info_box_head, $this->info_box_contents);
+ function showBox($head = null, $contents = null, $nooutput=0)
+ {
+ parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}
diff --git a/htdocs/core/boxes/box_clients.php b/htdocs/core/boxes/box_clients.php
index 24c940fb9ea..307dcc7cbfd 100644
--- a/htdocs/core/boxes/box_clients.php
+++ b/htdocs/core/boxes/box_clients.php
@@ -157,11 +157,12 @@ class box_clients extends ModeleBoxes
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
+ * @param int $nooutput No print, only return string
* @return void
*/
- function showBox($head = null, $contents = null)
- {
- parent::showBox($this->info_box_head, $this->info_box_contents);
+ function showBox($head = null, $contents = null, $nooutput=0)
+ {
+ parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}
diff --git a/htdocs/core/boxes/box_commandes.php b/htdocs/core/boxes/box_commandes.php
index 6eb5006182c..7653206333d 100644
--- a/htdocs/core/boxes/box_commandes.php
+++ b/htdocs/core/boxes/box_commandes.php
@@ -176,11 +176,12 @@ class box_commandes extends ModeleBoxes
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
+ * @param int $nooutput No print, only return string
* @return void
*/
- function showBox($head = null, $contents = null)
+ function showBox($head = null, $contents = null, $nooutput=0)
{
- parent::showBox($this->info_box_head, $this->info_box_contents);
+ parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}
diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php
index 178851466be..a6b8e2744a6 100644
--- a/htdocs/core/boxes/box_comptes.php
+++ b/htdocs/core/boxes/box_comptes.php
@@ -169,11 +169,12 @@ class box_comptes extends ModeleBoxes
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
+ * @param int $nooutput No print, only return string
* @return void
*/
- function showBox($head = null, $contents = null)
- {
- parent::showBox($this->info_box_head, $this->info_box_contents);
+ function showBox($head = null, $contents = null, $nooutput=0)
+ {
+ parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}
diff --git a/htdocs/core/boxes/box_contacts.php b/htdocs/core/boxes/box_contacts.php
index a1fc2768ba1..45963af9bb1 100644
--- a/htdocs/core/boxes/box_contacts.php
+++ b/htdocs/core/boxes/box_contacts.php
@@ -83,7 +83,7 @@ class box_contacts extends ModeleBoxes
$societestatic=new Societe($db);
$line = 0;
- while ($line < $num)
+ while ($line < $num)
{
$objp = $db->fetch_object($result);
$datec=$db->jdate($objp->datec);
@@ -100,7 +100,7 @@ class box_contacts extends ModeleBoxes
$contactstatic->address = $objp->address;
$contactstatic->zip = $objp->zip;
$contactstatic->town = $objp->town;
-
+
$societestatic->id = $objp->fk_soc;
$societestatic->name = $objp->socname;
$societestatic->name_alias = $objp->name_alias;
@@ -108,7 +108,7 @@ class box_contacts extends ModeleBoxes
$societestatic->code_fournisseur = $objp->code_fournisseur;
$societestatic->client = $objp->client;
$societestatic->fournisseur = $objp->fournisseur;
-
+
$this->info_box_contents[$line][] = array(
'td' => 'align="left"',
'text' => $contactstatic->getNomUrl(1),
@@ -131,7 +131,7 @@ class box_contacts extends ModeleBoxes
'text' => $contactstatic->getLibStatut(3),
'asis'=>1,
);
-
+
$line++;
}
@@ -163,11 +163,12 @@ class box_contacts extends ModeleBoxes
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
+ * @param int $nooutput No print, only return string
* @return void
*/
- function showBox($head = null, $contents = null)
- {
- parent::showBox($this->info_box_head, $this->info_box_contents);
+ function showBox($head = null, $contents = null, $nooutput=0)
+ {
+ parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}
diff --git a/htdocs/core/boxes/box_contracts.php b/htdocs/core/boxes/box_contracts.php
index 665bff4c6da..40cc8885f90 100644
--- a/htdocs/core/boxes/box_contracts.php
+++ b/htdocs/core/boxes/box_contracts.php
@@ -55,14 +55,14 @@ class box_contracts extends ModeleBoxes
$this->max=$max;
include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
-
+
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastContracts",$max));
if ($user->rights->contrat->lire)
{
$contractstatic=new Contrat($db);
$thirdpartytmp=new Societe($db);
-
+
$sql = "SELECT s.nom as name, s.rowid as socid,";
$sql.= " c.rowid, c.ref, c.statut as fk_statut, c.date_contrat, c.datec, c.fin_validite, c.date_cloture";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c";
@@ -83,8 +83,8 @@ class box_contracts extends ModeleBoxes
$line = 0;
$langs->load("contracts");
-
- while ($line < $num)
+
+ while ($line < $num)
{
$objp = $db->fetch_object($resql);
$datec=$db->jdate($objp->datec);
@@ -99,7 +99,7 @@ class box_contracts extends ModeleBoxes
$thirdpartytmp->name = $objp->name;
$thirdpartytmp->id = $objp->socid;
-
+
// fin_validite is no more on contract but on services
// if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->contrat->cloture->warning_delay)) { $late = img_warning($langs->trans("Late")); }
@@ -157,11 +157,12 @@ class box_contracts extends ModeleBoxes
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
+ * @param int $nooutput No print, only return string
* @return void
*/
- function showBox($head = null, $contents = null)
+ function showBox($head = null, $contents = null, $nooutput=0)
{
- parent::showBox($this->info_box_head, $this->info_box_contents);
+ parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}
diff --git a/htdocs/core/boxes/box_external_rss.php b/htdocs/core/boxes/box_external_rss.php
index f1db35e1614..dbe71a6ca41 100644
--- a/htdocs/core/boxes/box_external_rss.php
+++ b/htdocs/core/boxes/box_external_rss.php
@@ -184,11 +184,12 @@ class box_external_rss extends ModeleBoxes
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
+ * @param int $nooutput No print, only return string
* @return void
*/
- function showBox($head = null, $contents = null)
+ function showBox($head = null, $contents = null, $nooutput=0)
{
- parent::showBox($this->info_box_head, $this->info_box_contents);
+ parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}
diff --git a/htdocs/core/boxes/box_factures.php b/htdocs/core/boxes/box_factures.php
index 7b5a01d6bca..22a90929a0b 100644
--- a/htdocs/core/boxes/box_factures.php
+++ b/htdocs/core/boxes/box_factures.php
@@ -180,11 +180,12 @@ class box_factures extends ModeleBoxes
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
- * @return void
+ * @param int $nooutput No print, only return string
+ * @return void
*/
- function showBox($head = null, $contents = null)
- {
- parent::showBox($this->info_box_head, $this->info_box_contents);
+ function showBox($head = null, $contents = null, $nooutput=0)
+ {
+ parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}
diff --git a/htdocs/core/boxes/box_factures_fourn.php b/htdocs/core/boxes/box_factures_fourn.php
index 88b64947f05..b43d9cfc47b 100644
--- a/htdocs/core/boxes/box_factures_fourn.php
+++ b/htdocs/core/boxes/box_factures_fourn.php
@@ -189,11 +189,12 @@ class box_factures_fourn extends ModeleBoxes
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
+ * @param int $nooutput No print, only return string
* @return void
*/
- function showBox($head = null, $contents = null)
- {
- parent::showBox($this->info_box_head, $this->info_box_contents);
+ function showBox($head = null, $contents = null, $nooutput=0)
+ {
+ parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}
diff --git a/htdocs/core/boxes/box_factures_fourn_imp.php b/htdocs/core/boxes/box_factures_fourn_imp.php
index 27441f22ea5..b3ca0fec031 100644
--- a/htdocs/core/boxes/box_factures_fourn_imp.php
+++ b/htdocs/core/boxes/box_factures_fourn_imp.php
@@ -186,11 +186,12 @@ class box_factures_fourn_imp extends ModeleBoxes
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
+ * @param int $nooutput No print, only return string
* @return void
*/
- function showBox($head = null, $contents = null)
- {
- parent::showBox($this->info_box_head, $this->info_box_contents);
+ function showBox($head = null, $contents = null, $nooutput=0)
+ {
+ parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}
diff --git a/htdocs/core/boxes/box_factures_imp.php b/htdocs/core/boxes/box_factures_imp.php
index bcc26f60e4c..67c4d4dbfcc 100644
--- a/htdocs/core/boxes/box_factures_imp.php
+++ b/htdocs/core/boxes/box_factures_imp.php
@@ -182,11 +182,12 @@ class box_factures_imp extends ModeleBoxes
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
+ * @param int $nooutput No print, only return string
* @return void
*/
- function showBox($head = null, $contents = null)
- {
- parent::showBox($this->info_box_head, $this->info_box_contents);
+ function showBox($head = null, $contents = null, $nooutput=0)
+ {
+ parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}
diff --git a/htdocs/core/boxes/box_ficheinter.php b/htdocs/core/boxes/box_ficheinter.php
index decf5e564f0..d57a2a991df 100644
--- a/htdocs/core/boxes/box_ficheinter.php
+++ b/htdocs/core/boxes/box_ficheinter.php
@@ -144,11 +144,12 @@ class box_ficheinter extends ModeleBoxes
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
+ * @param int $nooutput No print, only return string
* @return void
*/
- function showBox($head = null, $contents = null)
- {
- parent::showBox($this->info_box_head, $this->info_box_contents);
+ function showBox($head = null, $contents = null, $nooutput=0)
+ {
+ parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}
diff --git a/htdocs/core/boxes/box_fournisseurs.php b/htdocs/core/boxes/box_fournisseurs.php
index e3e6061d803..ed3680af455 100644
--- a/htdocs/core/boxes/box_fournisseurs.php
+++ b/htdocs/core/boxes/box_fournisseurs.php
@@ -139,11 +139,12 @@ class box_fournisseurs extends ModeleBoxes
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
+ * @param int $nooutput No print, only return string
* @return void
*/
- function showBox($head = null, $contents = null)
+ function showBox($head = null, $contents = null, $nooutput=0)
{
- parent::showBox($this->info_box_head, $this->info_box_contents);
+ parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}
diff --git a/htdocs/core/boxes/box_goodcustomers.php b/htdocs/core/boxes/box_goodcustomers.php
index 579df4762a0..56aa9097ac2 100644
--- a/htdocs/core/boxes/box_goodcustomers.php
+++ b/htdocs/core/boxes/box_goodcustomers.php
@@ -81,7 +81,7 @@ class box_goodcustomers extends ModeleBoxes
if ($user->rights->societe->lire)
{
-
+
$sql = "SELECT s.rowid, s.nom as name, s.logo, s.code_client, s.code_fournisseur, s.client, s.fournisseur, s.tms as datem, s.status as status,";
$sql.= " count(*) as nbfact, sum(". $db->ifsql('f.paye=1','1','0').") as nbfactpaye";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as f";
@@ -127,7 +127,7 @@ class box_goodcustomers extends ModeleBoxes
'td' => 'align="right"',
'text' => $nbfact.( $nbimpaye != 0 ? ' ('.$nbimpaye.')':'')
);
-
+
$this->info_box_contents[$line][] = array(
'td' => 'align="right" width="18"',
'text' => $thirdpartystatic->LibStatut($objp->status,3)
@@ -158,11 +158,12 @@ class box_goodcustomers extends ModeleBoxes
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
+ * @param int $nooutput No print, only return string
* @return void
*/
- function showBox($head = null, $contents = null)
- {
- parent::showBox($this->info_box_head, $this->info_box_contents);
+ function showBox($head = null, $contents = null, $nooutput=0)
+ {
+ parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}
diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php
index 3848960e5e9..1b54d917d05 100644
--- a/htdocs/core/boxes/box_graph_invoices_permonth.php
+++ b/htdocs/core/boxes/box_graph_invoices_permonth.php
@@ -171,7 +171,7 @@ class box_graph_invoices_permonth extends ModeleBoxes
if (! $mesg)
{
$langs->load("bills");
-
+
$px2->SetData($data2);
unset($data2);
$px2->SetPrecisionY(0);
@@ -263,11 +263,12 @@ class box_graph_invoices_permonth extends ModeleBoxes
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
+ * @param int $nooutput No print, only return string
* @return void
*/
- function showBox($head = null, $contents = null)
- {
- parent::showBox($this->info_box_head, $this->info_box_contents);
+ function showBox($head = null, $contents = null, $nooutput=0)
+ {
+ parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}
diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php
index 0931d2d05df..c7856d619f6 100644
--- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php
+++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php
@@ -170,7 +170,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
if (! $mesg)
{
$langs->load("bills");
-
+
$px2->SetData($data2);
unset($data2);
$px2->SetPrecisionY(0);
@@ -262,11 +262,12 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
+ * @param int $nooutput No print, only return string
* @return void
*/
- function showBox($head = null, $contents = null)
- {
- parent::showBox($this->info_box_head, $this->info_box_contents);
+ function showBox($head = null, $contents = null, $nooutput=0)
+ {
+ parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}
diff --git a/htdocs/core/boxes/box_graph_orders_permonth.php b/htdocs/core/boxes/box_graph_orders_permonth.php
index 4f86dcd0b8b..4a0f0a7d5b1 100644
--- a/htdocs/core/boxes/box_graph_orders_permonth.php
+++ b/htdocs/core/boxes/box_graph_orders_permonth.php
@@ -90,7 +90,7 @@ class box_graph_orders_permonth extends ModeleBoxes
if ($user->rights->commande->lire)
{
$langs->load("orders");
-
+
$param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
$param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
$param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
@@ -263,11 +263,12 @@ class box_graph_orders_permonth extends ModeleBoxes
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
+ * @param int $nooutput No print, only return string
* @return void
*/
- function showBox($head = null, $contents = null)
- {
- parent::showBox($this->info_box_head, $this->info_box_contents);
+ function showBox($head = null, $contents = null, $nooutput=0)
+ {
+ parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}
diff --git a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php
index 6df7d81766c..2ab14bb4502 100644
--- a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php
+++ b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php
@@ -89,7 +89,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
if ($user->rights->fournisseur->commande->lire)
{
$langs->load("orders");
-
+
$param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
$param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
$param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
@@ -262,11 +262,12 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
+ * @param int $nooutput No print, only return string
* @return void
*/
- function showBox($head = null, $contents = null)
- {
- parent::showBox($this->info_box_head, $this->info_box_contents);
+ function showBox($head = null, $contents = null, $nooutput=0)
+ {
+ parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}
diff --git a/htdocs/core/boxes/box_graph_product_distribution.php b/htdocs/core/boxes/box_graph_product_distribution.php
index 46ddccc2a1d..48168eadb53 100644
--- a/htdocs/core/boxes/box_graph_product_distribution.php
+++ b/htdocs/core/boxes/box_graph_product_distribution.php
@@ -390,11 +390,12 @@ class box_graph_product_distribution extends ModeleBoxes
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
+ * @param int $nooutput No print, only return string
* @return void
*/
- function showBox($head = null, $contents = null)
- {
- parent::showBox($this->info_box_head, $this->info_box_contents);
+ function showBox($head = null, $contents = null, $nooutput=0)
+ {
+ parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}
diff --git a/htdocs/core/boxes/box_graph_propales_permonth.php b/htdocs/core/boxes/box_graph_propales_permonth.php
index 8ef7b25969f..0ae61938ce7 100644
--- a/htdocs/core/boxes/box_graph_propales_permonth.php
+++ b/htdocs/core/boxes/box_graph_propales_permonth.php
@@ -264,11 +264,12 @@ class box_graph_propales_permonth extends ModeleBoxes
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
+ * @param int $nooutput No print, only return string
* @return void
*/
- function showBox($head = null, $contents = null)
- {
- parent::showBox($this->info_box_head, $this->info_box_contents);
+ function showBox($head = null, $contents = null, $nooutput=0)
+ {
+ parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}
diff --git a/htdocs/core/boxes/box_members.php b/htdocs/core/boxes/box_members.php
index 9c166aac866..d5d8f1243f5 100644
--- a/htdocs/core/boxes/box_members.php
+++ b/htdocs/core/boxes/box_members.php
@@ -169,11 +169,12 @@ class box_members extends ModeleBoxes
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
+ * @param int $nooutput No print, only return string
* @return void
*/
- function showBox($head = null, $contents = null)
- {
- parent::showBox($this->info_box_head, $this->info_box_contents);
+ function showBox($head = null, $contents = null, $nooutput=0)
+ {
+ parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}
diff --git a/htdocs/core/boxes/box_produits.php b/htdocs/core/boxes/box_produits.php
index c8ef1b5f558..5cce3254bfb 100644
--- a/htdocs/core/boxes/box_produits.php
+++ b/htdocs/core/boxes/box_produits.php
@@ -192,11 +192,12 @@ class box_produits extends ModeleBoxes
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
+ * @param int $nooutput No print, only return string
* @return void
*/
- function showBox($head = null, $contents = null)
- {
- parent::showBox($this->info_box_head, $this->info_box_contents);
+ function showBox($head = null, $contents = null, $nooutput=0)
+ {
+ parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}
diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php
index 5a718b79696..4d79abd156b 100644
--- a/htdocs/core/boxes/box_produits_alerte_stock.php
+++ b/htdocs/core/boxes/box_produits_alerte_stock.php
@@ -199,11 +199,12 @@ class box_produits_alerte_stock extends ModeleBoxes
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
+ * @param int $nooutput No print, only return string
* @return void
*/
- function showBox($head = null, $contents = null)
- {
- parent::showBox($this->info_box_head, $this->info_box_contents);
+ function showBox($head = null, $contents = null, $nooutput=0)
+ {
+ parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}
diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php
index 7d819ec0d2b..8733f3ed8ce 100644
--- a/htdocs/core/boxes/box_project.php
+++ b/htdocs/core/boxes/box_project.php
@@ -173,11 +173,12 @@ class box_project extends ModeleBoxes
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
+ * @param int $nooutput No print, only return string
* @return void
*/
- function showBox($head = null, $contents = null)
- {
- parent::showBox($this->info_box_head, $this->info_box_contents);
+ function showBox($head = null, $contents = null, $nooutput=0)
+ {
+ parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}
diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php
index c14cf07a51c..b0a1e4a3798 100644
--- a/htdocs/core/boxes/box_propales.php
+++ b/htdocs/core/boxes/box_propales.php
@@ -166,11 +166,12 @@ class box_propales extends ModeleBoxes
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
+ * @param int $nooutput No print, only return string
* @return void
*/
- function showBox($head = null, $contents = null)
+ function showBox($head = null, $contents = null, $nooutput=0)
{
- parent::showBox($this->info_box_head, $this->info_box_contents);
+ parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}
diff --git a/htdocs/core/boxes/box_prospect.php b/htdocs/core/boxes/box_prospect.php
index 3895a27a9f1..40adb98b405 100644
--- a/htdocs/core/boxes/box_prospect.php
+++ b/htdocs/core/boxes/box_prospect.php
@@ -167,11 +167,12 @@ class box_prospect extends ModeleBoxes
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
+ * @param int $nooutput No print, only return string
* @return void
*/
- function showBox($head = null, $contents = null)
- {
- parent::showBox($this->info_box_head, $this->info_box_contents);
+ function showBox($head = null, $contents = null, $nooutput=0)
+ {
+ parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}
diff --git a/htdocs/core/boxes/box_services_contracts.php b/htdocs/core/boxes/box_services_contracts.php
index 802dee8474f..b45bde124a3 100644
--- a/htdocs/core/boxes/box_services_contracts.php
+++ b/htdocs/core/boxes/box_services_contracts.php
@@ -64,7 +64,7 @@ class box_services_contracts extends ModeleBoxes
$contractstatic=new Contrat($db);
$contratlignestatic=new ContratLigne($db);
$thirdpartytmp = new Societe($db);
-
+
$sql = "SELECT s.nom as name, s.rowid as socid,";
$sql.= " c.rowid, c.ref, c.statut as contract_status,";
$sql.= " cd.rowid as cdid, cd.tms as datem, cd.statut, cd.label, cd.description, cd.product_type as type,";
@@ -103,14 +103,14 @@ class box_services_contracts extends ModeleBoxes
$contratlignestatic->type=$objp->type;
$contratlignestatic->product_id=$objp->product_id;
$contratlignestatic->product_ref=$objp->product_ref;
-
+
$contractstatic->statut=$objp->contract_status;
$contractstatic->id=$objp->rowid;
$contractstatic->ref=$objp->ref;
-
+
$thirdpartytmp->name = $objp->name;
$thirdpartytmp->id = $objp->socid;
-
+
// Multilangs
if (! empty($conf->global->MAIN_MULTILANGS)) // si l'option est active
{
@@ -132,7 +132,7 @@ class box_services_contracts extends ModeleBoxes
'text' => $contratlignestatic->getNomUrl(1),
'asis' => 1
);
-
+
$this->info_box_contents[$i][] = array('td' => 'align="left"',
'text' => $contractstatic->getNomUrl(1),
'asis' => 1
@@ -175,11 +175,12 @@ class box_services_contracts extends ModeleBoxes
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
+ * @param int $nooutput No print, only return string
* @return void
*/
- function showBox($head = null, $contents = null)
- {
- parent::showBox($this->info_box_head, $this->info_box_contents);
+ function showBox($head = null, $contents = null, $nooutput=0)
+ {
+ parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}
diff --git a/htdocs/core/boxes/box_services_expired.php b/htdocs/core/boxes/box_services_expired.php
index 296ef56af8a..29db63054e5 100644
--- a/htdocs/core/boxes/box_services_expired.php
+++ b/htdocs/core/boxes/box_services_expired.php
@@ -118,7 +118,7 @@ class box_services_expired extends ModeleBoxes
$i++;
}
- if ($num==0)
+ if ($num==0)
{
$langs->load("contracts");
$this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoExpiredServices"));
@@ -147,11 +147,12 @@ class box_services_expired extends ModeleBoxes
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
+ * @param int $nooutput No print, only return string
* @return void
*/
- function showBox($head = null, $contents = null)
+ function showBox($head = null, $contents = null, $nooutput=0)
{
- parent::showBox($this->info_box_head, $this->info_box_contents);
+ parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}
diff --git a/htdocs/core/boxes/box_supplier_orders.php b/htdocs/core/boxes/box_supplier_orders.php
index 84521bf4ee0..1f0e1ece2ef 100644
--- a/htdocs/core/boxes/box_supplier_orders.php
+++ b/htdocs/core/boxes/box_supplier_orders.php
@@ -171,11 +171,12 @@ class box_supplier_orders extends ModeleBoxes
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
- * @return void
- */
- function showBox($head = null, $contents = null)
+ * @param int $nooutput No print, only return string
+ * @return void
+ */
+ function showBox($head = null, $contents = null, $nooutput=0)
{
- parent::showBox($this->info_box_head, $this->info_box_contents);
+ parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}
diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php
index d314af73cd1..29dd9390597 100644
--- a/htdocs/core/boxes/box_task.php
+++ b/htdocs/core/boxes/box_task.php
@@ -91,11 +91,11 @@ class box_task extends ModeleBoxes
$sql.= $db->plimit($max, 0);
$result = $db->query($sql);
- if ($result)
+ if ($result)
{
$num = $db->num_rows($result);
$i = 0;
- while ($i < $num)
+ while ($i < $num)
{
$objp = $db->fetch_object($result);
$this->info_box_contents[$i][] = array(
@@ -137,10 +137,11 @@ class box_task extends ModeleBoxes
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
+ * @param int $nooutput No print, only return string
* @return void
*/
- function showBox($head = null, $contents = null)
+ function showBox($head = null, $contents = null, $nooutput=0)
{
- parent::showBox($this->info_box_head, $this->info_box_contents);
+ parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 620047014d4..71540cf16d7 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -444,7 +444,7 @@ abstract class CommonObject
global $conf, $langs;
$countriesusingstate=array('AU','US','IN','GB','ES','UK','TR'); // See also option MAIN_FORCE_STATE_INTO_ADDRESS
-
+
$contactid=0;
$thirdpartyid=0;
if ($this->element == 'societe')
@@ -461,12 +461,12 @@ abstract class CommonObject
$contactid=$this->contact_id;
$thirdpartyid=$object->fk_soc;
}
-
+
$out='';
-
+
$outdone=0;
$coords = $this->getFullAddress(1,', ');
- if ($coords)
+ if ($coords)
{
if (! empty($conf->use_javascript_ajax))
{
@@ -481,7 +481,7 @@ abstract class CommonObject
}
if (! in_array($this->country_code,$countriesusingstate) && empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS) // If MAIN_FORCE_STATE_INTO_ADDRESS is on, state is already returned previously with getFullAddress
- && empty($conf->global->SOCIETE_DISABLE_STATE) && $this->state)
+ && empty($conf->global->SOCIETE_DISABLE_STATE) && $this->state)
{
$out.=($outdone?' - ':'').$this->state;
$outdone++;
@@ -512,15 +512,15 @@ abstract class CommonObject
if (! empty($this->office_fax)) {
$out.=dol_print_phone($this->fax,$this->country_code,$contactid,$thirdpartyid,'AC_FAX',' ','fax',$langs->trans("Fax")); $outdone++;
}
-
+
$out.='';
$outdone=0;
- if (! empty($this->email))
+ if (! empty($this->email))
{
$out.=dol_print_email($this->email,$this->id,$object->id,'AC_EMAIL',0,0,1);
$outdone++;
}
- if (! empty($this->url))
+ if (! empty($this->url))
{
$out.=dol_print_url($this->url,'',0,1);
$outdone++;
@@ -531,12 +531,12 @@ abstract class CommonObject
if ($this->skype) $out.=dol_print_skype($this->skype,$this->id,$object->id,'AC_SKYPE');
$outdone++;
}
-
+
$out.='';
-
+
return $out;
}
-
+
/**
* Add a link between element $this->element and a contact
*
@@ -592,7 +592,7 @@ abstract class CommonObject
}
$datecreate = dol_now();
-
+
$this->db->begin();
// Insertion dans la base
@@ -610,9 +610,9 @@ abstract class CommonObject
if (! $notrigger)
{
$result=$this->call_trigger(strtoupper($this->element).'_ADD_CONTACT', $user);
- if ($result < 0)
- {
- $this->db->rollback();
+ if ($result < 0)
+ {
+ $this->db->rollback();
return -1;
}
}
@@ -883,9 +883,9 @@ abstract class CommonObject
if (empty($order)) $order='position';
if ($order == 'position') $order.=',code';
-
+
$tab = array();
- $sql = "SELECT DISTINCT tc.rowid, tc.code, tc.libelle";
+ $sql = "SELECT DISTINCT tc.rowid, tc.code, tc.libelle, tc.position";
$sql.= " FROM ".MAIN_DB_PREFIX."c_type_contact as tc";
$sql.= " WHERE tc.element='".$this->element."'";
if ($activeonly == 1) $sql.= " AND tc.active=1"; // only the active types
@@ -1196,7 +1196,7 @@ abstract class CommonObject
if (!empty($id) && !empty($field) && !empty($table)) {
$sql = "SELECT ".$field." FROM ".MAIN_DB_PREFIX.$table;
$sql.= " WHERE rowid = ".$id;
-
+
dol_syslog(get_class($this).'::getValueFrom', LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
@@ -1428,7 +1428,7 @@ abstract class CommonObject
if ($this->statut >= 0 || $this->element == 'societe')
{
$fieldname = 'multicurrency_code';
-
+
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql .= ' SET '.$fieldname.' = "'.$this->db->escape($code).'"';
$sql .= ' WHERE rowid='.$this->id;
@@ -1436,10 +1436,10 @@ abstract class CommonObject
if ($this->db->query($sql))
{
$this->multicurrency_code = $code;
-
+
list($fk_multicurrency, $rate) = MultiCurrency::getIdAndTxFromCode($this->db, $code);
if ($rate) $this->setMulticurrencyRate($rate);
-
+
return 1;
}
else
@@ -1456,7 +1456,7 @@ abstract class CommonObject
return -2;
}
}
-
+
/**
* Change the multicurrency rate
*
@@ -1469,7 +1469,7 @@ abstract class CommonObject
if ($this->statut >= 0 || $this->element == 'societe')
{
$fieldname = 'multicurrency_tx';
-
+
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql .= ' SET '.$fieldname.' = '.$rate;
$sql .= ' WHERE rowid='.$this->id;
@@ -1477,11 +1477,11 @@ abstract class CommonObject
if ($this->db->query($sql))
{
$this->multicurrency_tx = $rate;
-
+
// Update line price
if (!empty($this->lines))
{
- foreach ($this->lines as &$line)
+ foreach ($this->lines as &$line)
{
switch ($this->element) {
case 'propal':
@@ -1503,10 +1503,10 @@ abstract class CommonObject
dol_syslog(get_class($this).'::setMulticurrencyRate no updateline defined', LOG_DEBUG);
break;
}
-
+
}
}
-
+
return 1;
}
else
@@ -2244,7 +2244,7 @@ abstract class CommonObject
$this->total_localtax1 += $obj->total_localtax1;
$this->total_localtax2 += $obj->total_localtax2;
$this->total_ttc += $obj->total_ttc;
-
+
if (! isset($total_ht_by_vats[$obj->vatrate])) $total_ht_by_vats[$obj->vatrate]=0;
if (! isset($total_tva_by_vats[$obj->vatrate])) $total_tva_by_vats[$obj->vatrate]=0;
if (! isset($total_ttc_by_vats[$obj->vatrate])) $total_ttc_by_vats[$obj->vatrate]=0;
@@ -2290,12 +2290,12 @@ abstract class CommonObject
$this->total_ttc -= $sit->total_ttc;
}
}
-
+
// Multicurrency
$this->multicurrency_total_ht += $this->total_ht * $multicurrency_tx;
$this->multicurrency_total_tva += $this->total_tva * $multicurrency_tx;
$this->multicurrency_total_ttc += $this->total_ttc * $multicurrency_tx;
-
+
$this->db->free($resql);
// Now update global field total_ht, total_ttc and tva
@@ -2398,8 +2398,8 @@ abstract class CommonObject
* - all parameters empty -> we look all link to current object (current object can be source or target)
* - one couple id+type is provided -> this will set $justsource or $justtarget
* - one couple id+type is provided and other type is provided -> this will set $justsource or $justtarget + criteria on other type
- *
- *
+ *
+ *
* @param int $sourceid Object source id (if not defined, id of object)
* @param string $sourcetype Object source type (if not defined, element name of object)
* @param int $targetid Object target id (if not defined, id of object)
@@ -2508,7 +2508,7 @@ abstract class CommonObject
{
// Parse element/subelement (ex: project_task)
$module = $element = $subelement = $objecttype;
- if ($objecttype != 'supplier_proposal' && $objecttype != 'order_supplier' && $objecttype != 'invoice_supplier'
+ if ($objecttype != 'supplier_proposal' && $objecttype != 'order_supplier' && $objecttype != 'invoice_supplier'
&& preg_match('/^([^_]+)_([^_]+)/i',$objecttype,$regs))
{
$module = $element = $regs[1];
@@ -2544,10 +2544,10 @@ abstract class CommonObject
else if ($objecttype == 'subscription') {
$classpath = 'adherents/class'; $module = 'adherent';
}
-
+
// Set classfile
$classfile = strtolower($subelement); $classname = ucfirst($subelement);
-
+
if ($objecttype == 'invoice_supplier') {
$classfile = 'fournisseur.facture'; $classname = 'FactureFournisseur';
}
@@ -2563,7 +2563,7 @@ abstract class CommonObject
else if ($objecttype == 'subscription') {
$classfile = 'cotisation'; $classname = 'Cotisation';
}
-
+
// Here $module, $classfile and $classname are set
if ($conf->$module->enabled && (($element != $this->element) || $alsosametype))
{
@@ -2936,7 +2936,7 @@ abstract class CommonObject
return price2num($total_discount);
}
-
+
/**
* Return into unit=0, the calculated total of weight and volume of all lines * qty
* Calculate by adding weight and volume of each product line, so properties ->volume/volume_units/weight/weight_units must be loaded on line.
@@ -2951,13 +2951,13 @@ abstract class CommonObject
$totalVolume = '';
$totalOrdered = ''; // defined for shipment only
$totalToShip = ''; // defined for shipment only
-
+
foreach ($this->lines as $line)
{
-
+
$totalOrdered+=$line->qty_asked; // defined for shipment only
$totalToShip+=$line->qty_shipped; // defined for shipment only
-
+
// Define qty, weight, volume, weight_units, volume_units
if ($this->element == 'shipping') $qty=$line->qty_shipped; // for shipments
else $qty=$line->qty;
@@ -2965,12 +2965,12 @@ abstract class CommonObject
$volume=$line->volume;
$weight_units=$line->weight_units;
$volume_units=$line->volume_units;
-
+
$weightUnit=0;
$volumeUnit=0;
if (! empty($weight_units)) $weightUnit = $weight_units;
if (! empty($volume_units)) $volumeUnit = $volume_units;
-
+
//var_dump($line->volume_units);
if ($weight_units < 50) // >50 means a standard unit (power of 10 of official unit) > 50 means an exotic unit (like inch)
{
@@ -2993,11 +2993,11 @@ abstract class CommonObject
$totalVolume += $volume * $qty; // This may be wrong if we mix different units
}
}
-
+
return array('weight'=>$totalWeight, 'volume'=>$totalVolume, 'ordered'=>$totalOrdered, 'toship'=>$totalToShip);
- }
-
-
+ }
+
+
/**
* Set extra parameters
*
@@ -3267,7 +3267,7 @@ abstract class CommonObject
// Multicurrency
if (!empty($conf->multicurrency->enabled)) print ' | '.$langs->trans('PriceUHTCurrency').' | ';
-
+
if ($inputalsopricewithtax) print ''.$langs->trans('PriceUTTC').' | ';
// Qty
@@ -3430,7 +3430,7 @@ abstract class CommonObject
$text.= ' - '.(! empty($line->label)?$line->label:$label);
$description.=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($line->description)); // Description is what to show on popup. We shown nothing if already into desc.
}
-
+
$line->pu_ttc = price2num($line->subprice * (1 + ($line->tva_tx/100)), 'MU');
// Output template part (modules that overwrite templates must declare this into descriptor)
@@ -3871,7 +3871,7 @@ abstract class CommonObject
return -1;
}
}
-
+
// We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8.
$sav_charset_output=$outputlangs->charset_output;
@@ -3935,13 +3935,13 @@ abstract class CommonObject
/* For default values */
/**
- * Return the default value to use for a field when showing the create form of object.
+ * Return the default value to use for a field when showing the create form of object.
* Return values in this order:
* 1) If parameter is available into POST, we return it first.
* 2) If not but an alternate value was provided as parameter of function, we return it.
- * 3) If not but a constant $conf->global->OBJECTELEMENT_FIELDNAME is set, we return it (It is better to use the dedicated table).
+ * 3) If not but a constant $conf->global->OBJECTELEMENT_FIELDNAME is set, we return it (It is better to use the dedicated table).
* 4) Return value found into database (TODO No yet implemented)
- *
+ *
* @param string $fieldname Name of field
* @param string $alternatevalue Alternate value to use
* @return string|string[] Default value (can be an array if the GETPOST return an array)
@@ -3952,27 +3952,27 @@ abstract class CommonObject
// If param here has been posted, we use this value first.
if (isset($_POST[$fieldname])) return GETPOST($fieldname, 2);
-
+
if (isset($alternatevalue)) return $alternatevalue;
-
+
$newelement=$this->element;
if ($newelement == 'facture') $newelement='invoice';
if ($newelement == 'commande') $newelement='order';
- if (empty($newelement))
+ if (empty($newelement))
{
dol_syslog("Ask a default value using common method getDefaultCreateValueForField on an object with no property ->element defined. Return empty string.", LOG_WARNING);
return '';
}
-
+
$keyforfieldname=strtoupper($newelement.'_DEFAULT_'.$fieldname);
//var_dump($keyforfieldname);
if (isset($conf->global->$keyforfieldname)) return $conf->global->$keyforfieldname;
-
- // TODO Ad here a scan into table llx_overwrite_default with a filter on $this->element and $fieldname
-
+
+ // TODO Ad here a scan into table llx_overwrite_default with a filter on $this->element and $fieldname
+
}
-
-
+
+
/* For triggers */
@@ -3989,7 +3989,7 @@ abstract class CommonObject
function call_trigger($trigger_name, $user)
{
global $langs,$conf;
-
+
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
$result=$interface->run_triggers($trigger_name,$this,$user,$langs,$conf);
@@ -4171,7 +4171,7 @@ abstract class CommonObject
{
$res=$object->fetch(0,$value);
if ($res > 0) $this->array_options[$key]=$object->id;
- else
+ else
{
$this->error="Ref '".$value."' for object '".$object->element."' not found";
$this->db->rollback();
@@ -4235,7 +4235,7 @@ abstract class CommonObject
}
else return 0;
}
-
+
/**
* Update an exta field value for the current object.
* Data to describe values to insert/update are stored into $this->array_options=array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...)
@@ -4300,7 +4300,7 @@ abstract class CommonObject
}
break;
}
-
+
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element."_extrafields SET ".$key."='".$this->db->escape($this->array_options["options_".$key])."'";
$sql .= " WHERE fk_object = ".$this->id;
@@ -4478,7 +4478,7 @@ abstract class CommonObject
* @param int $origin_id Old thirdparty id (the thirdparty to delete)
* @param int $dest_id New thirdparty id (the thirdparty that will received element of the other)
* @param string[] $tables Tables that need to be changed
- * @param int $ignoreerrors Ignore errors. Return true even if errors. We need this when replacement can fails like for categories (categorie of old thirdparty may already exists on new one)
+ * @param int $ignoreerrors Ignore errors. Return true even if errors. We need this when replacement can fails like for categories (categorie of old thirdparty may already exists on new one)
* @return bool
*/
public static function commonReplaceThirdparty(DoliDB $db, $origin_id, $dest_id, array $tables, $ignoreerrors=0)
@@ -4487,9 +4487,9 @@ abstract class CommonObject
{
$sql = 'UPDATE '.MAIN_DB_PREFIX.$table.' SET fk_soc = '.$dest_id.' WHERE fk_soc = '.$origin_id;
- if (! $db->query($sql))
+ if (! $db->query($sql))
{
- if ($ignoreerrors) return true;
+ if ($ignoreerrors) return true; // TODO Not enough. If there is A-B on kept thirdarty and B-C on old one, we must get A-B-C after merge. Not A-B.
//$this->errors = $db->lasterror();
return false;
}
@@ -4497,26 +4497,26 @@ abstract class CommonObject
return true;
}
-
+
/**
* Get buy price to use for margin calculation. This function is called when buy price is unknown.
* set buy price = sell price if ForceBuyingPriceIfNull configured,
* else if calculation MARGIN_TYPE = 'costprice' and costprice is defined, use costprice as buyprice
* else if calculation MARGIN_TYPE = 'pmp' and pmp is calculated, use pmp as buyprice
* else set min buy price as buy price
- *
+ *
* @param float $unitPrice product unit price
* @param float $discountPercent line discount percent
* @param int $fk_product product id
*
* @return float <0 if ko, buyprice if ok
*/
- public function defineBuyPrice($unitPrice = 0, $discountPercent = 0, $fk_product = 0)
+ public function defineBuyPrice($unitPrice = 0, $discountPercent = 0, $fk_product = 0)
{
global $conf;
-
+
$buyPrice = 0;
-
+
if (($unitPrice > 0) && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)) // In most cases, test here is false
{
$buyPrice = $unitPrice * (1 - $discountPercent / 100);
@@ -4560,7 +4560,7 @@ abstract class CommonObject
$buyPrice = $product->pmp;
}
}
-
+
if (empty($buyPrice) && isset($conf->global->MARGIN_TYPE) && in_array($conf->global->MARGIN_TYPE, array('1','pmp','costprice')))
{
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 1363e5012aa..f4163a889f0 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -6,6 +6,7 @@
* Copyright (C) 2013 Cédric Salvador
* Copyright (C) 2014 Marcos García
* Copyright (C) 2015 Bahfir Abbes
+ * Copyright (C) 2016 Ferran Marcet
* 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
@@ -687,7 +688,7 @@ class FormFile
*
* @param string $modulepart propal, facture, facture_fourn, ...
* @param string $modulesubdir Sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into subdir of module.
- * @param string $filedir Directory to scan
+ * @param string $filedir Full path to directory to scan
* @param string $filter Filter filenames on this regex string (Example: '\.pdf$')
* @return string Output string with HTML link of documents (might be empty string). This also fill the array ->infofiles
*/
@@ -720,9 +721,6 @@ class FormFile
if ($modulepart == 'export') {
$relativepath = $file["name"];
}
- if ($modulepart == 'facture_fournisseur' || $modulepart == 'invoice_fournisseur') {
- $relativepath = get_exdir($modulesubdir, 2,0,0,null,'invoice_supplier'). $modulesubdir. "/" . $file["name"];
- }
// Show file name with link to download
$out.= 'global->MAIN_USE_ADVANCED_PERMS) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->mailing->mailing_advance->recipient))
+ if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->mailing->mailing_advance->recipient))
{
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/cibles.php?id=".$object->id;
$head[$h][1] = $langs->trans("MailRecipients");
$head[$h][2] = 'targets';
$h++;
-
- if (! empty($conf->global->EMAILING_USE_ADVANCED_SELECTOR)) // Still need debug
+
+ if (! empty($conf->global->EMAILING_USE_ADVANCED_SELECTOR))
{
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/advtargetemailing.php?id=".$object->id;
$head[$h][1] = $langs->trans("MailAdvTargetRecipients");
@@ -54,7 +54,7 @@ function emailing_prepare_head(Mailing $object)
$h++;
}
}
-
+
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/info.php?id=".$object->id;
$head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info';
diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php
index d299d11798a..2c02a7f40c7 100644
--- a/htdocs/core/lib/pdf.lib.php
+++ b/htdocs/core/lib/pdf.lib.php
@@ -1480,7 +1480,10 @@ function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0)
*/
function pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails=0)
{
- global $hookmanager;
+ global $hookmanager,$conf;
+
+ $sign=1;
+ if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
$result='';
$reshook=0;
@@ -1497,7 +1500,7 @@ function pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails=0)
}
if (empty($reshook))
{
- if (empty($hidedetails) || $hidedetails > 1) $result.=price(($object->lines[$i]->subprice) + ($object->lines[$i]->subprice)*($object->lines[$i]->tva_tx)/100, 0, $outputlangs);
+ if (empty($hidedetails) || $hidedetails > 1) $result.=price($sign * (($object->lines[$i]->subprice) + ($object->lines[$i]->subprice)*($object->lines[$i]->tva_tx)/100), 0, $outputlangs);
}
return $result;
}
@@ -1805,7 +1808,10 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0)
*/
function pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails=0)
{
- global $hookmanager;
+ global $hookmanager,$conf;
+
+ $sign=1;
+ if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
$reshook=0;
$result='';
@@ -1826,7 +1832,7 @@ function pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails=0)
{
$result.=$outputlangs->transnoentities("Option");
}
- elseif (empty($hidedetails) || $hidedetails > 1) $result.=price(($object->lines[$i]->total_ht) + ($object->lines[$i]->total_ht)*($object->lines[$i]->tva_tx)/100, 0, $outputlangs);
+ elseif (empty($hidedetails) || $hidedetails > 1) $result.=price($sign * ($object->lines[$i]->total_ht) + ($object->lines[$i]->total_ht)*($object->lines[$i]->tva_tx)/100, 0, $outputlangs);
}
return $result;
}
diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php
index 2c362a42c2c..a6091f8ebb0 100644
--- a/htdocs/core/lib/sendings.lib.php
+++ b/htdocs/core/lib/sendings.lib.php
@@ -310,6 +310,7 @@ function show_list_sending_receive($origin,$origin_id,$filter='')
$expedition->id=$objp->sendingid;
$expedition->fetchObjectLinked($expedition->id,$expedition->element);
//var_dump($expedition->linkedObjects);
+
$receiving='';
if (count($expedition->linkedObjects['delivery']) > 0) $receiving=reset($expedition->linkedObjects['delivery']); // Take first link
diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
index 4615c783dfe..4305f379f44 100644
--- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
+++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
@@ -538,15 +538,18 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY($this->postotalht, $curY);
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $total_excl_tax, 0, 'R', 0);
+
+ $sign=1;
+ if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
// Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva
$prev_progress = $object->lines[$i]->get_prev_progress($object->id);
if ($prev_progress > 0) // Compute progress from previous situation
{
- if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne = $object->lines[$i]->multicurrency_total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent;
- else $tvaligne = $object->lines[$i]->total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent;
+ if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne = $sign * $object->lines[$i]->multicurrency_total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent;
+ else $tvaligne = $sign * $object->lines[$i]->total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent;
} else {
- if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva;
- else $tvaligne=$object->lines[$i]->total_tva;
+ if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne= $sign * $object->lines[$i]->multicurrency_total_tva;
+ else $tvaligne= $sign * $object->lines[$i]->total_tva;
}
$localtax1ligne=$object->lines[$i]->total_localtax1;
diff --git a/htdocs/core/modules/mailings/advthirdparties.modules.php b/htdocs/core/modules/mailings/advthirdparties.modules.php
index cba8af72295..1e04fe5459d 100644
--- a/htdocs/core/modules/mailings/advthirdparties.modules.php
+++ b/htdocs/core/modules/mailings/advthirdparties.modules.php
@@ -56,7 +56,7 @@ class mailing_advthirdparties extends MailingTargets
* @param array $contactid Array of contact id to add
* @return int <0 if error, number of emails added if ok
*/
- function add_to_target($mailing_id,$socid,$type_of_target, $contactid)
+ function add_to_target_spec($mailing_id,$socid,$type_of_target, $contactid)
{
global $conf, $langs;
@@ -80,14 +80,14 @@ class mailing_advthirdparties extends MailingTargets
{
$num = $this->db->num_rows($result);
$i = 0;
-
+
dol_syslog(get_class($this)."::add_to_target mailing ".$num." targets found", LOG_DEBUG);
-
+
$old = '';
while ($i < $num)
{
$obj = $this->db->fetch_object($result);
-
+
if (!empty($obj->email) && filter_var($obj->email, FILTER_VALIDATE_EMAIL)) {
if (!array_key_exists($obj->email, $cibles)) {
$cibles[$obj->email] = array(
@@ -102,7 +102,7 @@ class mailing_advthirdparties extends MailingTargets
);
}
}
-
+
$i++;
}
}
@@ -129,21 +129,21 @@ class mailing_advthirdparties extends MailingTargets
$sql.= " AND socp.fk_soc IN (".implode(',',$socid).")";
}
$sql.= " ORDER BY email";
-
+
// Stock recipients emails into targets table
$result=$this->db->query($sql);
if ($result)
{
$num = $this->db->num_rows($result);
$i = 0;
-
+
dol_syslog(get_class($this)."::add_to_target mailing ".$num." targets found");
-
+
$old = '';
while ($i < $num)
{
$obj = $this->db->fetch_object($result);
-
+
if (!empty($obj->email) && filter_var($obj->email, FILTER_VALIDATE_EMAIL)) {
if (!array_key_exists($obj->email, $cibles)) {
$cibles[$obj->email] = array(
@@ -158,7 +158,7 @@ class mailing_advthirdparties extends MailingTargets
);
}
}
-
+
$i++;
}
}
@@ -202,7 +202,7 @@ class mailing_advthirdparties extends MailingTargets
*
* @return int Nb of recipients
*/
- function getNbOfRecipients()
+ function getNbOfRecipients($sql)
{
global $conf;
diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php
index 03b450aa275..af51e01c576 100644
--- a/htdocs/core/modules/modAccounting.class.php
+++ b/htdocs/core/modules/modAccounting.class.php
@@ -71,7 +71,7 @@ class modAccounting extends DolibarrModules
$this->requiredby = array(); // List of modules id to disable if this one is disabled
$this->conflictwith = array("modComptabilite"); // List of modules are in conflict with this module
$this->phpmin = array(5, 3); // Minimum version of PHP required by module
- $this->need_dolibarr_version = array(3, 7); // Minimum version of Dolibarr required by module
+ $this->need_dolibarr_version = array(3, 9); // Minimum version of Dolibarr required by module
$this->langfiles = array("accountancy");
// Constants
@@ -179,7 +179,7 @@ class modAccounting extends DolibarrModules
$this->const[18] = array (
"ACCOUNTING_EXPORT_GLOBAL_ACCOUNT",
"yesno",
- "1"
+ "1"
);
$this->const[19] = array (
"ACCOUNTING_EXPORT_LABEL",
@@ -189,12 +189,12 @@ class modAccounting extends DolibarrModules
$this->const[20] = array (
"ACCOUNTING_EXPORT_AMOUNT",
"yesno",
- "1"
+ "1"
);
$this->const[21] = array (
"ACCOUNTING_EXPORT_DEVISE",
"yesno",
- "1"
+ "1"
);
*/
$this->const[22] = array(
@@ -270,7 +270,7 @@ class modAccounting extends DolibarrModules
$this->rights[$r][4] = 'fiscalyear';
$this->rights[$r][5] = '';
$r++;
-
+
$this->rights[$r][0] = 50440;
$this->rights[$r][1] = 'Manage chart of accounts';
$this->rights[$r][2] = 'r';
diff --git a/htdocs/don/card.php b/htdocs/don/card.php
index e770e2a146c..8614220e8c0 100644
--- a/htdocs/don/card.php
+++ b/htdocs/don/card.php
@@ -743,9 +743,9 @@ if (! empty($id) && $action != 'edit')
// Delete
if ($user->rights->don->supprimer)
{
- if ($don->statut == -1 || $don->statut == 0)
+ if ($object->statut == -1 || $object->statut == 0)
{
- print '";
+ print '";
}
else
{
@@ -783,4 +783,4 @@ if (! empty($id) && $action != 'edit')
}
llxFooter();
-$db->close();
\ No newline at end of file
+$db->close();
diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php
index 814b517ed38..bb8cb9bcdda 100644
--- a/htdocs/expedition/class/expedition.class.php
+++ b/htdocs/expedition/class/expedition.class.php
@@ -1304,7 +1304,7 @@ class Expedition extends CommonObject
$sql = "SELECT cd.rowid, cd.fk_product, cd.label as custom_label, cd.description, cd.qty as qty_asked, cd.product_type";
$sql.= ", cd.total_ht, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.total_tva";
- $sql.= ", cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.price, cd.subprice, cd.remise_percent";
+ $sql.= ", cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.price, cd.subprice, cd.remise_percent,cd.buy_price_ht as pa_ht";
$sql.= ", ed.rowid as line_id, ed.qty as qty_shipped, ed.fk_origin_line, ed.fk_entrepot";
$sql.= ", p.ref as product_ref, p.label as product_label, p.fk_product_type";
$sql.= ", p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.tobatch as product_tobatch";
@@ -1375,6 +1375,8 @@ class Expedition extends CommonObject
$line->volume = $obj->volume;
$line->volume_units = $obj->volume_units;
+ $line->pa_ht = $obj->pa_ht;
+
// For invoicing
$tabprice = calcul_price_total($obj->qty_shipped, $obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, 0, 'HT', $obj->info_bits, $obj->fk_product_type, $mysoc); // We force type to 0
$line->desc = $obj->description; // We need ->desc because some code into CommonObject use desc (property defined for other elements)
diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php
index 8729834ec3e..d8bb890c0dd 100644
--- a/htdocs/fourn/card.php
+++ b/htdocs/fourn/card.php
@@ -448,6 +448,18 @@ if ($object->id > 0)
}
// TODO move to DAO class
+ $sql = "SELECT count(p.rowid) as total";
+ $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p ";
+ $sql.= " WHERE p.fk_soc =".$object->id;
+ $sql.= " AND p.entity =".$conf->entity;
+ $sql.= " ORDER BY p.date_commande DESC";
+ $resql=$db->query($sql);
+ if ($resql)
+ {
+ $object_count = $db->fetch_object($resql);
+ $num = $object_count->total;
+ }
+
$sql = "SELECT p.rowid,p.ref, p.date_commande as dc, p.fk_statut, p.total_ht, p.tva as total_tva, p.total_ttc";
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p ";
$sql.= " WHERE p.fk_soc =".$object->id;
@@ -458,7 +470,6 @@ if ($object->id > 0)
if ($resql)
{
$i = 0 ;
- $num = $db->num_rows($resql);
if ($num > 0)
{
@@ -474,7 +485,7 @@ if ($object->id > 0)
}
$var = True;
- while ($i < $num && $i <= $MAXLIST)
+ while ($i < $num && $i < $MAXLIST)
{
$obj = $db->fetch_object($resql);
$var=!$var;
diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php
index 88f01c1e837..9412c5eb015 100644
--- a/htdocs/fourn/facture/list.php
+++ b/htdocs/fourn/facture/list.php
@@ -743,17 +743,20 @@ if ($resql)
$facturestatic->ref_supplier=$obj->ref_supplier;
$facturestatic->date_echeance = $db->jdate($obj->datelimite);
$facturestatic->statut = $obj->fk_statut;
-
+
print '';
if (! empty($arrayfields['f.ref']['checked']))
{
print '| ';
-
+
print $facturestatic->getNomUrl(1);
$filename=dol_sanitizeFileName($obj->ref);
+
$filedir=$conf->fournisseur->facture->dir_output.'/'.get_exdir($obj->facid,2,0,0,$facturestatic,'invoice_supplier').dol_sanitizeFileName($obj->ref);
- print $formfile->getDocumentsLink('facture_fournisseur', $filename, $filedir);
- print " | \n";
+ $subdir = get_exdir($obj->facid,2,0,0,$facturestatic,'invoice_supplier').dol_sanitizeFileName($obj->ref);
+ print $formfile->getDocumentsLink('facture_fournisseur', $subdir, $filedir);
+
+ print "\n";
if (! $i) $totalarray['nbfield']++;
}
diff --git a/htdocs/install/mysql/data/llx_accounting_category.sql b/htdocs/install/mysql/data/llx_accounting_category.sql
index 5769d291563..8e69ca6331e 100644
--- a/htdocs/install/mysql/data/llx_accounting_category.sql
+++ b/htdocs/install/mysql/data/llx_accounting_category.sql
@@ -25,5 +25,5 @@
--
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 1,'VTE','Ventes de marchandises', '707xxx', 0, 0, '', '10', 1, 1);
-INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 2,'MAR','Coût d\'achats marchandises vendues', '603xxx | 607xxx | 609xxx', 0, 0, '', '20', 1, 1);
+INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 2,'MAR','Coût d achats marchandises vendues', '603xxx | 607xxx | 609xxx', 0, 0, '', '20', 1, 1);
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 3,'MARGE','Marge commerciale', '', 0, 1, '1 + 2', '30', 1, 1);
\ No newline at end of file
diff --git a/htdocs/install/pgsql/functions/functions.sql b/htdocs/install/pgsql/functions/functions.sql
index 307c88c3007..df0c64855b1 100644
--- a/htdocs/install/pgsql/functions/functions.sql
+++ b/htdocs/install/pgsql/functions/functions.sql
@@ -56,16 +56,12 @@ CREATE OR REPLACE FUNCTION dol_util_triggerall(DoEnable boolean) RETURNS integer
CREATE OR REPLACE FUNCTION update_modified_column_tms() RETURNS TRIGGER AS $$ BEGIN NEW.tms = now(); RETURN NEW; END; $$ LANGUAGE plpgsql;
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_accounting_account FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_accounting_fiscalyear FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
-CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_accountingtransaction FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_actioncomm FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_actioncomm_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_adherent FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_adherent_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_adherent_type FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_adherent_type_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
-CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_askpricesupplier FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
-CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_askpricesupplier_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
-CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_askpricesupplierdet_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bank FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bank_account FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bank_account_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang
index 18742ba0ed7..9a12afd3953 100644
--- a/htdocs/langs/en_US/accountancy.lang
+++ b/htdocs/langs/en_US/accountancy.lang
@@ -84,6 +84,11 @@ AccountingCategory=Accounting category
NotMatch=Not Set
+DeleteMvt=Delete general ledger lines
+DelYear=Year to delete
+DelJournal=Journal to delete
+ConfirmDeleteMvt=This will delete all line of of the general ledger for year and/or from a specifics journal
+
DelBookKeeping=Delete the records of the general ledger
DescSellsJournal=Sales journal
@@ -142,6 +147,7 @@ Modelcsv_bob50=Export towards Sage BOB 50
Modelcsv_ciel=Export towards Sage Ciel Compta or Compta Evolution
Modelcsv_quadratus=Export towards Quadratus QuadraCompta
Modelcsv_ebp=Export towards EBP
+Modelcsv_cogilog=Export towards Cogilog
## Tools - Init accounting account on product / service
InitAccountancy=Init accountancy
@@ -160,3 +166,4 @@ Formula=Formula
## Error
ErrorNoAccountingCategoryForThisCountry=No accounting category are available for this country
ExportNotSupported=The export format setuped is not supported into this page
+BookeppingLineAlreayExists=Lines already existing into bookeeping
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index df340688a67..3eb13b3e602 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -534,6 +534,8 @@ Module59000Name=Margins
Module59000Desc=Module to manage margins
Module60000Name=Commissions
Module60000Desc=Module to manage commissions
+Module63000Name=Resources
+Module63000Desc=Manage resources (printers, cars, room, ...) you can then share into events
Permission11=Read customer invoices
Permission12=Create/modify customer invoices
Permission13=Unvalidate customer invoices
@@ -1591,4 +1593,4 @@ DetectionNotPossible=Detection not possible
UrlToGetKeyToUseAPIs=Url to get token to use API (once token has been received it is saved on database user table and will be checked on each future access)
ListOfAvailableAPIs=List of available APIs
activateModuleDependNotSatisfied=Module "%s" depends on module "%s" that is missing, so module "%1$s" may not work correclty. Please install module "%2$s" or disable module "%1$s" if you want to be safe from any surprise
-CommandIsNotInsideAllowedCommands=The command you try to run is not inside list of allowed commands defined into parameter $dolibarr_main_restrict_os_commands into conf.php file.
\ No newline at end of file
+CommandIsNotInsideAllowedCommands=The command you try to run is not inside list of allowed commands defined into parameter $dolibarr_main_restrict_os_commands into conf.php file.
diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang
index b1b8d601430..e9142d463ff 100644
--- a/htdocs/langs/en_US/products.lang
+++ b/htdocs/langs/en_US/products.lang
@@ -32,6 +32,8 @@ ServicesOnSellAndOnBuy=Services for sale and for purchase
LastModifiedProductsAndServices=Latest %s modified products/services
LastRecordedProducts=Latest %s recorded products
LastRecordedServices=Latest %s recorded services
+CardProduct0=Product card
+CardProduct1=Service card
Stock=Stock
Stocks=Stocks
Movements=Movements
diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php
index 9b203ea0424..c2c6ba1bc99 100644
--- a/htdocs/multicurrency/class/multicurrency.class.php
+++ b/htdocs/multicurrency/class/multicurrency.class.php
@@ -140,6 +140,7 @@ class MultiCurrency extends CommonObject
$this->db->begin();
+ dol_syslog(__METHOD__,LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$error ++;
@@ -184,9 +185,10 @@ class MultiCurrency extends CommonObject
$sql = 'SELECT';
$sql .= ' c.rowid, c.name, c.code, c.entity, c.date_create, c.fk_user';
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' AS c';
- if (!empty($code)) $sql .= ' WHERE c.code = "'.$this->db->escape($code).'"';
+ if (!empty($code)) $sql .= ' WHERE c.code = \''.$this->db->escape($code).'\'';
else $sql .= ' WHERE c.rowid = ' . $id;
+ dol_syslog(__METHOD__,LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
@@ -226,8 +228,6 @@ class MultiCurrency extends CommonObject
*/
public function fetchAllCurrencyRate()
{
- dol_syslog('Currency::fetchAllCurrencyRate', LOG_DEBUG);
-
$sql = 'SELECT cr.rowid';
$sql.= ' FROM ' . MAIN_DB_PREFIX . $this->table_element_line. ' as cr';
$sql.= ' WHERE cr.fk_multicurrency = '.$this->id;
@@ -235,6 +235,7 @@ class MultiCurrency extends CommonObject
$this->rates = array();
+ dol_syslog(__METHOD__,LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
@@ -284,10 +285,11 @@ class MultiCurrency extends CommonObject
// Update request
$sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET';
- $sql .= ' name="'.$this->db->escape($this->name).'"';
- $sql .= ' code="'.$this->db->escape($this->code).'"';
+ $sql .= ' name=\''.$this->db->escape($this->name).'\'';
+ $sql .= ' code=\''.$this->db->escape($this->code).'\'';
$sql .= ' WHERE rowid=' . $this->id;
+ dol_syslog(__METHOD__,LOG_DEBUG);
$this->db->begin();
$resql = $this->db->query($sql);
@@ -347,6 +349,7 @@ class MultiCurrency extends CommonObject
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element;
$sql .= ' WHERE rowid=' . $this->id;
+ dol_syslog(__METHOD__,LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$error ++;
@@ -425,7 +428,9 @@ class MultiCurrency extends CommonObject
$currency->code = $code;
$currency->name = $code;
- $sql = 'SELECT label FROM '.MAIN_DB_PREFIX.'c_currencies WHERE code_iso = "'.$db->escape($code).'"';
+ $sql = 'SELECT label FROM '.MAIN_DB_PREFIX.'c_currencies WHERE code_iso = \''.$db->escape($code).'\'';
+
+ dol_syslog(__METHOD__,LOG_DEBUG);
$resql = $db->query($sql);
if ($resql && ($line = $db->fetch_object($resql)))
{
@@ -475,6 +480,7 @@ class MultiCurrency extends CommonObject
$sql.= ' WHERE cr.fk_multicurrency = '.$this->id;
$sql.= ' AND cr.date_sync >= ALL (SELECT cr2.date_sync FROM '.MAIN_DB_PREFIX.$this->table_element_line.' AS cr2 WHERE cr.rowid = cr2.rowid)';
+ dol_syslog(__METHOD__,LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql && ($obj = $this->db->fetch_object($resql))) {
$this->rate = new CurrencyRate($this->db);
@@ -493,7 +499,9 @@ class MultiCurrency extends CommonObject
*/
public static function getIdFromCode(&$db, $code)
{
- $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'multicurrency WHERE code = "'.$db->escape($code).'"';
+ $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'multicurrency WHERE code = \''.$db->escape($code).'\'';
+
+ dol_syslog(__METHOD__,LOG_DEBUG);
$resql = $db->query($sql);
if ($resql && $obj = $db->fetch_object($resql)) return $obj->rowid;
else return 0;
@@ -512,10 +520,11 @@ class MultiCurrency extends CommonObject
{
$sql = 'SELECT m.rowid, mc.rate FROM '.MAIN_DB_PREFIX.'multicurrency m';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'multicurrency_rate mc ON (m.rowid = mc.fk_multicurrency)';
- $sql.= ' WHERE m.code = "'.$db->escape($code).'"';
+ $sql.= ' WHERE m.code = \''.$db->escape($code).'\'';
$sql.= " AND m.entity IN (".getEntity('multicurrency', 1).")";
$sql.= ' ORDER BY mc.date_sync DESC LIMIT 1';
+ dol_syslog(__METHOD__,LOG_DEBUG);
$resql = $db->query($sql);
if ($resql && $obj = $db->fetch_object($resql)) return array($obj->rowid, $obj->rate);
else return array(0, 1);
@@ -556,6 +565,8 @@ class MultiCurrency extends CommonObject
global $db;
$sql = 'SELECT multicurrency_tx FROM '.MAIN_DB_PREFIX.$table.' WHERE rowid = '.$fk_facture;
+
+ dol_syslog(__METHOD__,LOG_DEBUG);
$resql = $db->query($sql);
if ($resql && ($line = $db->fetch_object($resql)))
{
@@ -721,6 +732,7 @@ class CurrencyRate extends CommonObjectLine
$this->db->begin();
+ dol_syslog(__METHOD__,LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$error ++;
@@ -765,6 +777,7 @@ class CurrencyRate extends CommonObjectLine
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' AS cr';
$sql .= ' WHERE cr.rowid = ' . $id;
+ dol_syslog(__METHOD__,LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$numrows = $this->db->num_rows($resql);
@@ -816,6 +829,7 @@ class CurrencyRate extends CommonObjectLine
$this->db->begin();
+ dol_syslog(__METHOD__,LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$error ++;
@@ -866,6 +880,7 @@ class CurrencyRate extends CommonObjectLine
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element;
$sql .= ' WHERE rowid='.$this->id;
+ dol_syslog(__METHOD__,LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$error ++;
diff --git a/htdocs/product/card.php b/htdocs/product/card.php
index 330e712cf1b..e524b8f8303 100644
--- a/htdocs/product/card.php
+++ b/htdocs/product/card.php
@@ -1314,7 +1314,7 @@ else
}
// Custom code
- if (empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO))
+ if (! $object->isService() && empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO))
{
print '
| '.$langs->trans("CustomCode").' | | ';
// Origin country
diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php
index e7ce1625aad..ed3311a1b30 100644
--- a/htdocs/projet/card.php
+++ b/htdocs/projet/card.php
@@ -666,9 +666,13 @@ else
$filteronlist='';
if (! empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) $filteronlist=$conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
$text=$form->select_thirdparty_list($object->thirdparty->id, 'socid', $filteronlist, 'SelectThirdParty', 1, 0, array(), '', 0, 0, 'minwidth300');
- $texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty");
- print $form->textwithtooltip($text.' '.img_help(), $texthelp, 1, 0, '', '', 2);
- print '
';
+ if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile))
+ {
+ $texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty");
+ print $form->textwithtooltip($text.' '.img_help(), $texthelp, 1, 0, '', '', 2);
+ }
+ else print $text;
+ print '
';
}
// Visibility
diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php
index 236a8154578..f29122f1c24 100644
--- a/htdocs/projet/class/project.class.php
+++ b/htdocs/projet/class/project.class.php
@@ -1145,6 +1145,7 @@ class Project extends CommonObject
// Load source object
$clone_project->fetch($fromid);
+ $clone_project->fetch_optionals();
$clone_project->fetch_thirdparty();
$orign_dt_start=$clone_project->date_start;
diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php
index b69c731a1d7..c4dd53315a3 100644
--- a/htdocs/projet/tasks/time.php
+++ b/htdocs/projet/tasks/time.php
@@ -53,7 +53,7 @@ $projectstatic = new Project($db);
* Actions
*/
-if ($action == 'addtimespent' && $user->rights->projet->creer)
+if ($action == 'addtimespent' && $user->rights->projet->lire)
{
$error=0;
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index 4fca804638e..d9c38b6fa08 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -3469,17 +3469,17 @@ class Societe extends CommonObject
* Because this function is meant to be executed within a transaction, we won't take care of it.
*/
$sql = 'SELECT rowid
-FROM llx_societe_commerciaux
+FROM '.MAIN_DB_PREFIX.'societe_commerciaux
WHERE fk_soc = '.(int) $dest_id.' AND fk_user IN (
SELECT fk_user
- FROM llx_societe_commerciaux
+ FROM '.MAIN_DB_PREFIX.'societe_commerciaux
WHERE fk_soc = '.(int) $origin_id.'
);';
$query = $db->query($sql);
while ($result = $db->fetch_object($query)) {
- $db->query('DELETE FROM llx_societe_commerciaux WHERE rowid = '.$result->rowid);
+ $db->query('DELETE FROM '.MAIN_DB_PREFIX.'societe_commerciaux WHERE rowid = '.$result->rowid);
}
/**
diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php
index 70dee1ab8eb..a5fae415a6a 100644
--- a/htdocs/societe/consumption.php
+++ b/htdocs/societe/consumption.php
@@ -276,7 +276,7 @@ if ($type_element == 'contract')
$thirdTypeSelect='customer';
}
-if ($sql_select)
+if (!empty($sql_select))
{
$sql = $sql_select;
$sql.= ' d.description as description,';
@@ -302,7 +302,7 @@ if ($sql_select)
$sql.= " AND ".$dateprint." BETWEEN '".$db->idate($start)."' AND '".$db->idate($end)."'";
}
if ($sref) $sql.= " AND ".$doc_number." LIKE '%".$db->escape($sref)."%'";
- if ($sprod_fulldescr)
+ if ($sprod_fulldescr)
{
$sql.= " AND (d.description LIKE '%".$db->escape($sprod_fulldescr)."%'";
if (GETPOST('type_element') != 'fichinter') $sql.= " OR p.ref LIKE '%".$db->escape($sprod_fulldescr)."%'";
diff --git a/htdocs/user/class/userbankaccount.class.php b/htdocs/user/class/userbankaccount.class.php
index 4e88233fe35..514e8d0b28c 100644
--- a/htdocs/user/class/userbankaccount.class.php
+++ b/htdocs/user/class/userbankaccount.class.php
@@ -141,8 +141,7 @@ class UserBankAccount extends Account
$sql = "SELECT rowid, fk_user, entity, bank, number, code_banque, code_guichet, cle_rib, bic, iban_prefix as iban, domiciliation, proprio,";
$sql.= " owner_address, label, datec, tms as datem";
$sql.= " FROM ".MAIN_DB_PREFIX."user_rib";
- if ($id) $sql.= " WHERE rowid = ".$id;
- if ($socid) $sql.= " WHERE fk_user = ".$userid;
+ $sql.= " WHERE rowid = ".$id;
$resql = $this->db->query($sql);
if ($resql)