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

This commit is contained in:
John 2018-02-21 11:45:23 +01:00
commit 629b8e618e
74 changed files with 768 additions and 588 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

@ -28,27 +28,331 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
/** /**
* Class to manage categories of an accounting account * Class to manage categories of an accounting account
*/ */
class AccountancyCategory class AccountancyCategory // extends CommonObject
{ {
private $db; public $db; //!< To store db handler
public $error; public $error; //!< To return error code (or message)
public $errors = array (); public $errors=array(); //!< To return several error codes (or messages)
public $element = 'accounting_category'; public $element='c_accounting_category'; //!< Id that identify managed objects
public $table_element = 'c_accounting_category'; public $table_element='c_accounting_category'; //!< Name of table without prefix where object is stored
public $id; public $id;
public $code;
public $label;
public $range_account;
public $sens;
public $category_type;
public $formula;
public $position;
public $fk_country;
public $active;
public $lines_cptbk; public $lines_cptbk;
public $lines_display; public $lines_display;
public $sdc; public $sdc;
/** /**
* Constructor * Constructor
* *
* @param DoliDB $db Database handler * @param DoliDb $db Database handler
*/ */
public function __construct($db) { function __construct($db)
{
$this->db = $db; $this->db = $db;
} }
/**
* Create object into database
*
* @param User $user User that create
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, Id of created object if OK
*/
function create($user, $notrigger=0)
{
global $conf, $langs;
$error=0;
// Clean parameters
if (isset($this->code)) $this->code=trim($this->code);
if (isset($this->label)) $this->label=trim($this->label);
if (isset($this->range_account)) $this->range_account=trim($this->range_account);
if (isset($this->sens)) $this->sens=trim($this->sens);
if (isset($this->category_type)) $this->category_type=trim($this->category_type);
if (isset($this->formula)) $this->formula=trim($this->formula);
if (isset($this->position)) $this->position=trim($this->position);
if (isset($this->fk_country)) $this->fk_country=trim($this->fk_country);
if (isset($this->active)) $this->active=trim($this->active);
// Check parameters
// Put here code to add control on parameters values
// Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."c_accounting_category(";
if ($this->rowid > 0) $sql.= "rowid,";
$sql.= "code,";
$sql.= "label,";
$sql.= "range_account,";
$sql.= "sens,";
$sql.= "category_type,";
$sql.= "formula,";
$sql.= "position,";
$sql.= "fk_country,";
$sql.= "active";
$sql.= ") VALUES (";
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->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->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();
dol_syslog(get_class($this)."::create", LOG_DEBUG);
$resql=$this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
if (! $error)
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."c_accounting_category");
if (! $notrigger)
{
// Uncomment this and change MYOBJECT to your own tag if you
// want this action call a trigger.
//// Call triggers
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
//$interface=new Interfaces($this->db);
//$result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf);
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
//// End call triggers
}
}
// Commit or rollback
if ($error)
{
foreach($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg);
}
$this->db->rollback();
return -1*$error;
}
else
{
$this->db->commit();
return $this->id;
}
}
/**
* Load object in memory from database
*
* @param int $id Id object
* @param string $code Code
* @param string $label Label
* @return int <0 if KO, >0 if OK
*/
function fetch($id,$code='',$label='')
{
global $langs;
$sql = "SELECT";
$sql.= " t.rowid,";
$sql.= " t.code,";
$sql.= " t.label,";
$sql.= " t.range_account,";
$sql.= " t.sens,";
$sql.= " t.category_type,";
$sql.= " t.formula,";
$sql.= " t.position,";
$sql.= " t.fk_country,";
$sql.= " t.active";
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as t";
if ($id) $sql.= " WHERE t.rowid = ".$id;
elseif ($code) $sql.= " WHERE t.code = '".$this->db->escape($code)."'";
elseif ($label) $sql.= " WHERE t.label = '".$this->db->escape($label)."'";
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
if ($this->db->num_rows($resql))
{
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
$this->code = $obj->code;
$this->label = $obj->label;
$this->range_account = $obj->range_account;
$this->sens = $obj->sens;
$this->category_type = $obj->category_type;
$this->formula = $obj->formula;
$this->position = $obj->position;
$this->fk_country = $obj->fk_country;
$this->active = $obj->active;
}
$this->db->free($resql);
return 1;
}
else
{
$this->error="Error ".$this->db->lasterror();
return -1;
}
}
/**
* Update object into database
*
* @param User $user User that modify
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function update($user=null, $notrigger=0)
{
global $conf, $langs;
$error=0;
// Clean parameters
if (isset($this->code)) $this->code=trim($this->code);
if (isset($this->label)) $this->label=trim($this->label);
if (isset($this->range_account)) $this->range_account=trim($this->range_account);
if (isset($this->sens)) $this->sens=trim($this->sens);
if (isset($this->category_type)) $this->category_type=trim($this->category_type);
if (isset($this->formula)) $this->formula=trim($this->formula);
if (isset($this->position)) $this->position=trim($this->position);
if (isset($this->fk_country)) $this->fk_country=trim($this->fk_country);
if (isset($this->active)) $this->active=trim($this->active);
// Check parameters
// Put here code to add control on parameters values
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."c_accounting_category SET";
$sql.= " code=".(isset($this->code)?"'".$this->db->escape($this->code)."'":"null").",";
$sql.= " label=".(isset($this->label)?"'".$this->db->escape($this->label)."'":"null").",";
$sql.= " range_account=".(isset($this->range_account)?"'".$this->db->escape($this->range_account)."'":"null").",";
$sql.= " sens=".(isset($this->sens)?$this->sens:"null").",";
$sql.= " category_type=".(isset($this->category_type)?$this->category_type:"null").",";
$sql.= " formula=".(isset($this->formula)?"'".$this->db->escape($this->formula)."'":"null").",";
$sql.= " position=".(isset($this->position)?$this->position:"null").",";
$sql.= " fk_country=".(isset($this->fk_country)?$this->fk_country:"null").",";
$sql.= " active=".(isset($this->active)?$this->active:"null")."";
$sql.= " WHERE rowid=".$this->id;
$this->db->begin();
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
if (! $error)
{
if (! $notrigger)
{
// Uncomment this and change MYOBJECT to your own tag if you
// want this action call a trigger.
//// Call triggers
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
//$interface=new Interfaces($this->db);
//$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
//// End call triggers
}
}
// Commit or rollback
if ($error)
{
foreach($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg);
}
$this->db->rollback();
return -1*$error;
}
else
{
$this->db->commit();
return 1;
}
}
/**
* Delete object in database
*
* @param User $user User that delete
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function delete($user, $notrigger=0)
{
global $conf, $langs;
$error=0;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."c_accounting_category";
$sql.= " WHERE rowid=".$this->id;
$this->db->begin();
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
if (! $error)
{
if (! $notrigger)
{
// Uncomment this and change MYOBJECT to your own tag if you
// want this action call a trigger.
//// Call triggers
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
//$interface=new Interfaces($this->db);
//$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
//// End call triggers
}
}
// Commit or rollback
if ($error)
{
foreach($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg);
}
$this->db->rollback();
return -1*$error;
}
else
{
$this->db->commit();
return 1;
}
}
/** /**
* Function to select all accounting accounts from an accounting category * Function to select all accounting accounts from an accounting category
* *
@ -443,65 +747,6 @@ class AccountancyCategory
} }
// calcule
/* I try to replace this with dol_eval()
const PATTERN = '/(?:\-?\d+(?:\.?\d+)?[\+\-\*\/])+\-?\d+(?:\.?\d+)?/';
const PARENTHESIS_DEPTH = 10;
public function calculate($input)
{
global $langs;
if(strpos($input, '+') != null || strpos($input, '-') != null || strpos($input, '/') != null || strpos($input, '*') != null){
// Remove white spaces and invalid math chars
$input = str_replace($langs->trans("ThousandSeparator"), '', $input);
$input = str_replace(',', '.', $input);
$input = preg_replace('[^0-9\.\+\-\*\/\(\)]', '', $input);
// Calculate each of the parenthesis from the top
$i = 0;
while(strpos($input, '(') || strpos($input, ')')){
$input = preg_replace_callback('/\(([^\(\)]+)\)/', 'self::callback', $input);
$i++;
if($i > self::PARENTHESIS_DEPTH){
break;
}
}
// Calculate the result
if(preg_match(self::PATTERN, $input, $match)){
return $this->compute($match[0]);
}
return 0;
}
return $input;
}
private function compute($input){
$compute = create_function('', 'return '.$input.';');
return 0 + $compute();
}
private function callback($input){
if(is_numeric($input[1])){
return $input[1];
}
elseif(preg_match(self::PATTERN, $input[1], $match)){
return $this->compute($match[0]);
}
return 0;
}
*/
/** /**
* Get all accounting account of a group. * Get all accounting account of a group.
* You must choose between first parameter (personalized group) or the second (free criteria filter) * You must choose between first parameter (personalized group) or the second (free criteria filter)

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,11 +507,12 @@ 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'); require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php');
$formfile = new FormFile($db); $formfile = new FormFile($db);
$hidegeneratedfilelistifempty=1;
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0;
// Show list of available documents // Show list of available documents
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param); $urlsource.=str_replace('&amp;','&',$param);
@ -520,12 +521,7 @@ if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nb
$genallowed=$user->rights->monmodule->read; $genallowed=$user->rights->monmodule->read;
$delallowed=$user->rights->monmodule->create; $delallowed=$user->rights->monmodule->create;
print $formfile->showdocuments('massfilesarea_monmodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); print $formfile->showdocuments('massfilesarea_monmodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
}
else
{
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
}
} }
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,11 +892,10 @@ 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 // Show list of available documents
*/
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param); $urlsource.=str_replace('&amp;','&',$param);
@ -904,13 +903,7 @@ if ($resql)
$genallowed=$user->rights->propal->lire; $genallowed=$user->rights->propal->lire;
$delallowed=$user->rights->propal->creer; $delallowed=$user->rights->propal->creer;
print $formfile->showdocuments('massfilesarea_proposals','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,'',''); print $formfile->showdocuments('massfilesarea_proposals','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
}
else
{
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
}
} }
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,11 +1101,10 @@ 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 // Show list of available documents
*/
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param); $urlsource.=str_replace('&amp;','&',$param);
@ -1113,13 +1112,7 @@ if ($resql)
$genallowed=$user->rights->commande->lire; $genallowed=$user->rights->commande->lire;
$delallowed=$user->rights->commande->creer; $delallowed=$user->rights->commande->creer;
print $formfile->showdocuments('massfilesarea_orders','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); print $formfile->showdocuments('massfilesarea_orders','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
}
else
{
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
}
} }
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,7 +790,10 @@ class Facture extends CommonInvoice
// Charge facture source // Charge facture source
$facture=new Facture($this->db); $facture=new Facture($this->db);
// Retreive all extrafield
// fetch optionals attributes and labels
$this->fetch_optionals(); $this->fetch_optionals();
if(!empty($this->array_options)){ if(!empty($this->array_options)){
$facture->array_options = $this->array_options; $facture->array_options = $this->array_options;
} }
@ -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,12 +1331,9 @@ 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

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,8 +1192,9 @@ 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 // Show list of available documents
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param); $urlsource.=str_replace('&amp;','&',$param);
@ -1202,12 +1203,7 @@ if ($resql)
$genallowed=$user->rights->facture->lire; $genallowed=$user->rights->facture->lire;
$delallowed=$user->rights->facture->creer; $delallowed=$user->rights->facture->creer;
print $formfile->showdocuments('massfilesarea_invoices','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); print $formfile->showdocuments('massfilesarea_invoices','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
}
else
{
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
}
} }
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++;
} }
@ -634,12 +635,11 @@ 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
@ -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,11 +775,10 @@ 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 // Show list of available documents
*/
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param); $urlsource.=str_replace('&amp;','&',$param);
@ -787,12 +786,7 @@ if ($resql)
$genallowed=$user->rights->contrat->lire; $genallowed=$user->rights->contrat->lire;
$delallowed=$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,''); print $formfile->showdocuments('massfilesarea_contract','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
}
else
{
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
}
} }
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,8 +4533,18 @@ 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
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; $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

