Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into New_import_lines_from_linked_element

This commit is contained in:
John 2018-02-21 11:53:16 +01:00
commit bd0e8506f5
74 changed files with 443 additions and 529 deletions

View File

@ -12,6 +12,8 @@ Following changes may create regressions for some external modules, but were nec
'doaction' into 'sendMail'. 'doaction' into 'sendMail'.
* Rename trigger CONTRACT_SERVICE_ACTIVATE into LINECONTRACT_ACTIVATE and * Rename trigger CONTRACT_SERVICE_ACTIVATE into LINECONTRACT_ACTIVATE and
CONTRACT_SERVICE_CLOSE into LINECONTRACT_CLOSE 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 ***** ***** ChangeLog for 7.0.0 compared to 6.0.5 *****

View File

@ -92,7 +92,7 @@ class AccountancyCategory // extends CommonObject
// Insert request // Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."c_accounting_category("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."c_accounting_category(";
$sql.= "rowid,"; if ($this->rowid > 0) $sql.= "rowid,";
$sql.= "code,"; $sql.= "code,";
$sql.= "label,"; $sql.= "label,";
$sql.= "range_account,"; $sql.= "range_account,";
@ -103,16 +103,16 @@ class AccountancyCategory // extends CommonObject
$sql.= "fk_country,"; $sql.= "fk_country,";
$sql.= "active"; $sql.= "active";
$sql.= ") VALUES ("; $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->code)?'NULL':"'".$this->db->escape($this->code)."'").",";
$sql.= " ".(! isset($this->label)?'NULL':"'".$this->db->escape($this->label)."'").","; $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->range_account)?'NULL':"'".$this->db->escape($this->range_account)."'").",";
$sql.= " ".(! isset($this->sens)?'NULL':"'".$this->sens."'").","; $sql.= " ".(! isset($this->sens)?'NULL':"'".$this->db->escape($this->sens)."'").",";
$sql.= " ".(! isset($this->category_type)?'NULL':"'".$this->category_type."'").","; $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->formula)?'NULL':"'".$this->db->escape($this->formula)."'").",";
$sql.= " ".(! isset($this->position)?'NULL':"'".$this->position."'").","; $sql.= " ".(! isset($this->position)?'NULL':$this->db->escape($this->position)).",";
$sql.= " ".(! isset($this->fk_country)?'NULL':"'".$this->fk_country."'").","; $sql.= " ".(! isset($this->fk_country)?'NULL':$this->db->escape($this->fk_country)).",";
$sql.= " ".(! isset($this->active)?'NULL':"'".$this->active."'").""; $sql.= " ".(! isset($this->active)?'NULL':$this->db->escape($this->active));
$sql.= ")"; $sql.= ")";
$this->db->begin(); $this->db->begin();

View File

@ -1156,12 +1156,9 @@ class Adherent extends CommonObject
$this->model_pdf = $obj->model_pdf; $this->model_pdf = $obj->model_pdf;
// Retreive all extrafield for thirdparty // Retreive all extrafield
// fetch optionals attributes and labels // fetch optionals attributes and labels
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $this->fetch_optionals();
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
// Load other properties // Load other properties
$result=$this->fetch_subscriptions(); $result=$this->fetch_subscriptions();

View File

@ -507,25 +507,21 @@ print '</form>'."\n";
if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) 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 $hidegeneratedfilelistifempty=1;
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0;
$urlsource.=str_replace('&amp;','&',$param);
$filedir=$diroutputmassaction; // Show list of available documents
$genallowed=$user->rights->monmodule->read; $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$delallowed=$user->rights->monmodule->create; $urlsource.=str_replace('&amp;','&',$param);
print $formfile->showdocuments('massfilesarea_monmodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); $filedir=$diroutputmassaction;
} $genallowed=$user->rights->monmodule->read;
else $delallowed=$user->rights->monmodule->create;
{
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>'; print $formfile->showdocuments('massfilesarea_monmodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
}
} }
dol_fiche_end(); dol_fiche_end();

View File

@ -236,7 +236,9 @@ class Categorie extends CommonObject
$this->type = $res['type']; $this->type = $res['type'];
$this->entity = $res['entity']; $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); $this->db->free($resql);

View File

@ -465,7 +465,10 @@ class ActionComm extends CommonObject
// Load source object // Load source object
$objFrom = clone $this; $objFrom = clone $this;
// Retreive all extrafield
// fetch optionals attributes and labels
$this->fetch_optionals(); $this->fetch_optionals();
// $this->fetch_userassigned(); // $this->fetch_userassigned();
$this->fetchResources(); $this->fetchResources();

View File

