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,7 +12,9 @@ Following changes may create regressions for some external modules, but were nec
'doaction' into 'sendMail'.
* Rename trigger CONTRACT_SERVICE_ACTIVATE into LINECONTRACT_ACTIVATE and
CONTRACT_SERVICE_CLOSE into LINECONTRACT_CLOSE
* Remove triggers *_CLONE. The trigger CREATE with context 'createfromclone' is already called so this is
a duplicated feature. Cloning is not a business event, the business event is CREATE, so no trigger required.
***** ChangeLog for 7.0.0 compared to 6.0.5 *****
For users:

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 AccountancyCategory
class AccountancyCategory // extends CommonObject
{
private $db;
public $error;
public $errors = array ();
public $element = 'accounting_category';
public $table_element = 'c_accounting_category';
public $db; //!< To store db handler
public $error; //!< To return error code (or message)
public $errors=array(); //!< To return several error codes (or messages)
public $element='c_accounting_category'; //!< Id that identify managed objects
public $table_element='c_accounting_category'; //!< Name of table without prefix where object is stored
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_display;
public $sdc;
/**
* Constructor
* Constructor
*
* @param DoliDB $db Database handler
* @param DoliDb $db Database handler
*/
public function __construct($db) {
function __construct($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
*
@ -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.
* 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;
// Retreive all extrafield for thirdparty
// Retreive all extrafield
// fetch optionals attributes and labels
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
$this->fetch_optionals();
// Load other properties
$result=$this->fetch_subscriptions();

View File

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

View File

@ -236,7 +236,9 @@ class Categorie extends CommonObject
$this->type = $res['type'];
$this->entity = $res['entity'];
$this->fetch_optionals($this->id,null);
// Retreive all extrafield
// fetch optionals attributes and labels
$this->fetch_optionals();
$this->db->free($resql);

View File

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

View File

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

View File

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

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

View File

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

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

View File

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

View File

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

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
// some hooks
if (empty($reshook)) {
$result = $object->insertExtraFields();
$result = $object->insertExtraFields('BILL_MODIFY');
if ($result < 0)
{
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;
// Retreive all extrafield for thirdparty
// Retreive all extrafield
// fetch optionals attributes and labels
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
$this->fetch_optionals();
/*
* Lines

View File

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

View File

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

View File

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

View File

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

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

View File

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

View File

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

View File

@ -4481,7 +4481,7 @@ abstract class CommonObject
if (! is_array($optionsArray))
{
// If $extrafields is not a known object, we initialize it. Best practice is to have $extrafields defined into card.php or list.php page.
// TODO Use of existing extrafield is not yet ready (must mutualize code that use extrafields in form first)
// TODO Use of existing $extrafield is not yet ready (must mutualize code that use extrafields in form first)
// global $extrafields;
//if (! is_object($extrafields))
//{
@ -4496,6 +4496,10 @@ abstract class CommonObject
}
$optionsArray = $extrafields->attributes[$this->table_element]['label'];
}
else
{
dol_syslog("Warning: fetch_optionals was called with param $optionsArray defined when you should pass null now", LOG_WARNING);
}
$table_element = $this->table_element;
if ($table_element == 'categorie') $table_element = 'categories'; // For compatibility
@ -4529,7 +4533,17 @@ abstract class CommonObject
if ($key != 'rowid' && $key != 'tms' && $key != 'fk_member' && ! is_int($key))
{
// we can add this attribute to object
$this->array_options["options_".$key]=$value;
if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('date','datetime')))
{
//var_dump($extrafields->attributes[$this->table_element]['type'][$key]);
$this->array_options["options_".$key]=$this->db->jdate($value);
}
else
{
$this->array_options["options_".$key]=$value;
}
//var_dump('key '.$key.' '.$value.' type='.$extrafields->attributes[$this->table_element]['type'][$key].' '.$this->array_options["options_".$key]);
}
}
}

View File

@ -48,14 +48,14 @@ class Ctyperesource
/**
*/
public $code;
public $label;
public $active;
/**
*/
/**
* Constructor
@ -82,7 +82,7 @@ class Ctyperesource
$error = 0;
// Clean parameters
if (isset($this->code)) {
$this->code = trim($this->code);
}
@ -93,26 +93,26 @@ class Ctyperesource
$this->active = trim($this->active);
}
// Check parameters
// Put here code to add control on parameters values
// Insert request
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '(';
$sql.= 'code,';
$sql.= 'label';
$sql.= 'active';
$sql .= ') VALUES (';
$sql .= ' '.(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").',';
$sql .= ' '.(! isset($this->label)?'NULL':"'".$this->db->escape($this->label)."'").',';
$sql .= ' '.(! isset($this->active)?'NULL':$this->active);
$sql .= ')';
$this->db->begin();
@ -165,18 +165,18 @@ class Ctyperesource
$sql = 'SELECT';
$sql .= ' t.rowid,';
$sql .= " t.code,";
$sql .= " t.label,";
$sql .= " t.active";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
if ($id) $sql.= " WHERE t.id = ".$id;
elseif ($code) $sql.= " WHERE t.code = '".$this->db->escape($code)."'";
elseif ($label) $sql.= " WHERE t.label = '".$this->db->escape($label)."'";
$resql = $this->db->query($sql);
if ($resql) {
$numrows = $this->db->num_rows($resql);
@ -184,25 +184,20 @@ class Ctyperesource
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
$this->code = $obj->code;
$this->label = $obj->label;
$this->active = $obj->active;
}
// Retrieve all extrafields for invoice
// fetch optionals attributes and labels
/*
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
*/
// $this->fetch_optionals();
// $this->fetch_lines();
$this->db->free($resql);
if ($numrows) {
@ -236,12 +231,12 @@ class Ctyperesource
$sql = 'SELECT';
$sql .= ' t.rowid,';
$sql .= " t.code,";
$sql .= " t.label,";
$sql .= " t.active";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t';
// Manage filter
@ -251,7 +246,7 @@ class Ctyperesource
$sqlwhere [] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
}
}
if (count($sqlwhere) > 0) {
$sql .= ' WHERE ' . implode(' '.$filtermode.' ', $sqlwhere);
}
@ -270,12 +265,12 @@ class Ctyperesource
$line = new self($this->db);
$line->id = $obj->rowid;
$line->code = $obj->code;
$line->label = $obj->label;
$line->active = $obj->active;
}
$this->db->free($resql);
@ -303,7 +298,7 @@ class Ctyperesource
dol_syslog(__METHOD__, LOG_DEBUG);
// Clean parameters
if (isset($this->code)) {
$this->code = trim($this->code);
}
@ -319,12 +314,12 @@ class Ctyperesource
// Update request
$sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET';
$sql .= ' code = '.(isset($this->code)?"'".$this->db->escape($this->code)."'":"null").',';
$sql .= ' label = '.(isset($this->label)?"'".$this->db->escape($this->label)."'":"null").',';
$sql .= ' active = '.(isset($this->active)?$this->active:"null");
$sql .= ' WHERE rowid=' . $this->id;
$this->db->begin();
@ -387,7 +382,7 @@ class Ctyperesource
}
// If you need to delete child tables to, you can insert them here
if (!$error) {
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element;
$sql .= ' WHERE rowid=' . $this->id;
@ -468,7 +463,7 @@ class Ctyperesource
public function initAsSpecimen()
{
$this->id = 0;
$this->code = '';
$this->label = '';
$this->active = '';
@ -488,7 +483,7 @@ class CtyperesourceLine
/**
* @var mixed Sample line property 1
*/
public $code;
public $label;
public $active;
@ -496,5 +491,5 @@ class CtyperesourceLine
/**
* @var mixed Sample line property 2
*/
}

View File

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

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 $morepicto Add more HTML content into cell with picto
* @param Object $object Object when method is called from an object card.
* @param int $hideifempty Hide section of generated files if there is no file
* @return string Output string with HTML array of documents (might be empty string)
*/
function showdocuments($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$notused=0,$noform=0,$param='',$title='',$buttonlabel='',$codelang='',$morepicto='',$object=null)
function showdocuments($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$notused=0,$noform=0,$param='',$title='',$buttonlabel='',$codelang='',$morepicto='',$object=null,$hideifempty=0)
{
// Deprecation warning
if (0 !== $iconPDF) {
if (! empty($iconPDF)) {
dol_syslog(__METHOD__ . ": passing iconPDF parameter is deprecated", LOG_WARNING);
}
global $langs, $conf, $user, $hookmanager;
global $form, $bc;
global $form;
if (! is_object($form)) $form=new Form($this->db);
@ -305,9 +306,17 @@ class FormFile
}
$hookmanager->initHooks(array('formfile'));
$forname='builddoc';
$out='';
// Get list of files
$file_list=null;
if (! empty($filedir))
{
$file_list=dol_dir_list($filedir,'files',0,'','(\.meta|_preview.*.*\.png)$','date',SORT_DESC);
}
if ($hideifempty && empty($file_list)) return '';
$out='';
$forname='builddoc';
$headershown=0;
$showempty=0;
$i=0;
@ -678,8 +687,6 @@ class FormFile
// Get list of files
if (! empty($filedir))
{
$file_list=dol_dir_list($filedir,'files',0,'','(\.meta|_preview.*.*\.png)$','date',SORT_DESC);
$link_list = array();
if (is_object($object))
{
@ -949,7 +956,6 @@ class FormFile
function list_of_documents($filearray,$object,$modulepart,$param='',$forcedownload=0,$relativepath='',$permonobject=1,$useinecm=0,$textifempty='',$maxlength=0,$title='',$url='', $showrelpart=0, $permtoeditline=-1,$upload_dir='',$sortfield='',$sortorder='ASC', $disablemove=1, $addfilterfields=0)
{
global $user, $conf, $langs, $hookmanager;
global $bc,$bcdd;
global $sortfield, $sortorder, $maxheightmini;
global $dolibarr_main_url_root;
@ -1322,7 +1328,6 @@ class FormFile
function list_of_autoecmfiles($upload_dir, $filearray, $modulepart, $param, $forcedownload=0, $relativepath='', $permtodelete=1, $useinecm=0, $textifempty='', $maxlength=0, $url='', $addfilterfields=0)
{
global $user, $conf, $langs, $form;
global $bc;
global $sortfield, $sortorder;
global $search_doc_ref;
@ -1543,7 +1548,7 @@ class FormFile
if (count($filearray) == 0)
{
print '<tr '.$bc[false].'><td colspan="5">';
print '<tr class="oddeven"><td colspan="5">';
if (empty($textifempty)) print $langs->trans("NoFileFound");
else print $textifempty;
print '</td></tr>';
@ -1600,7 +1605,6 @@ class FormFile
public function listOfLinks($object, $permtodelete=1, $action=null, $selected=null, $param='')
{
global $user, $conf, $langs, $user;
global $bc;
global $sortfield, $sortorder;
$langs->load("link");
@ -1712,7 +1716,7 @@ class FormFile
}
if ($nboflinks == 0)
{
print '<tr ' . $bc[false] . '><td colspan="5" class="opacitymedium">';
print '<tr class="oddeven"><td colspan="5" class="opacitymedium">';
print $langs->trans("NoLinkFound");
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 Florian Henry <florian.henry@open-concept.pro>
* 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
* 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] .=' 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.'">';
// Convert date into timestamp format
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]);
if (in_array($extrafields->attributes[$object->table_element]['type'][$key], array('date','datetime')))
{
$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

View File

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

View File

@ -337,12 +337,8 @@ class EcmFiles //extends CommonObject
// Retrieve all extrafields for invoice
// fetch optionals attributes and labels
/*
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
*/
// $this->fetch_optionals();
// $this->fetch_lines();
$this->db->free($resql);

View File

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

View File

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

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
// some hooks
if (empty($reshook)) {
$result = $object->insertExtraFields();
$result = $object->insertExtraFields('SHIPMENT_MODIFY');
if ($result < 0)
{
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
// some hooks
if (empty($reshook)) {
$result = $object->insertExtraFields();
$result = $object->insertExtraFields('FICHINTER_MODIFY');
if ($result < 0)
{
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
if ($reshook < 0) $error++;
}
// Call trigger
$result=$this->call_trigger('EXPENSEREPORT_CLONE',$user);
if ($result < 0) $error++;
// End call triggers
}
unset($this->context['createfromclone']);

View File

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

View File

@ -383,14 +383,13 @@ class Fichinter extends CommonObject
if ($this->statut == 0) $this->brouillon = 1;
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
// Retreive all extrafield
// fetch optionals attributes and labels
$this->fetch_optionals();
/*
* Lines
*/
*/
$result=$this->fetch_lines();
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
if ($reshook < 0) $error++;
}
// Call trigger
$result=$this->call_trigger('INTERVENTION_CLONE',$user);
if ($result < 0) $error++;
// End call triggers
}
unset($this->context['createfromclone']);

View File

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

View File

@ -101,7 +101,7 @@ if (empty($reshook))
$result=$object->setPaymentMethods(GETPOST('mode_reglement_supplier_id','int'));
if ($result < 0) dol_print_error($db,$object->error);
}
// update supplier order min amount
if ($action == 'setsupplier_order_min_amount')
{
@ -121,7 +121,7 @@ if (empty($reshook))
if ($ret < 0) $error++;
if (! $error)
{
$result = $object->insertExtraFields();
$result = $object->insertExtraFields('COMPANY_MODIFY');
if ($result < 0) $error++;
}
if ($error) $action = 'edit_extras';
@ -255,14 +255,14 @@ if ($object->id > 0)
}
print "</td>";
print '</tr>';
print '<tr class="nowrap">';
print '<td>';
print $form->editfieldkey("OrderMinAmount",'supplier_order_min_amount',$object->supplier_order_min_amount,$object,$user->rights->societe->creer);
print '</td><td>';
$limit_field_type = (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) ? 'numeric' : 'amount';
print $form->editfieldval("OrderMinAmount",'supplier_order_min_amount',$object->supplier_order_min_amount,$object,$user->rights->societe->creer,$limit_field_type,($object->supplier_order_min_amount != '' ? price($object->supplier_order_min_amount) : ''));
print '</td>';
print '</tr>';

View File

@ -310,12 +310,9 @@ class CommandeFournisseur extends CommonOrder
$this->db->free($resql);
// Retrieve all extrafields
// Retreive all extrafield
// fetch optionals attributes and labels
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
$this->fetch_optionals();
if ($this->statut == 0) $this->brouillon = 1;
@ -1368,11 +1365,6 @@ class CommandeFournisseur extends CommonOrder
$reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++;
}
// Call trigger
$result=$this->call_trigger('ORDER_SUPPLIER_CLONE',$user);
if ($result < 0) $error++;
// End call triggers
}
unset($this->context['createfromclone']);

View File

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

View File

@ -963,7 +963,7 @@ if (empty($reshook))
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result=$object->insertExtraFields();
$result=$object->insertExtraFields('ORDER_SUPPLIER_MODIFY');
if ($result < 0)
{

View File

@ -1176,26 +1176,20 @@ if ($resql)
print '</div>';
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);
$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
{

View File

@ -1274,7 +1274,7 @@ if (empty($reshook))
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result=$object->insertExtraFields();
$result=$object->insertExtraFields('BILL_SUPPLIER_MODIFY');
if ($result < 0)
{

View File

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

View File

@ -4,6 +4,7 @@ WebsiteSetupDesc=Create here as much entry as number of different websites you n
DeleteWebsite=Delete website
ConfirmDeleteWebsite=Are you sure you want to delete this web site. All its pages and content will also be removed.
WEBSITE_TYPE_CONTAINER=Type of page/container
WEBSITE_PAGE_EXAMPLE=Web page to use as example
WEBSITE_PAGENAME=Page name/alias
WEBSITE_CSS_URL=URL of external CSS file
WEBSITE_CSS_INLINE=CSS file content (common to all pages)
@ -76,4 +77,6 @@ GrabImagesInto=Grab also images found into css and page.
ImagesShouldBeSavedInto=Images should be saved into directory
WebsiteRootOfImages=Root directory for website images
SubdirOfPage=Sub-directory dedicated to page
AliasPageAlreadyExists=Alias page <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);
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook)) {
$result = $object->insertExtraFields();
$result = $object->insertExtraFields('DELIVERY_MODIFY');
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -51,7 +51,7 @@ class ProductStockEntrepot extends CommonObject
/**
*/
public $tms = '';
public $fk_product;
public $fk_entrepot;
@ -61,7 +61,7 @@ class ProductStockEntrepot extends CommonObject
/**
*/
/**
* Constructor
@ -88,7 +88,7 @@ class ProductStockEntrepot extends CommonObject
$error = 0;
// Clean parameters
if (isset($this->fk_product)) $this->fk_product = trim($this->fk_product);
if (isset($this->fk_entrepot)) $this->fk_entrepot = trim($this->fk_entrepot);
if (isset($this->seuil_stock_alerte)) $this->seuil_stock_alerte = trim($this->seuil_stock_alerte);
@ -100,23 +100,23 @@ class ProductStockEntrepot extends CommonObject
// Insert request
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '(';
$sql.= 'fk_product,';
$sql.= 'fk_entrepot,';
$sql.= 'seuil_stock_alerte,';
$sql.= 'desiredstock,';
$sql.= 'import_key';
$sql .= ') VALUES (';
$sql .= ' '.(! isset($this->fk_product)?'NULL':$this->fk_product).',';
$sql .= ' '.(! isset($this->fk_entrepot)?'NULL':$this->fk_entrepot).',';
$sql .= ' '.(! isset($this->seuil_stock_alerte)?'0':$this->seuil_stock_alerte).',';
$sql .= ' '.(! isset($this->desiredstock)?'0':$this->desiredstock).',';
$sql .= ' '.(! isset($this->import_key)?'NULL':"'".$this->db->escape($this->import_key)."'");
$sql .= ')';
$this->db->begin();
@ -166,12 +166,12 @@ class ProductStockEntrepot extends CommonObject
public function fetch($id, $fk_product, $fk_entrepot)
{
if(empty($id) && (empty($fk_product) || empty($fk_entrepot))) return -1;
dol_syslog(__METHOD__, LOG_DEBUG);
$sql = 'SELECT';
$sql .= ' t.rowid,';
$sql .= " t.tms,";
$sql .= " t.fk_product,";
$sql .= " t.fk_entrepot,";
@ -179,11 +179,11 @@ class ProductStockEntrepot extends CommonObject
$sql .= " t.desiredstock,";
$sql .= " t.import_key";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
if(!empty($id)) $sql .= ' WHERE t.rowid = ' . $id;
else $sql.= ' WHERE t.fk_product = '.$fk_product.' AND t.fk_entrepot = '.$fk_entrepot;
$resql = $this->db->query($sql);
if ($resql) {
$numrows = $this->db->num_rows($resql);
@ -191,7 +191,7 @@ class ProductStockEntrepot extends CommonObject
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
$this->tms = $this->db->jdate($obj->tms);
$this->fk_product = $obj->fk_product;
$this->fk_entrepot = $obj->fk_entrepot;
@ -199,18 +199,15 @@ class ProductStockEntrepot extends CommonObject
$this->desiredstock = $obj->desiredstock;
$this->import_key = $obj->import_key;
}
// Retrieve all extrafields for invoice
// Retreive all extrafield
// fetch optionals attributes and labels
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
$this->fetch_optionals();
// $this->fetch_lines();
$this->db->free($resql);
if ($numrows) {
@ -246,7 +243,7 @@ class ProductStockEntrepot extends CommonObject
$sql = 'SELECT';
$sql .= ' t.rowid,';
$sql .= " t.tms,";
$sql .= " t.fk_product,";
$sql .= " t.fk_entrepot,";
@ -254,11 +251,11 @@ class ProductStockEntrepot extends CommonObject
$sql .= " t.desiredstock,";
$sql .= " t.import_key";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t';
$sql .= ' WHERE 1=1';
// Manage filter
$sqlwhere = array();
if (count($filter) > 0) {
@ -267,19 +264,19 @@ class ProductStockEntrepot extends CommonObject
}
}
if (count($sqlwhere) > 0) $sql .= ' AND ' . implode(' '.$filtermode.' ', $sqlwhere);
if(!empty($fk_product)) $sql .= ' AND fk_product = '.$fk_product;
elseif(!empty($fk_entrepot)) $sql .= ' AND fk_entrepot = '.$fk_entrepot;
// "elseif" used instead of "if" because getting list with specified fk_product and specified fk_entrepot would be the same as doing a fetch
if (!empty($sortfield)) $sql .= $this->db->order($sortfield,$sortorder);
if (!empty($limit)) $sql .= ' ' . $this->db->plimit($limit, $offset);
$lines = array();
$resql = $this->db->query($sql);
if ($resql) {
while ($obj = $this->db->fetch_object($resql)) {
$lines[$obj->rowid] = array(
'id'=>$obj->rowid
@ -315,20 +312,20 @@ class ProductStockEntrepot extends CommonObject
dol_syslog(__METHOD__, LOG_DEBUG);
// Clean parameters
if (isset($this->fk_product)) $this->fk_product = trim($this->fk_product);
if (isset($this->fk_entrepot)) $this->fk_entrepot = trim($this->fk_entrepot);
if (isset($this->seuil_stock_alerte)) $this->seuil_stock_alerte = trim($this->seuil_stock_alerte);
if (isset($this->desiredstock)) $this->desiredstock = trim($this->desiredstock);
if (isset($this->import_key)) $this->import_key = trim($this->import_key);
// Check parameters
// Put here code to add a control on parameters values
// Update request
$sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET';
$sql .= ' tms = '.(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : "'".$this->db->idate(dol_now())."'").',';
$sql .= ' fk_product = '.(isset($this->fk_product)?$this->fk_product:"null").',';
$sql .= ' fk_entrepot = '.(isset($this->fk_entrepot)?$this->fk_entrepot:"null").',';
@ -336,7 +333,7 @@ class ProductStockEntrepot extends CommonObject
$sql .= ' desiredstock = '.(isset($this->desiredstock)?$this->desiredstock:"null").',';
$sql .= ' import_key = '.(isset($this->import_key)?"'".$this->db->escape($this->import_key)."'":"null");
$sql .= ' WHERE rowid=' . $this->id;
$this->db->begin();
@ -573,7 +570,7 @@ class ProductStockEntrepot extends CommonObject
public function initAsSpecimen()
{
$this->id = 0;
$this->tms = '';
$this->fk_product = '';
$this->fk_entrepot = '';
@ -581,7 +578,7 @@ class ProductStockEntrepot extends CommonObject
$this->desiredstock = '';
$this->import_key = '';
}
}

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
// some hooks
if (empty($reshook)) {
$result = $object->insertExtraFields();
$result = $object->insertExtraFields('PRODUCT_LOT_MODIFY');
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -334,7 +334,7 @@ class Societe extends CommonObject
*/
var $price_level;
var $outstanding_limit;
/**
* Min order amounts
*/
@ -1315,8 +1315,9 @@ class Societe extends CommonObject
$result = 1;
// Retreive all extrafield for thirdparty
$this->fetch_optionals();
// Retreive all extrafield
// fetch optionals attributes and labels
$this->fetch_optionals();
}
else
{

View File

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

View File

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

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

View File

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

View File

@ -324,12 +324,9 @@ class User extends CommonObject
// in such case, this admin user must be admin for ALL entities.
if (empty($conf->multicompany->enabled) && $this->admin && $this->entity == 1) $this->entity = 0;
// Retreive all extrafield for thirdparty
// Retreive all extrafield
// fetch optionals attributes and labels
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
$this->fetch_optionals();
$this->db->free($result);
}

View File

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

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/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="/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['__WEBSITE_CREATE_BY__']=$user->getFullName($langs);
$sample = GETPOST('sample','alpha');
if (empty($sample)) $sample='empty';
$pathtosample = DOL_DOCUMENT_ROOT.'/website/page-sample-'.$sample.'.html';
// Init content with content into pagetemplate.html, blogposttempltate.html, ...
$objectpage->content = make_substitutions(@file_get_contents(DOL_DOCUMENT_ROOT.'/website/'.$objectpage->type_container.'template.html'), $substitutionarray);
$objectpage->content = make_substitutions(@file_get_contents($pathtosample), $substitutionarray);
}
if (! $error)
@ -2036,6 +2041,12 @@ if ($action == 'editmeta' || $action == 'createcontainer')
print $formwebsite->selectTypeOfContainer('WEBSITE_TYPE_CONTAINER', (GETPOST('WEBSITE_TYPE_CONTAINER')?GETPOST('WEBSITE_TYPE_CONTAINER'):'page'));
print '</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 $langs->trans('WEBSITE_PAGENAME');
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>