';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
// Action edit/delete and select
print '
';
// Transaction reconciliated or edit link
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index f2e57c8b536..0f8d0b37d53 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -142,9 +142,9 @@ if (!empty($conf->global->INVOICE_DISALLOW_REOPEN)) {
$usercanunvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($usercancreate)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->facture->invoice_advance->unvalidate)));
$usercanproductignorepricemin = ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS));
-$usercancreatemargin = $user->rights->margins->creer;
-$usercanreadallmargin = $user->rights->margins->liretous;
-$usercancreatewithdrarequest = $user->rights->prelevement->bons->creer;
+$usercancreatemargin = (!empty($user->rights->margins->creer) ? $user->rights->margins->creer : 0);
+$usercanreadallmargin = (!empty($user->rights->margins->liretous) ? $user->rights->margins->liretous : 0);
+$usercancreatewithdrarequest = (!empty($user->rights->prelevement->bons->creer) ? $user->rights->prelevement->bons->creer : 0);
$permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php
@@ -4317,7 +4317,7 @@ if ($action == 'create') {
}
$morehtmlref .= '';
- $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
+ $object->totalpaid = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '');
diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php
index 51fd8c1dd7a..8a8a9667a28 100644
--- a/htdocs/compta/facture/class/api_invoices.class.php
+++ b/htdocs/compta/facture/class/api_invoices.class.php
@@ -148,7 +148,10 @@ class Invoices extends DolibarrApi
// Add external contacts ids
if ($contact_list > -1) {
- $this->invoice->contacts_ids = $this->invoice->liste_contact(-1, 'external', $contact_list);
+ $tmparray = $this->invoice->liste_contact(-1, 'external', $contact_list);
+ if (is_array($tmparray)) {
+ $this->invoice->contacts_ids = $tmparray;
+ }
}
$this->invoice->fetchObjectLinked();
@@ -267,8 +270,10 @@ class Invoices extends DolibarrApi
$invoice_static->remaintopay = price2num($invoice_static->total_ttc - $invoice_static->totalpaid - $invoice_static->totalcreditnotes - $invoice_static->totaldeposits, 'MT');
// Add external contacts ids
- $invoice_static->contacts_ids = $invoice_static->liste_contact(-1, 'external', 1);
-
+ $tmparray = $invoice_static->liste_contact(-1, 'external', 1);
+ if (is_array($tmparray)) {
+ $invoice_static->contacts_ids = $tmparray;
+ }
$obj_ret[] = $this->_cleanObjectDatas($invoice_static);
}
$i++;
@@ -1768,7 +1773,10 @@ class Invoices extends DolibarrApi
// Add external contacts ids
if ($contact_list > -1) {
- $this->template_invoice->contacts_ids = $this->template_invoice->liste_contact(-1, 'external', $contact_list);
+ $tmparray = $this->template_invoice->liste_contact(-1, 'external', $contact_list);
+ if (is_array($tmparray)) {
+ $this->template_invoice->contacts_ids = $tmparray;
+ }
}
$this->template_invoice->fetchObjectLinked();
diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php
index 43897172779..301f16fb4a5 100644
--- a/htdocs/compta/facture/contact.php
+++ b/htdocs/compta/facture/contact.php
@@ -52,7 +52,7 @@ if ($user->socid) {
$object = new Facture($db);
// Load object
if ($id > 0 || !empty($ref)) {
- $ret = $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION);
+ $ret = $object->fetch($id, $ref, '', '', (!empty($conf->global->INVOICE_USE_SITUATION) ? $conf->global->INVOICE_USE_SITUATION : 0));
}
$result = restrictedArea($user, 'facture', $object->id);
@@ -171,7 +171,7 @@ if ($id > 0 || !empty($ref)) {
}
$morehtmlref .= '';
- $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
+ $object->totalpaid = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php
index 6eb05a16922..03e4a0b4577 100644
--- a/htdocs/compta/facture/document.php
+++ b/htdocs/compta/facture/document.php
@@ -172,7 +172,7 @@ if ($id > 0 || !empty($ref)) {
}
$morehtmlref .= '';
- $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
+ $object->totalpaid = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0);
diff --git a/htdocs/compta/facture/info.php b/htdocs/compta/facture/info.php
index 60efaf36e3d..f524d49eb97 100644
--- a/htdocs/compta/facture/info.php
+++ b/htdocs/compta/facture/info.php
@@ -47,7 +47,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Load object
if ($id > 0 || !empty($ref)) {
- $ret = $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION);
+ $ret = $object->fetch($id, $ref, '', '', (!empty($conf->global->INVOICE_USE_SITUATION) ? $conf->global->INVOICE_USE_SITUATION : 0));
}
// Security check
@@ -131,7 +131,7 @@ if (!empty($conf->projet->enabled)) {
}
$morehtmlref .= '';
-$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
+$object->totalpaid = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0);
@@ -140,7 +140,7 @@ print '';
print ' ';
-print '
';
+print '
';
dol_print_object_info($object);
print '
';
diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index 5937eda916c..6fd1e2a7322 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -245,7 +245,7 @@ $arrayfields = array(
'f.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>292),
'multicurrency_dynamount_payed'=>array('label'=>'MulticurrencyAlreadyPaid', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>295),
'multicurrency_rtp'=>array('label'=>'MulticurrencyRemainderToPay', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>296), // Not enabled by default because slow
- 'total_pa' => array('label' => ($conf->global->MARGIN_TYPE == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) ? 0 : 1)),
+ 'total_pa' => array('label' => ((isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == '1') ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) ? 0 : 1)),
'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) ? 0 : 1)),
'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),
'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)),
@@ -1112,7 +1112,7 @@ if ($resql) {
if (!empty($user->rights->facture->paiement)) {
$arrayofmassactions['makepayment'] = img_picto('', 'payment', 'class="pictofixedwidth"').$langs->trans("MakePaymentAndClassifyPayed");
}
- if ($conf->prelevement->enabled && !empty($user->rights->prelevement->bons->creer)) {
+ if (!empty($conf->prelevement->enabled) && !empty($user->rights->prelevement->bons->creer)) {
$langs->load("withdrawals");
$arrayofmassactions['withdrawrequest'] = img_picto('', 'payment', 'class="pictofixedwidth"').$langs->trans("MakeWithdrawRequest");
}
diff --git a/htdocs/compta/facture/note.php b/htdocs/compta/facture/note.php
index 6f699774d32..fe3bb736ea4 100644
--- a/htdocs/compta/facture/note.php
+++ b/htdocs/compta/facture/note.php
@@ -44,7 +44,7 @@ $action = GETPOST('action', 'aZ09');
$object = new Facture($db);
// Load object
if ($id > 0 || !empty($ref)) {
- $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION);
+ $object->fetch($id, $ref, '', '', (!empty($conf->global->INVOICE_USE_SITUATION) ? $conf->global->INVOICE_USE_SITUATION : 0));
}
$permissionnote = $user->rights->facture->creer; // Used by the include of actions_setnotes.inc.php
@@ -148,7 +148,7 @@ if ($id > 0 || !empty($ref)) {
}
$morehtmlref .= '';
- $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
+ $object->totalpaid = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0);
diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php
index 989fa28b2f0..33d6af875ff 100644
--- a/htdocs/compta/facture/prelevement.php
+++ b/htdocs/compta/facture/prelevement.php
@@ -384,7 +384,7 @@ if ($object->id > 0) {
}
$morehtmlref .= '';
- $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
+ $object->totalpaid = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $moreparam, 0, '', '');
diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php
index ae4064462e2..655ee13471b 100644
--- a/htdocs/compta/paiement/class/paiement.class.php
+++ b/htdocs/compta/paiement/class/paiement.class.php
@@ -109,6 +109,16 @@ class Paiement extends CommonObject
*/
public $ext_payment_id;
+ /**
+ * @var string Id of prelevement
+ */
+ public $id_prelevement;
+
+ /**
+ * @var string num_prelevement
+ */
+ public $num_prelevement;
+
/**
* @var string Name of external payment mode
*/
diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php
index 640ffc78d99..db48b2767f2 100644
--- a/htdocs/compta/paiement_charge.php
+++ b/htdocs/compta/paiement_charge.php
@@ -291,7 +291,7 @@ if ($action == 'create') {
print "
\n";
$total += $objp->total;
$total_ttc += $objp->total_ttc;
- $totalrecu += $objp->am;
+ $totalrecu += $objp->amount;
$i++;
}
if ($i > 1) {
diff --git a/htdocs/compta/paiement_vat.php b/htdocs/compta/paiement_vat.php
index 84d2765b278..645fd36bc2a 100644
--- a/htdocs/compta/paiement_vat.php
+++ b/htdocs/compta/paiement_vat.php
@@ -290,7 +290,7 @@ if ($action == 'create') {
print "\n";
$total += $objp->total;
$total_ttc += $objp->total_ttc;
- $totalrecu += $objp->am;
+ $totalrecu += $objp->amount;
$i++;
}
if ($i > 1) {
diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php
index 70d8da4c27b..41e036ae937 100644
--- a/htdocs/compta/sociales/class/chargesociales.class.php
+++ b/htdocs/compta/sociales/class/chargesociales.class.php
@@ -113,6 +113,11 @@ class ChargeSociales extends CommonObject
*/
public $fk_user;
+ /**
+ * @var double total
+ */
+ public $total;
+
const STATUS_UNPAID = 0;
const STATUS_PAID = 1;
diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php
index b6a611a47ee..1b83915714d 100644
--- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php
+++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php
@@ -100,6 +100,22 @@ class PaymentSocialContribution extends CommonObject
*/
public $fk_user_modif;
+ /**
+ * @var int ID
+ */
+ public $chid;
+
+ /**
+ * @var integer|string datepaye
+ */
+ public $datepaye;
+
+ /**
+ * @var integer|string paiementtype
+ */
+ public $paiementtype;
+
+
/**
* Constructor
*
diff --git a/htdocs/compta/tva/class/paymentvat.class.php b/htdocs/compta/tva/class/paymentvat.class.php
index 8eaf141b06c..cbdb4887869 100644
--- a/htdocs/compta/tva/class/paymentvat.class.php
+++ b/htdocs/compta/tva/class/paymentvat.class.php
@@ -96,6 +96,21 @@ class PaymentVAT extends CommonObject
*/
public $fk_user_modif;
+ /**
+ * @var int ID
+ */
+ public $chid;
+
+ /**
+ * @var integer|string datepaye
+ */
+ public $datepaye;
+
+ /**
+ * @var integer|string paiementtype
+ */
+ public $paiementtype;
+
/**
* Constructor
*
diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php
index 30682fa15b4..b30cc185a98 100644
--- a/htdocs/compta/tva/class/tva.class.php
+++ b/htdocs/compta/tva/class/tva.class.php
@@ -49,6 +49,12 @@ class Tva extends CommonObject
*/
public $picto = 'payment';
+ /**
+ * @deprecated
+ * @see $amount
+ */
+ public $total;
+
public $tms;
public $datep;
public $datev;
@@ -81,6 +87,11 @@ class Tva extends CommonObject
*/
public $fk_user_modif;
+ /**
+ * @var integer|string paiementtype
+ */
+ public $paiementtype;
+
const STATUS_UNPAID = 0;
const STATUS_PAID = 1;
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index bf33cbe224e..13bf93e2de4 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -116,7 +116,7 @@ abstract class CommonObject
public $array_languages = null; // Value is array() when load already tried
/**
- * @var array To sotre result of ->liste_contact()
+ * @var array To store result of ->liste_contact()
*/
public $contacts_ids;
@@ -8819,7 +8819,7 @@ abstract class CommonObject
}
}
} else {
- $this->{$field} = $obj->{$field};
+ $this->{$field} = !empty($obj->{$field}) ? $obj->{$field} : null;
}
}
diff --git a/htdocs/core/class/cstate.class.php b/htdocs/core/class/cstate.class.php
index 36c3cb2c0fe..d67b0c25f66 100644
--- a/htdocs/core/class/cstate.class.php
+++ b/htdocs/core/class/cstate.class.php
@@ -51,6 +51,12 @@ class Cstate // extends CommonObject
public $code_departement;
public $code;
+
+ /**
+ * @var string name
+ */
+ public $name = '';
+
/**
* @var string
* @deprecated
@@ -58,10 +64,7 @@ class Cstate // extends CommonObject
*/
public $nom = '';
- /**
- * @var string name
- */
- public $name = '';
+ public $label;
public $active;
@@ -88,7 +91,6 @@ class Cstate // extends CommonObject
*/
public function create($user, $notrigger = 0)
{
- global $conf, $langs;
$error = 0;
// Clean parameters
@@ -155,7 +157,6 @@ class Cstate // extends CommonObject
*/
public function fetch($id, $code = '')
{
- global $langs;
$sql = "SELECT";
$sql .= " t.rowid,";
$sql .= " t.code_departement,";
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 2df4f491105..31f69878dda 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -8629,10 +8629,26 @@ class Form
}
$possiblelinks = array(
- 'propal'=>array('enabled'=>$conf->propal->enabled, 'perms'=>1, 'label'=>'LinkToProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('propal').')'),
- 'order'=>array('enabled'=>$conf->commande->enabled, 'perms'=>1, 'label'=>'LinkToOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande').')'),
- 'invoice'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'),
- 'invoice_template'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToTemplateInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'),
+ 'propal'=>array(
+ 'enabled'=>$conf->propal->enabled,
+ 'perms'=>1,
+ 'label'=>'LinkToProposal',
+ 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('propal').')'),
+ 'order'=>array(
+ 'enabled'=>$conf->commande->enabled,
+ 'perms'=>1,
+ 'label'=>'LinkToOrder',
+ 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande').')'),
+ 'invoice'=>array(
+ 'enabled'=>$conf->facture->enabled,
+ 'perms'=>1,
+ 'label'=>'LinkToInvoice',
+ 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'),
+ 'invoice_template'=>array(
+ 'enabled'=>$conf->facture->enabled,
+ 'perms'=>1,
+ 'label'=>'LinkToTemplateInvoice',
+ 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'),
'contrat'=>array(
'enabled'=>$conf->contrat->enabled,
'perms'=>1,
@@ -8640,12 +8656,35 @@ class Form
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_customer as ref_client, t.ref_supplier, SUM(td.total_ht) as total_ht
FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."contrat as t, ".$this->db->prefix()."contratdet as td WHERE t.fk_soc = s.rowid AND td.fk_contrat = t.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('contract').') GROUP BY s.rowid, s.nom, s.client, t.rowid, t.ref, t.ref_customer, t.ref_supplier'
),
- 'fichinter'=>array('enabled'=>!empty($conf->ficheinter->enabled) ? $conf->ficheinter->enabled : 0, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('intervention').')'),
- 'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled, 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('supplier_proposal').')'),
- 'order_supplier'=>array('enabled'=>$conf->supplier_order->enabled, 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande_fournisseur').')'),
- 'invoice_supplier'=>array('enabled'=>$conf->supplier_invoice->enabled, 'perms'=>1, 'label'=>'LinkToSupplierInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('facture_fourn').')'),
- 'ticket'=>array('enabled'=>$conf->ticket->enabled, 'perms'=>1, 'label'=>'LinkToTicket', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.track_id, '0' as total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."ticket as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('ticket').')'),
- 'mo'=>array('enabled'=>$conf->mrp->enabled, 'perms'=>1, 'label'=>'LinkToMo', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.rowid, '0' as total_ht FROM ".$this->db->prefix()."societe as s INNER JOIN ".$this->db->prefix()."mrp_mo as t ON t.fk_soc = s.rowid WHERE t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('mo').')')
+ 'fichinter'=>array(
+ 'enabled'=>(!empty($conf->ficheinter->enabled) ? $conf->ficheinter->enabled : 0),
+ 'perms'=>1,
+ 'label'=>'LinkToIntervention',
+ 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('intervention').')'),
+ 'supplier_proposal'=>array(
+ 'enabled'=>(!empty($conf->supplier_proposal->enabled) ? $conf->supplier_proposal->enabled : 0),
+ 'perms'=>1,
+ 'label'=>'LinkToSupplierProposal',
+ 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('supplier_proposal').')'),
+ 'order_supplier'=>array(
+ 'enabled'=>(!empty($conf->supplier_order->enabled) ? $conf->supplier_order->enabled : 0),
+ 'perms'=>1,
+ 'label'=>'LinkToSupplierOrder',
+ 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande_fournisseur').')'),
+ 'invoice_supplier'=>array(
+ 'enabled'=>(!empty($conf->supplier_invoice->enabled) ? $conf->supplier_invoice->enabled : 0),
+ 'perms'=>1, 'label'=>'LinkToSupplierInvoice',
+ 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('facture_fourn').')'),
+ 'ticket'=>array(
+ 'enabled'=>(!empty($conf->ticket->enabled) ? $conf->ticket->enabled : 0),
+ 'perms'=>1,
+ 'label'=>'LinkToTicket',
+ 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.track_id, '0' as total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."ticket as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('ticket').')'),
+ 'mo'=>array(
+ 'enabled'=>(!empty($conf->mrp->enabled) ? $conf->mrp->enabled : 0),
+ 'perms'=>1,
+ 'label'=>'LinkToMo',
+ 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.rowid, '0' as total_ht FROM ".$this->db->prefix()."societe as s INNER JOIN ".$this->db->prefix()."mrp_mo as t ON t.fk_soc = s.rowid WHERE t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('mo').')')
);
}
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index cbaf59bd311..07bd8ac5a5f 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -1330,7 +1330,7 @@ class FormFile
if ($file['name'] != '.'
&& $file['name'] != '..'
&& !preg_match('/\.meta$/i', $file['name'])) {
- if ($filearray[$key]['rowid'] > 0) {
+ if (array_key_exists('rowid', $filearray[$key]) && $filearray[$key]['rowid'] > 0) {
$lastrowid = $filearray[$key]['rowid'];
}
$filepath = $relativepath.$file['name'];
@@ -1339,8 +1339,8 @@ class FormFile
$nboflines++;
print ''."\n";
// Do we have entry into database ?
- print ''."\n";
- print '