@ -195,7 +195,7 @@ if (empty($reshook))
if ($ret < 0) $error++; if ($ret < 0) $error++;
if (! $error) if (! $error)
{ {
$result = $object->insertExtraFields(); $result = $object->insertExtraFields('COMPANY_MODIFY');
if ($result < 0) if ($result < 0)
{ {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');

View File

@ -1234,7 +1234,7 @@ if (empty($reshook))
if ($ret < 0) $error++; if ($ret < 0) $error++;
if (! $error) if (! $error)
{ {
$result = $object->insertExtraFields(); $result = $object->insertExtraFields('PROPAL_MODIFY');
if ($result < 0) if ($result < 0)
{ {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');

View File

@ -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 $reshook=$hookmanager->executeHooks('createFrom',$parameters,$clonedObj,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++; if ($reshook < 0) $error++;
} }
// Call trigger
$result=$clonedObj->call_trigger('PROPAL_CLONE',$user);
if ($result < 0) { $error++; }
// End call triggers
} }
unset($this->context['createfromclone']); unset($this->context['createfromclone']);
@ -1439,12 +1434,9 @@ class Propal extends CommonObject
$this->brouillon = 1; $this->brouillon = 1;
} }
// Retreive all extrafield for invoice // Retreive all extrafield
// fetch optionals attributes and labels // fetch optionals attributes and labels
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $this->fetch_optionals();
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
$this->db->free($resql); $this->db->free($resql);

View File

@ -892,25 +892,18 @@ if ($resql)
print '</form>'."\n"; print '</form>'."\n";
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $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('&amp;','&',$param);
$filedir=$diroutputmassaction; // Show list of available documents
$genallowed=$user->rights->propal->lire; $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$delallowed=$user->rights->propal->creer; $urlsource.=str_replace('&amp;','&',$param);
print $formfile->showdocuments('massfilesarea_proposals','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,'',''); $filedir=$diroutputmassaction;
} $genallowed=$user->rights->propal->lire;
else $delallowed=$user->rights->propal->creer;
{
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
}
print $formfile->showdocuments('massfilesarea_proposals','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
} }
else else
{ {

View File

@ -1281,7 +1281,7 @@ if (empty($reshook))
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by $reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by
// some hooks // some hooks
if (empty($reshook)) { if (empty($reshook)) {
$result = $object->insertExtraFields(); $result = $object->insertExtraFields('ORDER_MODIFY');
if ($result < 0) if ($result < 0)
{ {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');

View File

@ -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 $reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++; if ($reshook < 0) $error++;
} }
// Call trigger
$result=$this->call_trigger('ORDER_CLONE',$user);
if ($result < 0) $error++;
// End call triggers
} }
unset($this->context['createfromclone']); unset($this->context['createfromclone']);
@ -1673,12 +1668,9 @@ class Commande extends CommonOrder
if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1; if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1;
// Retrieve all extrafields for invoice // Retreive all extrafield
// fetch optionals attributes and labels // fetch optionals attributes and labels
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $this->fetch_optionals();
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
$this->db->free($result); $this->db->free($result);

View File

@ -1101,25 +1101,18 @@ if ($resql)
print '</form>'."\n"; print '</form>'."\n";
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $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('&amp;','&',$param);
$filedir=$diroutputmassaction; // Show list of available documents
$genallowed=$user->rights->commande->lire; $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$delallowed=$user->rights->commande->creer; $urlsource.=str_replace('&amp;','&',$param);
print $formfile->showdocuments('massfilesarea_orders','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); $filedir=$diroutputmassaction;
} $genallowed=$user->rights->commande->lire;
else $delallowed=$user->rights->commande->creer;
{
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
}
print $formfile->showdocuments('massfilesarea_orders','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
} }
else else
{ {

View File

@ -913,12 +913,9 @@ class Account extends CommonObject
$this->date_creation = $this->db->jdate($obj->date_creation); $this->date_creation = $this->db->jdate($obj->date_creation);
$this->date_update = $this->db->jdate($obj->date_update); $this->date_update = $this->db->jdate($obj->date_update);
// Retreive all extrafield for thirdparty // Retreive all extrafield
// fetch optionals attributes and labels // fetch optionals attributes and labels
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); $this->fetch_optionals();
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
return 1; return 1;
} }

View File

@ -2119,7 +2119,7 @@ if (empty($reshook))
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by $reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by
// some hooks // some hooks
if (empty($reshook)) { if (empty($reshook)) {
$result = $object->insertExtraFields(); $result = $object->insertExtraFields('BILL_MODIFY');
if ($result < 0) if ($result < 0)
{ {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');

View File

@ -381,12 +381,9 @@ class FactureRec extends CommonInvoice
if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1; if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1;
// Retreive all extrafield for thirdparty // Retreive all extrafield
// fetch optionals attributes and labels // fetch optionals attributes and labels
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); $this->fetch_optionals();
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
/* /*
* Lines * Lines

View File

@ -790,14 +790,17 @@ class Facture extends CommonInvoice
// Charge facture source // Charge facture source
$facture=new Facture($this->db); $facture=new Facture($this->db);
$this->fetch_optionals(); // Retreive all extrafield
if(!empty($this->array_options)){ // fetch optionals attributes and labels
$facture->array_options = $this->array_options; $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 $line->fetch_optionals();//fetch extrafields
} }
$facture->fk_facture_source = $this->fk_facture_source; $facture->fk_facture_source = $this->fk_facture_source;
$facture->type = $this->type; $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 $reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++; if ($reshook < 0) $error++;
} }
// Call trigger
$result=$this->call_trigger('BILL_CLONE',$user);
if ($result < 0) $error++;
// End call triggers
} }
unset($this->context['createfromclone']); unset($this->context['createfromclone']);
@ -1333,16 +1331,13 @@ class Facture extends CommonInvoice
if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1; if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1;
// Retrieve all extrafield for invoice // Retreive all extrafield
// fetch optionals attributes and labels // fetch optionals attributes and labels
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $this->fetch_optionals();
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
/* /*
* Lines * Lines
*/ */
$this->lines = array(); $this->lines = array();

View File

@ -450,7 +450,7 @@ if (empty($reshook))
if ($ret < 0) $error++; if ($ret < 0) $error++;
if (! $error) { if (! $error) {
$result = $object->insertExtraFields(); $result = $object->insertExtraFields('BILLREC_MODIFY');
if ($result < 0) if ($result < 0)
{ {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');

View File

@ -1192,22 +1192,18 @@ if ($resql)
print "</form>\n"; print "</form>\n";
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $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('&amp;','&',$param);
$filedir=$diroutputmassaction; // Show list of available documents
$genallowed=$user->rights->facture->lire; $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$delallowed=$user->rights->facture->creer; $urlsource.=str_replace('&amp;','&',$param);
print $formfile->showdocuments('massfilesarea_invoices','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); $filedir=$diroutputmassaction;
} $genallowed=$user->rights->facture->lire;
else $delallowed=$user->rights->facture->creer;
{
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>'; print $formfile->showdocuments('massfilesarea_invoices','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
}
} }
else else
{ {

View File

@ -801,12 +801,9 @@ class Contact extends CommonObject
} }
} }
// Retreive all extrafield for contact // Retreive all extrafield
// fetch optionals attributes and labels // fetch optionals attributes and labels
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); $this->fetch_optionals();
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
return 1; return 1;
} }

View File

@ -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 $permissiondellink=$user->rights->contrat->creer; // Used by the include of actions_dellink.inc.php
/* /*
* Actions * Actions
*/ */
@ -875,13 +876,15 @@ if (empty($reshook))
} }
else if ($action == 'update_extras') else if ($action == 'update_extras')
{ {
$object->oldcopy = dol_clone($object);
// Fill array 'array_options' with data from update form // Fill array 'array_options' with data from update form
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element); $extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
if ($ret < 0) $error++; if ($ret < 0) $error++;
if (! $error) { if (! $error) {
$result = $object->insertExtraFields(); $result = $object->insertExtraFields('CONTRACT_MODIFY');
if ($result < 0) if ($result < 0)
{ {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');

View File

@ -261,9 +261,10 @@ class Contrat extends CommonObject
* *
* @param User $user Object User making action * @param User $user Object User making action
* @param int|string $date_start Date start (now if empty) * @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 * @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(); if (empty($date_start)) $date_start = dol_now();
@ -294,7 +295,7 @@ class Contrat extends CommonObject
if (! $error && $this->statut == 0) if (! $error && $this->statut == 0)
{ {
$result=$this->validate($user); $result=$this->validate($user, '', $notrigger);
if ($result < 0) $error++; if ($result < 0) $error++;
} }
@ -609,7 +610,7 @@ class Contrat extends CommonObject
$this->mise_en_service = $this->db->jdate($result["datemise"]); $this->mise_en_service = $this->db->jdate($result["datemise"]);
$this->date_contrat = $this->db->jdate($result["datecontrat"]); $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->fin_validite = $this->db->jdate($result["fin_validite"]);
$this->date_cloture = $this->db->jdate($result["date_cloture"]); $this->date_cloture = $this->db->jdate($result["date_cloture"]);
@ -634,16 +635,15 @@ class Contrat extends CommonObject
$this->db->free($resql); $this->db->free($resql);
// Retreive all extrafield for thirdparty
// Retreive all extrafield
// fetch optionals attributes and labels // fetch optionals attributes and labels
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); $this->fetch_optionals();
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
/* /*
* Lines * Lines
*/ */
$this->lines = array(); $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']); unset($this->context['createfromclone']);
// End // End

View File

@ -775,24 +775,18 @@ if ($resql)
print '</form>'; print '</form>';
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $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('&amp;','&',$param);
$filedir=$diroutputmassaction; // Show list of available documents
$genallowed=$user->rights->contrat->lire; $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$delallowed=$user->rights->contrat->lire; $urlsource.=str_replace('&amp;','&',$param);
print $formfile->showdocuments('massfilesarea_contract','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); $filedir=$diroutputmassaction;
} $genallowed=$user->rights->contrat->lire;
else $delallowed=$user->rights->contrat->lire;
{
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>'; print $formfile->showdocuments('massfilesarea_contract','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
}
} }
else else
{ {

View File

@ -4481,7 +4481,7 @@ abstract class CommonObject
if (! is_array($optionsArray)) 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. // 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; // global $extrafields;
//if (! is_object($extrafields)) //if (! is_object($extrafields))
//{ //{
@ -4496,6 +4496,10 @@ abstract class CommonObject
} }
$optionsArray = $extrafields->attributes[$this->table_element]['label']; $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; $table_element = $this->table_element;
if ($table_element == 'categorie') $table_element = 'categories'; // For compatibility 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)) if ($key != 'rowid' && $key != 'tms' && $key != 'fk_member' && ! is_int($key))
{ {
// we can add this attribute to object // 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]);
} }
} }
} }

