diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php
index 18f13a44813..e1e44a475ed 100644
--- a/htdocs/categories/class/categorie.class.php
+++ b/htdocs/categories/class/categorie.class.php
@@ -1241,7 +1241,7 @@ class Categorie extends CommonObject
$sql = "SELECT ct.fk_categorie, c.label, c.rowid";
$sql .= " FROM " . MAIN_DB_PREFIX . "categorie_" . $this->MAP_CAT_TABLE[$type] . " as ct, " . MAIN_DB_PREFIX . "categorie as c";
- $sql .= " WHERE ct.fk_categorie = c.rowid AND ct.fk_" . $this->MAP_CAT_FK[$type] . " = " . $id . " AND c.type = " . $this->MAP_ID[$type];
+ $sql .= " WHERE ct.fk_categorie = c.rowid AND ct.fk_" . $this->MAP_CAT_FK[$type] . " = " . (int) $id . " AND c.type = " . $this->MAP_ID[$type];
$sql .= " AND c.entity IN (" . getEntity( 'category', 1 ) . ")";
$res = $this->db->query($sql);
diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php
index 3f813e00938..610fe257732 100644
--- a/htdocs/compta/prelevement/class/bonprelevement.class.php
+++ b/htdocs/compta/prelevement/class/bonprelevement.class.php
@@ -1262,26 +1262,24 @@ class BonPrelevement extends CommonObject
$fileDebiteurSection = '';
$fileEmetteurSection = '';
$i = 0;
- $j = 0;
$this->total = 0;
/*
* section Debiteur (sepa Debiteurs bloc lines)
*/
+ $tmp_invoices = array();
+
$sql = "SELECT f.facnumber as fac FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl, ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."prelevement_facture as pf, ".MAIN_DB_PREFIX."societe as soc, ".MAIN_DB_PREFIX."c_country as p, ".MAIN_DB_PREFIX."societe_rib as rib WHERE pl.fk_prelevement_bons = ".$this->id." AND pl.rowid = pf.fk_prelevement_lignes AND pf.fk_facture = f.rowid AND soc.fk_pays = p.rowid AND soc.rowid = f.fk_soc AND rib.fk_soc = f.fk_soc AND rib.default_rib = 1";
$resql=$this->db->query($sql);
- if ($resql)
- {
- $num = $this->db->num_rows($resql);
- while ($j < $num)
- {
- $objfac = $this->db->fetch_object($resql);
- $ListOfFactures = $ListOfFactures . $objfac->fac . ",";
- $j++;
+ if ($resql) {
+ while ($objfac = $this->db->fetch_object($resql)) {
+ $tmp_invoices[] = $objfac->fac;
}
}
+ $ListOfFactures = implode($tmp_invoices);
+
$sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,";
$sql.= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,";
$sql.= " f.facnumber as fac, pf.fk_facture as idfac, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum";
diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php
index 9e0ed827ba8..3fe0530ec77 100644
--- a/htdocs/contrat/card.php
+++ b/htdocs/contrat/card.php
@@ -1643,7 +1643,7 @@ else
{
$tmpaction='activateline';
if ($objp->statut == 4) $tmpaction='unactivateline';
- if (($tmpaction=='activateline' && $user->rights->contrat->activer) || ($tmpaction=='unactivateline' && $user->rights->contrat->unactiver)) {
+ if (($tmpaction=='activateline' && $user->rights->contrat->activer) || ($tmpaction=='unactivateline' && $user->rights->contrat->desactiver)) {
print 'id . '&ligne=' . $object->lines[$cursorline - 1]->id . '&action=' . $tmpaction . '">';
print img_edit();
print '';
diff --git a/htdocs/core/modules/askpricesupplier/doc/doc_generic_askpricesupplier_odt.modules.php b/htdocs/core/modules/askpricesupplier/doc/doc_generic_askpricesupplier_odt.modules.php
index ddc995cc69a..49b0fdb69a3 100644
--- a/htdocs/core/modules/askpricesupplier/doc/doc_generic_askpricesupplier_odt.modules.php
+++ b/htdocs/core/modules/askpricesupplier/doc/doc_generic_askpricesupplier_odt.modules.php
@@ -273,7 +273,9 @@ class doc_generic_askpricesupplier_odt extends ModelePDFAskPriceSupplier
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
{
- $filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat;
+ $format=$conf->global->MAIN_DOC_USE_TIMING;
+ if ($format == '1') $format='%Y%m%d%H%M%S';
+ $filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat;
}
else
{
diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php
index 1b7da875073..27a98eff1d8 100644
--- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php
+++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php
@@ -239,7 +239,9 @@ class doc_generic_order_odt extends ModelePDFCommandes
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
{
- $filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat;
+ $format=$conf->global->MAIN_DOC_USE_TIMING;
+ if ($format == '1') $format='%Y%m%d%H%M%S';
+ $filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat;
}
else
{
diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php
index aaddbc1d748..b482d3a0abe 100644
--- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php
+++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php
@@ -239,7 +239,9 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
{
- $filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat;
+ $format=$conf->global->MAIN_DOC_USE_TIMING;
+ if ($format == '1') $format='%Y%m%d%H%M%S';
+ $filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat;
}
else
{
diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php
index 2ca90b13ace..2e45342c244 100644
--- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php
+++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php
@@ -240,7 +240,9 @@ class doc_generic_invoice_odt extends ModelePDFFactures
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
{
- $filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat;
+ $format=$conf->global->MAIN_DOC_USE_TIMING;
+ if ($format == '1') $format='%Y%m%d%H%M%S';
+ $filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat;
}
else
{
diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php
index 6e2601797f8..d42127a23ed 100644
--- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php
+++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php
@@ -449,7 +449,9 @@ class doc_generic_project_odt extends ModelePDFProjects
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
{
- $filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat;
+ $format=$conf->global->MAIN_DOC_USE_TIMING;
+ if ($format == '1') $format='%Y%m%d%H%M%S';
+ $filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat;
}
else
{
diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php
index 8f79094befc..44961120bb5 100644
--- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php
+++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php
@@ -273,7 +273,9 @@ class doc_generic_proposal_odt extends ModelePDFPropales
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
{
- $filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat;
+ $format=$conf->global->MAIN_DOC_USE_TIMING;
+ if ($format == '1') $format='%Y%m%d%H%M%S';
+ $filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat;
}
else
{
diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php
index 90ced6322b7..89ecf7075c5 100644
--- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php
+++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php
@@ -209,9 +209,15 @@ class doc_generic_odt extends ModeleThirdPartyDoc
$newfiletmp=preg_replace('/modele_/i','',$newfiletmp);
// Get extension (ods or odt)
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
+ if ( ! empty($conf->global->MAIN_DOC_USE_OBJECT_THIRDPARTY_NAME))
+ {
+ $newfiletmp = dol_sanitizeFileName(dol_string_nospecial($object->name)).'-'.$newfiletmp;
+ }
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
{
- $filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat;
+ $format=$conf->global->MAIN_DOC_USE_TIMING;
+ if ($format == '1') $format='%Y%m%d%H%M%S';
+ $filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat;
}
else
{
diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php
index 4aab3a99573..bada34e924c 100644
--- a/htdocs/fichinter/card.php
+++ b/htdocs/fichinter/card.php
@@ -116,17 +116,20 @@ if (empty($reshook))
if ($result >= 0)
{
- // Define output language
- $outputlangs = $langs;
- $newlang='';
- if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha');
- if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
- if (! empty($newlang))
+ if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
- $outputlangs = new Translate("",$conf);
- $outputlangs->setDefaultLang($newlang);
+ // Define output language
+ $outputlangs = $langs;
+ $newlang='';
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha');
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
+ if (! empty($newlang))
+ {
+ $outputlangs = new Translate("",$conf);
+ $outputlangs->setDefaultLang($newlang);
+ }
+ $result=fichinter_create($db, $object, (!GETPOST('model','alpha'))?$object->modelpdf:GETPOST('model','alpha'), $outputlangs);
}
- if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) $result=fichinter_create($db, $object, GETPOST('model','alpha'), $outputlangs);
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
exit;
@@ -142,17 +145,20 @@ if (empty($reshook))
$result = $object->setDraft($user);
if ($result >= 0)
{
- // Define output language
- $outputlangs = $langs;
- $newlang='';
- if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha');
- if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
- if (! empty($newlang))
+ if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
- $outputlangs = new Translate("",$conf);
- $outputlangs->setDefaultLang($newlang);
+ // Define output language
+ $outputlangs = $langs;
+ $newlang='';
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha');
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
+ if (! empty($newlang))
+ {
+ $outputlangs = new Translate("",$conf);
+ $outputlangs->setDefaultLang($newlang);
+ }
+ $result=fichinter_create($db, $object, (!GETPOST('model','alpha'))?$object->modelpdf:GETPOST('model','alpha'), $outputlangs);
}
- if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) $result=fichinter_create($db, $object, (!GETPOST('model','alpha'))?$object->model:GETPOST('model','apha'), $outputlangs);
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
exit;
diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php
index 7685c715494..e7777f82cd5 100644
--- a/htdocs/fourn/class/fournisseur.commande.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.class.php
@@ -583,7 +583,7 @@ class CommandeFournisseur extends CommonOrder
if (! empty($this->total_ht))
$label.= '
' . $langs->trans('AmountHT') . ': ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
if (! empty($this->total_tva))
- $label.= '
' . $langs->trans('TVA') . ': ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
+ $label.= '
' . $langs->trans('VAT') . ': ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
if (! empty($this->total_ttc))
$label.= '
' . $langs->trans('AmountTTC') . ': ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php
index 3e67f9dacb6..f70ca50c902 100644
--- a/htdocs/fourn/facture/card.php
+++ b/htdocs/fourn/facture/card.php
@@ -1655,12 +1655,6 @@ else
if ($objectref == 'PROV')
{
$savdate=$object->date;
- if (! empty($conf->global->FAC_FORCE_DATE_VALIDATION))
- {
- $object->date=dol_now();
- //TODO: Possibly will have to control payment information into suppliers
- //$object->date_lim_reglement=$object->calculate_date_lim_reglement();
- }
$numref = $object->getNextNumRef($societe);
}
else
diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php
index a02f2f78440..8704e781a30 100644
--- a/htdocs/fourn/facture/list.php
+++ b/htdocs/fourn/facture/list.php
@@ -304,7 +304,7 @@ if ($resql)
print '';
print '