diff --git a/ChangeLog b/ChangeLog
index fd18deeac14..5aff4d6d3ba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,7 +12,9 @@ Following changes may create regressions for some external modules, but were nec
'doaction' into 'sendMail'.
* Rename trigger CONTRACT_SERVICE_ACTIVATE into LINECONTRACT_ACTIVATE and
CONTRACT_SERVICE_CLOSE into LINECONTRACT_CLOSE
-
+* Remove triggers *_CLONE. The trigger CREATE with context 'createfromclone' is already called so this is
+ a duplicated feature. Cloning is not a business event, the business event is CREATE, so no trigger required.
+
***** ChangeLog for 7.0.0 compared to 6.0.5 *****
For users:
diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php
index dae58bf1520..92d0f9e4499 100644
--- a/htdocs/accountancy/class/accountancycategory.class.php
+++ b/htdocs/accountancy/class/accountancycategory.class.php
@@ -92,7 +92,7 @@ class AccountancyCategory // extends CommonObject
// Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."c_accounting_category(";
- $sql.= "rowid,";
+ if ($this->rowid > 0) $sql.= "rowid,";
$sql.= "code,";
$sql.= "label,";
$sql.= "range_account,";
@@ -103,16 +103,16 @@ class AccountancyCategory // extends CommonObject
$sql.= "fk_country,";
$sql.= "active";
$sql.= ") VALUES (";
- $sql.= " ".(! isset($this->rowid)?'NULL':"'".$this->rowid."'").",";
+ if ($this->rowid > 0) $sql.= " ".$this->rowid.",";
$sql.= " ".(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").",";
$sql.= " ".(! isset($this->label)?'NULL':"'".$this->db->escape($this->label)."'").",";
$sql.= " ".(! isset($this->range_account)?'NULL':"'".$this->db->escape($this->range_account)."'").",";
- $sql.= " ".(! isset($this->sens)?'NULL':"'".$this->sens."'").",";
- $sql.= " ".(! isset($this->category_type)?'NULL':"'".$this->category_type."'").",";
+ $sql.= " ".(! isset($this->sens)?'NULL':"'".$this->db->escape($this->sens)."'").",";
+ $sql.= " ".(! isset($this->category_type)?'NULL':"'".$this->db->escape($this->category_type)."'").",";
$sql.= " ".(! isset($this->formula)?'NULL':"'".$this->db->escape($this->formula)."'").",";
- $sql.= " ".(! isset($this->position)?'NULL':"'".$this->position."'").",";
- $sql.= " ".(! isset($this->fk_country)?'NULL':"'".$this->fk_country."'").",";
- $sql.= " ".(! isset($this->active)?'NULL':"'".$this->active."'")."";
+ $sql.= " ".(! isset($this->position)?'NULL':$this->db->escape($this->position)).",";
+ $sql.= " ".(! isset($this->fk_country)?'NULL':$this->db->escape($this->fk_country)).",";
+ $sql.= " ".(! isset($this->active)?'NULL':$this->db->escape($this->active));
$sql.= ")";
$this->db->begin();
diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php
index bd0722ae63e..5691cd6687b 100644
--- a/htdocs/adherents/class/adherent.class.php
+++ b/htdocs/adherents/class/adherent.class.php
@@ -1156,12 +1156,9 @@ class Adherent extends CommonObject
$this->model_pdf = $obj->model_pdf;
- // Retreive all extrafield for thirdparty
+ // Retreive all extrafield
// fetch optionals attributes and labels
- require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
- $extrafields=new ExtraFields($this->db);
- $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
- $this->fetch_optionals($this->id,$extralabels);
+ $this->fetch_optionals();
// Load other properties
$result=$this->fetch_subscriptions();
diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php
index 763e648746d..69d1d8a8cea 100644
--- a/htdocs/admin/mails_senderprofile_list.php
+++ b/htdocs/admin/mails_senderprofile_list.php
@@ -507,25 +507,21 @@ print ''."\n";
if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords))
{
- if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
- {
- require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php');
- $formfile = new FormFile($db);
+ require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php');
+ $formfile = new FormFile($db);
- // Show list of available documents
- $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
- $urlsource.=str_replace('&','&',$param);
+ $hidegeneratedfilelistifempty=1;
+ if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0;
- $filedir=$diroutputmassaction;
- $genallowed=$user->rights->monmodule->read;
- $delallowed=$user->rights->monmodule->create;
+ // Show list of available documents
+ $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
+ $urlsource.=str_replace('&','&',$param);
- print $formfile->showdocuments('massfilesarea_monmodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
- }
- else
- {
- print '
'.$langs->trans("ShowTempMassFilesArea").'';
- }
+ $filedir=$diroutputmassaction;
+ $genallowed=$user->rights->monmodule->read;
+ $delallowed=$user->rights->monmodule->create;
+
+ print $formfile->showdocuments('massfilesarea_monmodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
}
dol_fiche_end();
diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php
index 46063c0f8c4..5b824d8c959 100644
--- a/htdocs/categories/class/categorie.class.php
+++ b/htdocs/categories/class/categorie.class.php
@@ -236,7 +236,9 @@ class Categorie extends CommonObject
$this->type = $res['type'];
$this->entity = $res['entity'];
- $this->fetch_optionals($this->id,null);
+ // Retreive all extrafield
+ // fetch optionals attributes and labels
+ $this->fetch_optionals();
$this->db->free($resql);
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index 9e0a0d6321d..5f094856e1c 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -465,7 +465,10 @@ class ActionComm extends CommonObject
// Load source object
$objFrom = clone $this;
+ // Retreive all extrafield
+ // fetch optionals attributes and labels
$this->fetch_optionals();
+
// $this->fetch_userassigned();
$this->fetchResources();
diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php
index 81443f04d62..506b0c6fa8d 100644
--- a/htdocs/comm/card.php
+++ b/htdocs/comm/card.php
@@ -195,7 +195,7 @@ if (empty($reshook))
if ($ret < 0) $error++;
if (! $error)
{
- $result = $object->insertExtraFields();
+ $result = $object->insertExtraFields('COMPANY_MODIFY');
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php
index 54e3cf36c45..9c72170b880 100644
--- a/htdocs/comm/propal/card.php
+++ b/htdocs/comm/propal/card.php
@@ -1234,7 +1234,7 @@ if (empty($reshook))
if ($ret < 0) $error++;
if (! $error)
{
- $result = $object->insertExtraFields();
+ $result = $object->insertExtraFields('PROPAL_MODIFY');
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index 5efc1cf9db4..1380b02d339 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -1289,11 +1289,6 @@ class Propal extends CommonObject
$reshook=$hookmanager->executeHooks('createFrom',$parameters,$clonedObj,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++;
}
-
- // Call trigger
- $result=$clonedObj->call_trigger('PROPAL_CLONE',$user);
- if ($result < 0) { $error++; }
- // End call triggers
}
unset($this->context['createfromclone']);
@@ -1439,12 +1434,9 @@ class Propal extends CommonObject
$this->brouillon = 1;
}
- // Retreive all extrafield for invoice
+ // Retreive all extrafield
// fetch optionals attributes and labels
- require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
- $extrafields=new ExtraFields($this->db);
- $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
- $this->fetch_optionals($this->id,$extralabels);
+ $this->fetch_optionals();
$this->db->free($resql);
diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php
index af67bd8107b..5de43a75b9d 100644
--- a/htdocs/comm/propal/list.php
+++ b/htdocs/comm/propal/list.php
@@ -892,25 +892,18 @@ if ($resql)
print ''."\n";
- if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
- {
- /*
- * Show list of available documents
- */
- $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
- $urlsource.=str_replace('&','&',$param);
+ $hidegeneratedfilelistifempty=1;
+ if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0;
- $filedir=$diroutputmassaction;
- $genallowed=$user->rights->propal->lire;
- $delallowed=$user->rights->propal->creer;
+ // Show list of available documents
+ $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
+ $urlsource.=str_replace('&','&',$param);
- print $formfile->showdocuments('massfilesarea_proposals','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,'','');
- }
- else
- {
- print '
'.$langs->trans("ShowTempMassFilesArea").'';
- }
+ $filedir=$diroutputmassaction;
+ $genallowed=$user->rights->propal->lire;
+ $delallowed=$user->rights->propal->creer;
+ print $formfile->showdocuments('massfilesarea_proposals','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
}
else
{
diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index 6e1d411d55e..54c7db7d6ca 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -1281,7 +1281,7 @@ if (empty($reshook))
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by
// some hooks
if (empty($reshook)) {
- $result = $object->insertExtraFields();
+ $result = $object->insertExtraFields('ORDER_MODIFY');
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index 65b704693fb..f89bcf534a2 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -1073,11 +1073,6 @@ class Commande extends CommonOrder
$reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++;
}
-
- // Call trigger
- $result=$this->call_trigger('ORDER_CLONE',$user);
- if ($result < 0) $error++;
- // End call triggers
}
unset($this->context['createfromclone']);
@@ -1673,12 +1668,9 @@ class Commande extends CommonOrder
if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1;
- // Retrieve all extrafields for invoice
+ // Retreive all extrafield
// fetch optionals attributes and labels
- require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
- $extrafields=new ExtraFields($this->db);
- $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
- $this->fetch_optionals($this->id,$extralabels);
+ $this->fetch_optionals();
$this->db->free($result);
diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php
index 13225c2c5d3..fe8461c3a41 100644
--- a/htdocs/commande/list.php
+++ b/htdocs/commande/list.php
@@ -1101,25 +1101,18 @@ if ($resql)
print ''."\n";
- if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
- {
- /*
- * Show list of available documents
- */
- $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
- $urlsource.=str_replace('&','&',$param);
+ $hidegeneratedfilelistifempty=1;
+ if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0;
- $filedir=$diroutputmassaction;
- $genallowed=$user->rights->commande->lire;
- $delallowed=$user->rights->commande->creer;
+ // Show list of available documents
+ $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
+ $urlsource.=str_replace('&','&',$param);
- print $formfile->showdocuments('massfilesarea_orders','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
- }
- else
- {
- print '
'.$langs->trans("ShowTempMassFilesArea").'';
- }
+ $filedir=$diroutputmassaction;
+ $genallowed=$user->rights->commande->lire;
+ $delallowed=$user->rights->commande->creer;
+ print $formfile->showdocuments('massfilesarea_orders','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
}
else
{
diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php
index 1dba4a5b221..719a48c3e3c 100644
--- a/htdocs/compta/bank/class/account.class.php
+++ b/htdocs/compta/bank/class/account.class.php
@@ -913,12 +913,9 @@ class Account extends CommonObject
$this->date_creation = $this->db->jdate($obj->date_creation);
$this->date_update = $this->db->jdate($obj->date_update);
- // Retreive all extrafield for thirdparty
+ // Retreive all extrafield
// fetch optionals attributes and labels
- require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
- $extrafields=new ExtraFields($this->db);
- $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
- $this->fetch_optionals($this->id,$extralabels);
+ $this->fetch_optionals();
return 1;
}
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index 19612349214..ab7e0826553 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -2119,7 +2119,7 @@ if (empty($reshook))
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by
// some hooks
if (empty($reshook)) {
- $result = $object->insertExtraFields();
+ $result = $object->insertExtraFields('BILL_MODIFY');
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php
index 1636be2aace..84b61817a28 100644
--- a/htdocs/compta/facture/class/facture-rec.class.php
+++ b/htdocs/compta/facture/class/facture-rec.class.php
@@ -381,12 +381,9 @@ class FactureRec extends CommonInvoice
if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1;
- // Retreive all extrafield for thirdparty
+ // Retreive all extrafield
// fetch optionals attributes and labels
- require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
- $extrafields=new ExtraFields($this->db);
- $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
- $this->fetch_optionals($this->id,$extralabels);
+ $this->fetch_optionals();
/*
* Lines
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 7edc3b65b41..aba627dd8a2 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -790,14 +790,17 @@ class Facture extends CommonInvoice
// Charge facture source
$facture=new Facture($this->db);
- $this->fetch_optionals();
- if(!empty($this->array_options)){
- $facture->array_options = $this->array_options;
- }
+ // Retreive all extrafield
+ // fetch optionals attributes and labels
+ $this->fetch_optionals();
- foreach($this->lines as &$line){
+ if(!empty($this->array_options)){
+ $facture->array_options = $this->array_options;
+ }
+
+ foreach($this->lines as &$line){
$line->fetch_optionals();//fetch extrafields
- }
+ }
$facture->fk_facture_source = $this->fk_facture_source;
$facture->type = $this->type;
@@ -958,11 +961,6 @@ class Facture extends CommonInvoice
$reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++;
}
-
- // Call trigger
- $result=$this->call_trigger('BILL_CLONE',$user);
- if ($result < 0) $error++;
- // End call triggers
}
unset($this->context['createfromclone']);
@@ -1333,16 +1331,13 @@ class Facture extends CommonInvoice
if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1;
- // Retrieve all extrafield for invoice
+ // Retreive all extrafield
// fetch optionals attributes and labels
- require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
- $extrafields=new ExtraFields($this->db);
- $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
- $this->fetch_optionals($this->id,$extralabels);
+ $this->fetch_optionals();
/*
* Lines
- */
+ */
$this->lines = array();
diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php
index af81e797252..f869c01aa53 100644
--- a/htdocs/compta/facture/fiche-rec.php
+++ b/htdocs/compta/facture/fiche-rec.php
@@ -450,7 +450,7 @@ if (empty($reshook))
if ($ret < 0) $error++;
if (! $error) {
- $result = $object->insertExtraFields();
+ $result = $object->insertExtraFields('BILLREC_MODIFY');
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index fe26efd490e..5914f2f06e9 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -1192,22 +1192,18 @@ if ($resql)
print "\n";
- if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
- {
- // Show list of available documents
- $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
- $urlsource.=str_replace('&','&',$param);
+ $hidegeneratedfilelistifempty=1;
+ if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0;
- $filedir=$diroutputmassaction;
- $genallowed=$user->rights->facture->lire;
- $delallowed=$user->rights->facture->creer;
+ // Show list of available documents
+ $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
+ $urlsource.=str_replace('&','&',$param);
- print $formfile->showdocuments('massfilesarea_invoices','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
- }
- else
- {
- print '
'.$langs->trans("ShowTempMassFilesArea").'';
- }
+ $filedir=$diroutputmassaction;
+ $genallowed=$user->rights->facture->lire;
+ $delallowed=$user->rights->facture->creer;
+
+ print $formfile->showdocuments('massfilesarea_invoices','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
}
else
{
diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php
index f616ca728b6..eca1174bb59 100644
--- a/htdocs/contact/class/contact.class.php
+++ b/htdocs/contact/class/contact.class.php
@@ -801,12 +801,9 @@ class Contact extends CommonObject
}
}
- // Retreive all extrafield for contact
- // fetch optionals attributes and labels
- require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
- $extrafields=new ExtraFields($this->db);
- $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
- $this->fetch_optionals($this->id,$extralabels);
+ // Retreive all extrafield
+ // fetch optionals attributes and labels
+ $this->fetch_optionals();
return 1;
}
diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php
index 6111be6c7ee..0bbb509b7fa 100644
--- a/htdocs/contrat/card.php
+++ b/htdocs/contrat/card.php
@@ -94,6 +94,7 @@ $permissionnote=$user->rights->contrat->creer; // Used by the include of actions
$permissiondellink=$user->rights->contrat->creer; // Used by the include of actions_dellink.inc.php
+
/*
* Actions
*/
@@ -875,13 +876,15 @@ if (empty($reshook))
}
else if ($action == 'update_extras')
{
+ $object->oldcopy = dol_clone($object);
+
// Fill array 'array_options' with data from update form
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
if ($ret < 0) $error++;
if (! $error) {
- $result = $object->insertExtraFields();
+ $result = $object->insertExtraFields('CONTRACT_MODIFY');
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index 12e08984411..e7bae75c3ed 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -261,9 +261,10 @@ class Contrat extends CommonObject
*
* @param User $user Object User making action
* @param int|string $date_start Date start (now if empty)
+ * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
* @return int <0 if KO, >0 if OK
*/
- function activateAll($user, $date_start='')
+ function activateAll($user, $date_start='', $notrigger=0)
{
if (empty($date_start)) $date_start = dol_now();
@@ -294,7 +295,7 @@ class Contrat extends CommonObject
if (! $error && $this->statut == 0)
{
- $result=$this->validate($user);
+ $result=$this->validate($user, '', $notrigger);
if ($result < 0) $error++;
}
@@ -609,7 +610,7 @@ class Contrat extends CommonObject
$this->mise_en_service = $this->db->jdate($result["datemise"]);
$this->date_contrat = $this->db->jdate($result["datecontrat"]);
- $this->date_creation = $this->db->jdate($result["datecontrat"]);
+ $this->date_creation = $this->db->jdate($result["datecontrat"]);
$this->fin_validite = $this->db->jdate($result["fin_validite"]);
$this->date_cloture = $this->db->jdate($result["date_cloture"]);
@@ -634,16 +635,15 @@ class Contrat extends CommonObject
$this->db->free($resql);
- // Retreive all extrafield for thirdparty
+
+ // Retreive all extrafield
// fetch optionals attributes and labels
- require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
- $extrafields=new ExtraFields($this->db);
- $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
- $this->fetch_optionals($this->id,$extralabels);
+ $this->fetch_optionals();
+
/*
* Lines
- */
+ */
$this->lines = array();
@@ -2430,17 +2430,6 @@ class Contrat extends CommonObject
}
- if (! $notrigger && empty($error))
- {
- // Call trigger
- $clonedObj->old_copy=$this;
- $result = $clonedObj->call_trigger('CONTRACT_CLONE', $user);
- if ($result < 0) {
- $error ++;
- }
- // End call triggers
- }
-
unset($this->context['createfromclone']);
// End
diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php
index cdafbd6c2fd..babc31f7702 100644
--- a/htdocs/contrat/list.php
+++ b/htdocs/contrat/list.php
@@ -775,24 +775,18 @@ if ($resql)
print '';
- if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
- {
- /*
- * Show list of available documents
- */
- $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
- $urlsource.=str_replace('&','&',$param);
+ $hidegeneratedfilelistifempty=1;
+ if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0;
- $filedir=$diroutputmassaction;
- $genallowed=$user->rights->contrat->lire;
- $delallowed=$user->rights->contrat->lire;
+ // Show list of available documents
+ $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
+ $urlsource.=str_replace('&','&',$param);
- print $formfile->showdocuments('massfilesarea_contract','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
- }
- else
- {
- print '
'.$langs->trans("ShowTempMassFilesArea").'';
- }
+ $filedir=$diroutputmassaction;
+ $genallowed=$user->rights->contrat->lire;
+ $delallowed=$user->rights->contrat->lire;
+
+ print $formfile->showdocuments('massfilesarea_contract','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
}
else
{
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 1fe99edb192..18d2add801c 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -4481,7 +4481,7 @@ abstract class CommonObject
if (! is_array($optionsArray))
{
// If $extrafields is not a known object, we initialize it. Best practice is to have $extrafields defined into card.php or list.php page.
- // TODO Use of existing extrafield is not yet ready (must mutualize code that use extrafields in form first)
+ // TODO Use of existing $extrafield is not yet ready (must mutualize code that use extrafields in form first)
// global $extrafields;
//if (! is_object($extrafields))
//{
@@ -4496,6 +4496,10 @@ abstract class CommonObject
}
$optionsArray = $extrafields->attributes[$this->table_element]['label'];
}
+ else
+ {
+ dol_syslog("Warning: fetch_optionals was called with param $optionsArray defined when you should pass null now", LOG_WARNING);
+ }
$table_element = $this->table_element;
if ($table_element == 'categorie') $table_element = 'categories'; // For compatibility
@@ -4529,7 +4533,17 @@ abstract class CommonObject
if ($key != 'rowid' && $key != 'tms' && $key != 'fk_member' && ! is_int($key))
{
// we can add this attribute to object
- $this->array_options["options_".$key]=$value;
+ if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('date','datetime')))
+ {
+ //var_dump($extrafields->attributes[$this->table_element]['type'][$key]);
+ $this->array_options["options_".$key]=$this->db->jdate($value);
+ }
+ else
+ {
+ $this->array_options["options_".$key]=$value;
+ }
+
+ //var_dump('key '.$key.' '.$value.' type='.$extrafields->attributes[$this->table_element]['type'][$key].' '.$this->array_options["options_".$key]);
}
}
}
diff --git a/htdocs/core/class/ctyperesource.class.php b/htdocs/core/class/ctyperesource.class.php
index 1de616210e4..a5a6ea879ce 100644
--- a/htdocs/core/class/ctyperesource.class.php
+++ b/htdocs/core/class/ctyperesource.class.php
@@ -48,14 +48,14 @@ class Ctyperesource
/**
*/
-
+
public $code;
public $label;
public $active;
/**
*/
-
+
/**
* Constructor
@@ -82,7 +82,7 @@ class Ctyperesource
$error = 0;
// Clean parameters
-
+
if (isset($this->code)) {
$this->code = trim($this->code);
}
@@ -93,26 +93,26 @@ class Ctyperesource
$this->active = trim($this->active);
}
-
+
// Check parameters
// Put here code to add control on parameters values
// Insert request
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '(';
-
+
$sql.= 'code,';
$sql.= 'label';
$sql.= 'active';
-
+
$sql .= ') VALUES (';
-
+
$sql .= ' '.(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").',';
$sql .= ' '.(! isset($this->label)?'NULL':"'".$this->db->escape($this->label)."'").',';
$sql .= ' '.(! isset($this->active)?'NULL':$this->active);
-
+
$sql .= ')';
$this->db->begin();
@@ -165,18 +165,18 @@ class Ctyperesource
$sql = 'SELECT';
$sql .= ' t.rowid,';
-
+
$sql .= " t.code,";
$sql .= " t.label,";
$sql .= " t.active";
-
+
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
if ($id) $sql.= " WHERE t.id = ".$id;
elseif ($code) $sql.= " WHERE t.code = '".$this->db->escape($code)."'";
elseif ($label) $sql.= " WHERE t.label = '".$this->db->escape($label)."'";
-
-
+
+
$resql = $this->db->query($sql);
if ($resql) {
$numrows = $this->db->num_rows($resql);
@@ -184,25 +184,20 @@ class Ctyperesource
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
-
+
$this->code = $obj->code;
$this->label = $obj->label;
$this->active = $obj->active;
-
+
}
-
+
// Retrieve all extrafields for invoice
// fetch optionals attributes and labels
- /*
- require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
- $extrafields=new ExtraFields($this->db);
- $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
- $this->fetch_optionals($this->id,$extralabels);
- */
-
+ // $this->fetch_optionals();
+
// $this->fetch_lines();
-
+
$this->db->free($resql);
if ($numrows) {
@@ -236,12 +231,12 @@ class Ctyperesource
$sql = 'SELECT';
$sql .= ' t.rowid,';
-
+
$sql .= " t.code,";
$sql .= " t.label,";
$sql .= " t.active";
-
+
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t';
// Manage filter
@@ -251,7 +246,7 @@ class Ctyperesource
$sqlwhere [] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
}
}
-
+
if (count($sqlwhere) > 0) {
$sql .= ' WHERE ' . implode(' '.$filtermode.' ', $sqlwhere);
}
@@ -270,12 +265,12 @@ class Ctyperesource
$line = new self($this->db);
$line->id = $obj->rowid;
-
+
$line->code = $obj->code;
$line->label = $obj->label;
$line->active = $obj->active;
-
+
}
$this->db->free($resql);
@@ -303,7 +298,7 @@ class Ctyperesource
dol_syslog(__METHOD__, LOG_DEBUG);
// Clean parameters
-
+
if (isset($this->code)) {
$this->code = trim($this->code);
}
@@ -319,12 +314,12 @@ class Ctyperesource
// Update request
$sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET';
-
+
$sql .= ' code = '.(isset($this->code)?"'".$this->db->escape($this->code)."'":"null").',';
$sql .= ' label = '.(isset($this->label)?"'".$this->db->escape($this->label)."'":"null").',';
$sql .= ' active = '.(isset($this->active)?$this->active:"null");
-
+
$sql .= ' WHERE rowid=' . $this->id;
$this->db->begin();
@@ -387,7 +382,7 @@ class Ctyperesource
}
// If you need to delete child tables to, you can insert them here
-
+
if (!$error) {
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element;
$sql .= ' WHERE rowid=' . $this->id;
@@ -468,7 +463,7 @@ class Ctyperesource
public function initAsSpecimen()
{
$this->id = 0;
-
+
$this->code = '';
$this->label = '';
$this->active = '';
@@ -488,7 +483,7 @@ class CtyperesourceLine
/**
* @var mixed Sample line property 1
*/
-
+
public $code;
public $label;
public $active;
@@ -496,5 +491,5 @@ class CtyperesourceLine
/**
* @var mixed Sample line property 2
*/
-
+
}
diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index a127ce706e9..ee165ac6808 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -1404,12 +1404,12 @@ class ExtraFields
if ($type == 'date')
{
$showsize=10;
- $value=dol_print_date($value, 'day', 'tzuser');
+ $value=dol_print_date($value, 'day');
}
elseif ($type == 'datetime')
{
$showsize=19;
- $value=dol_print_date($value, 'dayhour', 'tzuser');
+ $value=dol_print_date($value, 'dayhour');
}
elseif ($type == 'int')
{
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index eded41be053..b139483b610 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -277,17 +277,18 @@ class FormFile
* @param string $codelang Default language code to use on lang combo box if multilang is enabled
* @param string $morepicto Add more HTML content into cell with picto
* @param Object $object Object when method is called from an object card.
+ * @param int $hideifempty Hide section of generated files if there is no file
* @return string Output string with HTML array of documents (might be empty string)
*/
- function showdocuments($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$notused=0,$noform=0,$param='',$title='',$buttonlabel='',$codelang='',$morepicto='',$object=null)
+ function showdocuments($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$notused=0,$noform=0,$param='',$title='',$buttonlabel='',$codelang='',$morepicto='',$object=null,$hideifempty=0)
{
// Deprecation warning
- if (0 !== $iconPDF) {
+ if (! empty($iconPDF)) {
dol_syslog(__METHOD__ . ": passing iconPDF parameter is deprecated", LOG_WARNING);
}
global $langs, $conf, $user, $hookmanager;
- global $form, $bc;
+ global $form;
if (! is_object($form)) $form=new Form($this->db);
@@ -305,9 +306,17 @@ class FormFile
}
$hookmanager->initHooks(array('formfile'));
- $forname='builddoc';
- $out='';
+ // Get list of files
+ $file_list=null;
+ if (! empty($filedir))
+ {
+ $file_list=dol_dir_list($filedir,'files',0,'','(\.meta|_preview.*.*\.png)$','date',SORT_DESC);
+ }
+ if ($hideifempty && empty($file_list)) return '';
+
+ $out='';
+ $forname='builddoc';
$headershown=0;
$showempty=0;
$i=0;
@@ -678,8 +687,6 @@ class FormFile
// Get list of files
if (! empty($filedir))
{
- $file_list=dol_dir_list($filedir,'files',0,'','(\.meta|_preview.*.*\.png)$','date',SORT_DESC);
-
$link_list = array();
if (is_object($object))
{
@@ -949,7 +956,6 @@ class FormFile
function list_of_documents($filearray,$object,$modulepart,$param='',$forcedownload=0,$relativepath='',$permonobject=1,$useinecm=0,$textifempty='',$maxlength=0,$title='',$url='', $showrelpart=0, $permtoeditline=-1,$upload_dir='',$sortfield='',$sortorder='ASC', $disablemove=1, $addfilterfields=0)
{
global $user, $conf, $langs, $hookmanager;
- global $bc,$bcdd;
global $sortfield, $sortorder, $maxheightmini;
global $dolibarr_main_url_root;
@@ -1322,7 +1328,6 @@ class FormFile
function list_of_autoecmfiles($upload_dir, $filearray, $modulepart, $param, $forcedownload=0, $relativepath='', $permtodelete=1, $useinecm=0, $textifempty='', $maxlength=0, $url='', $addfilterfields=0)
{
global $user, $conf, $langs, $form;
- global $bc;
global $sortfield, $sortorder;
global $search_doc_ref;
@@ -1543,7 +1548,7 @@ class FormFile
if (count($filearray) == 0)
{
- print '
| ';
+ print ' |
| ';
if (empty($textifempty)) print $langs->trans("NoFileFound");
else print $textifempty;
print ' |
';
@@ -1600,7 +1605,6 @@ class FormFile
public function listOfLinks($object, $permtodelete=1, $action=null, $selected=null, $param='')
{
global $user, $conf, $langs, $user;
- global $bc;
global $sortfield, $sortorder;
$langs->load("link");
@@ -1712,7 +1716,7 @@ class FormFile
}
if ($nboflinks == 0)
{
- print '| ';
+ print ' |
| ';
print $langs->trans("NoLinkFound");
print ' |
';
}
diff --git a/htdocs/core/class/html.formwebsite.class.php b/htdocs/core/class/html.formwebsite.class.php
index 4f92b2e9449..e7cd6d447a0 100644
--- a/htdocs/core/class/html.formwebsite.class.php
+++ b/htdocs/core/class/html.formwebsite.class.php
@@ -158,4 +158,49 @@ class FormWebsite
}
}
+
+ /**
+ * Return a HTML select list of a dictionary
+ *
+ * @param string $htmlname Name of select zone
+ * @param string $selected Selected value
+ * @param int $useempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries.
+ * @param string $moreattrib More attributes on HTML select tag
+ * @return void
+ */
+ function selectSampleOfContainer($htmlname, $selected='', $useempty=0, $moreattrib='')
+ {
+ global $langs, $conf, $user;
+
+ $langs->load("admin");
+
+ $arrayofsamples=array('corporatehome'=>'CorporateHomePage', 'empty'=>'EmptyPage');
+
+ $out = '';
+
+ $out .= '";
+
+ return $out;
+ }
+
}
diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php
index 059118e2663..9bad202251e 100644
--- a/htdocs/core/modules/modAccounting.class.php
+++ b/htdocs/core/modules/modAccounting.class.php
@@ -251,10 +251,10 @@ class modAccounting extends DolibarrModules
$this->import_fields_array[$r]=array('aa.fk_pcg_version'=>"Chartofaccounts*",'aa.account_number'=>"AccountAccounting*",'aa.label'=>"Label*",'aa.account_parent'=>"Accountparent","aa.fk_accounting_category"=>"AccountingCategory","aa.pcg_type"=>"Pcgtype*",'aa.pcg_subtype'=>'Pcgsubtype*','aa.active'=>'Status*','aa.datec'=>"DateCreation");
$this->import_regex_array[$r]=array('aa.fk_pcg_version'=>'pcg_version@'.MAIN_DB_PREFIX.'accounting_system','aa.account_number'=>'^\d{1,32}$','aa.label'=>'^.{1,255}$','aa.account_parent'=>'^\d{0,32}$','aa.fk_accounting_category'=>'rowid@'.MAIN_DB_PREFIX.'c_accounting_category','aa.pcg_type'=>'^.{1,20}$','aa.pcg_subtype'=>'^.{1,20}$','aa.active'=>'^0|1$','aa.datec'=>'^\d{4}-\d{2}-\d{2}$');
$this->import_convertvalue_array[$r]=array(
- 'aa.fk_accounting_category'=>array('rule'=>'fetchidfromcodeorlabel','classfile'=>'/accountancy/class/accountancycategory.class.php','class'=>'AccountingCategory','method'=>'fetch','dict'=>'DictionaryAccountancyCategory'),
+ 'aa.fk_accounting_category'=>array('rule'=>'fetchidfromcodeorlabel','classfile'=>'/accountancy/class/accountancycategory.class.php','class'=>'AccountancyCategory','method'=>'fetch','dict'=>'DictionaryAccountancyCategory'),
'aa.account_parent'=>array('rule'=>'zeroifnull'),
);
- $this->import_examplevalues_array[$r]=array('aa.fk_pcg_version'=>"PCG99-ABREGE",'aa.account_number'=>"707",'aa.label'=>"Product sales",'aa.account_parent'=>"1407","aa.fk_accounting_category"=>"SALES","aa.pcg_type"=>"PROD",'aa.pcg_subtype'=>'PRODUCT','aa.active'=>'1','aa.datec'=>"2017-04-28");
+ $this->import_examplevalues_array[$r]=array('aa.fk_pcg_version'=>"PCG99-ABREGE",'aa.account_number'=>"707",'aa.label'=>"Product sales",'aa.account_parent'=>"1407","aa.fk_accounting_category"=>"","aa.pcg_type"=>"PROD",'aa.pcg_subtype'=>'PRODUCT','aa.active'=>'1','aa.datec'=>"2017-04-28");
}
}
diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php
index 9d638426bc3..3559df44c9c 100644
--- a/htdocs/core/tpl/extrafields_view.tpl.php
+++ b/htdocs/core/tpl/extrafields_view.tpl.php
@@ -107,8 +107,16 @@ if (empty($reshook) && ! empty($extrafields->attributes[$object->table_element][
print '";
print '';
-
+
print '';
print '| ';
print $form->editfieldkey("OrderMinAmount",'supplier_order_min_amount',$object->supplier_order_min_amount,$object,$user->rights->societe->creer);
print ' | ';
$limit_field_type = (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) ? 'numeric' : 'amount';
print $form->editfieldval("OrderMinAmount",'supplier_order_min_amount',$object->supplier_order_min_amount,$object,$user->rights->societe->creer,$limit_field_type,($object->supplier_order_min_amount != '' ? price($object->supplier_order_min_amount) : ''));
-
+
print ' | ';
print '
';
diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php
index 38d0e42d36a..1bbde68172e 100644
--- a/htdocs/fourn/class/fournisseur.commande.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.class.php
@@ -310,12 +310,9 @@ class CommandeFournisseur extends CommonOrder
$this->db->free($resql);
- // Retrieve all extrafields
+ // Retreive all extrafield
// fetch optionals attributes and labels
- require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
- $extrafields=new ExtraFields($this->db);
- $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
- $this->fetch_optionals($this->id,$extralabels);
+ $this->fetch_optionals();
if ($this->statut == 0) $this->brouillon = 1;
@@ -1368,11 +1365,6 @@ class CommandeFournisseur extends CommonOrder
$reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++;
}
-
- // Call trigger
- $result=$this->call_trigger('ORDER_SUPPLIER_CLONE',$user);
- if ($result < 0) $error++;
- // End call triggers
}
unset($this->context['createfromclone']);
diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php
index 292466ea0d8..1f84e71df96 100644
--- a/htdocs/fourn/class/fournisseur.facture.class.php
+++ b/htdocs/fourn/class/fournisseur.facture.class.php
@@ -643,10 +643,7 @@ class FactureFournisseur extends CommonInvoice
// Retreive all extrafield
// fetch optionals attributes and labels
- require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
- $extrafields=new ExtraFields($this->db);
- $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
- $this->fetch_optionals($this->id,$extralabels);
+ $this->fetch_optionals();
if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1;
diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php
index 81ea1a0f951..da3f79d94d0 100644
--- a/htdocs/fourn/commande/card.php
+++ b/htdocs/fourn/commande/card.php
@@ -963,7 +963,7 @@ if (empty($reshook))
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
- $result=$object->insertExtraFields();
+ $result=$object->insertExtraFields('ORDER_SUPPLIER_MODIFY');
if ($result < 0)
{
diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php
index 0b45f2d63a0..f3deb4b12a3 100644
--- a/htdocs/fourn/commande/list.php
+++ b/htdocs/fourn/commande/list.php
@@ -1176,26 +1176,20 @@ if ($resql)
print '';
print "\n";
- if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
- {
- /*
- * Show list of available documents
- */
- $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
- $urlsource.=str_replace('&','&',$param);
-
- $filedir=$diroutputmassaction;
- $genallowed=$user->rights->fournisseur->commande->lire;
- $delallowed=$user->rights->fournisseur->commande->creer;
-
- print $formfile->showdocuments('massfilesarea_supplier_order','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
- }
- else
- {
- print '
'.$langs->trans("ShowTempMassFilesArea").'';
- }
-
$db->free($resql);
+
+ $hidegeneratedfilelistifempty=1;
+ if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0;
+
+ // Show list of available documents
+ $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
+ $urlsource.=str_replace('&','&',$param);
+
+ $filedir=$diroutputmassaction;
+ $genallowed=$user->rights->fournisseur->commande->lire;
+ $delallowed=$user->rights->fournisseur->commande->creer;
+
+ print $formfile->showdocuments('massfilesarea_supplier_order','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
}
else
{
diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php
index 761d5d591e3..cfba614492e 100644
--- a/htdocs/fourn/facture/card.php
+++ b/htdocs/fourn/facture/card.php
@@ -1274,7 +1274,7 @@ if (empty($reshook))
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
- $result=$object->insertExtraFields();
+ $result=$object->insertExtraFields('BILL_SUPPLIER_MODIFY');
if ($result < 0)
{
diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php
index 31d6ba2f183..1e056292517 100644
--- a/htdocs/fourn/facture/list.php
+++ b/htdocs/fourn/facture/list.php
@@ -1098,22 +1098,18 @@ if ($resql)
print "\n";
/*
- if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
- {
- // Show list of available documents
- $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
- $urlsource.=str_replace('&','&',$param);
+ $hidegeneratedfilelistifempty=1;
+ if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0;
- $filedir=$diroutputmassaction;
- $genallowed=$user->rights->facture->lire;
- $delallowed=$user->rights->facture->creer;
+ // Show list of available documents
+ $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
+ $urlsource.=str_replace('&','&',$param);
- print $formfile->showdocuments('massfilesarea_invoices','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
- }
- else
- {
- print '
'.$langs->trans("ShowTempMassFilesArea").'';
- }
+ $filedir=$diroutputmassaction;
+ $genallowed=$user->rights->facture->lire;
+ $delallowed=$user->rights->facture->creer;
+
+ print $formfile->showdocuments('massfilesarea_invoices','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
*/
}
else
diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang
index 6e67062b859..a4c7d9e0211 100644
--- a/htdocs/langs/en_US/website.lang
+++ b/htdocs/langs/en_US/website.lang
@@ -4,6 +4,7 @@ WebsiteSetupDesc=Create here as much entry as number of different websites you n
DeleteWebsite=Delete website
ConfirmDeleteWebsite=Are you sure you want to delete this web site. All its pages and content will also be removed.
WEBSITE_TYPE_CONTAINER=Type of page/container
+WEBSITE_PAGE_EXAMPLE=Web page to use as example
WEBSITE_PAGENAME=Page name/alias
WEBSITE_CSS_URL=URL of external CSS file
WEBSITE_CSS_INLINE=CSS file content (common to all pages)
@@ -76,4 +77,6 @@ GrabImagesInto=Grab also images found into css and page.
ImagesShouldBeSavedInto=Images should be saved into directory
WebsiteRootOfImages=Root directory for website images
SubdirOfPage=Sub-directory dedicated to page
-AliasPageAlreadyExists=Alias page %s already exists
\ No newline at end of file
+AliasPageAlreadyExists=Alias page %s already exists
+CorporateHomePage=Corporate Home page
+EmptyPage=Empty page
\ No newline at end of file
diff --git a/htdocs/livraison/card.php b/htdocs/livraison/card.php
index b0de98ae2eb..41091b36e08 100644
--- a/htdocs/livraison/card.php
+++ b/htdocs/livraison/card.php
@@ -206,7 +206,7 @@ if ($action == 'update_extras')
$parameters = array('id' => $object->id);
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook)) {
- $result = $object->insertExtraFields();
+ $result = $object->insertExtraFields('DELIVERY_MODIFY');
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php
index 837b0af77f5..d0d24d39144 100644
--- a/htdocs/livraison/class/livraison.class.php
+++ b/htdocs/livraison/class/livraison.class.php
@@ -301,13 +301,9 @@ class Livraison extends CommonObject
if ($this->statut == 0) $this->brouillon = 1;
-
- // Retrieve all extrafields for delivery
+ // Retreive all extrafield
// fetch optionals attributes and labels
- require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
- $extrafields=new ExtraFields($this->db);
- $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
- $this->fetch_optionals($this->id,$extralabels);
+ $this->fetch_optionals();
/*
* Lignes
diff --git a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php
index e413c969119..f9984e8fb40 100644
--- a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php
+++ b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php
@@ -151,13 +151,13 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers
case 'STOCK_MOVEMENT':
//MYECMDIR
- case 'MYECMDIR_DELETE':
case 'MYECMDIR_CREATE':
case 'MYECMDIR_MODIFY':
+ case 'MYECMDIR_DELETE':
// Customer orders
case 'ORDER_CREATE':
- case 'ORDER_CLONE':
+ case 'ORDER_MODIFY':
case 'ORDER_VALIDATE':
case 'ORDER_DELETE':
case 'ORDER_CANCEL':
@@ -170,7 +170,7 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers
// Supplier orders
case 'ORDER_SUPPLIER_CREATE':
- case 'ORDER_SUPPLIER_CLONE':
+ case 'ORDER_SUPPLIER_MODIFY':
case 'ORDER_SUPPLIER_VALIDATE':
case 'ORDER_SUPPLIER_DELETE':
case 'ORDER_SUPPLIER_APPROVE':
@@ -184,7 +184,6 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers
// Proposals
case 'PROPAL_CREATE':
- case 'PROPAL_CLONE':
case 'PROPAL_MODIFY':
case 'PROPAL_VALIDATE':
case 'PROPAL_SENTBYMAIL':
@@ -197,7 +196,6 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers
// SupplierProposal
case 'SUPPLIER_PROPOSAL_CREATE':
- case 'SUPPLIER_PROPOSAL_CLONE':
case 'SUPPLIER_PROPOSAL_MODIFY':
case 'SUPPLIER_PROPOSAL_VALIDATE':
case 'SUPPLIER_PROPOSAL_SENTBYMAIL':
@@ -210,8 +208,8 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers
// Contracts
case 'CONTRACT_CREATE':
- case 'CONTRACT_ACTIVATE':
case 'CONTRACT_MODIFY':
+ case 'CONTRACT_ACTIVATE':
case 'CONTRACT_CANCEL':
case 'CONTRACT_CLOSE':
case 'CONTRACT_DELETE':
@@ -221,7 +219,6 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers
// Bills
case 'BILL_CREATE':
- case 'BILL_CLONE':
case 'BILL_MODIFY':
case 'BILL_VALIDATE':
case 'BILL_UNVALIDATE':
diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php
index 23a748a12dc..72715ec27f1 100644
--- a/htdocs/modulebuilder/template/myobject_list.php
+++ b/htdocs/modulebuilder/template/myobject_list.php
@@ -542,25 +542,21 @@ print ''."\n";
if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords))
{
- if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
- {
- require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php');
- $formfile = new FormFile($db);
+ $hidegeneratedfilelistifempty=1;
+ if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0;
- // Show list of available documents
- $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
- $urlsource.=str_replace('&','&',$param);
+ require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php');
+ $formfile = new FormFile($db);
- $filedir=$diroutputmassaction;
- $genallowed=$user->rights->mymodule->read;
- $delallowed=$user->rights->mymodule->create;
+ // Show list of available documents
+ $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
+ $urlsource.=str_replace('&','&',$param);
- print $formfile->showdocuments('massfilesarea_mymodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
- }
- else
- {
- print '
'.$langs->trans("ShowTempMassFilesArea").'';
- }
+ $filedir=$diroutputmassaction;
+ $genallowed=$user->rights->mymodule->read;
+ $delallowed=$user->rights->mymodule->create;
+
+ print $formfile->showdocuments('massfilesarea_mymodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
}
// End of page
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 73d867e7141..123330004ed 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -1951,13 +1951,9 @@ class Product extends CommonObject
$this->db->free($resql);
-
- // Retreive all extrafield for current object
+ // Retreive all extrafield
// fetch optionals attributes and labels
- require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
- $extrafields=new ExtraFields($this->db);
- $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
- $this->fetch_optionals($this->id,$extralabels);
+ $this->fetch_optionals();
// multilangs
if (! empty($conf->global->MAIN_MULTILANGS)) $this->getMultiLangs();
diff --git a/htdocs/product/inventory/list.php b/htdocs/product/inventory/list.php
index cb67168b214..f9fef88edce 100644
--- a/htdocs/product/inventory/list.php
+++ b/htdocs/product/inventory/list.php
@@ -494,25 +494,21 @@ print ''."\n";
if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords))
{
- if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
- {
- require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php');
- $formfile = new FormFile($db);
+ $hidegeneratedfilelistifempty=1;
+ if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0;
- // Show list of available documents
- $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
- $urlsource.=str_replace('&','&',$param);
+ require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php');
+ $formfile = new FormFile($db);
- $filedir=$diroutputmassaction;
- $genallowed=$user->rights->mymodule->read;
- $delallowed=$user->rights->mymodule->create;
+ // Show list of available documents
+ $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
+ $urlsource.=str_replace('&','&',$param);
- print $formfile->showdocuments('massfilesarea_mymodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
- }
- else
- {
- print '
'.$langs->trans("ShowTempMassFilesArea").'';
- }
+ $filedir=$diroutputmassaction;
+ $genallowed=$user->rights->mymodule->read;
+ $delallowed=$user->rights->mymodule->create;
+
+ print $formfile->showdocuments('massfilesarea_mymodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
}
// End of page
diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php
index 69be51f11e8..ab2b60f564a 100644
--- a/htdocs/product/stock/class/mouvementstock.class.php
+++ b/htdocs/product/stock/class/mouvementstock.class.php
@@ -576,12 +576,9 @@ class MouvementStock extends CommonObject
$this->sellby = $this->db->jdate($obj->sellby);
}
- // Retrieve all extrafields for invoice
+ // Retreive all extrafield
// fetch optionals attributes and labels
- require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
- $extrafields=new ExtraFields($this->db);
- $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
- $this->fetch_optionals($this->id,$extralabels);
+ $this->fetch_optionals();
// $this->fetch_lines();
diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php
index d7915512b2c..31c28eaa5b3 100644
--- a/htdocs/product/stock/class/productlot.class.php
+++ b/htdocs/product/stock/class/productlot.class.php
@@ -233,12 +233,9 @@ class Productlot extends CommonObject
$this->fk_user_modif = $obj->fk_user_modif;
$this->import_key = $obj->import_key;
- // Retrieve all extrafields for invoice
+ // Retreive all extrafield
// fetch optionals attributes and labels
- require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
- $extrafields=new ExtraFields($this->db);
- $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
- $this->fetch_optionals($this->id,$extralabels);
+ $this->fetch_optionals();
}
$this->db->free($resql);
diff --git a/htdocs/product/stock/class/productstockentrepot.class.php b/htdocs/product/stock/class/productstockentrepot.class.php
index 048be66461f..cbca4e5854d 100644
--- a/htdocs/product/stock/class/productstockentrepot.class.php
+++ b/htdocs/product/stock/class/productstockentrepot.class.php
@@ -51,7 +51,7 @@ class ProductStockEntrepot extends CommonObject
/**
*/
-
+
public $tms = '';
public $fk_product;
public $fk_entrepot;
@@ -61,7 +61,7 @@ class ProductStockEntrepot extends CommonObject
/**
*/
-
+
/**
* Constructor
@@ -88,7 +88,7 @@ class ProductStockEntrepot extends CommonObject
$error = 0;
// Clean parameters
-
+
if (isset($this->fk_product)) $this->fk_product = trim($this->fk_product);
if (isset($this->fk_entrepot)) $this->fk_entrepot = trim($this->fk_entrepot);
if (isset($this->seuil_stock_alerte)) $this->seuil_stock_alerte = trim($this->seuil_stock_alerte);
@@ -100,23 +100,23 @@ class ProductStockEntrepot extends CommonObject
// Insert request
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '(';
-
+
$sql.= 'fk_product,';
$sql.= 'fk_entrepot,';
$sql.= 'seuil_stock_alerte,';
$sql.= 'desiredstock,';
$sql.= 'import_key';
-
+
$sql .= ') VALUES (';
-
+
$sql .= ' '.(! isset($this->fk_product)?'NULL':$this->fk_product).',';
$sql .= ' '.(! isset($this->fk_entrepot)?'NULL':$this->fk_entrepot).',';
$sql .= ' '.(! isset($this->seuil_stock_alerte)?'0':$this->seuil_stock_alerte).',';
$sql .= ' '.(! isset($this->desiredstock)?'0':$this->desiredstock).',';
$sql .= ' '.(! isset($this->import_key)?'NULL':"'".$this->db->escape($this->import_key)."'");
-
+
$sql .= ')';
$this->db->begin();
@@ -166,12 +166,12 @@ class ProductStockEntrepot extends CommonObject
public function fetch($id, $fk_product, $fk_entrepot)
{
if(empty($id) && (empty($fk_product) || empty($fk_entrepot))) return -1;
-
+
dol_syslog(__METHOD__, LOG_DEBUG);
$sql = 'SELECT';
$sql .= ' t.rowid,';
-
+
$sql .= " t.tms,";
$sql .= " t.fk_product,";
$sql .= " t.fk_entrepot,";
@@ -179,11 +179,11 @@ class ProductStockEntrepot extends CommonObject
$sql .= " t.desiredstock,";
$sql .= " t.import_key";
-
+
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
if(!empty($id)) $sql .= ' WHERE t.rowid = ' . $id;
else $sql.= ' WHERE t.fk_product = '.$fk_product.' AND t.fk_entrepot = '.$fk_entrepot;
-
+
$resql = $this->db->query($sql);
if ($resql) {
$numrows = $this->db->num_rows($resql);
@@ -191,7 +191,7 @@ class ProductStockEntrepot extends CommonObject
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
-
+
$this->tms = $this->db->jdate($obj->tms);
$this->fk_product = $obj->fk_product;
$this->fk_entrepot = $obj->fk_entrepot;
@@ -199,18 +199,15 @@ class ProductStockEntrepot extends CommonObject
$this->desiredstock = $obj->desiredstock;
$this->import_key = $obj->import_key;
-
+
}
-
- // Retrieve all extrafields for invoice
+
+ // Retreive all extrafield
// fetch optionals attributes and labels
- require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
- $extrafields=new ExtraFields($this->db);
- $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
- $this->fetch_optionals($this->id,$extralabels);
+ $this->fetch_optionals();
// $this->fetch_lines();
-
+
$this->db->free($resql);
if ($numrows) {
@@ -246,7 +243,7 @@ class ProductStockEntrepot extends CommonObject
$sql = 'SELECT';
$sql .= ' t.rowid,';
-
+
$sql .= " t.tms,";
$sql .= " t.fk_product,";
$sql .= " t.fk_entrepot,";
@@ -254,11 +251,11 @@ class ProductStockEntrepot extends CommonObject
$sql .= " t.desiredstock,";
$sql .= " t.import_key";
-
+
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t';
-
+
$sql .= ' WHERE 1=1';
-
+
// Manage filter
$sqlwhere = array();
if (count($filter) > 0) {
@@ -267,19 +264,19 @@ class ProductStockEntrepot extends CommonObject
}
}
if (count($sqlwhere) > 0) $sql .= ' AND ' . implode(' '.$filtermode.' ', $sqlwhere);
-
+
if(!empty($fk_product)) $sql .= ' AND fk_product = '.$fk_product;
elseif(!empty($fk_entrepot)) $sql .= ' AND fk_entrepot = '.$fk_entrepot;
// "elseif" used instead of "if" because getting list with specified fk_product and specified fk_entrepot would be the same as doing a fetch
-
+
if (!empty($sortfield)) $sql .= $this->db->order($sortfield,$sortorder);
if (!empty($limit)) $sql .= ' ' . $this->db->plimit($limit, $offset);
-
+
$lines = array();
$resql = $this->db->query($sql);
if ($resql) {
-
+
while ($obj = $this->db->fetch_object($resql)) {
$lines[$obj->rowid] = array(
'id'=>$obj->rowid
@@ -315,20 +312,20 @@ class ProductStockEntrepot extends CommonObject
dol_syslog(__METHOD__, LOG_DEBUG);
// Clean parameters
-
+
if (isset($this->fk_product)) $this->fk_product = trim($this->fk_product);
if (isset($this->fk_entrepot)) $this->fk_entrepot = trim($this->fk_entrepot);
if (isset($this->seuil_stock_alerte)) $this->seuil_stock_alerte = trim($this->seuil_stock_alerte);
if (isset($this->desiredstock)) $this->desiredstock = trim($this->desiredstock);
if (isset($this->import_key)) $this->import_key = trim($this->import_key);
-
+
// Check parameters
// Put here code to add a control on parameters values
// Update request
$sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET';
-
+
$sql .= ' tms = '.(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : "'".$this->db->idate(dol_now())."'").',';
$sql .= ' fk_product = '.(isset($this->fk_product)?$this->fk_product:"null").',';
$sql .= ' fk_entrepot = '.(isset($this->fk_entrepot)?$this->fk_entrepot:"null").',';
@@ -336,7 +333,7 @@ class ProductStockEntrepot extends CommonObject
$sql .= ' desiredstock = '.(isset($this->desiredstock)?$this->desiredstock:"null").',';
$sql .= ' import_key = '.(isset($this->import_key)?"'".$this->db->escape($this->import_key)."'":"null");
-
+
$sql .= ' WHERE rowid=' . $this->id;
$this->db->begin();
@@ -573,7 +570,7 @@ class ProductStockEntrepot extends CommonObject
public function initAsSpecimen()
{
$this->id = 0;
-
+
$this->tms = '';
$this->fk_product = '';
$this->fk_entrepot = '';
@@ -581,7 +578,7 @@ class ProductStockEntrepot extends CommonObject
$this->desiredstock = '';
$this->import_key = '';
-
+
}
}
diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php
index 3a8f4cbff4e..1d9a7420740 100644
--- a/htdocs/product/stock/productlot_card.php
+++ b/htdocs/product/stock/productlot_card.php
@@ -135,7 +135,7 @@ if (empty($reshook))
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by
// some hooks
if (empty($reshook)) {
- $result = $object->insertExtraFields();
+ $result = $object->insertExtraFields('PRODUCT_LOT_MODIFY');
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php
index 5934e8dff55..76d70c1ad10 100644
--- a/htdocs/product/stock/productlot_list.php
+++ b/htdocs/product/stock/productlot_list.php
@@ -537,22 +537,18 @@ if ($resql)
print ''."\n";
/*
- if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
- {
- // Show list of available documents
- $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
- $urlsource.=str_replace('&','&',$param);
+ $hidegeneratedfilelistifempty=1;
+ if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0;
- $filedir=$diroutputmassaction;
- $genallowed=$user->rights->facture->lire;
- $delallowed=$user->rights->facture->creer;
+ // Show list of available documents
+ $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
+ $urlsource.=str_replace('&','&',$param);
- print $formfile->showdocuments('massfilesarea_orders','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
- }
- else
- {
- print '
'.$langs->trans("ShowTempMassFilesArea").'';
- }
+ $filedir=$diroutputmassaction;
+ $genallowed=$user->rights->facture->lire;
+ $delallowed=$user->rights->facture->creer;
+
+ print $formfile->showdocuments('massfilesarea_orders','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
*/
}
else
diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php
index e24a444702c..8dbce2790fa 100644
--- a/htdocs/projet/class/project.class.php
+++ b/htdocs/projet/class/project.class.php
@@ -444,7 +444,8 @@ class Project extends CommonObject
$this->db->free($resql);
- // Retreive all extrafield for thirdparty
+ // Retreive all extrafield
+ // fetch optionals attributes and labels
$this->fetch_optionals();
if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT))
diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php
index e694b3c7bfd..eeacf27aaec 100644
--- a/htdocs/projet/class/task.class.php
+++ b/htdocs/projet/class/task.class.php
@@ -266,8 +266,9 @@ class Task extends CommonObject
$this->task_parent_position = $obj->task_parent_position;
}
- // Retreive all extrafield data
- $this->fetch_optionals();
+ // Retreive all extrafield
+ // fetch optionals attributes and labels
+ $this->fetch_optionals();
}
$this->db->free($resql);
diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php
index c880f9538c7..c7126c6d3bb 100644
--- a/htdocs/resource/class/dolresource.class.php
+++ b/htdocs/resource/class/dolresource.class.php
@@ -213,13 +213,9 @@ class Dolresource extends CommonObject
$this->note_private = $obj->note_private;
$this->type_label = $obj->type_label;
- // Retreive all extrafield for thirdparty
+ // Retreive all extrafield
// fetch optionals attributes and labels
- require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
- $extrafields=new ExtraFields($this->db);
- $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
- $this->fetch_optionals($this->id,$extralabels);
-
+ $this->fetch_optionals();
}
$this->db->free($resql);
diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php
index dcacf89d643..b48c80a7a24 100644
--- a/htdocs/societe/card.php
+++ b/htdocs/societe/card.php
@@ -334,7 +334,7 @@ if (empty($reshook))
if (! $error)
{
- $result = $object->insertExtraFields();
+ $result = $object->insertExtraFields('COMPANY_MODIFY');
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index 652ffd8742e..3ca69fdb6fd 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -334,7 +334,7 @@ class Societe extends CommonObject
*/
var $price_level;
var $outstanding_limit;
-
+
/**
* Min order amounts
*/
@@ -1315,8 +1315,9 @@ class Societe extends CommonObject
$result = 1;
- // Retreive all extrafield for thirdparty
- $this->fetch_optionals();
+ // Retreive all extrafield
+ // fetch optionals attributes and labels
+ $this->fetch_optionals();
}
else
{
diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php
index ef990a7e4f0..9e57176250a 100644
--- a/htdocs/societe/website.php
+++ b/htdocs/societe/website.php
@@ -525,25 +525,21 @@ print ''."\n";
if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords))
{
- if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
- {
- require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php');
- $formfile = new FormFile($db);
+ $hidegeneratedfilelistifempty=1;
+ if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0;
- // Show list of available documents
- $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
- $urlsource.=str_replace('&','&',$param);
+ require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php');
+ $formfile = new FormFile($db);
- $filedir=$diroutputmassaction;
- $genallowed=$user->rights->mymodule->read;
- $delallowed=$user->rights->mymodule->create;
+ // Show list of available documents
+ $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
+ $urlsource.=str_replace('&','&',$param);
- print $formfile->showdocuments('massfilesarea_mymodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
- }
- else
- {
- print '
'.$langs->trans("ShowTempMassFilesArea").'';
- }
+ $filedir=$diroutputmassaction;
+ $genallowed=$user->rights->mymodule->read;
+ $delallowed=$user->rights->mymodule->create;
+
+ print $formfile->showdocuments('massfilesarea_mymodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
}
diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php
index a5488959016..440551bd925 100644
--- a/htdocs/supplier_proposal/card.php
+++ b/htdocs/supplier_proposal/card.php
@@ -934,7 +934,7 @@ if (empty($reshook))
if (! $error)
{
- $result = $object->insertExtraFields();
+ $result = $object->insertExtraFields('SUPPLIER_PROPOSAL_MODIFY');
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php
index e43404777b6..c6ae3642bc9 100644
--- a/htdocs/supplier_proposal/class/supplier_proposal.class.php
+++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php
@@ -1101,11 +1101,6 @@ class SupplierProposal extends CommonObject
$reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++;
}
-
- // Call trigger
- $result=$this->call_trigger('SUPPLIER_PROPOSAL_CLONE',$user);
- if ($result < 0) { $error++; }
- // End call triggers
}
// End
@@ -1220,12 +1215,9 @@ class SupplierProposal extends CommonObject
$this->brouillon = 1;
}
- // Retreive all extrafield for invoice
+ // Retreive all extrafield
// fetch optionals attributes and labels
- require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
- $extrafields=new ExtraFields($this->db);
- $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
- $this->fetch_optionals($this->id,$extralabels);
+ $this->fetch_optionals();
$this->db->free($resql);
@@ -1316,12 +1308,9 @@ class SupplierProposal extends CommonObject
return -1;
}
- // Retreive all extrafield for askprice
+ // Retreive all extrafield
// fetch optionals attributes and labels
- require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
- $extrafields=new ExtraFields($this->db);
- $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
- $this->fetch_optionals($this->id,$extralabels);
+ $this->fetch_optionals();
return 1;
}
diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php
index abf9f9cfd2a..1a7d248f83f 100644
--- a/htdocs/supplier_proposal/list.php
+++ b/htdocs/supplier_proposal/list.php
@@ -858,26 +858,19 @@ if ($resql)
print ''."\n";
- if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
- {
- /*
- * Show list of available documents
- */
- $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
- $urlsource.=str_replace('&','&',$param);
+ $hidegeneratedfilelistifempty=1;
+ if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0;
- $filedir=$diroutputmassaction;
+ // Show list of available documents
+ $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
+ $urlsource.=str_replace('&','&',$param);
- $genallowed=$user->rights->supplier_proposal->lire;
- $delallowed=$user->rights->supplier_proposal->creer;
+ $filedir=$diroutputmassaction;
- print $formfile->showdocuments('massfilesarea_supplier_proposal','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,'','');
- }
- else
- {
- print '
'.$langs->trans("ShowTempMassFilesArea").'';
- }
+ $genallowed=$user->rights->supplier_proposal->lire;
+ $delallowed=$user->rights->supplier_proposal->creer;
+ print $formfile->showdocuments('massfilesarea_supplier_proposal','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
}
else
{
diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php
index 6a2a1b774e7..3fcdf411a24 100644
--- a/htdocs/user/class/user.class.php
+++ b/htdocs/user/class/user.class.php
@@ -324,12 +324,9 @@ class User extends CommonObject
// in such case, this admin user must be admin for ALL entities.
if (empty($conf->multicompany->enabled) && $this->admin && $this->entity == 1) $this->entity = 0;
- // Retreive all extrafield for thirdparty
+ // Retreive all extrafield
// fetch optionals attributes and labels
- require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
- $extrafields=new ExtraFields($this->db);
- $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
- $this->fetch_optionals($this->id,$extralabels);
+ $this->fetch_optionals();
$this->db->free($result);
}
diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php
index 2e0cd0376c6..5104d813a05 100644
--- a/htdocs/user/class/usergroup.class.php
+++ b/htdocs/user/class/usergroup.class.php
@@ -116,12 +116,9 @@ class UserGroup extends CommonObject
$this->members=$this->listUsersForGroup();
- // Retreive all extrafield for group
+ // Retreive all extrafield
// fetch optionals attributes and labels
- dol_include_once('/core/class/extrafields.class.php');
- $extrafields=new ExtraFields($this->db);
- $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
- $this->fetch_optionals($this->id,$extralabels);
+ $this->fetch_optionals();
// Sav current LDAP Current DN
diff --git a/htdocs/website/index.php b/htdocs/website/index.php
index 959529eb44e..084ef28c2d0 100644
--- a/htdocs/website/index.php
+++ b/htdocs/website/index.php
@@ -153,7 +153,7 @@ $htmlheadercontentdefault.=''."\n";
$htmlheadercontentdefault.=''."\n";
$htmlheadercontentdefault.=''."\n";
-$htmlheadercontentdefault.=''."\n";
+$htmlheadercontentdefault.=''."\n";
/*
@@ -552,8 +552,13 @@ if ($action == 'addcontainer')
$substitutionarray=array();
$substitutionarray['__WEBSITE_CREATE_BY__']=$user->getFullName($langs);
+ $sample = GETPOST('sample','alpha');
+ if (empty($sample)) $sample='empty';
+
+ $pathtosample = DOL_DOCUMENT_ROOT.'/website/page-sample-'.$sample.'.html';
+
// Init content with content into pagetemplate.html, blogposttempltate.html, ...
- $objectpage->content = make_substitutions(@file_get_contents(DOL_DOCUMENT_ROOT.'/website/'.$objectpage->type_container.'template.html'), $substitutionarray);
+ $objectpage->content = make_substitutions(@file_get_contents($pathtosample), $substitutionarray);
}
if (! $error)
@@ -2036,6 +2041,12 @@ if ($action == 'editmeta' || $action == 'createcontainer')
print $formwebsite->selectTypeOfContainer('WEBSITE_TYPE_CONTAINER', (GETPOST('WEBSITE_TYPE_CONTAINER')?GETPOST('WEBSITE_TYPE_CONTAINER'):'page'));
print '';
+ print '| ';
+ print $langs->trans('WEBSITE_PAGE_EXAMPLE');
+ print ' | ';
+ print $formwebsite->selectSampleOfContainer('sample', (GETPOST('sample')?GETPOST('sample'):'corporatehomepage'));
+ print ' |
';
+
print '| ';
print $langs->trans('WEBSITE_PAGENAME');
print ' | ';
diff --git a/htdocs/website/pagetemplate.html b/htdocs/website/page-sample-corporatehome.html
similarity index 100%
rename from htdocs/website/pagetemplate.html
rename to htdocs/website/page-sample-corporatehome.html
diff --git a/htdocs/website/page-sample-empty.html b/htdocs/website/page-sample-empty.html
new file mode 100644
index 00000000000..313c398a86e
--- /dev/null
+++ b/htdocs/website/page-sample-empty.html
@@ -0,0 +1,10 @@
+
+ __[MAIN_INFO_SOCIETE_NOM]__
+__(MyContainerTitle)__
+
+
+
+
+ Created by: __WEBSITE_CREATE_BY__
+
+
|