View File

@ -194,12 +194,7 @@ class Ctyperesource
// Retrieve all extrafields for invoice // Retrieve all extrafields for invoice
// fetch optionals attributes and labels // fetch optionals attributes and labels
/* // $this->fetch_optionals();
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_lines(); // $this->fetch_lines();

View File

@ -1404,12 +1404,12 @@ class ExtraFields
if ($type == 'date') if ($type == 'date')
{ {
$showsize=10; $showsize=10;
$value=dol_print_date($value, 'day', 'tzuser'); $value=dol_print_date($value, 'day');
} }
elseif ($type == 'datetime') elseif ($type == 'datetime')
{ {
$showsize=19; $showsize=19;
$value=dol_print_date($value, 'dayhour', 'tzuser'); $value=dol_print_date($value, 'dayhour');
} }
elseif ($type == 'int') elseif ($type == 'int')
{ {

View File

@ -277,17 +277,18 @@ class FormFile
* @param string $codelang Default language code to use on lang combo box if multilang is enabled * @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 string $morepicto Add more HTML content into cell with picto
* @param Object $object Object when method is called from an object card. * @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) * @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 // Deprecation warning
if (0 !== $iconPDF) { if (! empty($iconPDF)) {
dol_syslog(__METHOD__ . ": passing iconPDF parameter is deprecated", LOG_WARNING); dol_syslog(__METHOD__ . ": passing iconPDF parameter is deprecated", LOG_WARNING);
} }
global $langs, $conf, $user, $hookmanager; global $langs, $conf, $user, $hookmanager;
global $form, $bc; global $form;
if (! is_object($form)) $form=new Form($this->db); if (! is_object($form)) $form=new Form($this->db);
@ -305,9 +306,17 @@ class FormFile
} }
$hookmanager->initHooks(array('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; $headershown=0;
$showempty=0; $showempty=0;
$i=0; $i=0;
@ -678,8 +687,6 @@ class FormFile
// Get list of files // Get list of files
if (! empty($filedir)) if (! empty($filedir))
{ {
$file_list=dol_dir_list($filedir,'files',0,'','(\.meta|_preview.*.*\.png)$','date',SORT_DESC);
$link_list = array(); $link_list = array();
if (is_object($object)) 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) 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 $user, $conf, $langs, $hookmanager;
global $bc,$bcdd;
global $sortfield, $sortorder, $maxheightmini; global $sortfield, $sortorder, $maxheightmini;
global $dolibarr_main_url_root; 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) 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 $user, $conf, $langs, $form;
global $bc;
global $sortfield, $sortorder; global $sortfield, $sortorder;
global $search_doc_ref; global $search_doc_ref;
@ -1543,7 +1548,7 @@ class FormFile
if (count($filearray) == 0) if (count($filearray) == 0)
{ {
print '<tr '.$bc[false].'><td colspan="5">'; print '<tr class="oddeven"><td colspan="5">';
if (empty($textifempty)) print $langs->trans("NoFileFound"); if (empty($textifempty)) print $langs->trans("NoFileFound");
else print $textifempty; else print $textifempty;
print '</td></tr>'; print '</td></tr>';
@ -1600,7 +1605,6 @@ class FormFile
public function listOfLinks($object, $permtodelete=1, $action=null, $selected=null, $param='') public function listOfLinks($object, $permtodelete=1, $action=null, $selected=null, $param='')
{ {
global $user, $conf, $langs, $user; global $user, $conf, $langs, $user;
global $bc;
global $sortfield, $sortorder; global $sortfield, $sortorder;
$langs->load("link"); $langs->load("link");
@ -1712,7 +1716,7 @@ class FormFile
} }
if ($nboflinks == 0) if ($nboflinks == 0)
{ {
print '<tr ' . $bc[false] . '><td colspan="5" class="opacitymedium">'; print '<tr class="oddeven"><td colspan="5" class="opacitymedium">';
print $langs->trans("NoLinkFound"); print $langs->trans("NoLinkFound");
print '</td></tr>'; print '</td></tr>';
} }

View File

@ -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 .= '<select id="select'.$htmlname.'" class="flat selectTypeOfContainer" name="'.$htmlname.'"'.($moreattrib?' '.$moreattrib:'').'>';
if ($useempty == 1 || ($useempty == 2 && $num > 1))
{
$out .= '<option value="-1">&nbsp;</option>';
}
foreach($arrayofsamples as $key => $val)
{
if ($selected == $key)
{
$out .= '<option value="'.$key.'" selected>';
}
else
{
$out .= '<option value="'.$key.'">';
}
$out .= $langs->trans($val);
$out .= '</option>';
$i++;
}
$out .= "</select>";
return $out;
}
} }

View File

@ -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_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_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( $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'), '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");
} }
} }

View File

@ -107,8 +107,16 @@ if (empty($reshook) && ! empty($extrafields->attributes[$object->table_element][
print '<td id="'.$html_id.'" class="'.$object->element.'_extras_'.$key.'" colspan="'.$cols.'">'; print '<td id="'.$html_id.'" class="'.$object->element.'_extras_'.$key.'" colspan="'.$cols.'">';
// Convert date into timestamp format // Convert date into timestamp format
if (in_array($extrafields->attributes[$object->table_element]['type'][$key], array('date','datetime'))) { if (in_array($extrafields->attributes[$object->table_element]['type'][$key], array('date','datetime')))
$value = isset($_POST["options_" . $key]) ? dol_mktime($_POST["options_" . $key . "hour"], $_POST["options_" . $key . "min"], 0, $_POST["options_" . $key . "month"], $_POST["options_" . $key . "day"], $_POST["options_" . $key . "year"]) : $db->jdate($object->array_options['options_' . $key]); {
$datenotinstring = $object->array_options['options_' . $key];
// print 'X'.$object->array_options['options_' . $key].'-'.$datenotinstring.'x';
if (! is_numeric($object->array_options['options_' . $key])) // For backward compatibility
{
$datenotinstring = $db->jdate($datenotinstring);
}
//print 'x'.$object->array_options['options_' . $key].'-'.$datenotinstring.' - '.dol_print_date($datenotinstring, 'dayhour');
$value = isset($_POST["options_" . $key]) ? dol_mktime($_POST["options_" . $key . "hour"], $_POST["options_" . $key . "min"], 0, $_POST["options_" . $key . "month"], $_POST["options_" . $key . "day"], $_POST["options_" . $key . "year"]) : $datenotinstring;
} }
//TODO Improve element and rights detection //TODO Improve element and rights detection

View File

@ -665,12 +665,9 @@ class Don extends CommonObject
$this->modelpdf = $obj->model_pdf; $this->modelpdf = $obj->model_pdf;
$this->commentaire = $obj->note; // deprecated $this->commentaire = $obj->note; // deprecated
// Retrieve all extrafield for thirdparty // Retreive all extrafield
// fetch optionals attributes and labels // fetch optionals attributes and labels
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $this->fetch_optionals();
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
} }
return 1; return 1;
} }

View File

@ -337,12 +337,8 @@ class EcmFiles //extends CommonObject
// Retrieve all extrafields for invoice // Retrieve all extrafields for invoice
// fetch optionals attributes and labels // fetch optionals attributes and labels
/* // $this->fetch_optionals();
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_lines(); // $this->fetch_lines();
$this->db->free($resql); $this->db->free($resql);

View File

@ -168,7 +168,7 @@ if (empty($reshook))
$parameters = array('id' => $object->id); $parameters = array('id' => $object->id);
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook)) { if (empty($reshook)) {
$result = $object->insertExtraFields(); $result = $object->insertExtraFields('SHIPMENT_MODIFY');
if ($result < 0) if ($result < 0)
{ {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');

View File

@ -547,12 +547,9 @@ class Expedition extends CommonObject
*/ */
$result=$this->fetch_thirdparty(); $result=$this->fetch_thirdparty();
// Retrieve all extrafields for expedition // Retreive all extrafield
// fetch optionals attributes and labels // fetch optionals attributes and labels
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $this->fetch_optionals();
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
/* /*
* Lines * Lines

View File

@ -193,7 +193,7 @@ if (empty($reshook))
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by $reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by
// some hooks // some hooks
if (empty($reshook)) { if (empty($reshook)) {
$result = $object->insertExtraFields(); $result = $object->insertExtraFields('SHIPMENT_MODIFY');
if ($result < 0) if ($result < 0)
{ {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');

View File

@ -299,7 +299,7 @@ if (empty($reshook))
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by $reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by
// some hooks // some hooks
if (empty($reshook)) { if (empty($reshook)) {
$result = $object->insertExtraFields(); $result = $object->insertExtraFields('FICHINTER_MODIFY');
if ($result < 0) if ($result < 0)
{ {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');

View File

@ -341,11 +341,6 @@ class ExpenseReport extends CommonObject
$reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++; if ($reshook < 0) $error++;
} }
// Call trigger
$result=$this->call_trigger('EXPENSEREPORT_CLONE',$user);
if ($result < 0) $error++;
// End call triggers
} }
unset($this->context['createfromclone']); unset($this->context['createfromclone']);

View File

@ -831,22 +831,18 @@ if ($resql)
if (empty($id)) if (empty($id))
{ {
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $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('&amp;','&',$param);
$filedir=$diroutputmassaction; // Show list of available documents
$genallowed=$user->rights->expensereport->lire; $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$delallowed=$user->rights->expensereport->creer; $urlsource.=str_replace('&amp;','&',$param);
print $formfile->showdocuments('massfilesarea_expensereport','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); $filedir=$diroutputmassaction;
} $genallowed=$user->rights->expensereport->lire;
else $delallowed=$user->rights->expensereport->creer;
{
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>'; print $formfile->showdocuments('massfilesarea_expensereport','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
}
} }
} }
else else

View File

@ -755,7 +755,7 @@ if (empty($reshook))
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook)) if (empty($reshook))
{ {
$result=$object->insertExtraFields(); $result=$object->insertExtraFields('INTERVENTION_MODIFY');
if ($result < 0) if ($result < 0)
{ {
$error++; $error++;

View File

@ -383,14 +383,13 @@ class Fichinter extends CommonObject
if ($this->statut == 0) $this->brouillon = 1; if ($this->statut == 0) $this->brouillon = 1;
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); // Retreive all extrafield
$extrafields=new ExtraFields($this->db); // fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); $this->fetch_optionals();
$this->fetch_optionals($this->id,$extralabels);
/* /*
* Lines * Lines
*/ */
$result=$this->fetch_lines(); $result=$this->fetch_lines();
if ($result < 0) if ($result < 0)
{ {
@ -1107,11 +1106,6 @@ class Fichinter extends CommonObject
$reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++; if ($reshook < 0) $error++;
} }
// Call trigger
$result=$this->call_trigger('INTERVENTION_CLONE',$user);
if ($result < 0) $error++;
// End call triggers
} }
unset($this->context['createfromclone']); unset($this->context['createfromclone']);