@ -4,6 +4,7 @@
* Copyright (C) 2014 Ari Elbaz (elarifr) <github@accedinfo.com> * Copyright (C) 2014 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2017 Open-DSI <support@open-dsi.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -235,5 +236,25 @@ class modAccounting extends DolibarrModules
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'accounting_account as aa, '.MAIN_DB_PREFIX.'accounting_system as ac'; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'accounting_account as aa, '.MAIN_DB_PREFIX.'accounting_system as ac';
$this->export_sql_end[$r] .=' WHERE ac.pcg_version = aa.fk_pcg_version AND aa.entity IN ('.getEntity('accounting').') '; $this->export_sql_end[$r] .=' WHERE ac.pcg_version = aa.fk_pcg_version AND aa.entity IN ('.getEntity('accounting').') ';
// Imports
//--------
$r=0;
$r++;
$this->import_code[$r]=$this->rights_class.'_'.$r;
$this->import_label[$r]="Chartofaccounts"; // Translation key
$this->import_icon[$r]=$this->picto;
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r]=array('aa'=>MAIN_DB_PREFIX.'accounting_account');
$this->import_tables_creator_array[$r]=array('aa'=>'fk_user_author'); // Fields to store import user id
$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'=>'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"=>"","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,8 +831,9 @@ 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 // Show list of available documents
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param); $urlsource.=str_replace('&amp;','&',$param);
@ -841,12 +842,7 @@ if ($resql)
$genallowed=$user->rights->expensereport->lire; $genallowed=$user->rights->expensereport->lire;
$delallowed=$user->rights->expensereport->creer; $delallowed=$user->rights->expensereport->creer;
print $formfile->showdocuments('massfilesarea_expensereport','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); print $formfile->showdocuments('massfilesarea_expensereport','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
}
else
{
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
}
} }
} }
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,10 +383,9 @@ 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
@ -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,11 +563,10 @@ 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 // Show list of available documents
*/
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param); $urlsource.=str_replace('&amp;','&',$param);
@ -575,13 +574,7 @@ if ($resql)
$genallowed=$user->rights->ficheinter->lire; $genallowed=$user->rights->ficheinter->lire;
$delallowed=$user->rights->ficheinter->creer; $delallowed=$user->rights->ficheinter->creer;
print $formfile->showdocuments('massfilesarea_interventions','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); print $formfile->showdocuments('massfilesarea_interventions','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
}
else
{
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
}
} }
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,11 +1176,12 @@ if ($resql)
print '</div>'; print '</div>';
print "</form>\n"; print "</form>\n";
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $db->free($resql);
{
/* $hidegeneratedfilelistifempty=1;
* Show list of available documents if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0;
*/
// Show list of available documents
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param); $urlsource.=str_replace('&amp;','&',$param);
@ -1188,14 +1189,7 @@ if ($resql)
$genallowed=$user->rights->fournisseur->commande->lire; $genallowed=$user->rights->fournisseur->commande->lire;
$delallowed=$user->rights->fournisseur->commande->creer; $delallowed=$user->rights->fournisseur->commande->creer;
print $formfile->showdocuments('massfilesarea_supplier_order','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); print $formfile->showdocuments('massfilesarea_supplier_order','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
}
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);
} }
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,8 +1098,9 @@ 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 // Show list of available documents
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param); $urlsource.=str_replace('&amp;','&',$param);
@ -1108,12 +1109,7 @@ if ($resql)
$genallowed=$user->rights->facture->lire; $genallowed=$user->rights->facture->lire;
$delallowed=$user->rights->facture->creer; $delallowed=$user->rights->facture->creer;
print $formfile->showdocuments('massfilesarea_invoices','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); print $formfile->showdocuments('massfilesarea_invoices','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
}
else
{
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
}
*/ */
} }
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,8 +542,9 @@ 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'); require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php');
$formfile = new FormFile($db); $formfile = new FormFile($db);
@ -555,12 +556,7 @@ if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nb
$genallowed=$user->rights->mymodule->read; $genallowed=$user->rights->mymodule->read;
$delallowed=$user->rights->mymodule->create; $delallowed=$user->rights->mymodule->create;
print $formfile->showdocuments('massfilesarea_mymodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); print $formfile->showdocuments('massfilesarea_mymodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
}
else
{
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
}
} }
// 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,8 +494,9 @@ 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'); require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php');
$formfile = new FormFile($db); $formfile = new FormFile($db);
@ -507,12 +508,7 @@ if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nb
$genallowed=$user->rights->mymodule->read; $genallowed=$user->rights->mymodule->read;
$delallowed=$user->rights->mymodule->create; $delallowed=$user->rights->mymodule->create;
print $formfile->showdocuments('massfilesarea_mymodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); print $formfile->showdocuments('massfilesarea_mymodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
}
else
{
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
}
} }
// 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,8 +537,9 @@ 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 // Show list of available documents
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param); $urlsource.=str_replace('&amp;','&',$param);
@ -547,12 +548,7 @@ if ($resql)
$genallowed=$user->rights->facture->lire; $genallowed=$user->rights->facture->lire;
$delallowed=$user->rights->facture->creer; $delallowed=$user->rights->facture->creer;
print $formfile->showdocuments('massfilesarea_orders','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); print $formfile->showdocuments('massfilesarea_orders','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
}
else
{
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
}
*/ */
} }
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,7 +266,8 @@ 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
// fetch optionals attributes and labels
$this->fetch_optionals(); $this->fetch_optionals();
} }

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

View File

@ -525,8 +525,9 @@ 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'); require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php');
$formfile = new FormFile($db); $formfile = new FormFile($db);
@ -538,12 +539,7 @@ if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nb
$genallowed=$user->rights->mymodule->read; $genallowed=$user->rights->mymodule->read;
$delallowed=$user->rights->mymodule->create; $delallowed=$user->rights->mymodule->create;
print $formfile->showdocuments('massfilesarea_mymodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); print $formfile->showdocuments('massfilesarea_mymodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
}
else
{
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
}
} }

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