View File

@ -563,25 +563,18 @@ if ($resql)
print "</form>\n"; print "</form>\n";
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $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('&amp;','&',$param);
$filedir=$diroutputmassaction; // Show list of available documents
$genallowed=$user->rights->ficheinter->lire; $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$delallowed=$user->rights->ficheinter->creer; $urlsource.=str_replace('&amp;','&',$param);
print $formfile->showdocuments('massfilesarea_interventions','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); $filedir=$diroutputmassaction;
} $genallowed=$user->rights->ficheinter->lire;
else $delallowed=$user->rights->ficheinter->creer;
{
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
}
print $formfile->showdocuments('massfilesarea_interventions','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
} }
else else
{ {

View File

@ -121,7 +121,7 @@ if (empty($reshook))
if ($ret < 0) $error++; if ($ret < 0) $error++;
if (! $error) if (! $error)
{ {
$result = $object->insertExtraFields(); $result = $object->insertExtraFields('COMPANY_MODIFY');
if ($result < 0) $error++; if ($result < 0) $error++;
} }
if ($error) $action = 'edit_extras'; if ($error) $action = 'edit_extras';

View File

@ -310,12 +310,9 @@ class CommandeFournisseur extends CommonOrder
$this->db->free($resql); $this->db->free($resql);
// Retrieve all extrafields // Retreive all extrafield
// fetch optionals attributes and labels // fetch optionals attributes and labels
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); $this->fetch_optionals();
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
if ($this->statut == 0) $this->brouillon = 1; 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 $reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++; 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']); unset($this->context['createfromclone']);

View File

@ -643,10 +643,7 @@ class FactureFournisseur extends CommonInvoice
// Retreive all extrafield // Retreive all extrafield
// fetch optionals attributes and labels // fetch optionals attributes and labels
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); $this->fetch_optionals();
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1; if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1;

View File

@ -963,7 +963,7 @@ if (empty($reshook))
{ {
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used 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) if ($result < 0)
{ {

View File

@ -1176,26 +1176,20 @@ if ($resql)
print '</div>'; print '</div>';
print "</form>\n"; print "</form>\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('&amp;','&',$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 '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
}
$db->free($resql); $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('&amp;','&',$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 else
{ {

View File

@ -1274,7 +1274,7 @@ if (empty($reshook))
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used 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) if ($result < 0)
{ {

View File

@ -1098,22 +1098,18 @@ if ($resql)
print "</form>\n"; print "</form>\n";
/* /*
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $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('&amp;','&',$param);
$filedir=$diroutputmassaction; // Show list of available documents
$genallowed=$user->rights->facture->lire; $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$delallowed=$user->rights->facture->creer; $urlsource.=str_replace('&amp;','&',$param);
print $formfile->showdocuments('massfilesarea_invoices','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); $filedir=$diroutputmassaction;
} $genallowed=$user->rights->facture->lire;
else $delallowed=$user->rights->facture->creer;
{
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>'; print $formfile->showdocuments('massfilesarea_invoices','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
}
*/ */
} }
else else

View File

@ -4,6 +4,7 @@ WebsiteSetupDesc=Create here as much entry as number of different websites you n
DeleteWebsite=Delete website DeleteWebsite=Delete website
ConfirmDeleteWebsite=Are you sure you want to delete this web site. All its pages and content will also be removed. 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_TYPE_CONTAINER=Type of page/container
WEBSITE_PAGE_EXAMPLE=Web page to use as example
WEBSITE_PAGENAME=Page name/alias WEBSITE_PAGENAME=Page name/alias
WEBSITE_CSS_URL=URL of external CSS file WEBSITE_CSS_URL=URL of external CSS file
WEBSITE_CSS_INLINE=CSS file content (common to all pages) WEBSITE_CSS_INLINE=CSS file content (common to all pages)
@ -77,3 +78,5 @@ ImagesShouldBeSavedInto=Images should be saved into directory
WebsiteRootOfImages=Root directory for website images WebsiteRootOfImages=Root directory for website images
SubdirOfPage=Sub-directory dedicated to page SubdirOfPage=Sub-directory dedicated to page
AliasPageAlreadyExists=Alias page <strong>%s</strong> already exists AliasPageAlreadyExists=Alias page <strong>%s</strong> already exists
CorporateHomePage=Corporate Home page
EmptyPage=Empty page

View File

@ -206,7 +206,7 @@ if ($action == 'update_extras')
$parameters = array('id' => $object->id); $parameters = array('id' => $object->id);
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook)) { if (empty($reshook)) {
$result = $object->insertExtraFields(); $result = $object->insertExtraFields('DELIVERY_MODIFY');
if ($result < 0) if ($result < 0)
{ {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');

View File

@ -301,13 +301,9 @@ class Livraison extends CommonObject
if ($this->statut == 0) $this->brouillon = 1; if ($this->statut == 0) $this->brouillon = 1;
// Retreive all extrafield
// Retrieve all extrafields for delivery
// fetch optionals attributes and labels // fetch optionals attributes and labels
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $this->fetch_optionals();
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
/* /*
* Lignes * Lignes

View File

@ -151,13 +151,13 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers
case 'STOCK_MOVEMENT': case 'STOCK_MOVEMENT':
//MYECMDIR //MYECMDIR
case 'MYECMDIR_DELETE':
case 'MYECMDIR_CREATE': case 'MYECMDIR_CREATE':
case 'MYECMDIR_MODIFY': case 'MYECMDIR_MODIFY':
case 'MYECMDIR_DELETE':
// Customer orders // Customer orders
case 'ORDER_CREATE': case 'ORDER_CREATE':
case 'ORDER_CLONE': case 'ORDER_MODIFY':
case 'ORDER_VALIDATE': case 'ORDER_VALIDATE':
case 'ORDER_DELETE': case 'ORDER_DELETE':
case 'ORDER_CANCEL': case 'ORDER_CANCEL':
@ -170,7 +170,7 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers
// Supplier orders // Supplier orders
case 'ORDER_SUPPLIER_CREATE': case 'ORDER_SUPPLIER_CREATE':
case 'ORDER_SUPPLIER_CLONE': case 'ORDER_SUPPLIER_MODIFY':
case 'ORDER_SUPPLIER_VALIDATE': case 'ORDER_SUPPLIER_VALIDATE':
case 'ORDER_SUPPLIER_DELETE': case 'ORDER_SUPPLIER_DELETE':
case 'ORDER_SUPPLIER_APPROVE': case 'ORDER_SUPPLIER_APPROVE':
@ -184,7 +184,6 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers
// Proposals // Proposals
case 'PROPAL_CREATE': case 'PROPAL_CREATE':
case 'PROPAL_CLONE':
case 'PROPAL_MODIFY': case 'PROPAL_MODIFY':
case 'PROPAL_VALIDATE': case 'PROPAL_VALIDATE':
case 'PROPAL_SENTBYMAIL': case 'PROPAL_SENTBYMAIL':
@ -197,7 +196,6 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers
// SupplierProposal // SupplierProposal
case 'SUPPLIER_PROPOSAL_CREATE': case 'SUPPLIER_PROPOSAL_CREATE':
case 'SUPPLIER_PROPOSAL_CLONE':
case 'SUPPLIER_PROPOSAL_MODIFY': case 'SUPPLIER_PROPOSAL_MODIFY':
case 'SUPPLIER_PROPOSAL_VALIDATE': case 'SUPPLIER_PROPOSAL_VALIDATE':
case 'SUPPLIER_PROPOSAL_SENTBYMAIL': case 'SUPPLIER_PROPOSAL_SENTBYMAIL':
@ -210,8 +208,8 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers
// Contracts // Contracts
case 'CONTRACT_CREATE': case 'CONTRACT_CREATE':
case 'CONTRACT_ACTIVATE':
case 'CONTRACT_MODIFY': case 'CONTRACT_MODIFY':
case 'CONTRACT_ACTIVATE':
case 'CONTRACT_CANCEL': case 'CONTRACT_CANCEL':
case 'CONTRACT_CLOSE': case 'CONTRACT_CLOSE':
case 'CONTRACT_DELETE': case 'CONTRACT_DELETE':
@ -221,7 +219,6 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers
// Bills // Bills
case 'BILL_CREATE': case 'BILL_CREATE':
case 'BILL_CLONE':
case 'BILL_MODIFY': case 'BILL_MODIFY':
case 'BILL_VALIDATE': case 'BILL_VALIDATE':
case 'BILL_UNVALIDATE': case 'BILL_UNVALIDATE':

View File

@ -542,25 +542,21 @@ print '</form>'."\n";
if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords))
{ {
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=1;
{ if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0;
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php');
$formfile = new FormFile($db);
// Show list of available documents require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php');
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; $formfile = new FormFile($db);
$urlsource.=str_replace('&amp;','&',$param);
$filedir=$diroutputmassaction; // Show list of available documents
$genallowed=$user->rights->mymodule->read; $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$delallowed=$user->rights->mymodule->create; $urlsource.=str_replace('&amp;','&',$param);
print $formfile->showdocuments('massfilesarea_mymodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); $filedir=$diroutputmassaction;
} $genallowed=$user->rights->mymodule->read;
else $delallowed=$user->rights->mymodule->create;
{
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>'; print $formfile->showdocuments('massfilesarea_mymodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
}
} }
// End of page // End of page

View File

@ -1951,13 +1951,9 @@ class Product extends CommonObject
$this->db->free($resql); $this->db->free($resql);
// Retreive all extrafield
// Retreive all extrafield for current object
// fetch optionals attributes and labels // fetch optionals attributes and labels
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); $this->fetch_optionals();
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
// multilangs // multilangs
if (! empty($conf->global->MAIN_MULTILANGS)) $this->getMultiLangs(); if (! empty($conf->global->MAIN_MULTILANGS)) $this->getMultiLangs();

View File

@ -494,25 +494,21 @@ print '</form>'."\n";
if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords))
{ {
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=1;
{ if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0;
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php');
$formfile = new FormFile($db);
// Show list of available documents require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php');
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; $formfile = new FormFile($db);
$urlsource.=str_replace('&amp;','&',$param);
$filedir=$diroutputmassaction; // Show list of available documents
$genallowed=$user->rights->mymodule->read; $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$delallowed=$user->rights->mymodule->create; $urlsource.=str_replace('&amp;','&',$param);
print $formfile->showdocuments('massfilesarea_mymodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); $filedir=$diroutputmassaction;
} $genallowed=$user->rights->mymodule->read;
else $delallowed=$user->rights->mymodule->create;
{
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>'; print $formfile->showdocuments('massfilesarea_mymodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
}
} }
// End of page // End of page

View File

@ -576,12 +576,9 @@ class MouvementStock extends CommonObject
$this->sellby = $this->db->jdate($obj->sellby); $this->sellby = $this->db->jdate($obj->sellby);
} }
// Retrieve all extrafields for invoice // Retreive all extrafield
// fetch optionals attributes and labels // fetch optionals attributes and labels
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $this->fetch_optionals();
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
// $this->fetch_lines(); // $this->fetch_lines();

View File

@ -233,12 +233,9 @@ class Productlot extends CommonObject
$this->fk_user_modif = $obj->fk_user_modif; $this->fk_user_modif = $obj->fk_user_modif;
$this->import_key = $obj->import_key; $this->import_key = $obj->import_key;
// Retrieve all extrafields for invoice // Retreive all extrafield
// fetch optionals attributes and labels // fetch optionals attributes and labels
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $this->fetch_optionals();
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
} }
$this->db->free($resql); $this->db->free($resql);

View File

@ -202,12 +202,9 @@ class ProductStockEntrepot extends CommonObject
} }
// Retrieve all extrafields for invoice // Retreive all extrafield
// fetch optionals attributes and labels // fetch optionals attributes and labels
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $this->fetch_optionals();
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
// $this->fetch_lines(); // $this->fetch_lines();

View File

@ -135,7 +135,7 @@ if (empty($reshook))
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by $reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by
// some hooks // some hooks
if (empty($reshook)) { if (empty($reshook)) {
$result = $object->insertExtraFields(); $result = $object->insertExtraFields('PRODUCT_LOT_MODIFY');
if ($result < 0) if ($result < 0)
{ {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');

View File

@ -537,22 +537,18 @@ if ($resql)
print '</form>'."\n"; print '</form>'."\n";
/* /*
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $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('&amp;','&',$param);
$filedir=$diroutputmassaction; // Show list of available documents
$genallowed=$user->rights->facture->lire; $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$delallowed=$user->rights->facture->creer; $urlsource.=str_replace('&amp;','&',$param);
print $formfile->showdocuments('massfilesarea_orders','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); $filedir=$diroutputmassaction;
} $genallowed=$user->rights->facture->lire;
else $delallowed=$user->rights->facture->creer;
{
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>'; print $formfile->showdocuments('massfilesarea_orders','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
}
*/ */
} }
else else

View File

@ -444,7 +444,8 @@ class Project extends CommonObject
$this->db->free($resql); $this->db->free($resql);
// Retreive all extrafield for thirdparty // Retreive all extrafield
// fetch optionals attributes and labels
$this->fetch_optionals(); $this->fetch_optionals();
if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT)) if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT))

View File

@ -266,8 +266,9 @@ class Task extends CommonObject
$this->task_parent_position = $obj->task_parent_position; $this->task_parent_position = $obj->task_parent_position;
} }
// Retreive all extrafield data // Retreive all extrafield
$this->fetch_optionals(); // fetch optionals attributes and labels
$this->fetch_optionals();
} }
$this->db->free($resql); $this->db->free($resql);

View File

@ -213,13 +213,9 @@ class Dolresource extends CommonObject
$this->note_private = $obj->note_private; $this->note_private = $obj->note_private;
$this->type_label = $obj->type_label; $this->type_label = $obj->type_label;
// Retreive all extrafield for thirdparty // Retreive all extrafield
// fetch optionals attributes and labels // fetch optionals attributes and labels
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); $this->fetch_optionals();
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
} }
$this->db->free($resql); $this->db->free($resql);

View File

@ -334,7 +334,7 @@ if (empty($reshook))
if (! $error) if (! $error)
{ {
$result = $object->insertExtraFields(); $result = $object->insertExtraFields('COMPANY_MODIFY');
if ($result < 0) if ($result < 0)
{ {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');

View File

@ -1315,8 +1315,9 @@ class Societe extends CommonObject
$result = 1; $result = 1;
// Retreive all extrafield for thirdparty // Retreive all extrafield
$this->fetch_optionals(); // fetch optionals attributes and labels
$this->fetch_optionals();
} }
else else
{ {

View File

@ -525,25 +525,21 @@ print '</form>'."\n";
if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords))
{ {
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=1;
{ if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0;
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php');
$formfile = new FormFile($db);
// Show list of available documents require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php');
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; $formfile = new FormFile($db);
$urlsource.=str_replace('&amp;','&',$param);
$filedir=$diroutputmassaction; // Show list of available documents
$genallowed=$user->rights->mymodule->read; $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$delallowed=$user->rights->mymodule->create; $urlsource.=str_replace('&amp;','&',$param);
print $formfile->showdocuments('massfilesarea_mymodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); $filedir=$diroutputmassaction;
} $genallowed=$user->rights->mymodule->read;
else $delallowed=$user->rights->mymodule->create;
{
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>'; print $formfile->showdocuments('massfilesarea_mymodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
}
} }

View File

@ -934,7 +934,7 @@ if (empty($reshook))
if (! $error) if (! $error)
{ {
$result = $object->insertExtraFields(); $result = $object->insertExtraFields('SUPPLIER_PROPOSAL_MODIFY');
if ($result < 0) if ($result < 0)
{ {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');

View File

@ -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 $reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++; if ($reshook < 0) $error++;
} }
// Call trigger
$result=$this->call_trigger('SUPPLIER_PROPOSAL_CLONE',$user);
if ($result < 0) { $error++; }
// End call triggers
} }
// End // End
@ -1220,12 +1215,9 @@ class SupplierProposal extends CommonObject
$this->brouillon = 1; $this->brouillon = 1;
} }
// Retreive all extrafield for invoice // Retreive all extrafield
// fetch optionals attributes and labels // fetch optionals attributes and labels
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $this->fetch_optionals();
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
$this->db->free($resql); $this->db->free($resql);
@ -1316,12 +1308,9 @@ class SupplierProposal extends CommonObject
return -1; return -1;
} }
// Retreive all extrafield for askprice // Retreive all extrafield
// fetch optionals attributes and labels // fetch optionals attributes and labels
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $this->fetch_optionals();
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
return 1; return 1;
} }

View File

@ -858,26 +858,19 @@ if ($resql)
print '</form>'."\n"; print '</form>'."\n";
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $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('&amp;','&',$param);
$filedir=$diroutputmassaction; // Show list of available documents
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param);
$genallowed=$user->rights->supplier_proposal->lire; $filedir=$diroutputmassaction;
$delallowed=$user->rights->supplier_proposal->creer;
print $formfile->showdocuments('massfilesarea_supplier_proposal','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,'',''); $genallowed=$user->rights->supplier_proposal->lire;
} $delallowed=$user->rights->supplier_proposal->creer;
else
{
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
}
print $formfile->showdocuments('massfilesarea_supplier_proposal','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
} }
else else
{ {

View File

@ -324,12 +324,9 @@ class User extends CommonObject
// in such case, this admin user must be admin for ALL entities. // 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; 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 // fetch optionals attributes and labels
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); $this->fetch_optionals();
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
$this->db->free($result); $this->db->free($result);
} }

View File

@ -116,12 +116,9 @@ class UserGroup extends CommonObject
$this->members=$this->listUsersForGroup(); $this->members=$this->listUsersForGroup();
// Retreive all extrafield for group // Retreive all extrafield
// fetch optionals attributes and labels // fetch optionals attributes and labels
dol_include_once('/core/class/extrafields.class.php'); $this->fetch_optionals();
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
// Sav current LDAP Current DN // Sav current LDAP Current DN

View File

@ -153,7 +153,7 @@ $htmlheadercontentdefault.='<script src="//cdnjs.cloudflare.com/ajax/libs/jquery
$htmlheadercontentdefault.='<script src="//cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js"></script>'."\n"; $htmlheadercontentdefault.='<script src="//cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js"></script>'."\n";
$htmlheadercontentdefault.='<script src="//cdnjs.cloudflare.com/ajax/libs/popper.js/1.13.0/umd/popper.min.js"></script>'."\n"; $htmlheadercontentdefault.='<script src="//cdnjs.cloudflare.com/ajax/libs/popper.js/1.13.0/umd/popper.min.js"></script>'."\n";
$htmlheadercontentdefault.='<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-beta.2/js/bootstrap.min.js"></script>'."\n"; $htmlheadercontentdefault.='<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-beta.2/js/bootstrap.min.js"></script>'."\n";
$htmlheadercontentdefault.='<script src="/document.php?modulepart=medias&file=relativepathtomyfile.js"></script>'."\n"; $htmlheadercontentdefault.='<script src="/document.php?modulepart=medias&file=js/myfile.js"></script>'."\n";
/* /*
@ -552,8 +552,13 @@ if ($action == 'addcontainer')
$substitutionarray=array(); $substitutionarray=array();
$substitutionarray['__WEBSITE_CREATE_BY__']=$user->getFullName($langs); $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, ... // 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) 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 $formwebsite->selectTypeOfContainer('WEBSITE_TYPE_CONTAINER', (GETPOST('WEBSITE_TYPE_CONTAINER')?GETPOST('WEBSITE_TYPE_CONTAINER'):'page'));
print '</td></tr>'; print '</td></tr>';
print '<tr><td class="titlefield fieldrequired">';
print $langs->trans('WEBSITE_PAGE_EXAMPLE');
print '</td><td>';
print $formwebsite->selectSampleOfContainer('sample', (GETPOST('sample')?GETPOST('sample'):'corporatehomepage'));
print '</td></tr>';
print '<tr><td class="titlefieldcreate fieldrequired">'; print '<tr><td class="titlefieldcreate fieldrequired">';
print $langs->trans('WEBSITE_PAGENAME'); print $langs->trans('WEBSITE_PAGENAME');
print '</td><td>'; print '</td><td>';

View File

@ -0,0 +1,10 @@
<div class="dolcontenteditable" contenteditable="true">
<div style="text-align: center"><h1>__[MAIN_INFO_SOCIETE_NOM]__</h1><br>
__(MyContainerTitle)__
</div>
</div>
<div class="dolcontenteditable" contenteditable="true">
<br>
<div style="text-align: center">Created by: __WEBSITE_CREATE_BY__</div>
<br>
</div>