Merge remote-tracking branch 'upstream/develop' into actioncomm_category
This commit is contained in:
commit
2e5f539b2a
@ -36,7 +36,7 @@ class AccountancySystem
|
||||
/**
|
||||
* @var string Error code (or message)
|
||||
*/
|
||||
public $error='';
|
||||
public $error = '';
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
@ -48,7 +48,14 @@ class AccountancySystem
|
||||
*/
|
||||
public $fk_pcg_version;
|
||||
|
||||
/**
|
||||
* @var string pcg type
|
||||
*/
|
||||
public $pcg_type;
|
||||
|
||||
/**
|
||||
* @var string pcg subtype
|
||||
*/
|
||||
public $pcg_subtype;
|
||||
|
||||
/**
|
||||
@ -61,7 +68,14 @@ class AccountancySystem
|
||||
*/
|
||||
public $label;
|
||||
|
||||
/**
|
||||
* @var string account number
|
||||
*/
|
||||
public $account_number;
|
||||
|
||||
/**
|
||||
* @var string account parent
|
||||
*/
|
||||
public $account_parent;
|
||||
|
||||
/**
|
||||
|
||||
@ -42,8 +42,7 @@ class AccountingJournal extends CommonObject
|
||||
public $fk_element = '';
|
||||
|
||||
/**
|
||||
* 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||
* @var int
|
||||
* @var int 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||
*/
|
||||
public $ismultientitymanaged = 0;
|
||||
|
||||
@ -57,6 +56,9 @@ class AccountingJournal extends CommonObject
|
||||
*/
|
||||
public $rowid;
|
||||
|
||||
/**
|
||||
* @var string Accounting journal code
|
||||
*/
|
||||
public $code;
|
||||
|
||||
/**
|
||||
@ -64,9 +66,19 @@ class AccountingJournal extends CommonObject
|
||||
*/
|
||||
public $label;
|
||||
|
||||
public $nature; // 1:various operations, 2:sale, 3:purchase, 4:bank, 5:expense-report, 8:inventory, 9: has-new
|
||||
/**
|
||||
* @var int 1:various operations, 2:sale, 3:purchase, 4:bank, 5:expense-report, 8:inventory, 9: has-new
|
||||
*/
|
||||
public $nature;
|
||||
|
||||
/**
|
||||
* @var int is active or not
|
||||
*/
|
||||
public $active;
|
||||
|
||||
/**
|
||||
* @var array array of lines
|
||||
*/
|
||||
public $lines;
|
||||
|
||||
/**
|
||||
|
||||
@ -38,7 +38,7 @@ class BookKeeping extends CommonObject
|
||||
public $error;
|
||||
|
||||
/**
|
||||
* @var string[] Error codes (or messages)
|
||||
* @var string[] Array of Error codes (or messages)
|
||||
*/
|
||||
public $errors = array();
|
||||
|
||||
@ -67,7 +67,14 @@ class BookKeeping extends CommonObject
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* @var string Date of source document, in db date NOT NULL
|
||||
*/
|
||||
public $doc_date;
|
||||
|
||||
/**
|
||||
* @var int Deadline for payment
|
||||
*/
|
||||
public $date_lim_reglement;
|
||||
|
||||
/**
|
||||
@ -119,9 +126,25 @@ class BookKeeping extends CommonObject
|
||||
* @var string label operation
|
||||
*/
|
||||
public $label_operation;
|
||||
|
||||
/**
|
||||
* @var float FEC:Debit
|
||||
*/
|
||||
public $debit;
|
||||
|
||||
/**
|
||||
* @var float FEC:Credit
|
||||
*/
|
||||
public $credit;
|
||||
|
||||
/**
|
||||
* @var float FEC:Amount (Not necessary)
|
||||
*/
|
||||
public $montant;
|
||||
|
||||
/**
|
||||
* @var string FEC:Sens (Not necessary)
|
||||
*/
|
||||
public $sens;
|
||||
|
||||
/**
|
||||
@ -129,9 +152,24 @@ class BookKeeping extends CommonObject
|
||||
*/
|
||||
public $fk_user_author;
|
||||
|
||||
/**
|
||||
* @var string key for import
|
||||
*/
|
||||
public $import_key;
|
||||
|
||||
/**
|
||||
* @var string code journal
|
||||
*/
|
||||
public $code_journal;
|
||||
|
||||
/**
|
||||
* @var string label journal
|
||||
*/
|
||||
public $journal_label;
|
||||
|
||||
/**
|
||||
* @var int accounting transaction id
|
||||
*/
|
||||
public $piece_num;
|
||||
|
||||
/**
|
||||
@ -140,7 +178,6 @@ class BookKeeping extends CommonObject
|
||||
public $picto = 'generic';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
|
||||
@ -1077,7 +1077,7 @@ else
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook))
|
||||
{
|
||||
print $object->showOptionals($extrafields, 'edit');
|
||||
print $object->showOptionals($extrafields, 'edit', $parameters);
|
||||
}
|
||||
|
||||
print '<tbody>';
|
||||
|
||||
@ -99,9 +99,9 @@ class AdherentType extends CommonObject
|
||||
public $mail_valid;
|
||||
|
||||
/** @var array Array of members */
|
||||
public $members=array();
|
||||
public $members = array();
|
||||
|
||||
public $multilangs=array();
|
||||
public $multilangs = array();
|
||||
|
||||
|
||||
/**
|
||||
@ -127,8 +127,8 @@ class AdherentType extends CommonObject
|
||||
$current_lang = $langs->getDefaultLang();
|
||||
|
||||
$sql = "SELECT lang, label, description, email";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type_lang";
|
||||
$sql.= " WHERE fk_type=".$this->id;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type_lang";
|
||||
$sql .= " WHERE fk_type=".$this->id;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
@ -138,7 +138,7 @@ class AdherentType extends CommonObject
|
||||
if ($obj->lang == $current_lang) // si on a les traduct. dans la langue courante on les charge en infos principales.
|
||||
{
|
||||
$this->label = $obj->label;
|
||||
$this->description = $obj->description;
|
||||
$this->description = $obj->description;
|
||||
$this->email = $obj->email;
|
||||
}
|
||||
$this->multilangs["$obj->lang"]["label"] = $obj->label;
|
||||
@ -149,7 +149,7 @@ class AdherentType extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error="Error: ".$this->db->lasterror()." - ".$sql;
|
||||
$this->error = "Error: ".$this->db->lasterror()." - ".$sql;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -171,75 +171,75 @@ class AdherentType extends CommonObject
|
||||
{
|
||||
if ($key == $current_lang) {
|
||||
$sql = "SELECT rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type_lang";
|
||||
$sql.= " WHERE fk_type=".$this->id;
|
||||
$sql.= " AND lang='".$key."'";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type_lang";
|
||||
$sql .= " WHERE fk_type=".$this->id;
|
||||
$sql .= " AND lang='".$key."'";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($this->db->num_rows($result)) // if there is already a description line for this language
|
||||
{
|
||||
$sql2 = "UPDATE ".MAIN_DB_PREFIX."adherent_type_lang";
|
||||
$sql2.= " SET ";
|
||||
$sql2.= " label='".$this->db->escape($this->label)."',";
|
||||
$sql2.= " description='".$this->db->escape($this->description)."'";
|
||||
if (! empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2.= ", email='".$this->db->escape($this->other)."'";
|
||||
$sql2 .= " SET ";
|
||||
$sql2 .= " label='".$this->db->escape($this->label)."',";
|
||||
$sql2 .= " description='".$this->db->escape($this->description)."'";
|
||||
if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2 .= ", email='".$this->db->escape($this->other)."'";
|
||||
}
|
||||
$sql2.= " WHERE fk_type=".$this->id." AND lang='".$this->db->escape($key)."'";
|
||||
$sql2 .= " WHERE fk_type=".$this->id." AND lang='".$this->db->escape($key)."'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql2 = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type_lang (fk_type, lang, label, description";
|
||||
if (! empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2.=", email";
|
||||
if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2 .= ", email";
|
||||
}
|
||||
$sql2.= ")";
|
||||
$sql2.= " VALUES(".$this->id.",'".$this->db->escape($key)."','". $this->db->escape($this->label)."',";
|
||||
$sql2.= " '".$this->db->escape($this->description)."'";
|
||||
if (! empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2.= ", '".$this->db->escape($this->other)."'";
|
||||
$sql2 .= ")";
|
||||
$sql2 .= " VALUES(".$this->id.",'".$this->db->escape($key)."','".$this->db->escape($this->label)."',";
|
||||
$sql2 .= " '".$this->db->escape($this->description)."'";
|
||||
if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2 .= ", '".$this->db->escape($this->other)."'";
|
||||
}
|
||||
$sql2.= ")";
|
||||
$sql2 .= ")";
|
||||
}
|
||||
dol_syslog(get_class($this).'::setMultiLangs key = current_lang = '.$key);
|
||||
if (! $this->db->query($sql2)) {
|
||||
$this->error=$this->db->lasterror();
|
||||
if (!$this->db->query($sql2)) {
|
||||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
elseif (isset($this->multilangs[$key])) {
|
||||
$sql = "SELECT rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type_lang";
|
||||
$sql.= " WHERE fk_type=".$this->id;
|
||||
$sql.= " AND lang='".$key."'";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type_lang";
|
||||
$sql .= " WHERE fk_type=".$this->id;
|
||||
$sql .= " AND lang='".$key."'";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($this->db->num_rows($result)) // if there is already a description line for this language
|
||||
{
|
||||
$sql2 = "UPDATE ".MAIN_DB_PREFIX."adherent_type_lang";
|
||||
$sql2.= " SET ";
|
||||
$sql2.= " label='".$this->db->escape($this->multilangs["$key"]["label"])."',";
|
||||
$sql2.= " description='".$this->db->escape($this->multilangs["$key"]["description"])."'";
|
||||
if (! empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2.= ", email='".$this->db->escape($this->multilangs["$key"]["other"])."'";
|
||||
$sql2 .= " SET ";
|
||||
$sql2 .= " label='".$this->db->escape($this->multilangs["$key"]["label"])."',";
|
||||
$sql2 .= " description='".$this->db->escape($this->multilangs["$key"]["description"])."'";
|
||||
if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2 .= ", email='".$this->db->escape($this->multilangs["$key"]["other"])."'";
|
||||
}
|
||||
$sql2.= " WHERE fk_type=".$this->id." AND lang='".$this->db->escape($key)."'";
|
||||
$sql2 .= " WHERE fk_type=".$this->id." AND lang='".$this->db->escape($key)."'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql2 = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type_lang (fk_type, lang, label, description";
|
||||
if (! empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2.=", email";
|
||||
if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2 .= ", email";
|
||||
}
|
||||
$sql2.= ")";
|
||||
$sql2.= " VALUES(".$this->id.",'".$this->db->escape($key)."','". $this->db->escape($this->multilangs["$key"]["label"])."',";
|
||||
$sql2.= " '".$this->db->escape($this->multilangs["$key"]["description"])."'";
|
||||
if (! empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2.= ", '".$this->db->escape($this->multilangs["$key"]["other"])."'";
|
||||
$sql2 .= ")";
|
||||
$sql2 .= " VALUES(".$this->id.",'".$this->db->escape($key)."','".$this->db->escape($this->multilangs["$key"]["label"])."',";
|
||||
$sql2 .= " '".$this->db->escape($this->multilangs["$key"]["description"])."'";
|
||||
if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2 .= ", '".$this->db->escape($this->multilangs["$key"]["other"])."'";
|
||||
}
|
||||
$sql2.= ")";
|
||||
$sql2 .= ")";
|
||||
}
|
||||
|
||||
// We do not save if main fields are empty
|
||||
if ($this->multilangs["$key"]["label"] || $this->multilangs["$key"]["description"]) {
|
||||
if (! $this->db->query($sql2)) {
|
||||
$this->error=$this->db->lasterror();
|
||||
if (!$this->db->query($sql2)) {
|
||||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -272,7 +272,7 @@ class AdherentType extends CommonObject
|
||||
public function delMultiLangs($langtodelete, $user)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent_type_lang";
|
||||
$sql.= " WHERE fk_type=".$this->id." AND lang='".$this->db->escape($langtodelete)."'";
|
||||
$sql .= " WHERE fk_type=".$this->id." AND lang='".$this->db->escape($langtodelete)."'";
|
||||
|
||||
dol_syslog(get_class($this).'::delMultiLangs', LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
@ -289,7 +289,7 @@ class AdherentType extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->error = $this->db->lasterror();
|
||||
dol_syslog(get_class($this).'::delMultiLangs error='.$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
@ -306,22 +306,22 @@ class AdherentType extends CommonObject
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
$error=0;
|
||||
$error = 0;
|
||||
|
||||
$this->statut=(int) $this->statut;
|
||||
$this->label=trim($this->label);
|
||||
$this->statut = (int) $this->statut;
|
||||
$this->label = trim($this->label);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type (";
|
||||
$sql.= " morphy";
|
||||
$sql.= ", libelle";
|
||||
$sql.= ", entity";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= "'".$this->db->escape($this->morphy)."'";
|
||||
$sql.= ", '".$this->db->escape($this->label)."'";
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ")";
|
||||
$sql .= " morphy";
|
||||
$sql .= ", libelle";
|
||||
$sql .= ", entity";
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= "'".$this->db->escape($this->morphy)."'";
|
||||
$sql .= ", '".$this->db->escape($this->label)."'";
|
||||
$sql .= ", ".$conf->entity;
|
||||
$sql .= ")";
|
||||
|
||||
dol_syslog("Adherent_type::create", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
@ -336,15 +336,15 @@ class AdherentType extends CommonObject
|
||||
return -3;
|
||||
}
|
||||
|
||||
if (! $notrigger)
|
||||
if (!$notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('MEMBER_TYPE_CREATE', $user);
|
||||
$result = $this->call_trigger('MEMBER_TYPE_CREATE', $user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
@ -358,7 +358,7 @@ class AdherentType extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->error = $this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -375,23 +375,23 @@ class AdherentType extends CommonObject
|
||||
{
|
||||
global $langs, $conf, $hookmanager;
|
||||
|
||||
$error=0;
|
||||
$error = 0;
|
||||
|
||||
$this->label=trim($this->label);
|
||||
$this->label = trim($this->label);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent_type ";
|
||||
$sql.= "SET ";
|
||||
$sql.= "statut = ".$this->statut.",";
|
||||
$sql.= "libelle = '".$this->db->escape($this->label) ."',";
|
||||
$sql.= "morphy = '".$this->db->escape($this->morphy) ."',";
|
||||
$sql.= "subscription = '".$this->db->escape($this->subscription)."',";
|
||||
$sql.= "duration = '" . $this->db->escape($this->duration_value . $this->duration_unit) ."',";
|
||||
$sql.= "note = '".$this->db->escape($this->note)."',";
|
||||
$sql.= "vote = ".(integer) $this->db->escape($this->vote).",";
|
||||
$sql.= "mail_valid = '".$this->db->escape($this->mail_valid)."'";
|
||||
$sql.= " WHERE rowid =".$this->id;
|
||||
$sql .= "SET ";
|
||||
$sql .= "statut = ".$this->statut.",";
|
||||
$sql .= "libelle = '".$this->db->escape($this->label)."',";
|
||||
$sql .= "morphy = '".$this->db->escape($this->morphy)."',";
|
||||
$sql .= "subscription = '".$this->db->escape($this->subscription)."',";
|
||||
$sql .= "duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."',";
|
||||
$sql .= "note = '".$this->db->escape($this->note)."',";
|
||||
$sql .= "vote = ".(integer) $this->db->escape($this->vote).",";
|
||||
$sql .= "mail_valid = '".$this->db->escape($this->mail_valid)."'";
|
||||
$sql .= " WHERE rowid =".$this->id;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
@ -399,34 +399,34 @@ class AdherentType extends CommonObject
|
||||
$this->description = $this->db->escape($this->note);
|
||||
|
||||
// Multilangs
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) {
|
||||
if (!empty($conf->global->MAIN_MULTILANGS)) {
|
||||
if ($this->setMultiLangs($user) < 0) {
|
||||
$this->error=$langs->trans("Error")." : ".$this->db->error()." - ".$sql;
|
||||
$this->error = $langs->trans("Error")." : ".$this->db->error()." - ".$sql;
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
$action='update';
|
||||
$action = 'update';
|
||||
|
||||
// Actions on extra fields
|
||||
if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||
{
|
||||
$result=$this->insertExtraFields();
|
||||
$result = $this->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error && ! $notrigger)
|
||||
if (!$error && !$notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('MEMBER_TYPE_MODIFY', $user);
|
||||
$result = $this->call_trigger('MEMBER_TYPE_MODIFY', $user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
@ -440,7 +440,7 @@ class AdherentType extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->error = $this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -458,13 +458,13 @@ class AdherentType extends CommonObject
|
||||
$error = 0;
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent_type";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('MEMBER_TYPE_DELETE', $user);
|
||||
$result = $this->call_trigger('MEMBER_TYPE_DELETE', $user);
|
||||
if ($result < 0) { $error++; $this->db->rollback(); return -2; }
|
||||
// End call triggers
|
||||
|
||||
@ -474,7 +474,7 @@ class AdherentType extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -495,7 +495,7 @@ class AdherentType extends CommonObject
|
||||
|
||||
dol_syslog("Adherent_type::fetch", LOG_DEBUG);
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows($resql))
|
||||
@ -506,10 +506,10 @@ class AdherentType extends CommonObject
|
||||
$this->ref = $obj->rowid;
|
||||
$this->label = $obj->label;
|
||||
$this->morphy = $obj->morphy;
|
||||
$this->statut = $obj->status; // deprecated
|
||||
$this->statut = $obj->status; // deprecated
|
||||
$this->status = $obj->status;
|
||||
$this->duration = $obj->duration;
|
||||
$this->duration_value = substr($obj->duration, 0, dol_strlen($obj->duration)-1);
|
||||
$this->duration_value = substr($obj->duration, 0, dol_strlen($obj->duration) - 1);
|
||||
$this->duration_unit = substr($obj->duration, -1);
|
||||
$this->subscription = $obj->subscription;
|
||||
$this->mail_valid = $obj->mail_valid;
|
||||
@ -517,7 +517,7 @@ class AdherentType extends CommonObject
|
||||
$this->vote = $obj->vote;
|
||||
|
||||
// multilangs
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) {
|
||||
if (!empty($conf->global->MAIN_MULTILANGS)) {
|
||||
$this->getMultiLangs();
|
||||
}
|
||||
}
|
||||
@ -526,7 +526,7 @@ class AdherentType extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -540,15 +540,15 @@ class AdherentType extends CommonObject
|
||||
public function liste_array()
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf,$langs;
|
||||
global $conf, $langs;
|
||||
|
||||
$adherenttypes = array();
|
||||
|
||||
$sql = "SELECT rowid, libelle as label";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type";
|
||||
$sql.= " WHERE entity IN (".getEntity('member_type').")";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type";
|
||||
$sql .= " WHERE entity IN (".getEntity('member_type').")";
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$nump = $this->db->num_rows($resql);
|
||||
@ -585,13 +585,13 @@ class AdherentType extends CommonObject
|
||||
{
|
||||
global $conf, $user;
|
||||
|
||||
$ret=array();
|
||||
$ret = array();
|
||||
|
||||
$sql = "SELECT a.rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a";
|
||||
$sql.= " WHERE a.entity IN (".getEntity('member').")";
|
||||
$sql.= " AND a.fk_adherent_type = ".$this->id;
|
||||
if (! empty($excludefilter)) $sql.=' AND ('.$excludefilter.')';
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as a";
|
||||
$sql .= " WHERE a.entity IN (".getEntity('member').")";
|
||||
$sql .= " AND a.fk_adherent_type = ".$this->id;
|
||||
if (!empty($excludefilter)) $sql .= ' AND ('.$excludefilter.')';
|
||||
|
||||
dol_syslog(get_class($this)."::listUsersForGroup", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
@ -599,31 +599,31 @@ class AdherentType extends CommonObject
|
||||
{
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
if (! array_key_exists($obj->rowid, $ret))
|
||||
if (!array_key_exists($obj->rowid, $ret))
|
||||
{
|
||||
if ($mode < 2)
|
||||
{
|
||||
$memberstatic=new Adherent($this->db);
|
||||
$memberstatic = new Adherent($this->db);
|
||||
if ($mode == 1) {
|
||||
$memberstatic->fetch($obj->rowid, '', '', '', false, false);
|
||||
} else {
|
||||
$memberstatic->fetch($obj->rowid);
|
||||
}
|
||||
$ret[$obj->rowid]=$memberstatic;
|
||||
$ret[$obj->rowid] = $memberstatic;
|
||||
}
|
||||
else $ret[$obj->rowid]=$obj->rowid;
|
||||
else $ret[$obj->rowid] = $obj->rowid;
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->free($resql);
|
||||
|
||||
$this->members=$ret;
|
||||
$this->members = $ret;
|
||||
|
||||
return $ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -655,15 +655,15 @@ class AdherentType extends CommonObject
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$result='';
|
||||
$label=$langs->trans("ShowTypeCard", $this->label);
|
||||
$result = '';
|
||||
$label = $langs->trans("ShowTypeCard", $this->label);
|
||||
|
||||
$linkstart = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkend='</a>';
|
||||
$linkend = '</a>';
|
||||
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
||||
if ($withpicto != 2) $result.= ($maxlen?dol_trunc($this->label, $maxlen):$this->label);
|
||||
if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
|
||||
if ($withpicto != 2) $result .= ($maxlen ?dol_trunc($this->label, $maxlen) : $this->label);
|
||||
$result .= $linkend;
|
||||
|
||||
return $result;
|
||||
@ -723,10 +723,10 @@ class AdherentType extends CommonObject
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
$dn='';
|
||||
if ($mode==0) $dn=$conf->global->LDAP_KEY_MEMBERS_TYPES."=".$info[$conf->global->LDAP_KEY_MEMBERS_TYPES].",".$conf->global->LDAP_MEMBER_TYPE_DN;
|
||||
if ($mode==1) $dn=$conf->global->LDAP_MEMBER_TYPE_DN;
|
||||
if ($mode==2) $dn=$conf->global->LDAP_KEY_MEMBERS_TYPES."=".$info[$conf->global->LDAP_KEY_MEMBERS_TYPES];
|
||||
$dn = '';
|
||||
if ($mode == 0) $dn = $conf->global->LDAP_KEY_MEMBERS_TYPES."=".$info[$conf->global->LDAP_KEY_MEMBERS_TYPES].",".$conf->global->LDAP_MEMBER_TYPE_DN;
|
||||
if ($mode == 1) $dn = $conf->global->LDAP_MEMBER_TYPE_DN;
|
||||
if ($mode == 2) $dn = $conf->global->LDAP_KEY_MEMBERS_TYPES."=".$info[$conf->global->LDAP_KEY_MEMBERS_TYPES];
|
||||
return $dn;
|
||||
}
|
||||
|
||||
@ -741,27 +741,27 @@ class AdherentType extends CommonObject
|
||||
public function _load_ldap_info()
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf,$langs;
|
||||
global $conf, $langs;
|
||||
|
||||
$info=array();
|
||||
$info = array();
|
||||
|
||||
// Object classes
|
||||
$info["objectclass"]=explode(',', $conf->global->LDAP_MEMBER_TYPE_OBJECT_CLASS);
|
||||
$info["objectclass"] = explode(',', $conf->global->LDAP_MEMBER_TYPE_OBJECT_CLASS);
|
||||
|
||||
// Champs
|
||||
if ($this->label && ! empty($conf->global->LDAP_MEMBER_TYPE_FIELD_FULLNAME)) $info[$conf->global->LDAP_MEMBER_TYPE_FIELD_FULLNAME] = $this->label;
|
||||
if ($this->note && ! empty($conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION] = dol_string_nohtmltag($this->note, 0, 'UTF-8', 1);
|
||||
if (! empty($conf->global->LDAP_MEMBER_TYPE_FIELD_GROUPMEMBERS))
|
||||
if ($this->label && !empty($conf->global->LDAP_MEMBER_TYPE_FIELD_FULLNAME)) $info[$conf->global->LDAP_MEMBER_TYPE_FIELD_FULLNAME] = $this->label;
|
||||
if ($this->note && !empty($conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION] = dol_string_nohtmltag($this->note, 0, 'UTF-8', 1);
|
||||
if (!empty($conf->global->LDAP_MEMBER_TYPE_FIELD_GROUPMEMBERS))
|
||||
{
|
||||
$valueofldapfield=array();
|
||||
foreach($this->members as $key=>$val) // This is array of users for group into dolibarr database.
|
||||
$valueofldapfield = array();
|
||||
foreach ($this->members as $key=>$val) // This is array of users for group into dolibarr database.
|
||||
{
|
||||
$member=new Adherent($this->db);
|
||||
$member = new Adherent($this->db);
|
||||
$member->fetch($val->id, '', '', '', false, false);
|
||||
$info2 = $member->_load_ldap_info();
|
||||
$valueofldapfield[] = $member->_load_ldap_dn($info2);
|
||||
}
|
||||
$info[$conf->global->LDAP_MEMBER_TYPE_FIELD_GROUPMEMBERS] = (!empty($valueofldapfield)?$valueofldapfield:'');
|
||||
$info[$conf->global->LDAP_MEMBER_TYPE_FIELD_GROUPMEMBERS] = (!empty($valueofldapfield) ? $valueofldapfield : '');
|
||||
}
|
||||
return $info;
|
||||
}
|
||||
@ -780,18 +780,18 @@ class AdherentType extends CommonObject
|
||||
// Initialise parametres
|
||||
$this->id = 0;
|
||||
$this->ref = 'MTSPEC';
|
||||
$this->specimen=1;
|
||||
$this->specimen = 1;
|
||||
|
||||
$this->label='MEMBERS TYPE SPECIMEN';
|
||||
$this->note='This is a note';
|
||||
$this->mail_valid='This is welcome email';
|
||||
$this->subscription=1;
|
||||
$this->vote=0;
|
||||
$this->label = 'MEMBERS TYPE SPECIMEN';
|
||||
$this->note = 'This is a note';
|
||||
$this->mail_valid = 'This is welcome email';
|
||||
$this->subscription = 1;
|
||||
$this->vote = 0;
|
||||
|
||||
$this->statut=1;
|
||||
$this->statut = 1;
|
||||
|
||||
// Members of this member type is just me
|
||||
$this->members=array(
|
||||
$this->members = array(
|
||||
$user->id => $user
|
||||
);
|
||||
}
|
||||
@ -805,7 +805,7 @@ class AdherentType extends CommonObject
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if (! empty($this->mail_valid) && trim(dol_htmlentitiesbr_decode($this->mail_valid)))
|
||||
if (!empty($this->mail_valid) && trim(dol_htmlentitiesbr_decode($this->mail_valid)))
|
||||
{
|
||||
return $this->mail_valid;
|
||||
}
|
||||
@ -823,7 +823,7 @@ class AdherentType extends CommonObject
|
||||
global $conf;
|
||||
|
||||
// mail_subscription not defined so never used
|
||||
if (! empty($this->mail_subscription) && trim(dol_htmlentitiesbr_decode($this->mail_subscription))) // Property not yet defined
|
||||
if (!empty($this->mail_subscription) && trim(dol_htmlentitiesbr_decode($this->mail_subscription))) // Property not yet defined
|
||||
{
|
||||
return $this->mail_subscription;
|
||||
}
|
||||
@ -841,7 +841,7 @@ class AdherentType extends CommonObject
|
||||
global $conf;
|
||||
|
||||
// NOTE mail_resiliate not defined so never used
|
||||
if (! empty($this->mail_resiliate) && trim(dol_htmlentitiesbr_decode($this->mail_resiliate))) // Property not yet defined
|
||||
if (!empty($this->mail_resiliate) && trim(dol_htmlentitiesbr_decode($this->mail_resiliate))) // Property not yet defined
|
||||
{
|
||||
return $this->mail_resiliate;
|
||||
}
|
||||
|
||||
@ -373,11 +373,11 @@ if ($action == 'create')
|
||||
|
||||
// Other attributes
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $act, $action); // Note that $action and $object may have been modified by hook
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook))
|
||||
{
|
||||
print $object->showOptionals($extrafields, 'edit');
|
||||
print $object->showOptionals($extrafields, 'edit', $parameters);
|
||||
}
|
||||
print '<tbody>';
|
||||
print "</table>\n";
|
||||
@ -823,7 +823,7 @@ if ($rowid > 0)
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook))
|
||||
{
|
||||
print $object->showOptionals($extrafields, 'edit');
|
||||
print $object->showOptionals($extrafields, 'edit', $parameters);
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -321,13 +321,15 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
|
||||
$newcardbutton = '';
|
||||
//if ($user->rights->emailcollector->creer)
|
||||
//{
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', 'emailcollector_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']));
|
||||
//}
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, $newcardbutton, '', $limit);
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, $newcardbutton.' '.$linkback, '', $limit);
|
||||
|
||||
// Add code for pre mass action (confirmation or email presend form)
|
||||
/*$topicmail="";
|
||||
|
||||
@ -391,11 +391,11 @@ if ($action == 'create')
|
||||
|
||||
// Other attributes
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $act, $action); // Note that $action and $object may have been modified by hook
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook))
|
||||
{
|
||||
print $object->showOptionals($extrafields, 'edit');
|
||||
print $object->showOptionals($extrafields, 'edit', $parameters);
|
||||
}
|
||||
print '<tbody>';
|
||||
print "</table>\n";
|
||||
@ -606,7 +606,7 @@ if ($rowid > 0)
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook))
|
||||
{
|
||||
print $object->showOptionals($extrafields, 'edit');
|
||||
print $object->showOptionals($extrafields, 'edit', $parameters);
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -95,7 +95,7 @@ class BOM extends CommonObject
|
||||
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1:(finished IS NULL or finished <> 0)', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp'),
|
||||
'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1', 'css'=>'maxwidth75imp'),
|
||||
'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>-1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'),
|
||||
'duration' => array('type'=>'real', 'label'=>'EstimatedDuration', 'enabled'=>1, 'visible'=>-1, 'position'=>101, 'notnull'=>-1, 'css'=>'maxwidth50imp', 'help'=>'EstimatedDurationDesc'),
|
||||
'duration' => array('type'=>'duration', 'label'=>'EstimatedDuration', 'enabled'=>1, 'visible'=>-1, 'position'=>101, 'notnull'=>-1, 'css'=>'maxwidth50imp', 'help'=>'EstimatedDurationDesc'),
|
||||
'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:0', 'label'=>'WarehouseForProduction', 'enabled'=>1, 'visible'=>-1, 'position'=>102),
|
||||
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>-2, 'position'=>161, 'notnull'=>-1,),
|
||||
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>-2, 'position'=>162, 'notnull'=>-1,),
|
||||
|
||||
@ -278,7 +278,7 @@ if ($user->rights->categorie->creer)
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook))
|
||||
{
|
||||
print $object->showOptionals($extrafields, 'edit');
|
||||
print $object->showOptionals($extrafields, 'edit', $parameters);
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -83,16 +83,16 @@ class Categories extends DolibarrApi
|
||||
*/
|
||||
public function get($id, $include_childs = false)
|
||||
{
|
||||
if (! DolibarrApiAccess::$user->rights->categorie->lire) {
|
||||
if (!DolibarrApiAccess::$user->rights->categorie->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->category->fetch($id);
|
||||
if ( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'category not found');
|
||||
}
|
||||
|
||||
if ( ! DolibarrApi::_checkAccessToResource('categorie', $this->category->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('categorie', $this->category->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -131,50 +131,50 @@ class Categories extends DolibarrApi
|
||||
|
||||
$obj_ret = array();
|
||||
|
||||
if(! DolibarrApiAccess::$user->rights->categorie->lire) {
|
||||
if (!DolibarrApiAccess::$user->rights->categorie->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$sql = "SELECT t.rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."categorie as t";
|
||||
$sql.= ' WHERE t.entity IN ('.getEntity('category').')';
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."categorie as t";
|
||||
$sql .= ' WHERE t.entity IN ('.getEntity('category').')';
|
||||
if (!empty($type))
|
||||
{
|
||||
$sql.= ' AND t.type='.array_search($type, Categories::$TYPES);
|
||||
$sql .= ' AND t.type='.array_search($type, Categories::$TYPES);
|
||||
}
|
||||
// Add sql filters
|
||||
if ($sqlfilters)
|
||||
{
|
||||
if (! DolibarrApi::_checkFilters($sqlfilters))
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters))
|
||||
{
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
if ($page < 0)
|
||||
{
|
||||
$page = 0;
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
|
||||
$sql.= $db->plimit($limit + 1, $offset);
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$i=0;
|
||||
$i = 0;
|
||||
$num = $db->num_rows($result);
|
||||
$min = min($num, ($limit <= 0 ? $num : $limit));
|
||||
while ($i < $min)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$category_static = new Categorie($db);
|
||||
if($category_static->fetch($obj->rowid)) {
|
||||
if ($category_static->fetch($obj->rowid)) {
|
||||
$obj_ret[] = $this->_cleanObjectDatas($category_static);
|
||||
}
|
||||
$i++;
|
||||
@ -183,7 +183,7 @@ class Categories extends DolibarrApi
|
||||
else {
|
||||
throw new RestException(503, 'Error when retrieve category list : '.$db->lasterror());
|
||||
}
|
||||
if( ! count($obj_ret)) {
|
||||
if (!count($obj_ret)) {
|
||||
throw new RestException(404, 'No category found');
|
||||
}
|
||||
return $obj_ret;
|
||||
@ -197,14 +197,14 @@ class Categories extends DolibarrApi
|
||||
*/
|
||||
public function post($request_data = null)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->categorie->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->categorie->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
// Check mandatory fields
|
||||
$result = $this->_validate($request_data);
|
||||
|
||||
foreach($request_data as $field => $value) {
|
||||
foreach ($request_data as $field => $value) {
|
||||
$this->category->$field = $value;
|
||||
}
|
||||
if ($this->category->create(DolibarrApiAccess::$user) < 0) {
|
||||
@ -222,20 +222,20 @@ class Categories extends DolibarrApi
|
||||
*/
|
||||
public function put($id, $request_data = null)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->categorie->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->categorie->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->category->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'category not found');
|
||||
}
|
||||
|
||||
if ( ! DolibarrApi::_checkAccessToResource('category', $this->category->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('category', $this->category->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
foreach($request_data as $field => $value) {
|
||||
foreach ($request_data as $field => $value) {
|
||||
if ($field == 'id') continue;
|
||||
$this->category->$field = $value;
|
||||
}
|
||||
@ -258,19 +258,19 @@ class Categories extends DolibarrApi
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->categorie->supprimer) {
|
||||
if (!DolibarrApiAccess::$user->rights->categorie->supprimer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$result = $this->category->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'category not found');
|
||||
}
|
||||
|
||||
if ( ! DolibarrApi::_checkAccessToResource('category', $this->category->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('category', $this->category->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
if (! $this->category->delete(DolibarrApiAccess::$user)) {
|
||||
if (!$this->category->delete(DolibarrApiAccess::$user)) {
|
||||
throw new RestException(401, 'error when delete category');
|
||||
}
|
||||
|
||||
@ -311,21 +311,21 @@ class Categories extends DolibarrApi
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
if($type == Categorie::TYPE_PRODUCT && ! (DolibarrApiAccess::$user->rights->produit->lire || DolibarrApiAccess::$user->rights->service->lire)) {
|
||||
if ($type == Categorie::TYPE_PRODUCT && !(DolibarrApiAccess::$user->rights->produit->lire || DolibarrApiAccess::$user->rights->service->lire)) {
|
||||
throw new RestException(401);
|
||||
} elseif ($type == Categorie::TYPE_CONTACT && ! DolibarrApiAccess::$user->rights->contact->lire) {
|
||||
} elseif ($type == Categorie::TYPE_CONTACT && !DolibarrApiAccess::$user->rights->contact->lire) {
|
||||
throw new RestException(401);
|
||||
} elseif ($type == Categorie::TYPE_CUSTOMER && ! DolibarrApiAccess::$user->rights->societe->lire) {
|
||||
} elseif ($type == Categorie::TYPE_CUSTOMER && !DolibarrApiAccess::$user->rights->societe->lire) {
|
||||
throw new RestException(401);
|
||||
} elseif ($type == Categorie::TYPE_SUPPLIER && ! DolibarrApiAccess::$user->rights->fournisseur->lire) {
|
||||
} elseif ($type == Categorie::TYPE_SUPPLIER && !DolibarrApiAccess::$user->rights->fournisseur->lire) {
|
||||
throw new RestException(401);
|
||||
} elseif ($type == Categorie::TYPE_MEMBER && ! DolibarrApiAccess::$user->rights->adherent->lire) {
|
||||
} elseif ($type == Categorie::TYPE_MEMBER && !DolibarrApiAccess::$user->rights->adherent->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$categories = $this->category->getListForItem($id, $type, $sortfield, $sortorder, $limit, $page);
|
||||
|
||||
if( ! is_array($categories)) {
|
||||
if (!is_array($categories)) {
|
||||
if ($categories == 0) {
|
||||
throw new RestException(404, 'No category found for this object');
|
||||
}
|
||||
@ -352,37 +352,37 @@ class Categories extends DolibarrApi
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
if(! DolibarrApiAccess::$user->rights->categorie->lire) {
|
||||
if (!DolibarrApiAccess::$user->rights->categorie->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->category->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'category not found');
|
||||
}
|
||||
|
||||
if ($type === Categorie::TYPE_PRODUCT) {
|
||||
if(! (DolibarrApiAccess::$user->rights->produit->creer || DolibarrApiAccess::$user->rights->service->creer)) {
|
||||
if (!(DolibarrApiAccess::$user->rights->produit->creer || DolibarrApiAccess::$user->rights->service->creer)) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Product($this->db);
|
||||
} elseif ($type === Categorie::TYPE_CUSTOMER) {
|
||||
if(! DolibarrApiAccess::$user->rights->societe->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->societe->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Societe($this->db);
|
||||
} elseif ($type === Categorie::TYPE_SUPPLIER) {
|
||||
if(! DolibarrApiAccess::$user->rights->societe->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->societe->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Societe($this->db);
|
||||
} elseif ($type === Categorie::TYPE_CONTACT) {
|
||||
if(! DolibarrApiAccess::$user->rights->societe->contact->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->societe->contact->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Contact($this->db);
|
||||
} elseif ($type === Categorie::TYPE_MEMBER) {
|
||||
if(! DolibarrApiAccess::$user->rights->adherent->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->adherent->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Adherent($this->db);
|
||||
@ -393,7 +393,7 @@ class Categories extends DolibarrApi
|
||||
if (!empty($object)) {
|
||||
$result = $object->fetch($object_id);
|
||||
if ($result > 0) {
|
||||
$result=$this->category->add_type($object, $type);
|
||||
$result = $this->category->add_type($object, $type);
|
||||
if ($result < 0) {
|
||||
if ($this->category->error != 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||
throw new RestException(500, 'Error when linking object', array_merge(array($this->category->error), $this->category->errors));
|
||||
@ -432,37 +432,37 @@ class Categories extends DolibarrApi
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
if(! DolibarrApiAccess::$user->rights->categorie->lire) {
|
||||
if (!DolibarrApiAccess::$user->rights->categorie->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->category->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'category not found');
|
||||
}
|
||||
|
||||
if ($type === Categorie::TYPE_PRODUCT) {
|
||||
if(! (DolibarrApiAccess::$user->rights->produit->creer || DolibarrApiAccess::$user->rights->service->creer)) {
|
||||
if (!(DolibarrApiAccess::$user->rights->produit->creer || DolibarrApiAccess::$user->rights->service->creer)) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Product($this->db);
|
||||
} elseif ($type === Categorie::TYPE_CUSTOMER) {
|
||||
if(! DolibarrApiAccess::$user->rights->societe->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->societe->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Societe($this->db);
|
||||
} elseif ($type === Categorie::TYPE_SUPPLIER) {
|
||||
if(! DolibarrApiAccess::$user->rights->societe->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->societe->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Societe($this->db);
|
||||
} elseif ($type === Categorie::TYPE_CONTACT) {
|
||||
if(! DolibarrApiAccess::$user->rights->societe->contact->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->societe->contact->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Contact($this->db);
|
||||
} elseif ($type === Categorie::TYPE_MEMBER) {
|
||||
if(! DolibarrApiAccess::$user->rights->adherent->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->adherent->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Adherent($this->db);
|
||||
@ -473,7 +473,7 @@ class Categories extends DolibarrApi
|
||||
if (!empty($object)) {
|
||||
$result = $object->fetch('', $object_ref);
|
||||
if ($result > 0) {
|
||||
$result=$this->category->add_type($object, $type);
|
||||
$result = $this->category->add_type($object, $type);
|
||||
if ($result < 0) {
|
||||
if ($this->category->error != 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||
throw new RestException(500, 'Error when linking object', array_merge(array($this->category->error), $this->category->errors));
|
||||
@ -512,37 +512,37 @@ class Categories extends DolibarrApi
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
if(! DolibarrApiAccess::$user->rights->categorie->lire) {
|
||||
if (!DolibarrApiAccess::$user->rights->categorie->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->category->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'category not found');
|
||||
}
|
||||
|
||||
if ($type === Categorie::TYPE_PRODUCT) {
|
||||
if(! (DolibarrApiAccess::$user->rights->produit->creer || DolibarrApiAccess::$user->rights->service->creer)) {
|
||||
if (!(DolibarrApiAccess::$user->rights->produit->creer || DolibarrApiAccess::$user->rights->service->creer)) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Product($this->db);
|
||||
} elseif ($type === Categorie::TYPE_CUSTOMER) {
|
||||
if(! DolibarrApiAccess::$user->rights->societe->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->societe->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Societe($this->db);
|
||||
} elseif ($type === Categorie::TYPE_SUPPLIER) {
|
||||
if(! DolibarrApiAccess::$user->rights->societe->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->societe->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Societe($this->db);
|
||||
} elseif ($type === Categorie::TYPE_CONTACT) {
|
||||
if(! DolibarrApiAccess::$user->rights->societe->contact->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->societe->contact->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Contact($this->db);
|
||||
} elseif ($type === Categorie::TYPE_MEMBER) {
|
||||
if(! DolibarrApiAccess::$user->rights->adherent->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->adherent->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Adherent($this->db);
|
||||
@ -553,7 +553,7 @@ class Categories extends DolibarrApi
|
||||
if (!empty($object)) {
|
||||
$result = $object->fetch((int) $object_id);
|
||||
if ($result > 0) {
|
||||
$result=$this->category->del_type($object, $type);
|
||||
$result = $this->category->del_type($object, $type);
|
||||
if ($result < 0) {
|
||||
throw new RestException(500, 'Error when unlinking object', array_merge(array($this->category->error), $this->category->errors));
|
||||
}
|
||||
@ -590,37 +590,37 @@ class Categories extends DolibarrApi
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
if(! DolibarrApiAccess::$user->rights->categorie->lire) {
|
||||
if (!DolibarrApiAccess::$user->rights->categorie->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->category->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'category not found');
|
||||
}
|
||||
|
||||
if ($type === Categorie::TYPE_PRODUCT) {
|
||||
if(! (DolibarrApiAccess::$user->rights->produit->creer || DolibarrApiAccess::$user->rights->service->creer)) {
|
||||
if (!(DolibarrApiAccess::$user->rights->produit->creer || DolibarrApiAccess::$user->rights->service->creer)) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Product($this->db);
|
||||
} elseif ($type === Categorie::TYPE_CUSTOMER) {
|
||||
if(! DolibarrApiAccess::$user->rights->societe->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->societe->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Societe($this->db);
|
||||
} elseif ($type === Categorie::TYPE_SUPPLIER) {
|
||||
if(! DolibarrApiAccess::$user->rights->societe->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->societe->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Societe($this->db);
|
||||
} elseif ($type === Categorie::TYPE_CONTACT) {
|
||||
if(! DolibarrApiAccess::$user->rights->societe->contact->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->societe->contact->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Contact($this->db);
|
||||
} elseif ($type === Categorie::TYPE_MEMBER) {
|
||||
if(! DolibarrApiAccess::$user->rights->adherent->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->adherent->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Adherent($this->db);
|
||||
@ -631,7 +631,7 @@ class Categories extends DolibarrApi
|
||||
if (!empty($object)) {
|
||||
$result = $object->fetch('', (string) $object_ref);
|
||||
if ($result > 0) {
|
||||
$result=$this->category->del_type($object, $type);
|
||||
$result = $this->category->del_type($object, $type);
|
||||
if ($result < 0) {
|
||||
throw new RestException(500, 'Error when unlinking object', array_merge(array($this->category->error), $this->category->errors));
|
||||
}
|
||||
@ -741,7 +741,7 @@ class Categories extends DolibarrApi
|
||||
{
|
||||
dol_syslog("getObjects($id, $type, $onlyids)", LOG_DEBUG);
|
||||
|
||||
if (! DolibarrApiAccess::$user->rights->categorie->lire) {
|
||||
if (!DolibarrApiAccess::$user->rights->categorie->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
@ -751,11 +751,11 @@ class Categories extends DolibarrApi
|
||||
}
|
||||
|
||||
$result = $this->category->fetch($id);
|
||||
if (! $result) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'category not found');
|
||||
}
|
||||
|
||||
if (! DolibarrApi::_checkAccessToResource('category', $this->category->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('category', $this->category->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
|
||||
@ -789,18 +789,19 @@ class Categorie extends CommonObject
|
||||
|
||||
$objs = array();
|
||||
|
||||
$obj = new $this->MAP_OBJ_CLASS[$type]( $this->db );
|
||||
$tmpclass = $this->MAP_OBJ_CLASS[$type];
|
||||
$obj = new $tmpclass($this->db);
|
||||
|
||||
$sql = "SELECT c.fk_" . $this->MAP_CAT_FK[$type];
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "categorie_" . $this->MAP_CAT_TABLE[$type] . " as c";
|
||||
$sql .= ", " . MAIN_DB_PREFIX . $this->MAP_OBJ_TABLE[$type] . " as o";
|
||||
$sql .= " WHERE o.entity IN (" . getEntity($obj->element).")";
|
||||
$sql = "SELECT c.fk_".$this->MAP_CAT_FK[$type];
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."categorie_".$this->MAP_CAT_TABLE[$type]." as c";
|
||||
$sql .= ", ".MAIN_DB_PREFIX.$this->MAP_OBJ_TABLE[$type]." as o";
|
||||
$sql .= " WHERE o.entity IN (".getEntity($obj->element).")";
|
||||
$sql .= " AND c.fk_categorie = ".$this->id;
|
||||
$sql .= " AND c.fk_" . $this->MAP_CAT_FK[$type] . " = o.rowid";
|
||||
$sql .= " AND c.fk_".$this->MAP_CAT_FK[$type]." = o.rowid";
|
||||
// Protection for external users
|
||||
if (($type == 'customer' || $type == 'supplier') && $user->socid > 0)
|
||||
{
|
||||
$sql.= " AND o.rowid = ".$user->socid;
|
||||
$sql .= " AND o.rowid = ".$user->socid;
|
||||
}
|
||||
if ($limit > 0 || $offset > 0) $sql .= $this->db->plimit($limit + 1, $offset);
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
@ -937,7 +938,7 @@ class Categorie extends CommonObject
|
||||
$categories[$i]['description'] = $category_static->description;
|
||||
$categories[$i]['color'] = $category_static->color;
|
||||
$categories[$i]['socid'] = $category_static->socid;
|
||||
$categories[$i]['ref_ext'] = $category_static->ref_ext;
|
||||
$categories[$i]['ref_ext'] = $category_static->ref_ext;
|
||||
$categories[$i]['visible'] = $category_static->visible;
|
||||
$categories[$i]['type'] = $category_static->type;
|
||||
$categories[$i]['entity'] = $category_static->entity;
|
||||
@ -1577,7 +1578,7 @@ class Categorie extends CommonObject
|
||||
$sql .= " AND rowid = '".$id."'";
|
||||
}
|
||||
|
||||
$res = $this->db->query($sql);
|
||||
$res = $this->db->query($sql);
|
||||
if ($res)
|
||||
{
|
||||
while ($rec = $this->db->fetch_array($res))
|
||||
|
||||
@ -180,7 +180,7 @@ $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object,
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook))
|
||||
{
|
||||
print $object->showOptionals($extrafields, 'edit');
|
||||
print $object->showOptionals($extrafields, 'edit', $parameters);
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -1132,7 +1132,7 @@ if ($action == 'create')
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook))
|
||||
{
|
||||
print $object->showOptionals($extrafields, 'edit');
|
||||
print $object->showOptionals($extrafields, 'edit', $parameters);
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
@ -1549,7 +1549,7 @@ if ($id > 0)
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook))
|
||||
{
|
||||
print $object->showOptionals($extrafields, 'edit');
|
||||
print $object->showOptionals($extrafields, 'edit', $parameters);
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -1242,7 +1242,7 @@ else
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook))
|
||||
{
|
||||
print $object->showOptionals($extrafields, 'edit');
|
||||
print $object->showOptionals($extrafields, 'edit', $parameters);
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -1771,7 +1771,7 @@ if ($action == 'create' && $usercancreate)
|
||||
}
|
||||
};
|
||||
|
||||
print $object->showOptionals($extrafields, 'edit');
|
||||
print $object->showOptionals($extrafields, 'edit', $parameters);
|
||||
}
|
||||
|
||||
// Template to use by default
|
||||
|
||||
@ -443,7 +443,7 @@ if ($action == 'create')
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook))
|
||||
{
|
||||
print $object->showOptionals($extrafields, 'edit');
|
||||
print $object->showOptionals($extrafields, 'edit', $parameters);
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
@ -945,7 +945,7 @@ else
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook))
|
||||
{
|
||||
print $object->showOptionals($extrafields, 'edit');
|
||||
print $object->showOptionals($extrafields, 'edit', $parameters);
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -344,8 +344,6 @@ if ($action == 'create')
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
// Category
|
||||
if (is_array($options) && count($options) && $conf->categorie->enabled)
|
||||
{
|
||||
|
||||
@ -3282,11 +3282,11 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="2"', 'cols'=>2);
|
||||
$parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="2"', 'cols' => '2');
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook)) {
|
||||
print $object->showOptionals($extrafields, 'edit');
|
||||
print $object->showOptionals($extrafields, 'edit', $parameters);
|
||||
}
|
||||
|
||||
// Template to use by default
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -829,7 +829,7 @@ else
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook))
|
||||
{
|
||||
print $object->showOptionals($extrafields, 'edit');
|
||||
print $object->showOptionals($extrafields, 'edit', $parameters);
|
||||
}
|
||||
|
||||
print "</table><br>";
|
||||
@ -1162,12 +1162,12 @@ else
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters = array('colspan' => ' colspan="3"', 'cols'=>3);
|
||||
$parameters = array('colspan' => ' colspan="3"', 'cols'=> '3');
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook))
|
||||
{
|
||||
print $object->showOptionals($extrafields, 'edit');
|
||||
print $object->showOptionals($extrafields, 'edit', $parameters);
|
||||
}
|
||||
|
||||
$object->load_ref_elements();
|
||||
|
||||
@ -40,39 +40,39 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/contract/modules_contract.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
if (! empty($conf->projet->enabled)) {
|
||||
if (!empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
if (!empty($conf->projet->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||
}
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("contracts","orders","companies","bills","products",'compta'));
|
||||
$langs->loadLangs(array("contracts", "orders", "companies", "bills", "products", 'compta'));
|
||||
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$confirm=GETPOST('confirm', 'alpha');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$socid = GETPOST('socid', 'int');
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref=GETPOST('ref', 'alpha');
|
||||
$origin=GETPOST('origin', 'alpha');
|
||||
$originid=GETPOST('originid', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$origin = GETPOST('origin', 'alpha');
|
||||
$originid = GETPOST('originid', 'int');
|
||||
|
||||
$datecontrat='';
|
||||
$usehm=(! empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE:0);
|
||||
$datecontrat = '';
|
||||
$usehm = (!empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? $conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE : 0);
|
||||
|
||||
// Security check
|
||||
if ($user->socid) $socid=$user->socid;
|
||||
$result=restrictedArea($user, 'contrat', $id);
|
||||
if ($user->socid) $socid = $user->socid;
|
||||
$result = restrictedArea($user, 'contrat', $id);
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('contractcard','globalcard'));
|
||||
$hookmanager->initHooks(array('contractcard', 'globalcard'));
|
||||
|
||||
$object = new Contrat($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// Load object
|
||||
if ($id > 0 || ! empty($ref) && $action!='add') {
|
||||
if ($id > 0 || !empty($ref) && $action != 'add') {
|
||||
$ret = $object->fetch($id, $ref);
|
||||
if ($ret > 0)
|
||||
$ret = $object->fetch_thirdparty();
|
||||
@ -444,8 +444,8 @@ if (empty($reshook))
|
||||
$error++;
|
||||
}
|
||||
|
||||
$date_start = dol_mktime(GETPOST('date_start' . $predef . 'hour'), GETPOST('date_start' . $predef . 'min'), GETPOST('date_start' . $predef . 'sec'), GETPOST('date_start' . $predef . 'month'), GETPOST('date_start' . $predef . 'day'), GETPOST('date_start' . $predef . 'year'));
|
||||
$date_end = dol_mktime(GETPOST('date_end' . $predef . 'hour'), GETPOST('date_end' . $predef . 'min'), GETPOST('date_end' . $predef . 'sec'), GETPOST('date_end' . $predef . 'month'), GETPOST('date_end' . $predef . 'day'), GETPOST('date_end' . $predef . 'year'));
|
||||
$date_start = dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year'));
|
||||
$date_end = dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year'));
|
||||
if (!empty($date_start) && !empty($date_end) && $date_start > $date_end)
|
||||
{
|
||||
setEventMessages($langs->trans("Error").': '.$langs->trans("DateStartPlanned").' > '.$langs->trans("DateEndPlanned"), null, 'errors');
|
||||
@ -528,46 +528,46 @@ if (empty($reshook))
|
||||
{
|
||||
if ($price_base_type != 'HT')
|
||||
{
|
||||
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat/100)), 'MU');
|
||||
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
|
||||
}
|
||||
else
|
||||
{
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat/100)), 'MU');
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
|
||||
}
|
||||
}
|
||||
|
||||
$desc=$prod->description;
|
||||
$desc=dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION));
|
||||
$desc = $prod->description;
|
||||
$desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION));
|
||||
$fk_unit = $prod->fk_unit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$pu_ht=GETPOST('price_ht');
|
||||
$pu_ht = GETPOST('price_ht');
|
||||
$price_base_type = 'HT';
|
||||
$tva_tx=GETPOST('tva_tx')?str_replace('*', '', GETPOST('tva_tx')):0; // tva_tx field may be disabled, so we use vat rate 0
|
||||
$tva_npr=preg_match('/\*/', GETPOST('tva_tx'))?1:0;
|
||||
$desc=$product_desc;
|
||||
$fk_unit= GETPOST('units', 'alpha');
|
||||
$tva_tx = GETPOST('tva_tx') ?str_replace('*', '', GETPOST('tva_tx')) : 0; // tva_tx field may be disabled, so we use vat rate 0
|
||||
$tva_npr = preg_match('/\*/', GETPOST('tva_tx')) ? 1 : 0;
|
||||
$desc = $product_desc;
|
||||
$fk_unit = GETPOST('units', 'alpha');
|
||||
}
|
||||
|
||||
$localtax1_tx=get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr);
|
||||
$localtax2_tx=get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr);
|
||||
$localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr);
|
||||
$localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr);
|
||||
|
||||
// ajout prix achat
|
||||
$fk_fournprice = $_POST['fournprice'];
|
||||
if ( ! empty($_POST['buying_price']) )
|
||||
if (!empty($_POST['buying_price']))
|
||||
$pa_ht = $_POST['buying_price'];
|
||||
else
|
||||
$pa_ht = null;
|
||||
|
||||
$info_bits=0;
|
||||
$info_bits = 0;
|
||||
if ($tva_npr) $info_bits |= 0x01;
|
||||
|
||||
if (((! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance))
|
||||
|| empty($conf->global->MAIN_USE_ADVANCED_PERMS) ) && ($price_min && (price2num($pu_ht)*(1-price2num($remise_percent)/100) < price2num($price_min))))
|
||||
if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance))
|
||||
|| empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && ($price_min && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min))))
|
||||
{
|
||||
$object->error = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency));
|
||||
$result = -1 ;
|
||||
$result = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1239,39 +1239,39 @@ if ($action == 'create')
|
||||
print "</td></tr>";
|
||||
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
if (!empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load('projects');
|
||||
|
||||
$formproject=new FormProjets($db);
|
||||
$formproject = new FormProjets($db);
|
||||
|
||||
print '<tr><td>'.$langs->trans("Project").'</td><td>';
|
||||
$formproject->select_projects(($soc->id>0?$soc->id:-1), $projectid, "projectid", 0, 0, 1, 1);
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'"><span class="valignmiddle text-plus-circle">' . $langs->trans("AddProject") . '</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
|
||||
$formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, "projectid", 0, 0, 1, 1);
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddProject").'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
print '<tr><td>'.$langs->trans("NotePublic").'</td><td class="tdtop">';
|
||||
$doleditor=new DolEditor('note_public', $note_public, '', '100', 'dolibarr_notes', 'In', 1, true, true, ROWS_3, '90%');
|
||||
$doleditor = new DolEditor('note_public', $note_public, '', '100', 'dolibarr_notes', 'In', 1, true, true, ROWS_3, '90%');
|
||||
print $doleditor->Create(1);
|
||||
print '</td></tr>';
|
||||
|
||||
if (empty($user->socid))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("NotePrivate").'</td><td class="tdtop">';
|
||||
$doleditor=new DolEditor('note_private', $note_private, '', '100', 'dolibarr_notes', 'In', 1, true, true, ROWS_3, '90%');
|
||||
$doleditor = new DolEditor('note_private', $note_private, '', '100', 'dolibarr_notes', 'In', 1, true, true, ROWS_3, '90%');
|
||||
print $doleditor->Create(1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters=array('objectsrc' => $objectsrc,'colspan' => ' colspan="3"', 'cols'=>3);
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
$parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"', 'cols' => '3');
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
// Other attributes
|
||||
if (empty($reshook)) {
|
||||
print $object->showOptionals($extrafields, 'edit');
|
||||
print $object->showOptionals($extrafields, 'edit', $parameters);
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
@ -1389,62 +1389,62 @@ else
|
||||
|
||||
// Contract card
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/contrat/list.php?restore_lastsearch_values=1'.(! empty($socid)?'&socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/contrat/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
|
||||
$morehtmlref='';
|
||||
if (! empty($modCodeContract->code_auto)) {
|
||||
$morehtmlref.=$object->ref;
|
||||
$morehtmlref = '';
|
||||
if (!empty($modCodeContract->code_auto)) {
|
||||
$morehtmlref .= $object->ref;
|
||||
} else {
|
||||
$morehtmlref.=$form->editfieldkey("", 'ref', $object->ref, $object, $user->rights->contrat->creer, 'string', '', 0, 3);
|
||||
$morehtmlref.=$form->editfieldval("", 'ref', $object->ref, $object, $user->rights->contrat->creer, 'string', '', 0, 2);
|
||||
$morehtmlref .= $form->editfieldkey("", 'ref', $object->ref, $object, $user->rights->contrat->creer, 'string', '', 0, 3);
|
||||
$morehtmlref .= $form->editfieldval("", 'ref', $object->ref, $object, $user->rights->contrat->creer, 'string', '', 0, 2);
|
||||
}
|
||||
|
||||
$morehtmlref.='<div class="refidno">';
|
||||
$morehtmlref .= '<div class="refidno">';
|
||||
// Ref customer
|
||||
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->contrat->creer, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->contrat->creer, 'string', '', null, null, '', 1, 'getFormatedCustomerRef');
|
||||
$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->contrat->creer, 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->contrat->creer, 'string', '', null, null, '', 1, 'getFormatedCustomerRef');
|
||||
// Ref supplier
|
||||
$morehtmlref.='<br>';
|
||||
$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->contrat->creer, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->contrat->creer, 'string', '', null, null, '', 1, 'getFormatedSupplierRef');
|
||||
$morehtmlref .= '<br>';
|
||||
$morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->contrat->creer, 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->contrat->creer, 'string', '', null, null, '', 1, 'getFormatedSupplierRef');
|
||||
// Thirdparty
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' (<a href="'.DOL_URL_ROOT.'/contrat/list.php?socid='.$object->thirdparty->id.'&search_name='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherContracts").'</a>)';
|
||||
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
|
||||
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/contrat/list.php?socid='.$object->thirdparty->id.'&search_name='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherContracts").'</a>)';
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
if (!empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
|
||||
if ($user->rights->contrat->creer)
|
||||
{
|
||||
if ($action != 'classify') {
|
||||
$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
|
||||
}
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref .= $formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref .= '</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
if (!empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
|
||||
$morehtmlref .= $proj->ref;
|
||||
$morehtmlref .= '</a>';
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
$morehtmlref .= '';
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'none', $morehtmlref);
|
||||
@ -1619,7 +1619,7 @@ else
|
||||
// Quantity
|
||||
print '<td class="center">'.$objp->qty.'</td>';
|
||||
// Unit
|
||||
if($conf->global->PRODUCT_USE_UNITS) print '<td class="left">'.$langs->trans($object->lines[$cursorline-1]->getLabelOfUnit()).'</td>';
|
||||
if ($conf->global->PRODUCT_USE_UNITS) print '<td class="left">'.$langs->trans($object->lines[$cursorline - 1]->getLabelOfUnit()).'</td>';
|
||||
// Discount
|
||||
if ($objp->remise_percent > 0)
|
||||
{
|
||||
@ -1717,32 +1717,32 @@ else
|
||||
print '<td>';
|
||||
if ($objp->fk_product)
|
||||
{
|
||||
$productstatic->id=$objp->fk_product;
|
||||
$productstatic->type=$objp->ptype;
|
||||
$productstatic->ref=$objp->pref;
|
||||
$productstatic->entity=$objp->pentity;
|
||||
$productstatic->id = $objp->fk_product;
|
||||
$productstatic->type = $objp->ptype;
|
||||
$productstatic->ref = $objp->pref;
|
||||
$productstatic->entity = $objp->pentity;
|
||||
print $productstatic->getNomUrl(1, '', 32);
|
||||
print $objp->label?' - '.dol_trunc($objp->label, 32):'';
|
||||
print $objp->label ? ' - '.dol_trunc($objp->label, 32) : '';
|
||||
print '<br>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print $objp->label?$objp->label.'<br>':'';
|
||||
print $objp->label ? $objp->label.'<br>' : '';
|
||||
}
|
||||
|
||||
// editeur wysiwyg
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$nbrows=ROWS_2;
|
||||
if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
|
||||
$enable=(isset($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0);
|
||||
$doleditor=new DolEditor('product_desc', $objp->description, '', 92, 'dolibarr_details', '', false, true, $enable, $nbrows, '90%');
|
||||
$nbrows = ROWS_2;
|
||||
if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT;
|
||||
$enable = (isset($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0);
|
||||
$doleditor = new DolEditor('product_desc', $objp->description, '', 92, 'dolibarr_details', '', false, true, $enable, $nbrows, '90%');
|
||||
$doleditor->Create();
|
||||
|
||||
print '</td>';
|
||||
|
||||
// VAT
|
||||
print '<td class="right">';
|
||||
print $form->load_tva("eltva_tx", $objp->tva_tx.($objp->vat_src_code?(' ('.$objp->vat_src_code.')'):''), $mysoc, $object->thirdparty, $objp->fk_product, $objp->info_bits, $objp->product_type, 0, 1);
|
||||
print $form->load_tva("eltva_tx", $objp->tva_tx.($objp->vat_src_code ? (' ('.$objp->vat_src_code.')') : ''), $mysoc, $object->thirdparty, $objp->fk_product, $objp->info_bits, $objp->product_type, 0, 1);
|
||||
print '</td>';
|
||||
|
||||
// Price
|
||||
@ -1767,7 +1767,7 @@ else
|
||||
// Discount
|
||||
print '<td class="nowrap right"><input size="1" type="text" name="elremise_percent" value="'.$objp->remise_percent.'">%</td>';
|
||||
|
||||
if (! empty($usemargins))
|
||||
if (!empty($usemargins))
|
||||
{
|
||||
print '<td class="right">';
|
||||
if ($objp->fk_product) print '<select id="fournprice" name="fournprice"></select>';
|
||||
@ -1885,27 +1885,27 @@ else
|
||||
// Area with status and activation info of line
|
||||
if ($object->statut > 0)
|
||||
{
|
||||
print '<table class="notopnoleftnoright tableforservicepart2'.($cursorline < $nbofservices ?' boxtablenobottom':'').'" width="100%">';
|
||||
print '<table class="notopnoleftnoright tableforservicepart2'.($cursorline < $nbofservices ? ' boxtablenobottom' : '').'" width="100%">';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("ServiceStatus").': '.$object->lines[$cursorline-1]->getLibStatut(4).'</td>';
|
||||
print '<td>'.$langs->trans("ServiceStatus").': '.$object->lines[$cursorline - 1]->getLibStatut(4).'</td>';
|
||||
print '<td width="30" class="right">';
|
||||
if ($user->socid == 0)
|
||||
{
|
||||
if ($object->statut > 0 && $action != 'activateline' && $action != 'unactivateline')
|
||||
{
|
||||
$tmpaction='activateline';
|
||||
$tmpactionpicto='play';
|
||||
$tmpactiontext=$langs->trans("Activate");
|
||||
$tmpaction = 'activateline';
|
||||
$tmpactionpicto = 'play';
|
||||
$tmpactiontext = $langs->trans("Activate");
|
||||
if ($objp->statut == 4)
|
||||
{
|
||||
$tmpaction='unactivateline';
|
||||
$tmpactionpicto='playstop';
|
||||
$tmpactiontext=$langs->trans("Disable");
|
||||
$tmpaction = 'unactivateline';
|
||||
$tmpactionpicto = 'playstop';
|
||||
$tmpactiontext = $langs->trans("Disable");
|
||||
}
|
||||
if (($tmpaction=='activateline' && $user->rights->contrat->activer) || ($tmpaction=='unactivateline' && $user->rights->contrat->desactiver))
|
||||
if (($tmpaction == 'activateline' && $user->rights->contrat->activer) || ($tmpaction == 'unactivateline' && $user->rights->contrat->desactiver))
|
||||
{
|
||||
print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&ligne=' . $object->lines[$cursorline - 1]->id . '&action=' . $tmpaction . '">';
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&ligne='.$object->lines[$cursorline - 1]->id.'&action='.$tmpaction.'">';
|
||||
print img_picto($tmpactiontext, $tmpactionpicto);
|
||||
print '</a>';
|
||||
}
|
||||
@ -2060,24 +2060,24 @@ else
|
||||
// Form to add new line
|
||||
if ($user->rights->contrat->creer && ($object->statut == 0))
|
||||
{
|
||||
$dateSelector=1;
|
||||
$dateSelector = 1;
|
||||
|
||||
print "\n";
|
||||
print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline')?'#add':'#line_'.GETPOST('lineid')).'" method="POST">
|
||||
print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '#add' : '#line_'.GETPOST('lineid')).'" method="POST">
|
||||
<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">
|
||||
<input type="hidden" name="action" value="'.(($action != 'editline')?'addline':'updateline').'">
|
||||
<input type="hidden" name="action" value="'.(($action != 'editline') ? 'addline' : 'updateline').'">
|
||||
<input type="hidden" name="mode" value="">
|
||||
<input type="hidden" name="id" value="'.$object->id.'">
|
||||
';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table id="tablelines" class="noborder noshadow" width="100%">'; // Array with (n*2)+1 lines
|
||||
print '<table id="tablelines" class="noborder noshadow" width="100%">'; // Array with (n*2)+1 lines
|
||||
|
||||
// Form to add new line
|
||||
if ($action != 'editline')
|
||||
{
|
||||
$forcetoshowtitlelines=1;
|
||||
if (empty($object->multicurrency_code)) $object->multicurrency_code = $conf->currency; // TODO Remove this when multicurrency supported on contracts
|
||||
$forcetoshowtitlelines = 1;
|
||||
if (empty($object->multicurrency_code)) $object->multicurrency_code = $conf->currency; // TODO Remove this when multicurrency supported on contracts
|
||||
|
||||
// Add free products/services
|
||||
$object->formAddObjectLine(1, $mysoc, $soc);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2017-2019 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
@ -49,15 +49,24 @@ if ($action == 'add' && ! empty($permissiontoadd))
|
||||
{
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue; // Ignore special fields
|
||||
if ($object->fields[$key]['type'] == 'duration') {
|
||||
if (GETPOST($key.'hour') == '' && GETPOST($key.'min') == '') continue; // The field was not submited to be edited
|
||||
}
|
||||
else {
|
||||
if (!GETPOSTISSET($key)) continue; // The field was not submited to be edited
|
||||
}
|
||||
// Ignore special fields
|
||||
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue;
|
||||
|
||||
// Set value to insert
|
||||
if (in_array($object->fields[$key]['type'], array('text', 'html'))) {
|
||||
$value = GETPOST($key, 'none');
|
||||
} elseif ($object->fields[$key]['type']=='date') {
|
||||
} elseif ($object->fields[$key]['type'] == 'date') {
|
||||
$value = dol_mktime(12, 0, 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int'));
|
||||
} elseif ($object->fields[$key]['type']=='datetime') {
|
||||
} elseif ($object->fields[$key]['type'] == 'datetime') {
|
||||
$value = dol_mktime(GETPOST($key.'hour', 'int'), GETPOST($key.'min', 'int'), 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int'));
|
||||
} elseif ($object->fields[$key]['type'] == 'duration') {
|
||||
$value = 60*60*GETPOST($key.'hour', 'int') + 60*GETPOST($key.'min', 'int');
|
||||
} elseif (preg_match('/^(integer|price|real|double)/', $object->fields[$key]['type'])) {
|
||||
$value = price2num(GETPOST($key, 'none')); // To fix decimal separator according to lang setup
|
||||
} else {
|
||||
@ -108,8 +117,16 @@ if ($action == 'update' && !empty($permissiontoadd))
|
||||
{
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
if (!GETPOSTISSET($key)) continue; // The field was not submited to be edited
|
||||
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue; // Ignore special fields
|
||||
// Check if field was submited to be edited
|
||||
if ($object->fields[$key]['type'] == 'duration') {
|
||||
if (!GETPOSTISSET($key.'hour') || !GETPOSTISSET($key.'min')) continue; // The field was not submited to be edited
|
||||
}
|
||||
else {
|
||||
if (!GETPOSTISSET($key)) continue; // The field was not submited to be edited
|
||||
}
|
||||
// Ignore special fields
|
||||
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue;
|
||||
|
||||
// Set value to update
|
||||
if (in_array($object->fields[$key]['type'], array('text', 'html'))) {
|
||||
$value = GETPOST($key, 'none');
|
||||
@ -117,6 +134,12 @@ if ($action == 'update' && !empty($permissiontoadd))
|
||||
$value = dol_mktime(12, 0, 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year'));
|
||||
} elseif ($object->fields[$key]['type'] == 'datetime') {
|
||||
$value = dol_mktime(GETPOST($key.'hour'), GETPOST($key.'min'), 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year'));
|
||||
} elseif ($object->fields[$key]['type'] == 'duration') {
|
||||
if (GETPOST($key.'hour', 'int') != '' || GETPOST($key.'min', 'int') != '') {
|
||||
$value = 60*60*GETPOST($key.'hour', 'int') + 60*GETPOST($key.'min', 'int');
|
||||
} else {
|
||||
$value = '';
|
||||
}
|
||||
} elseif (in_array($object->fields[$key]['type'], array('price', 'real'))) {
|
||||
$value = price2num(GETPOST($key));
|
||||
} else {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -178,7 +178,7 @@ class Conf
|
||||
|
||||
if ($value && preg_match('/^MAIN_MODULE_/', $key))
|
||||
{
|
||||
$reg=array();
|
||||
$reg = array();
|
||||
// If this is constant for a new tab page activated by a module. It initializes modules_parts['tabs'].
|
||||
if (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)_TABS_/i', $key))
|
||||
{
|
||||
@ -224,11 +224,11 @@ class Conf
|
||||
}
|
||||
|
||||
// Include other local consts.php files and fetch their values to the corresponding database constants.
|
||||
if (! empty($this->global->LOCAL_CONSTS_FILES)) {
|
||||
if (!empty($this->global->LOCAL_CONSTS_FILES)) {
|
||||
$filesList = explode(":", $this->global->LOCAL_CONSTS_FILES);
|
||||
foreach ($filesList as $file) {
|
||||
$file=dol_sanitizeFileName($file);
|
||||
include_once DOL_DOCUMENT_ROOT . "/".$file."/".$file."_consts.php"; // This file can run code like setting $this->global->XXX vars.
|
||||
$file = dol_sanitizeFileName($file);
|
||||
include_once DOL_DOCUMENT_ROOT."/".$file."/".$file."_consts.php"; // This file can run code like setting $this->global->XXX vars.
|
||||
}
|
||||
}
|
||||
|
||||
@ -326,33 +326,33 @@ class Conf
|
||||
}
|
||||
|
||||
// For mycompany storage
|
||||
$this->mycompany->multidir_output = array($this->entity => $rootfordata."/mycompany");
|
||||
$this->mycompany->multidir_temp = array($this->entity => $rootfordata."/mycompany/temp");
|
||||
$this->mycompany->multidir_output = array($this->entity => $rootfordata."/mycompany");
|
||||
$this->mycompany->multidir_temp = array($this->entity => $rootfordata."/mycompany/temp");
|
||||
// For backward compatibility
|
||||
$this->mycompany->dir_output=$rootfordata."/mycompany";
|
||||
$this->mycompany->dir_temp=$rootfordata."/mycompany/temp";
|
||||
$this->mycompany->dir_output = $rootfordata."/mycompany";
|
||||
$this->mycompany->dir_temp = $rootfordata."/mycompany/temp";
|
||||
|
||||
// For admin storage
|
||||
$this->admin->dir_output=$rootfordata.'/admin';
|
||||
$this->admin->dir_temp=$rootfordata.'/admin/temp';
|
||||
$this->admin->dir_output = $rootfordata.'/admin';
|
||||
$this->admin->dir_temp = $rootfordata.'/admin/temp';
|
||||
|
||||
// For user storage
|
||||
$this->user->multidir_output = array($this->entity => $rootfordata."/users");
|
||||
$this->user->multidir_temp = array($this->entity => $rootfordata."/users/temp");
|
||||
$this->user->multidir_output = array($this->entity => $rootfordata."/users");
|
||||
$this->user->multidir_temp = array($this->entity => $rootfordata."/users/temp");
|
||||
// For backward compatibility
|
||||
$this->user->dir_output=$rootforuser."/users";
|
||||
$this->user->dir_temp=$rootforuser."/users/temp";
|
||||
$this->user->dir_output = $rootforuser."/users";
|
||||
$this->user->dir_temp = $rootforuser."/users/temp";
|
||||
|
||||
// For usergroup storage
|
||||
$this->usergroup->dir_output=$rootforuser."/usergroups";
|
||||
$this->usergroup->dir_temp=$rootforuser."/usergroups/temp";
|
||||
$this->usergroup->dir_output = $rootforuser."/usergroups";
|
||||
$this->usergroup->dir_temp = $rootforuser."/usergroups/temp";
|
||||
|
||||
// For proposal storage
|
||||
$this->propal->multidir_output = array($this->entity => $rootfordata."/propale");
|
||||
$this->propal->multidir_temp = array($this->entity => $rootfordata."/propale/temp");
|
||||
$this->propal->multidir_output = array($this->entity => $rootfordata."/propale");
|
||||
$this->propal->multidir_temp = array($this->entity => $rootfordata."/propale/temp");
|
||||
// For backward compatibility
|
||||
$this->propal->dir_output=$rootfordata."/propale";
|
||||
$this->propal->dir_temp=$rootfordata."/propale/temp";
|
||||
$this->propal->dir_output = $rootfordata."/propale";
|
||||
$this->propal->dir_temp = $rootfordata."/propale/temp";
|
||||
|
||||
// For bank storage
|
||||
$this->bank->multidir_output = array($this->entity => $rootfordata."/bank");
|
||||
@ -361,107 +361,107 @@ class Conf
|
||||
$this->bank->dir_temp = $rootfordata."/bank/temp";
|
||||
|
||||
// For medias storage
|
||||
$this->medias->multidir_output = array($this->entity => $rootfordata."/medias");
|
||||
$this->medias->multidir_temp = array($this->entity => $rootfordata."/medias/temp");
|
||||
$this->medias->multidir_output = array($this->entity => $rootfordata."/medias");
|
||||
$this->medias->multidir_temp = array($this->entity => $rootfordata."/medias/temp");
|
||||
|
||||
// Exception: Some dir are not the name of module. So we keep exception here for backward compatibility.
|
||||
|
||||
// Sous module bons d'expedition
|
||||
$this->expedition_bon->enabled=(! empty($this->global->MAIN_SUBMODULE_EXPEDITION)?$this->global->MAIN_SUBMODULE_EXPEDITION:0);
|
||||
$this->expedition_bon->enabled = (!empty($this->global->MAIN_SUBMODULE_EXPEDITION) ? $this->global->MAIN_SUBMODULE_EXPEDITION : 0);
|
||||
// Sous module bons de livraison
|
||||
$this->livraison_bon->enabled=(! empty($this->global->MAIN_SUBMODULE_LIVRAISON)?$this->global->MAIN_SUBMODULE_LIVRAISON:0);
|
||||
$this->livraison_bon->enabled = (!empty($this->global->MAIN_SUBMODULE_LIVRAISON) ? $this->global->MAIN_SUBMODULE_LIVRAISON : 0);
|
||||
|
||||
// Module fournisseur
|
||||
// TODO To split into module supplier_invoice and supplier_order
|
||||
if (! empty($this->fournisseur))
|
||||
if (!empty($this->fournisseur))
|
||||
{
|
||||
$this->fournisseur->commande=new stdClass();
|
||||
$this->fournisseur->commande->multidir_output=array($this->entity => $rootfordata."/fournisseur/commande");
|
||||
$this->fournisseur->commande->multidir_temp =array($this->entity => $rootfordata."/fournisseur/commande/temp");
|
||||
$this->fournisseur->commande->dir_output=$rootfordata."/fournisseur/commande"; // For backward compatibility
|
||||
$this->fournisseur->commande->dir_temp =$rootfordata."/fournisseur/commande/temp"; // For backward compatibility
|
||||
$this->fournisseur->facture=new stdClass();
|
||||
$this->fournisseur->facture->multidir_output=array($this->entity => $rootfordata."/fournisseur/facture");
|
||||
$this->fournisseur->facture->multidir_temp =array($this->entity => $rootfordata."/fournisseur/facture/temp");
|
||||
$this->fournisseur->facture->dir_output =$rootfordata."/fournisseur/facture"; // For backward compatibility
|
||||
$this->fournisseur->facture->dir_temp =$rootfordata."/fournisseur/facture/temp"; // For backward compatibility
|
||||
$this->fournisseur->commande = new stdClass();
|
||||
$this->fournisseur->commande->multidir_output = array($this->entity => $rootfordata."/fournisseur/commande");
|
||||
$this->fournisseur->commande->multidir_temp = array($this->entity => $rootfordata."/fournisseur/commande/temp");
|
||||
$this->fournisseur->commande->dir_output = $rootfordata."/fournisseur/commande"; // For backward compatibility
|
||||
$this->fournisseur->commande->dir_temp = $rootfordata."/fournisseur/commande/temp"; // For backward compatibility
|
||||
$this->fournisseur->facture = new stdClass();
|
||||
$this->fournisseur->facture->multidir_output = array($this->entity => $rootfordata."/fournisseur/facture");
|
||||
$this->fournisseur->facture->multidir_temp = array($this->entity => $rootfordata."/fournisseur/facture/temp");
|
||||
$this->fournisseur->facture->dir_output = $rootfordata."/fournisseur/facture"; // For backward compatibility
|
||||
$this->fournisseur->facture->dir_temp = $rootfordata."/fournisseur/facture/temp"; // For backward compatibility
|
||||
|
||||
$this->fournisseur->payment=new stdClass();
|
||||
$this->fournisseur->payment->multidir_output=array($this->entity => $rootfordata."/fournisseur/payment");
|
||||
$this->fournisseur->payment->multidir_temp =array($this->entity => $rootfordata."/fournisseur/payment/temp");
|
||||
$this->fournisseur->payment->dir_output =$rootfordata."/fournisseur/payment"; // For backward compatibility
|
||||
$this->fournisseur->payment->dir_temp =$rootfordata."/fournisseur/payment/temp"; // For backward compatibility
|
||||
$this->fournisseur->payment = new stdClass();
|
||||
$this->fournisseur->payment->multidir_output = array($this->entity => $rootfordata."/fournisseur/payment");
|
||||
$this->fournisseur->payment->multidir_temp = array($this->entity => $rootfordata."/fournisseur/payment/temp");
|
||||
$this->fournisseur->payment->dir_output = $rootfordata."/fournisseur/payment"; // For backward compatibility
|
||||
$this->fournisseur->payment->dir_temp = $rootfordata."/fournisseur/payment/temp"; // For backward compatibility
|
||||
|
||||
// To prepare split of module vendor(fournisseur) into vendor + supplier_order + supplier_invoice + supplierproposal
|
||||
if (! empty($this->fournisseur->enabled)) // By default, if module supplier is on, we set new properties
|
||||
if (!empty($this->fournisseur->enabled)) // By default, if module supplier is on, we set new properties
|
||||
{
|
||||
if (empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) // This can be set to 1 once modules purchase order and supplier invoice exists
|
||||
{
|
||||
$this->supplier_order=new stdClass();
|
||||
$this->supplier_order->enabled=1;
|
||||
$this->supplier_order->multidir_output=array($this->entity => $rootfordata."/fournisseur/commande");
|
||||
$this->supplier_order->multidir_temp =array($this->entity => $rootfordata."/fournisseur/commande/temp");
|
||||
$this->supplier_order->dir_output=$rootfordata."/fournisseur/commande"; // For backward compatibility
|
||||
$this->supplier_order->dir_temp=$rootfordata."/fournisseur/commande/temp"; // For backward compatibility
|
||||
$this->supplier_order = new stdClass();
|
||||
$this->supplier_order->enabled = 1;
|
||||
$this->supplier_order->multidir_output = array($this->entity => $rootfordata."/fournisseur/commande");
|
||||
$this->supplier_order->multidir_temp = array($this->entity => $rootfordata."/fournisseur/commande/temp");
|
||||
$this->supplier_order->dir_output = $rootfordata."/fournisseur/commande"; // For backward compatibility
|
||||
$this->supplier_order->dir_temp = $rootfordata."/fournisseur/commande/temp"; // For backward compatibility
|
||||
}
|
||||
|
||||
if (empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) // This can be set to 1 once modules purchase order and supplier invoice exists
|
||||
{
|
||||
$this->supplier_invoice=new stdClass();
|
||||
$this->supplier_invoice->enabled=1;
|
||||
$this->supplier_invoice->multidir_output=array($this->entity => $rootfordata."/fournisseur/facture");
|
||||
$this->supplier_invoice->multidir_temp =array($this->entity => $rootfordata."/fournisseur/facture/temp");
|
||||
$this->supplier_invoice->dir_output=$rootfordata."/fournisseur/facture"; // For backward compatibility
|
||||
$this->supplier_invoice->dir_temp=$rootfordata."/fournisseur/facture/temp"; // For backward compatibility
|
||||
$this->supplier_invoice = new stdClass();
|
||||
$this->supplier_invoice->enabled = 1;
|
||||
$this->supplier_invoice->multidir_output = array($this->entity => $rootfordata."/fournisseur/facture");
|
||||
$this->supplier_invoice->multidir_temp = array($this->entity => $rootfordata."/fournisseur/facture/temp");
|
||||
$this->supplier_invoice->dir_output = $rootfordata."/fournisseur/facture"; // For backward compatibility
|
||||
$this->supplier_invoice->dir_temp = $rootfordata."/fournisseur/facture/temp"; // For backward compatibility
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Module product/service
|
||||
$this->product->multidir_output=array($this->entity => $rootfordata."/produit");
|
||||
$this->product->multidir_temp =array($this->entity => $rootfordata."/produit/temp");
|
||||
$this->service->multidir_output=array($this->entity => $rootfordata."/produit");
|
||||
$this->service->multidir_temp =array($this->entity => $rootfordata."/produit/temp");
|
||||
$this->product->multidir_output = array($this->entity => $rootfordata."/produit");
|
||||
$this->product->multidir_temp = array($this->entity => $rootfordata."/produit/temp");
|
||||
$this->service->multidir_output = array($this->entity => $rootfordata."/produit");
|
||||
$this->service->multidir_temp = array($this->entity => $rootfordata."/produit/temp");
|
||||
// For backward compatibility
|
||||
$this->product->dir_output=$rootfordata."/produit";
|
||||
$this->product->dir_temp =$rootfordata."/produit/temp";
|
||||
$this->service->dir_output=$rootfordata."/produit";
|
||||
$this->service->dir_temp =$rootfordata."/produit/temp";
|
||||
$this->product->dir_output = $rootfordata."/produit";
|
||||
$this->product->dir_temp = $rootfordata."/produit/temp";
|
||||
$this->service->dir_output = $rootfordata."/produit";
|
||||
$this->service->dir_temp = $rootfordata."/produit/temp";
|
||||
|
||||
// Module productbatch
|
||||
$this->productbatch->multidir_output=array($this->entity => $rootfordata."/produitlot");
|
||||
$this->productbatch->multidir_temp =array($this->entity => $rootfordata."/produitlot/temp");
|
||||
$this->productbatch->multidir_output = array($this->entity => $rootfordata."/produitlot");
|
||||
$this->productbatch->multidir_temp = array($this->entity => $rootfordata."/produitlot/temp");
|
||||
|
||||
// Module contrat
|
||||
$this->contrat->multidir_output = array($this->entity => $rootfordata."/contract");
|
||||
$this->contrat->multidir_temp = array($this->entity => $rootfordata."/contract/temp");
|
||||
$this->contrat->multidir_output = array($this->entity => $rootfordata."/contract");
|
||||
$this->contrat->multidir_temp = array($this->entity => $rootfordata."/contract/temp");
|
||||
// For backward compatibility
|
||||
$this->contrat->dir_output=$rootfordata."/contract";
|
||||
$this->contrat->dir_temp =$rootfordata."/contract/temp";
|
||||
$this->contrat->dir_output = $rootfordata."/contract";
|
||||
$this->contrat->dir_temp = $rootfordata."/contract/temp";
|
||||
|
||||
// Module bank
|
||||
$this->bank->dir_output=$rootfordata."/bank";
|
||||
$this->bank->dir_temp =$rootfordata."/bank/temp";
|
||||
$this->bank->dir_output = $rootfordata."/bank";
|
||||
$this->bank->dir_temp = $rootfordata."/bank/temp";
|
||||
|
||||
|
||||
// Set some default values
|
||||
//$this->global->MAIN_LIST_FILTER_ON_DAY=1; // On filter that show date, we must show input field for day before or after month
|
||||
$this->global->MAIN_MAIL_USE_MULTI_PART=1;
|
||||
$this->global->MAIN_MAIL_USE_MULTI_PART = 1;
|
||||
|
||||
// societe
|
||||
if (empty($this->global->SOCIETE_CODECLIENT_ADDON)) $this->global->SOCIETE_CODECLIENT_ADDON="mod_codeclient_leopard";
|
||||
if (empty($this->global->SOCIETE_CODECOMPTA_ADDON)) $this->global->SOCIETE_CODECOMPTA_ADDON="mod_codecompta_panicum";
|
||||
if (empty($this->global->SOCIETE_CODECLIENT_ADDON)) $this->global->SOCIETE_CODECLIENT_ADDON = "mod_codeclient_leopard";
|
||||
if (empty($this->global->SOCIETE_CODECOMPTA_ADDON)) $this->global->SOCIETE_CODECOMPTA_ADDON = "mod_codecompta_panicum";
|
||||
|
||||
if (empty($this->global->CHEQUERECEIPTS_ADDON)) $this->global->CHEQUERECEIPTS_ADDON='mod_chequereceipt_mint';
|
||||
if (empty($conf->global->TICKET_ADDON)) $this->global->TICKET_ADDON='mod_ticket_simple';
|
||||
if (empty($this->global->CHEQUERECEIPTS_ADDON)) $this->global->CHEQUERECEIPTS_ADDON = 'mod_chequereceipt_mint';
|
||||
if (empty($conf->global->TICKET_ADDON)) $this->global->TICKET_ADDON = 'mod_ticket_simple';
|
||||
|
||||
// Security
|
||||
if (empty($this->global->USER_PASSWORD_GENERATED)) $this->global->USER_PASSWORD_GENERATED='standard'; // Default password generator
|
||||
if (empty($this->global->MAIN_UMASK)) $this->global->MAIN_UMASK='0664'; // Default mask
|
||||
if (empty($this->global->USER_PASSWORD_GENERATED)) $this->global->USER_PASSWORD_GENERATED = 'standard'; // Default password generator
|
||||
if (empty($this->global->MAIN_UMASK)) $this->global->MAIN_UMASK = '0664'; // Default mask
|
||||
|
||||
// conf->use_javascript_ajax
|
||||
$this->use_javascript_ajax=1;
|
||||
if (isset($this->global->MAIN_DISABLE_JAVASCRIPT)) $this->use_javascript_ajax=! $this->global->MAIN_DISABLE_JAVASCRIPT;
|
||||
$this->use_javascript_ajax = 1;
|
||||
if (isset($this->global->MAIN_DISABLE_JAVASCRIPT)) $this->use_javascript_ajax = !$this->global->MAIN_DISABLE_JAVASCRIPT;
|
||||
// If no javascript_ajax, Ajax features are disabled.
|
||||
if (empty($this->use_javascript_ajax))
|
||||
{
|
||||
@ -471,231 +471,231 @@ class Conf
|
||||
unset($this->global->PROJECT_USE_SEARCH_TO_SELECT);
|
||||
}
|
||||
|
||||
if (! empty($this->productbatch->enabled))
|
||||
if (!empty($this->productbatch->enabled))
|
||||
{
|
||||
$this->global->STOCK_CALCULATE_ON_BILL=0;
|
||||
$this->global->STOCK_CALCULATE_ON_VALIDATE_ORDER=0;
|
||||
$this->global->STOCK_CALCULATE_ON_SHIPMENT=1;
|
||||
$this->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE=0;
|
||||
$this->global->STOCK_CALCULATE_ON_SUPPLIER_BILL=0;
|
||||
$this->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER=0;
|
||||
if(empty($this->reception->enabled))$this->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER=1;
|
||||
$this->global->STOCK_CALCULATE_ON_BILL = 0;
|
||||
$this->global->STOCK_CALCULATE_ON_VALIDATE_ORDER = 0;
|
||||
$this->global->STOCK_CALCULATE_ON_SHIPMENT = 1;
|
||||
$this->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE = 0;
|
||||
$this->global->STOCK_CALCULATE_ON_SUPPLIER_BILL = 0;
|
||||
$this->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER = 0;
|
||||
if (empty($this->reception->enabled))$this->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER = 1;
|
||||
else {
|
||||
$this->global->STOCK_CALCULATE_ON_RECEPTION=1;
|
||||
$this->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE=0;
|
||||
$this->global->STOCK_CALCULATE_ON_RECEPTION = 1;
|
||||
$this->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// conf->currency
|
||||
if (empty($this->global->MAIN_MONNAIE)) $this->global->MAIN_MONNAIE='EUR';
|
||||
$this->currency=$this->global->MAIN_MONNAIE;
|
||||
if (empty($this->global->MAIN_MONNAIE)) $this->global->MAIN_MONNAIE = 'EUR';
|
||||
$this->currency = $this->global->MAIN_MONNAIE;
|
||||
|
||||
if (empty($this->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY)) $this->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY = 30; // Less than 1 minutes to be sure
|
||||
if (empty($this->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY)) $this->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY = 30; // Less than 1 minutes to be sure
|
||||
|
||||
// conf->global->ACCOUNTING_MODE = Option des modules Comptabilites (simple ou expert). Defini le mode de calcul des etats comptables (CA,...)
|
||||
if (empty($this->global->ACCOUNTING_MODE)) $this->global->ACCOUNTING_MODE='RECETTES-DEPENSES'; // By default. Can be 'RECETTES-DEPENSES' ou 'CREANCES-DETTES'
|
||||
if (empty($this->global->ACCOUNTING_MODE)) $this->global->ACCOUNTING_MODE = 'RECETTES-DEPENSES'; // By default. Can be 'RECETTES-DEPENSES' ou 'CREANCES-DETTES'
|
||||
|
||||
// By default, suppliers objects can be linked to all projects
|
||||
if (! isset($this->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS)) $this->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS = 1;
|
||||
if (!isset($this->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS)) $this->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS = 1;
|
||||
|
||||
// By default we enable feature to bill time spent
|
||||
if (! isset($this->global->PROJECT_BILL_TIME_SPENT)) $this->global->PROJECT_BILL_TIME_SPENT = 1;
|
||||
if (!isset($this->global->PROJECT_BILL_TIME_SPENT)) $this->global->PROJECT_BILL_TIME_SPENT = 1;
|
||||
|
||||
// MAIN_HTML_TITLE
|
||||
if (! isset($this->global->MAIN_HTML_TITLE)) $this->global->MAIN_HTML_TITLE='noapp,thirdpartynameonly,contactnameonly,projectnameonly';
|
||||
if (!isset($this->global->MAIN_HTML_TITLE)) $this->global->MAIN_HTML_TITLE = 'noapp,thirdpartynameonly,contactnameonly,projectnameonly';
|
||||
|
||||
// conf->liste_limit = constante de taille maximale des listes
|
||||
if (empty($this->global->MAIN_SIZE_LISTE_LIMIT)) $this->global->MAIN_SIZE_LISTE_LIMIT=25;
|
||||
$this->liste_limit=$this->global->MAIN_SIZE_LISTE_LIMIT;
|
||||
if (empty($this->global->MAIN_SIZE_LISTE_LIMIT)) $this->global->MAIN_SIZE_LISTE_LIMIT = 25;
|
||||
$this->liste_limit = $this->global->MAIN_SIZE_LISTE_LIMIT;
|
||||
|
||||
// conf->product->limit_size = constante de taille maximale des select de produit
|
||||
if (! isset($this->global->PRODUIT_LIMIT_SIZE)) $this->global->PRODUIT_LIMIT_SIZE=1000;
|
||||
$this->product->limit_size=$this->global->PRODUIT_LIMIT_SIZE;
|
||||
if (!isset($this->global->PRODUIT_LIMIT_SIZE)) $this->global->PRODUIT_LIMIT_SIZE = 1000;
|
||||
$this->product->limit_size = $this->global->PRODUIT_LIMIT_SIZE;
|
||||
|
||||
// conf->theme et $this->css
|
||||
if (empty($this->global->MAIN_THEME)) $this->global->MAIN_THEME="eldy";
|
||||
if (! empty($this->global->MAIN_FORCETHEME)) $this->global->MAIN_THEME=$this->global->MAIN_FORCETHEME;
|
||||
$this->theme=$this->global->MAIN_THEME;
|
||||
if (empty($this->global->MAIN_THEME)) $this->global->MAIN_THEME = "eldy";
|
||||
if (!empty($this->global->MAIN_FORCETHEME)) $this->global->MAIN_THEME = $this->global->MAIN_FORCETHEME;
|
||||
$this->theme = $this->global->MAIN_THEME;
|
||||
$this->css = "/theme/".$this->theme."/style.css.php";
|
||||
|
||||
// conf->email_from = email pour envoi par dolibarr des mails automatiques
|
||||
$this->email_from = "robot@example.com";
|
||||
if (! empty($this->global->MAIN_MAIL_EMAIL_FROM)) $this->email_from = $this->global->MAIN_MAIL_EMAIL_FROM;
|
||||
if (!empty($this->global->MAIN_MAIL_EMAIL_FROM)) $this->email_from = $this->global->MAIN_MAIL_EMAIL_FROM;
|
||||
|
||||
// conf->notification->email_from = email pour envoi par Dolibarr des notifications
|
||||
$this->notification->email_from=$this->email_from;
|
||||
if (! empty($this->global->NOTIFICATION_EMAIL_FROM)) $this->notification->email_from=$this->global->NOTIFICATION_EMAIL_FROM;
|
||||
$this->notification->email_from = $this->email_from;
|
||||
if (!empty($this->global->NOTIFICATION_EMAIL_FROM)) $this->notification->email_from = $this->global->NOTIFICATION_EMAIL_FROM;
|
||||
|
||||
// conf->mailing->email_from = email pour envoi par Dolibarr des mailings
|
||||
$this->mailing->email_from=$this->email_from;
|
||||
if (! empty($this->global->MAILING_EMAIL_FROM)) $this->mailing->email_from=$this->global->MAILING_EMAIL_FROM;
|
||||
if (! isset($this->global->MAIN_EMAIL_ADD_TRACK_ID)) $this->global->MAIN_EMAIL_ADD_TRACK_ID=1;
|
||||
$this->mailing->email_from = $this->email_from;
|
||||
if (!empty($this->global->MAILING_EMAIL_FROM)) $this->mailing->email_from = $this->global->MAILING_EMAIL_FROM;
|
||||
if (!isset($this->global->MAIN_EMAIL_ADD_TRACK_ID)) $this->global->MAIN_EMAIL_ADD_TRACK_ID = 1;
|
||||
|
||||
// Format for date (used by default when not found or not searched in lang)
|
||||
$this->format_date_short="%d/%m/%Y"; // Format of day with PHP/C tags (strftime functions)
|
||||
$this->format_date_short_java="dd/MM/yyyy"; // Format of day with Java tags
|
||||
$this->format_hour_short="%H:%M";
|
||||
$this->format_hour_short_duration="%H:%M";
|
||||
$this->format_date_text_short="%d %b %Y";
|
||||
$this->format_date_text="%d %B %Y";
|
||||
$this->format_date_hour_short="%d/%m/%Y %H:%M";
|
||||
$this->format_date_hour_sec_short="%d/%m/%Y %H:%M:%S";
|
||||
$this->format_date_hour_text_short="%d %b %Y %H:%M";
|
||||
$this->format_date_hour_text="%d %B %Y %H:%M";
|
||||
$this->format_date_short = "%d/%m/%Y"; // Format of day with PHP/C tags (strftime functions)
|
||||
$this->format_date_short_java = "dd/MM/yyyy"; // Format of day with Java tags
|
||||
$this->format_hour_short = "%H:%M";
|
||||
$this->format_hour_short_duration = "%H:%M";
|
||||
$this->format_date_text_short = "%d %b %Y";
|
||||
$this->format_date_text = "%d %B %Y";
|
||||
$this->format_date_hour_short = "%d/%m/%Y %H:%M";
|
||||
$this->format_date_hour_sec_short = "%d/%m/%Y %H:%M:%S";
|
||||
$this->format_date_hour_text_short = "%d %b %Y %H:%M";
|
||||
$this->format_date_hour_text = "%d %B %Y %H:%M";
|
||||
|
||||
// Duration of workday
|
||||
if (! isset($this->global->MAIN_DURATION_OF_WORKDAY)) $this->global->MAIN_DURATION_OF_WORKDAY=86400;
|
||||
if (!isset($this->global->MAIN_DURATION_OF_WORKDAY)) $this->global->MAIN_DURATION_OF_WORKDAY = 86400;
|
||||
|
||||
// Limites decimales si non definie (peuvent etre egale a 0)
|
||||
if (! isset($this->global->MAIN_MAX_DECIMALS_UNIT)) $this->global->MAIN_MAX_DECIMALS_UNIT=5;
|
||||
if (! isset($this->global->MAIN_MAX_DECIMALS_TOT)) $this->global->MAIN_MAX_DECIMALS_TOT=2;
|
||||
if (! isset($this->global->MAIN_MAX_DECIMALS_SHOWN)) $this->global->MAIN_MAX_DECIMALS_SHOWN=8;
|
||||
if (!isset($this->global->MAIN_MAX_DECIMALS_UNIT)) $this->global->MAIN_MAX_DECIMALS_UNIT = 5;
|
||||
if (!isset($this->global->MAIN_MAX_DECIMALS_TOT)) $this->global->MAIN_MAX_DECIMALS_TOT = 2;
|
||||
if (!isset($this->global->MAIN_MAX_DECIMALS_SHOWN)) $this->global->MAIN_MAX_DECIMALS_SHOWN = 8;
|
||||
|
||||
// Default pdf option
|
||||
if (! isset($this->global->MAIN_PDF_DASH_BETWEEN_LINES)) $this->global->MAIN_PDF_DASH_BETWEEN_LINES=1; // use dash between lines
|
||||
if (! isset($this->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) $this->global->PDF_ALLOW_HTML_FOR_FREE_TEXT=1; // allow html content into free footer text
|
||||
if (!isset($this->global->MAIN_PDF_DASH_BETWEEN_LINES)) $this->global->MAIN_PDF_DASH_BETWEEN_LINES = 1; // use dash between lines
|
||||
if (!isset($this->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) $this->global->PDF_ALLOW_HTML_FOR_FREE_TEXT = 1; // allow html content into free footer text
|
||||
|
||||
// Default max file size for upload
|
||||
$this->maxfilesize = (empty($this->global->MAIN_UPLOAD_DOC) ? 0 : (int) $this->global->MAIN_UPLOAD_DOC * 1024);
|
||||
|
||||
// By default, we propagate contacts
|
||||
if (! isset($this->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN)) $this->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN='*'; // Can be also '*' or '^(BILLING|SHIPPING|CUSTOMER|.*)$' (regex not yet implemented)
|
||||
if (!isset($this->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN)) $this->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN = '*'; // Can be also '*' or '^(BILLING|SHIPPING|CUSTOMER|.*)$' (regex not yet implemented)
|
||||
|
||||
// By default, we do not use the zip town table but the table of third parties
|
||||
if (! isset($this->global->MAIN_USE_ZIPTOWN_DICTIONNARY)) $this->global->MAIN_USE_ZIPTOWN_DICTIONNARY=0;
|
||||
if (!isset($this->global->MAIN_USE_ZIPTOWN_DICTIONNARY)) $this->global->MAIN_USE_ZIPTOWN_DICTIONNARY = 0;
|
||||
|
||||
// By default, we open card if one found
|
||||
if (! isset($this->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE)) $this->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE=1;
|
||||
if (!isset($this->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE)) $this->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE = 1;
|
||||
|
||||
// By default, we show state code in combo list
|
||||
if (! isset($this->global->MAIN_SHOW_STATE_CODE)) $this->global->MAIN_SHOW_STATE_CODE=1;
|
||||
if (!isset($this->global->MAIN_SHOW_STATE_CODE)) $this->global->MAIN_SHOW_STATE_CODE = 1;
|
||||
|
||||
// Use a SCA ready workflow with Stripe module (STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION by default if nothing defined)
|
||||
if (! isset($this->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION) && empty($this->global->STRIPE_USE_NEW_CHECKOUT)) $this->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION=1;
|
||||
if (!isset($this->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION) && empty($this->global->STRIPE_USE_NEW_CHECKOUT)) $this->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION = 1;
|
||||
|
||||
// Define list of limited modules (value must be key found for "name" property of module, so for example 'supplierproposal' for Module "Supplier Proposal"
|
||||
if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='user,societe,propal,commande,facture,categorie,supplierproposal,fournisseur,contact,projet,contrat,ficheinter,expedition,agenda,resource,adherent,blockedlog'; // '' means 'all'. Note that contact is added here as it should be a module later.
|
||||
if (! empty($this->modules_parts['moduleforexternal'])) // Module part to include an external module into the MAIN_MODULES_FOR_EXTERNAL list
|
||||
if (!isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL = 'user,societe,propal,commande,facture,categorie,supplierproposal,fournisseur,contact,projet,contrat,ficheinter,expedition,agenda,resource,adherent,blockedlog'; // '' means 'all'. Note that contact is added here as it should be a module later.
|
||||
if (!empty($this->modules_parts['moduleforexternal'])) // Module part to include an external module into the MAIN_MODULES_FOR_EXTERNAL list
|
||||
{
|
||||
foreach($this->modules_parts['moduleforexternal'] as $key=>$value) $this->global->MAIN_MODULES_FOR_EXTERNAL.=",".$key;
|
||||
foreach ($this->modules_parts['moduleforexternal'] as $key=>$value) $this->global->MAIN_MODULES_FOR_EXTERNAL .= ",".$key;
|
||||
}
|
||||
|
||||
// Enable select2
|
||||
if (empty($this->global->MAIN_USE_JQUERY_MULTISELECT) || $this->global->MAIN_USE_JQUERY_MULTISELECT == '1') $this->global->MAIN_USE_JQUERY_MULTISELECT='select2';
|
||||
if (empty($this->global->MAIN_USE_JQUERY_MULTISELECT) || $this->global->MAIN_USE_JQUERY_MULTISELECT == '1') $this->global->MAIN_USE_JQUERY_MULTISELECT = 'select2';
|
||||
|
||||
// Timeouts
|
||||
if (empty($this->global->MAIN_USE_CONNECT_TIMEOUT)) $this->global->MAIN_USE_CONNECT_TIMEOUT=10;
|
||||
if (empty($this->global->MAIN_USE_RESPONSE_TIMEOUT)) $this->global->MAIN_USE_RESPONSE_TIMEOUT=30;
|
||||
if (empty($this->global->MAIN_USE_CONNECT_TIMEOUT)) $this->global->MAIN_USE_CONNECT_TIMEOUT = 10;
|
||||
if (empty($this->global->MAIN_USE_RESPONSE_TIMEOUT)) $this->global->MAIN_USE_RESPONSE_TIMEOUT = 30;
|
||||
|
||||
// Set default variable to calculate VAT as if option tax_mode was 0 (standard)
|
||||
if (empty($this->global->TAX_MODE_SELL_PRODUCT)) $this->global->TAX_MODE_SELL_PRODUCT='invoice';
|
||||
if (empty($this->global->TAX_MODE_BUY_PRODUCT)) $this->global->TAX_MODE_BUY_PRODUCT='invoice';
|
||||
if (empty($this->global->TAX_MODE_SELL_SERVICE)) $this->global->TAX_MODE_SELL_SERVICE='payment';
|
||||
if (empty($this->global->TAX_MODE_BUY_SERVICE)) $this->global->TAX_MODE_BUY_SERVICE='payment';
|
||||
if (empty($this->global->TAX_MODE_SELL_PRODUCT)) $this->global->TAX_MODE_SELL_PRODUCT = 'invoice';
|
||||
if (empty($this->global->TAX_MODE_BUY_PRODUCT)) $this->global->TAX_MODE_BUY_PRODUCT = 'invoice';
|
||||
if (empty($this->global->TAX_MODE_SELL_SERVICE)) $this->global->TAX_MODE_SELL_SERVICE = 'payment';
|
||||
if (empty($this->global->TAX_MODE_BUY_SERVICE)) $this->global->TAX_MODE_BUY_SERVICE = 'payment';
|
||||
|
||||
// Delay before warnings
|
||||
// Avoid strict errors. TODO: Replace xxx->warning_delay with a property ->warning_delay_xxx
|
||||
if (isset($this->agenda)) {
|
||||
$this->adherent->subscription = new stdClass();
|
||||
$this->adherent->subscription->warning_delay=(isset($this->global->MAIN_DELAY_MEMBERS)?$this->global->MAIN_DELAY_MEMBERS:0)*24*60*60;
|
||||
$this->adherent->subscription->warning_delay = (isset($this->global->MAIN_DELAY_MEMBERS) ? $this->global->MAIN_DELAY_MEMBERS : 0) * 24 * 60 * 60;
|
||||
}
|
||||
if (isset($this->agenda)) {
|
||||
$this->agenda->warning_delay=(isset($this->global->MAIN_DELAY_ACTIONS_TODO)?$this->global->MAIN_DELAY_ACTIONS_TODO:7)*24*60*60;
|
||||
$this->agenda->warning_delay = (isset($this->global->MAIN_DELAY_ACTIONS_TODO) ? $this->global->MAIN_DELAY_ACTIONS_TODO : 7) * 24 * 60 * 60;
|
||||
}
|
||||
if (isset($this->projet))
|
||||
{
|
||||
$this->projet->warning_delay=(isset($this->global->MAIN_DELAY_PROJECT_TO_CLOSE)?$this->global->MAIN_DELAY_PROJECT_TO_CLOSE:7)*24*60*60;
|
||||
$this->projet->task = new StdClass();
|
||||
$this->projet->task->warning_delay=(isset($this->global->MAIN_DELAY_TASKS_TODO)?$this->global->MAIN_DELAY_TASKS_TODO:7)*24*60*60;
|
||||
$this->projet->warning_delay = (isset($this->global->MAIN_DELAY_PROJECT_TO_CLOSE) ? $this->global->MAIN_DELAY_PROJECT_TO_CLOSE : 7) * 24 * 60 * 60;
|
||||
$this->projet->task = new StdClass();
|
||||
$this->projet->task->warning_delay = (isset($this->global->MAIN_DELAY_TASKS_TODO) ? $this->global->MAIN_DELAY_TASKS_TODO : 7) * 24 * 60 * 60;
|
||||
}
|
||||
|
||||
if (isset($this->commande)) {
|
||||
$this->commande->client = new stdClass();
|
||||
$this->commande->fournisseur = new stdClass();
|
||||
$this->commande->client->warning_delay=(isset($this->global->MAIN_DELAY_ORDERS_TO_PROCESS)?$this->global->MAIN_DELAY_ORDERS_TO_PROCESS:2)*24*60*60;
|
||||
$this->commande->fournisseur->warning_delay=(isset($this->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS)?$this->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS:7)*24*60*60;
|
||||
$this->commande->client = new stdClass();
|
||||
$this->commande->fournisseur = new stdClass();
|
||||
$this->commande->client->warning_delay = (isset($this->global->MAIN_DELAY_ORDERS_TO_PROCESS) ? $this->global->MAIN_DELAY_ORDERS_TO_PROCESS : 2) * 24 * 60 * 60;
|
||||
$this->commande->fournisseur->warning_delay = (isset($this->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS) ? $this->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS : 7) * 24 * 60 * 60;
|
||||
}
|
||||
if (isset($this->propal)) {
|
||||
$this->propal->cloture = new stdClass();
|
||||
$this->propal->facturation = new stdClass();
|
||||
$this->propal->cloture->warning_delay=(isset($this->global->MAIN_DELAY_PROPALS_TO_CLOSE)?$this->global->MAIN_DELAY_PROPALS_TO_CLOSE:0)*24*60*60;
|
||||
$this->propal->facturation->warning_delay=(isset($this->global->MAIN_DELAY_PROPALS_TO_BILL)?$this->global->MAIN_DELAY_PROPALS_TO_BILL:0)*24*60*60;
|
||||
$this->propal->cloture = new stdClass();
|
||||
$this->propal->facturation = new stdClass();
|
||||
$this->propal->cloture->warning_delay = (isset($this->global->MAIN_DELAY_PROPALS_TO_CLOSE) ? $this->global->MAIN_DELAY_PROPALS_TO_CLOSE : 0) * 24 * 60 * 60;
|
||||
$this->propal->facturation->warning_delay = (isset($this->global->MAIN_DELAY_PROPALS_TO_BILL) ? $this->global->MAIN_DELAY_PROPALS_TO_BILL : 0) * 24 * 60 * 60;
|
||||
}
|
||||
if (isset($this->facture)) {
|
||||
$this->facture->client = new stdClass();
|
||||
$this->facture->fournisseur = new stdClass();
|
||||
$this->facture->client->warning_delay=(isset($this->global->MAIN_DELAY_CUSTOMER_BILLS_UNPAYED)?$this->global->MAIN_DELAY_CUSTOMER_BILLS_UNPAYED:0)*24*60*60;
|
||||
$this->facture->fournisseur->warning_delay=(isset($this->global->MAIN_DELAY_SUPPLIER_BILLS_TO_PAY)?$this->global->MAIN_DELAY_SUPPLIER_BILLS_TO_PAY:0)*24*60*60;
|
||||
$this->facture->client = new stdClass();
|
||||
$this->facture->fournisseur = new stdClass();
|
||||
$this->facture->client->warning_delay = (isset($this->global->MAIN_DELAY_CUSTOMER_BILLS_UNPAYED) ? $this->global->MAIN_DELAY_CUSTOMER_BILLS_UNPAYED : 0) * 24 * 60 * 60;
|
||||
$this->facture->fournisseur->warning_delay = (isset($this->global->MAIN_DELAY_SUPPLIER_BILLS_TO_PAY) ? $this->global->MAIN_DELAY_SUPPLIER_BILLS_TO_PAY : 0) * 24 * 60 * 60;
|
||||
}
|
||||
if (isset($this->contrat)) {
|
||||
$this->contrat->services = new stdClass();
|
||||
$this->contrat->services->inactifs = new stdClass();
|
||||
$this->contrat->services->expires = new stdClass();
|
||||
$this->contrat->services->inactifs->warning_delay=(isset($this->global->MAIN_DELAY_NOT_ACTIVATED_SERVICES)?$this->global->MAIN_DELAY_NOT_ACTIVATED_SERVICES:0)*24*60*60;
|
||||
$this->contrat->services->expires->warning_delay=(isset($this->global->MAIN_DELAY_RUNNING_SERVICES)?$this->global->MAIN_DELAY_RUNNING_SERVICES:0)*24*60*60;
|
||||
$this->contrat->services = new stdClass();
|
||||
$this->contrat->services->inactifs = new stdClass();
|
||||
$this->contrat->services->expires = new stdClass();
|
||||
$this->contrat->services->inactifs->warning_delay = (isset($this->global->MAIN_DELAY_NOT_ACTIVATED_SERVICES) ? $this->global->MAIN_DELAY_NOT_ACTIVATED_SERVICES : 0) * 24 * 60 * 60;
|
||||
$this->contrat->services->expires->warning_delay = (isset($this->global->MAIN_DELAY_RUNNING_SERVICES) ? $this->global->MAIN_DELAY_RUNNING_SERVICES : 0) * 24 * 60 * 60;
|
||||
}
|
||||
if (isset($this->commande)) {
|
||||
$this->bank->rappro = new stdClass();
|
||||
$this->bank->cheque = new stdClass();
|
||||
$this->bank->rappro->warning_delay=(isset($this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE)?$this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE:0)*24*60*60;
|
||||
$this->bank->cheque->warning_delay=(isset($this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT)?$this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT:0)*24*60*60;
|
||||
$this->bank->rappro->warning_delay = (isset($this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE) ? $this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE : 0) * 24 * 60 * 60;
|
||||
$this->bank->cheque->warning_delay = (isset($this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT) ? $this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT : 0) * 24 * 60 * 60;
|
||||
}
|
||||
if (isset($this->expensereport)) {
|
||||
$this->expensereport->approve = new stdClass();
|
||||
$this->expensereport->approve->warning_delay=(isset($this->global->MAIN_DELAY_EXPENSEREPORTS)?$this->global->MAIN_DELAY_EXPENSEREPORTS:0)*24*60*60;
|
||||
$this->expensereport->approve->warning_delay = (isset($this->global->MAIN_DELAY_EXPENSEREPORTS) ? $this->global->MAIN_DELAY_EXPENSEREPORTS : 0) * 24 * 60 * 60;
|
||||
$this->expensereport->payment = new stdClass();
|
||||
$this->expensereport->payment->warning_delay=(isset($this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY)?$this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY:0)*24*60*60;
|
||||
$this->expensereport->payment->warning_delay = (isset($this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY) ? $this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY : 0) * 24 * 60 * 60;
|
||||
}
|
||||
if (isset($this->holiday)) {
|
||||
$this->holiday->approve = new stdClass();
|
||||
$this->holiday->approve->warning_delay=(isset($this->global->MAIN_DELAY_HOLIDAYS)?$this->global->MAIN_DELAY_HOLIDAYS:0)*24*60*60;
|
||||
$this->holiday->approve->warning_delay = (isset($this->global->MAIN_DELAY_HOLIDAYS) ? $this->global->MAIN_DELAY_HOLIDAYS : 0) * 24 * 60 * 60;
|
||||
}
|
||||
|
||||
if (! empty($this->global->PRODUIT_MULTIPRICES) && empty($this->global->PRODUIT_MULTIPRICES_LIMIT))
|
||||
if (!empty($this->global->PRODUIT_MULTIPRICES) && empty($this->global->PRODUIT_MULTIPRICES_LIMIT))
|
||||
{
|
||||
$this->global->PRODUIT_MULTIPRICES_LIMIT = 5;
|
||||
}
|
||||
|
||||
// For modules that want to disable top or left menu
|
||||
if (! empty($this->global->MAIN_HIDE_TOP_MENU)) $this->dol_hide_topmenu=$this->global->MAIN_HIDE_TOP_MENU;
|
||||
if (! empty($this->global->MAIN_HIDE_LEFT_MENU)) $this->dol_hide_leftmenu=$this->global->MAIN_HIDE_LEFT_MENU;
|
||||
if (!empty($this->global->MAIN_HIDE_TOP_MENU)) $this->dol_hide_topmenu = $this->global->MAIN_HIDE_TOP_MENU;
|
||||
if (!empty($this->global->MAIN_HIDE_LEFT_MENU)) $this->dol_hide_leftmenu = $this->global->MAIN_HIDE_LEFT_MENU;
|
||||
|
||||
if (empty($this->global->MAIN_SIZE_SHORTLIST_LIMIT)) $this->global->MAIN_SIZE_SHORTLIST_LIMIT=3;
|
||||
if (empty($this->global->MAIN_SIZE_SHORTLIST_LIMIT)) $this->global->MAIN_SIZE_SHORTLIST_LIMIT = 3;
|
||||
|
||||
if (! isset($this->global->THEME_HIDE_BORDER_ON_INPUT)) $this->global->THEME_HIDE_BORDER_ON_INPUT=0;
|
||||
if (!isset($this->global->THEME_HIDE_BORDER_ON_INPUT)) $this->global->THEME_HIDE_BORDER_ON_INPUT = 0;
|
||||
|
||||
// Save inconsistent option
|
||||
if (empty($this->global->AGENDA_USE_EVENT_TYPE) && (! isset($this->global->AGENDA_DEFAULT_FILTER_TYPE) || $this->global->AGENDA_DEFAULT_FILTER_TYPE == 'AC_NON_AUTO'))
|
||||
if (empty($this->global->AGENDA_USE_EVENT_TYPE) && (!isset($this->global->AGENDA_DEFAULT_FILTER_TYPE) || $this->global->AGENDA_DEFAULT_FILTER_TYPE == 'AC_NON_AUTO'))
|
||||
{
|
||||
$this->global->AGENDA_DEFAULT_FILTER_TYPE='0'; // 'AC_NON_AUTO' does not exists when AGENDA_DEFAULT_FILTER_TYPE is not on.
|
||||
$this->global->AGENDA_DEFAULT_FILTER_TYPE = '0'; // 'AC_NON_AUTO' does not exists when AGENDA_DEFAULT_FILTER_TYPE is not on.
|
||||
}
|
||||
|
||||
if (! isset($this->global->MAIN_EXTRAFIELDS_IN_ONE_TD)) $this->global->MAIN_EXTRAFIELDS_IN_ONE_TD = 1;
|
||||
if (!isset($this->global->MAIN_EXTRAFIELDS_IN_ONE_TD)) $this->global->MAIN_EXTRAFIELDS_IN_ONE_TD = 1;
|
||||
|
||||
if (! isset($this->global->MAIN_USE_OLD_TITLE_BUTTON)) $this->global->MAIN_USE_OLD_TITLE_BUTTON = 0;
|
||||
if (!isset($this->global->MAIN_USE_OLD_TITLE_BUTTON)) $this->global->MAIN_USE_OLD_TITLE_BUTTON = 0;
|
||||
|
||||
if (empty($this->global->MAIN_MODULE_DOLISTORE_API_SRV)) $this->global->MAIN_MODULE_DOLISTORE_API_SRV='https://www.dolistore.com';
|
||||
if (empty($this->global->MAIN_MODULE_DOLISTORE_API_KEY)) $this->global->MAIN_MODULE_DOLISTORE_API_KEY='dolistorecatalogpublickey1234567';
|
||||
if (empty($this->global->MAIN_MODULE_DOLISTORE_API_SRV)) $this->global->MAIN_MODULE_DOLISTORE_API_SRV = 'https://www.dolistore.com';
|
||||
if (empty($this->global->MAIN_MODULE_DOLISTORE_API_KEY)) $this->global->MAIN_MODULE_DOLISTORE_API_KEY = 'dolistorecatalogpublickey1234567';
|
||||
|
||||
// If we are in develop mode, we activate the option MAIN_SECURITY_CSRF_WITH_TOKEN to 1 if not already defined.
|
||||
if (! isset($conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN) && $conf->global->MAIN_FEATURES_LEVEL >= 2) $conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN = 1;
|
||||
if (!isset($conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN) && $conf->global->MAIN_FEATURES_LEVEL >= 2) $conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN = 1;
|
||||
|
||||
// For backward compatibility
|
||||
if (isset($this->product)) $this->produit=$this->product;
|
||||
if (isset($this->facture)) $this->invoice=$this->facture;
|
||||
if (isset($this->commande)) $this->order=$this->commande;
|
||||
if (isset($this->contrat)) $this->contract=$this->contrat;
|
||||
if (isset($this->categorie)) $this->category=$this->categorie;
|
||||
if (isset($this->project)) $this->project=$this->projet;
|
||||
if (isset($this->product)) $this->produit = $this->product;
|
||||
if (isset($this->facture)) $this->invoice = $this->facture;
|
||||
if (isset($this->commande)) $this->order = $this->commande;
|
||||
if (isset($this->contrat)) $this->contract = $this->contrat;
|
||||
if (isset($this->categorie)) $this->category = $this->categorie;
|
||||
if (isset($this->project)) $this->project = $this->projet;
|
||||
|
||||
// Object $mc
|
||||
if (! defined('NOREQUIREMC') && ! empty($this->multicompany->enabled))
|
||||
if (!defined('NOREQUIREMC') && !empty($this->multicompany->enabled))
|
||||
{
|
||||
if (is_object($mc)) $mc->setValues($this);
|
||||
}
|
||||
|
||||
// We init log handlers
|
||||
if (! empty($this->global->SYSLOG_HANDLERS)) {
|
||||
if (!empty($this->global->SYSLOG_HANDLERS)) {
|
||||
$handlers = json_decode($this->global->SYSLOG_HANDLERS);
|
||||
} else {
|
||||
$handlers = array();
|
||||
|
||||
@ -1957,13 +1957,14 @@ class ExtraFields
|
||||
*
|
||||
* @param string $key Key of attribute
|
||||
* @param string $object Object
|
||||
* @param int $colspan Value of colspan to use (it must includes the first column with title)
|
||||
* @return string HTML code with line for separator
|
||||
*/
|
||||
public function showSeparator($key, $object)
|
||||
public function showSeparator($key, $object, $colspan = 2)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$out = '<tr id="trextrafieldseparator'.$key.'" class="trextrafieldseparator trextrafieldseparator'.$key.'"><td colspan="2"><strong>';
|
||||
$out = '<tr id="trextrafieldseparator'.$key.'" class="trextrafieldseparator trextrafieldseparator'.$key.'"><td colspan="'.$colspan.'"><strong>';
|
||||
$out .= $langs->trans($this->attributes[$object->table_element]['label'][$key]);
|
||||
$out .= '</strong></td></tr>';
|
||||
|
||||
|
||||
@ -5749,14 +5749,14 @@ class Form
|
||||
/**
|
||||
* Function to show a form to select a duration on a page
|
||||
*
|
||||
* @param string $prefix Prefix for input fields
|
||||
* @param int $iSecond Default preselected duration (number of seconds or '')
|
||||
* @param int $disabled Disable the combo box
|
||||
* @param string $typehour If 'select' then input hour and input min is a combo,
|
||||
* if 'text' input hour is in text and input min is a text,
|
||||
* if 'textselect' input hour is in text and input min is a combo
|
||||
* @param integer $minunderhours If 1, show minutes selection under the hours
|
||||
* @param int $nooutput Do not output html string but return it
|
||||
* @param string $prefix Prefix for input fields
|
||||
* @param int $iSecond Default preselected duration (number of seconds or '')
|
||||
* @param int $disabled Disable the combo box
|
||||
* @param string $typehour If 'select' then input hour and input min is a combo,
|
||||
* If 'text' input hour is in text and input min is a text,
|
||||
* If 'textselect' input hour is in text and input min is a combo
|
||||
* @param integer $minunderhours If 1, show minutes selection under the hours
|
||||
* @param int $nooutput Do not output html string but return it
|
||||
* @return string|void
|
||||
*/
|
||||
public function select_duration($prefix, $iSecond = '', $disabled = 0, $typehour = 'select', $minunderhours = 0, $nooutput = 0)
|
||||
|
||||
@ -56,19 +56,19 @@ class FormWebsite
|
||||
*/
|
||||
public function selectWebsite($selected = '', $htmlname = 'exportmodelid', $useempty = 0)
|
||||
{
|
||||
$out='';
|
||||
$out = '';
|
||||
|
||||
$sql = "SELECT rowid, ref";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."website";
|
||||
$sql.= " WHERE 1 = 1";
|
||||
$sql.= " ORDER BY rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."website";
|
||||
$sql .= " WHERE 1 = 1";
|
||||
$sql .= " ORDER BY rowid";
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$out.='<select class="flat minwidth100" name="'.$htmlname.'" id="'.$htmlname.'">';
|
||||
$out .= '<select class="flat minwidth100" name="'.$htmlname.'" id="'.$htmlname.'">';
|
||||
if ($useempty)
|
||||
{
|
||||
$out.='<option value="-1"> </option>';
|
||||
$out .= '<option value="-1"> </option>';
|
||||
}
|
||||
|
||||
$num = $this->db->num_rows($result);
|
||||
@ -78,17 +78,17 @@ class FormWebsite
|
||||
$obj = $this->db->fetch_object($result);
|
||||
if ($selected == $obj->rowid)
|
||||
{
|
||||
$out.='<option value="'.$obj->rowid.'" selected>';
|
||||
$out .= '<option value="'.$obj->rowid.'" selected>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$out.='<option value="'.$obj->rowid.'">';
|
||||
$out .= '<option value="'.$obj->rowid.'">';
|
||||
}
|
||||
$out.=$obj->ref;
|
||||
$out.='</option>';
|
||||
$out .= $obj->ref;
|
||||
$out .= '</option>';
|
||||
$i++;
|
||||
}
|
||||
$out.="</select>";
|
||||
$out .= "</select>";
|
||||
}
|
||||
else {
|
||||
dol_print_error($this->db);
|
||||
@ -114,9 +114,9 @@ class FormWebsite
|
||||
$langs->load("admin");
|
||||
|
||||
$sql = "SELECT rowid, code, label, entity";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.'c_type_container';
|
||||
$sql.= " WHERE active = 1 AND entity IN (".getEntity('c_type_container').")";
|
||||
$sql.= " ORDER BY label";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.'c_type_container';
|
||||
$sql .= " WHERE active = 1 AND entity IN (".getEntity('c_type_container').")";
|
||||
$sql .= " ORDER BY label";
|
||||
|
||||
dol_syslog(get_class($this)."::selectTypeOfContainer", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
@ -126,7 +126,7 @@ class FormWebsite
|
||||
$i = 0;
|
||||
if ($num)
|
||||
{
|
||||
print '<select id="select'.$htmlname.'" class="flat selectTypeOfContainer" name="'.$htmlname.'"'.($moreattrib?' '.$moreattrib:'').'>';
|
||||
print '<select id="select'.$htmlname.'" class="flat selectTypeOfContainer" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
|
||||
if ($useempty == 1 || ($useempty == 2 && $num > 1))
|
||||
{
|
||||
print '<option value="-1"> </option>';
|
||||
@ -179,8 +179,8 @@ class FormWebsite
|
||||
$listofsamples = dol_dir_list(DOL_DOCUMENT_ROOT.'/website/samples', 'files', 0, '^page-sample-.*\.html$');
|
||||
|
||||
$arrayofsamples = array();
|
||||
$arrayofsamples['empty']='EmptyPage'; // Always this one first
|
||||
foreach($listofsamples as $sample)
|
||||
$arrayofsamples['empty'] = 'EmptyPage'; // Always this one first
|
||||
foreach ($listofsamples as $sample)
|
||||
{
|
||||
$reg = array();
|
||||
if (preg_match('/^page-sample-(.*)\.html$/', $sample['name'], $reg))
|
||||
@ -193,14 +193,14 @@ class FormWebsite
|
||||
}
|
||||
|
||||
$out = '';
|
||||
$out .= '<select id="select'.$htmlname.'" class="flat selectTypeOfContainer" name="'.$htmlname.'"'.($moreattrib?' '.$moreattrib:'').'>';
|
||||
$out .= '<select id="select'.$htmlname.'" class="flat selectTypeOfContainer" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
|
||||
|
||||
if ($useempty == 1 || $useempty == 2)
|
||||
{
|
||||
$out .= '<option value="-1"> </option>';
|
||||
}
|
||||
|
||||
foreach($arrayofsamples as $key => $val)
|
||||
foreach ($arrayofsamples as $key => $val)
|
||||
{
|
||||
if ($selected == $key)
|
||||
{
|
||||
@ -229,63 +229,66 @@ class FormWebsite
|
||||
* @param int $showempty Show empty record
|
||||
* @param string $action Action on page that use this select list
|
||||
* @param string $morecss More CSS
|
||||
* @param array $excludeids Exclude some ID in list
|
||||
* @return string HTML select component with list of type of containers
|
||||
*/
|
||||
public function selectContainer($website, $htmlname = 'pageid', $pageid = 0, $showempty = 0, $action = '', $morecss = 'minwidth200')
|
||||
public function selectContainer($website, $htmlname = 'pageid', $pageid = 0, $showempty = 0, $action = '', $morecss = 'minwidth200', $excludeids = null)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$atleastonepage = (is_array($website->lines) && count($website->lines) > 0);
|
||||
|
||||
$out='';
|
||||
$out = '';
|
||||
if ($atleastonepage && $action != 'editsource')
|
||||
{
|
||||
$out.='<select name="'.$htmlname.'" id="'.$htmlname.'" class="maxwidth300'.($morecss ? ' '.$morecss : '').'">';
|
||||
$out .= '<select name="'.$htmlname.'" id="'.$htmlname.'" class="maxwidth300'.($morecss ? ' '.$morecss : '').'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
$out.='<select name="pageidbis" id="pageid" class="maxwidth300'.($morecss ? ' '.$morecss : '').'" disabled="disabled">';
|
||||
$out .= '<select name="pageidbis" id="pageid" class="maxwidth300'.($morecss ? ' '.$morecss : '').'" disabled="disabled">';
|
||||
}
|
||||
|
||||
if ($showempty || ! $atleastonepage) $out.='<option value="-1"> </option>';
|
||||
if ($showempty || !$atleastonepage) $out .= '<option value="-1"> </option>';
|
||||
|
||||
if ($atleastonepage)
|
||||
{
|
||||
if (empty($pageid) && $action != 'createcontainer') // Page id is not defined, we try to take one
|
||||
{
|
||||
$firstpageid=0;$homepageid=0;
|
||||
foreach($website->lines as $key => $valpage)
|
||||
$firstpageid = 0; $homepageid = 0;
|
||||
foreach ($website->lines as $key => $valpage)
|
||||
{
|
||||
if (empty($firstpageid)) $firstpageid=$valpage->id;
|
||||
if ($website->fk_default_home && $key == $website->fk_default_home) $homepageid=$valpage->id;
|
||||
if (empty($firstpageid)) $firstpageid = $valpage->id;
|
||||
if ($website->fk_default_home && $key == $website->fk_default_home) $homepageid = $valpage->id;
|
||||
}
|
||||
$pageid=$homepageid?$homepageid:$firstpageid; // We choose home page and if not defined yet, we take first page
|
||||
$pageid = $homepageid ? $homepageid : $firstpageid; // We choose home page and if not defined yet, we take first page
|
||||
}
|
||||
|
||||
foreach($website->lines as $key => $valpage)
|
||||
foreach ($website->lines as $key => $valpage)
|
||||
{
|
||||
$valueforoption = '<span class="opacitymedium">['.$valpage->type_container.' '.sprintf("%03d", $valpage->id).']</span> ';
|
||||
$valueforoption.= $valpage->pageurl.' - '.$valpage->title;
|
||||
if ($website->fk_default_home && $key == $website->fk_default_home) $valueforoption.=' <span class="opacitymedium">('.$langs->trans("HomePage").')</span>';
|
||||
if (is_array($excludeids) && count($excludeids) && in_array($valpage->id, $excludeids)) continue;
|
||||
|
||||
$out.='<option value="'.$key.'"';
|
||||
if ($pageid > 0 && $pageid == $key) $out.=' selected'; // To preselect a value
|
||||
$out.=' data-html="'.dol_escape_htmltag($valueforoption).'"';
|
||||
$out.='>';
|
||||
$out.=$valueforoption;
|
||||
$out.='</option>';
|
||||
$valueforoption = '<span class="opacitymedium">['.$valpage->type_container.' '.sprintf("%03d", $valpage->id).']</span> ';
|
||||
$valueforoption .= $valpage->pageurl.' - '.$valpage->title;
|
||||
if ($website->fk_default_home && $key == $website->fk_default_home) $valueforoption .= ' <span class="opacitymedium">('.$langs->trans("HomePage").')</span>';
|
||||
|
||||
$out .= '<option value="'.$key.'"';
|
||||
if ($pageid > 0 && $pageid == $key) $out .= ' selected'; // To preselect a value
|
||||
$out .= ' data-html="'.dol_escape_htmltag($valueforoption).'"';
|
||||
$out .= '>';
|
||||
$out .= $valueforoption;
|
||||
$out .= '</option>';
|
||||
}
|
||||
}
|
||||
$out.='</select>';
|
||||
$out .= '</select>';
|
||||
|
||||
if ($atleastonepage && $action != 'editsource')
|
||||
{
|
||||
$out.=ajax_combobox($htmlname);
|
||||
$out .= ajax_combobox($htmlname);
|
||||
}
|
||||
else
|
||||
{
|
||||
$out.='<input type="hidden" name="'.$htmlname.'" value="'.$pageid.'">';
|
||||
$out.=ajax_combobox($htmlname);
|
||||
$out .= '<input type="hidden" name="'.$htmlname.'" value="'.$pageid.'">';
|
||||
$out .= ajax_combobox($htmlname);
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
||||
@ -173,24 +173,24 @@ class Menubase
|
||||
global $conf, $langs;
|
||||
|
||||
// Clean parameters
|
||||
$this->menu_handler=trim($this->menu_handler);
|
||||
$this->module=trim($this->module);
|
||||
$this->type=trim($this->type);
|
||||
$this->mainmenu=trim($this->mainmenu);
|
||||
$this->leftmenu=trim($this->leftmenu);
|
||||
$this->fk_menu = (int) $this->fk_menu; // If -1, fk_mainmenu and fk_leftmenu must be defined
|
||||
$this->fk_mainmenu=trim($this->fk_mainmenu);
|
||||
$this->fk_leftmenu=trim($this->fk_leftmenu);
|
||||
$this->menu_handler = trim($this->menu_handler);
|
||||
$this->module = trim($this->module);
|
||||
$this->type = trim($this->type);
|
||||
$this->mainmenu = trim($this->mainmenu);
|
||||
$this->leftmenu = trim($this->leftmenu);
|
||||
$this->fk_menu = (int) $this->fk_menu; // If -1, fk_mainmenu and fk_leftmenu must be defined
|
||||
$this->fk_mainmenu = trim($this->fk_mainmenu);
|
||||
$this->fk_leftmenu = trim($this->fk_leftmenu);
|
||||
$this->position = (int) $this->position;
|
||||
$this->url=trim($this->url);
|
||||
$this->target=trim($this->target);
|
||||
$this->titre=trim($this->titre);
|
||||
$this->langs=trim($this->langs);
|
||||
$this->perms=trim($this->perms);
|
||||
$this->enabled=trim($this->enabled);
|
||||
$this->url = trim($this->url);
|
||||
$this->target = trim($this->target);
|
||||
$this->titre = trim($this->titre);
|
||||
$this->langs = trim($this->langs);
|
||||
$this->perms = trim($this->perms);
|
||||
$this->enabled = trim($this->enabled);
|
||||
$this->user = (int) $this->user;
|
||||
if (empty($this->position)) $this->position=0;
|
||||
if (! $this->level) $this->level=0;
|
||||
if (empty($this->position)) $this->position = 0;
|
||||
if (!$this->level) $this->level = 0;
|
||||
|
||||
// Check parameters
|
||||
if (empty($this->menu_handler)) return -1;
|
||||
@ -201,32 +201,32 @@ class Menubase
|
||||
if (in_array($this->db->type, array('pgsql')))
|
||||
{
|
||||
$sql = "SELECT MAX(rowid) as maxrowid FROM ".MAIN_DB_PREFIX."menu";
|
||||
$resqlrowid=$this->db->query($sql);
|
||||
$resqlrowid = $this->db->query($sql);
|
||||
if ($resqlrowid) {
|
||||
$obj=$this->db->fetch_object($resqlrowid);
|
||||
$maxrowid=$obj->maxrowid;
|
||||
$obj = $this->db->fetch_object($resqlrowid);
|
||||
$maxrowid = $obj->maxrowid;
|
||||
|
||||
// Max rowid can be empty if there is no record yet
|
||||
if(empty($maxrowid)) $maxrowid=1;
|
||||
if (empty($maxrowid)) $maxrowid = 1;
|
||||
|
||||
$sql = "SELECT setval('".MAIN_DB_PREFIX."menu_rowid_seq', ".($maxrowid).")";
|
||||
//print $sql; exit;
|
||||
$resqlrowidset=$this->db->query($sql);
|
||||
if (! $resqlrowidset) dol_print_error($this->db);
|
||||
$resqlrowidset = $this->db->query($sql);
|
||||
if (!$resqlrowidset) dol_print_error($this->db);
|
||||
}
|
||||
else dol_print_error($this->db);
|
||||
}
|
||||
|
||||
// Check that entry does not exists yet on key menu_handler-fk_menu-position-url-entity, to avoid errors with postgresql
|
||||
$sql = "SELECT count(*)";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."menu";
|
||||
$sql.= " WHERE menu_handler = '".$this->db->escape($this->menu_handler)."'";
|
||||
$sql.= " AND fk_menu = ".((int) $this->fk_menu);
|
||||
$sql.= " AND position = ".((int) $this->position);
|
||||
$sql.= " AND url = '".$this->db->escape($this->url)."'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."menu";
|
||||
$sql .= " WHERE menu_handler = '".$this->db->escape($this->menu_handler)."'";
|
||||
$sql .= " AND fk_menu = ".((int) $this->fk_menu);
|
||||
$sql .= " AND position = ".((int) $this->position);
|
||||
$sql .= " AND url = '".$this->db->escape($this->url)."'";
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
|
||||
$result=$this->db->query($sql);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$row = $this->db->fetch_row($result);
|
||||
@ -235,45 +235,45 @@ class Menubase
|
||||
{
|
||||
// Insert request
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."menu(";
|
||||
$sql.= "menu_handler,";
|
||||
$sql.= "entity,";
|
||||
$sql.= "module,";
|
||||
$sql.= "type,";
|
||||
$sql.= "mainmenu,";
|
||||
$sql.= "leftmenu,";
|
||||
$sql.= "fk_menu,";
|
||||
$sql.= "fk_mainmenu,";
|
||||
$sql.= "fk_leftmenu,";
|
||||
$sql.= "position,";
|
||||
$sql.= "url,";
|
||||
$sql.= "target,";
|
||||
$sql.= "titre,";
|
||||
$sql.= "langs,";
|
||||
$sql.= "perms,";
|
||||
$sql.= "enabled,";
|
||||
$sql.= "usertype";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= " '".$this->db->escape($this->menu_handler)."',";
|
||||
$sql.= " '".$this->db->escape($conf->entity)."',";
|
||||
$sql.= " '".$this->db->escape($this->module)."',";
|
||||
$sql.= " '".$this->db->escape($this->type)."',";
|
||||
$sql.= " ".($this->mainmenu?"'".$this->db->escape($this->mainmenu)."'":"''").","; // Can't be null
|
||||
$sql.= " ".($this->leftmenu?"'".$this->db->escape($this->leftmenu)."'":"null").",";
|
||||
$sql.= " ".((int) $this->fk_menu).",";
|
||||
$sql.= " ".($this->fk_mainmenu?"'".$this->db->escape($this->fk_mainmenu)."'":"null").",";
|
||||
$sql.= " ".($this->fk_leftmenu?"'".$this->db->escape($this->fk_leftmenu)."'":"null").",";
|
||||
$sql.= " ".((int) $this->position).",";
|
||||
$sql.= " '".$this->db->escape($this->url)."',";
|
||||
$sql.= " '".$this->db->escape($this->target)."',";
|
||||
$sql.= " '".$this->db->escape($this->titre)."',";
|
||||
$sql.= " '".$this->db->escape($this->langs)."',";
|
||||
$sql.= " '".$this->db->escape($this->perms)."',";
|
||||
$sql.= " '".$this->db->escape($this->enabled)."',";
|
||||
$sql.= " '".$this->db->escape($this->user)."'";
|
||||
$sql.= ")";
|
||||
$sql .= "menu_handler,";
|
||||
$sql .= "entity,";
|
||||
$sql .= "module,";
|
||||
$sql .= "type,";
|
||||
$sql .= "mainmenu,";
|
||||
$sql .= "leftmenu,";
|
||||
$sql .= "fk_menu,";
|
||||
$sql .= "fk_mainmenu,";
|
||||
$sql .= "fk_leftmenu,";
|
||||
$sql .= "position,";
|
||||
$sql .= "url,";
|
||||
$sql .= "target,";
|
||||
$sql .= "titre,";
|
||||
$sql .= "langs,";
|
||||
$sql .= "perms,";
|
||||
$sql .= "enabled,";
|
||||
$sql .= "usertype";
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= " '".$this->db->escape($this->menu_handler)."',";
|
||||
$sql .= " '".$this->db->escape($conf->entity)."',";
|
||||
$sql .= " '".$this->db->escape($this->module)."',";
|
||||
$sql .= " '".$this->db->escape($this->type)."',";
|
||||
$sql .= " ".($this->mainmenu ? "'".$this->db->escape($this->mainmenu)."'" : "''").","; // Can't be null
|
||||
$sql .= " ".($this->leftmenu ? "'".$this->db->escape($this->leftmenu)."'" : "null").",";
|
||||
$sql .= " ".((int) $this->fk_menu).",";
|
||||
$sql .= " ".($this->fk_mainmenu ? "'".$this->db->escape($this->fk_mainmenu)."'" : "null").",";
|
||||
$sql .= " ".($this->fk_leftmenu ? "'".$this->db->escape($this->fk_leftmenu)."'" : "null").",";
|
||||
$sql .= " ".((int) $this->position).",";
|
||||
$sql .= " '".$this->db->escape($this->url)."',";
|
||||
$sql .= " '".$this->db->escape($this->target)."',";
|
||||
$sql .= " '".$this->db->escape($this->titre)."',";
|
||||
$sql .= " '".$this->db->escape($this->langs)."',";
|
||||
$sql .= " '".$this->db->escape($this->perms)."',";
|
||||
$sql .= " '".$this->db->escape($this->enabled)."',";
|
||||
$sql .= " '".$this->db->escape($this->user)."'";
|
||||
$sql .= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."menu");
|
||||
@ -283,7 +283,7 @@ class Menubase
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -312,22 +312,22 @@ class Menubase
|
||||
//global $conf, $langs;
|
||||
|
||||
// Clean parameters
|
||||
$this->rowid=trim($this->rowid);
|
||||
$this->menu_handler=trim($this->menu_handler);
|
||||
$this->module=trim($this->module);
|
||||
$this->type=trim($this->type);
|
||||
$this->mainmenu=trim($this->mainmenu);
|
||||
$this->leftmenu=trim($this->leftmenu);
|
||||
$this->rowid = trim($this->rowid);
|
||||
$this->menu_handler = trim($this->menu_handler);
|
||||
$this->module = trim($this->module);
|
||||
$this->type = trim($this->type);
|
||||
$this->mainmenu = trim($this->mainmenu);
|
||||
$this->leftmenu = trim($this->leftmenu);
|
||||
$this->fk_menu = (int) $this->fk_menu;
|
||||
$this->fk_mainmenu=trim($this->fk_mainmenu);
|
||||
$this->fk_leftmenu=trim($this->fk_leftmenu);
|
||||
$this->fk_mainmenu = trim($this->fk_mainmenu);
|
||||
$this->fk_leftmenu = trim($this->fk_leftmenu);
|
||||
$this->position = (int) $this->position;
|
||||
$this->url=trim($this->url);
|
||||
$this->target=trim($this->target);
|
||||
$this->titre=trim($this->titre);
|
||||
$this->langs=trim($this->langs);
|
||||
$this->perms=trim($this->perms);
|
||||
$this->enabled=trim($this->enabled);
|
||||
$this->url = trim($this->url);
|
||||
$this->target = trim($this->target);
|
||||
$this->titre = trim($this->titre);
|
||||
$this->langs = trim($this->langs);
|
||||
$this->perms = trim($this->perms);
|
||||
$this->enabled = trim($this->enabled);
|
||||
$this->user = (int) $this->user;
|
||||
|
||||
// Check parameters
|
||||
@ -335,29 +335,29 @@ class Menubase
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."menu SET";
|
||||
$sql.= " menu_handler='".$this->db->escape($this->menu_handler)."',";
|
||||
$sql.= " module='".$this->db->escape($this->module)."',";
|
||||
$sql.= " type='".$this->db->escape($this->type)."',";
|
||||
$sql.= " mainmenu='".$this->db->escape($this->mainmenu)."',";
|
||||
$sql.= " leftmenu='".$this->db->escape($this->leftmenu)."',";
|
||||
$sql.= " fk_menu=".$this->fk_menu.",";
|
||||
$sql.= " fk_mainmenu=".($this->fk_mainmenu?"'".$this->db->escape($this->fk_mainmenu)."'":"null").",";
|
||||
$sql.= " fk_leftmenu=".($this->fk_leftmenu?"'".$this->db->escape($this->fk_leftmenu)."'":"null").",";
|
||||
$sql.= " position=".($this->position > 0 ? $this->position : 0).",";
|
||||
$sql.= " url='".$this->db->escape($this->url)."',";
|
||||
$sql.= " target='".$this->db->escape($this->target)."',";
|
||||
$sql.= " titre='".$this->db->escape($this->titre)."',";
|
||||
$sql.= " langs='".$this->db->escape($this->langs)."',";
|
||||
$sql.= " perms='".$this->db->escape($this->perms)."',";
|
||||
$sql.= " enabled='".$this->db->escape($this->enabled)."',";
|
||||
$sql.= " usertype='".$this->db->escape($this->user)."'";
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
$sql .= " menu_handler='".$this->db->escape($this->menu_handler)."',";
|
||||
$sql .= " module='".$this->db->escape($this->module)."',";
|
||||
$sql .= " type='".$this->db->escape($this->type)."',";
|
||||
$sql .= " mainmenu='".$this->db->escape($this->mainmenu)."',";
|
||||
$sql .= " leftmenu='".$this->db->escape($this->leftmenu)."',";
|
||||
$sql .= " fk_menu=".$this->fk_menu.",";
|
||||
$sql .= " fk_mainmenu=".($this->fk_mainmenu ? "'".$this->db->escape($this->fk_mainmenu)."'" : "null").",";
|
||||
$sql .= " fk_leftmenu=".($this->fk_leftmenu ? "'".$this->db->escape($this->fk_leftmenu)."'" : "null").",";
|
||||
$sql .= " position=".($this->position > 0 ? $this->position : 0).",";
|
||||
$sql .= " url='".$this->db->escape($this->url)."',";
|
||||
$sql .= " target='".$this->db->escape($this->target)."',";
|
||||
$sql .= " titre='".$this->db->escape($this->titre)."',";
|
||||
$sql .= " langs='".$this->db->escape($this->langs)."',";
|
||||
$sql .= " perms='".$this->db->escape($this->perms)."',";
|
||||
$sql .= " enabled='".$this->db->escape($this->enabled)."',";
|
||||
$sql .= " usertype='".$this->db->escape($this->user)."'";
|
||||
$sql .= " WHERE rowid=".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
if (!$resql)
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -377,37 +377,37 @@ class Menubase
|
||||
//global $langs;
|
||||
|
||||
$sql = "SELECT";
|
||||
$sql.= " t.rowid,";
|
||||
$sql.= " t.menu_handler,";
|
||||
$sql.= " t.entity,";
|
||||
$sql.= " t.module,";
|
||||
$sql.= " t.type,";
|
||||
$sql.= " t.mainmenu,";
|
||||
$sql.= " t.leftmenu,";
|
||||
$sql.= " t.fk_menu,";
|
||||
$sql.= " t.fk_mainmenu,";
|
||||
$sql.= " t.fk_leftmenu,";
|
||||
$sql.= " t.position,";
|
||||
$sql.= " t.url,";
|
||||
$sql.= " t.target,";
|
||||
$sql.= " t.titre,";
|
||||
$sql.= " t.langs,";
|
||||
$sql.= " t.perms,";
|
||||
$sql.= " t.enabled,";
|
||||
$sql.= " t.usertype as user,";
|
||||
$sql.= " t.tms";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."menu as t";
|
||||
$sql.= " WHERE t.rowid = ".$id;
|
||||
$sql .= " t.rowid,";
|
||||
$sql .= " t.menu_handler,";
|
||||
$sql .= " t.entity,";
|
||||
$sql .= " t.module,";
|
||||
$sql .= " t.type,";
|
||||
$sql .= " t.mainmenu,";
|
||||
$sql .= " t.leftmenu,";
|
||||
$sql .= " t.fk_menu,";
|
||||
$sql .= " t.fk_mainmenu,";
|
||||
$sql .= " t.fk_leftmenu,";
|
||||
$sql .= " t.position,";
|
||||
$sql .= " t.url,";
|
||||
$sql .= " t.target,";
|
||||
$sql .= " t.titre,";
|
||||
$sql .= " t.langs,";
|
||||
$sql .= " t.perms,";
|
||||
$sql .= " t.enabled,";
|
||||
$sql .= " t.usertype as user,";
|
||||
$sql .= " t.tms";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."menu as t";
|
||||
$sql .= " WHERE t.rowid = ".$id;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows($resql))
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->id = $obj->rowid;
|
||||
|
||||
$this->menu_handler = $obj->menu_handler;
|
||||
$this->entity = $obj->entity;
|
||||
@ -434,7 +434,7 @@ class Menubase
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -451,13 +451,13 @@ class Menubase
|
||||
//global $conf, $langs;
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."menu";
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
$sql .= " WHERE rowid=".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
if (!$resql)
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -474,25 +474,25 @@ class Menubase
|
||||
*/
|
||||
public function initAsSpecimen()
|
||||
{
|
||||
$this->id=0;
|
||||
$this->id = 0;
|
||||
|
||||
$this->menu_handler='all';
|
||||
$this->module='specimen';
|
||||
$this->type='top';
|
||||
$this->mainmenu='';
|
||||
$this->fk_menu='0';
|
||||
$this->position='';
|
||||
$this->url='http://dummy';
|
||||
$this->target='';
|
||||
$this->titre='Specimen menu'; // deprecated
|
||||
$this->title='Specimen menu';
|
||||
$this->langs='';
|
||||
$this->level='';
|
||||
$this->leftmenu='';
|
||||
$this->perms='';
|
||||
$this->enabled='';
|
||||
$this->user='';
|
||||
$this->tms='';
|
||||
$this->menu_handler = 'all';
|
||||
$this->module = 'specimen';
|
||||
$this->type = 'top';
|
||||
$this->mainmenu = '';
|
||||
$this->fk_menu = '0';
|
||||
$this->position = '';
|
||||
$this->url = 'http://dummy';
|
||||
$this->target = '';
|
||||
$this->titre = 'Specimen menu'; // deprecated
|
||||
$this->title = 'Specimen menu';
|
||||
$this->langs = '';
|
||||
$this->level = '';
|
||||
$this->leftmenu = '';
|
||||
$this->perms = '';
|
||||
$this->enabled = '';
|
||||
$this->user = '';
|
||||
$this->tms = '';
|
||||
}
|
||||
|
||||
|
||||
@ -508,16 +508,16 @@ class Menubase
|
||||
*/
|
||||
public function menuTopCharger($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
|
||||
{
|
||||
global $langs, $user, $conf; // To export to dol_eval function
|
||||
global $mainmenu,$leftmenu; // To export to dol_eval function
|
||||
global $langs, $user, $conf; // To export to dol_eval function
|
||||
global $mainmenu, $leftmenu; // To export to dol_eval function
|
||||
|
||||
$mainmenu=$mymainmenu; // To export to dol_eval function
|
||||
$leftmenu=$myleftmenu; // To export to dol_eval function
|
||||
$mainmenu = $mymainmenu; // To export to dol_eval function
|
||||
$leftmenu = $myleftmenu; // To export to dol_eval function
|
||||
|
||||
$newTabMenu=array();
|
||||
foreach($tabMenu as $val)
|
||||
$newTabMenu = array();
|
||||
foreach ($tabMenu as $val)
|
||||
{
|
||||
if ($val['type']=='top') $newTabMenu[]=$val;
|
||||
if ($val['type'] == 'top') $newTabMenu[] = $val;
|
||||
}
|
||||
|
||||
return $newTabMenu;
|
||||
@ -537,20 +537,20 @@ class Menubase
|
||||
*/
|
||||
public function menuLeftCharger($newmenu, $mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
|
||||
{
|
||||
global $langs, $user, $conf; // To export to dol_eval function
|
||||
global $mainmenu,$leftmenu; // To export to dol_eval function
|
||||
global $langs, $user, $conf; // To export to dol_eval function
|
||||
global $mainmenu, $leftmenu; // To export to dol_eval function
|
||||
|
||||
$mainmenu=$mymainmenu; // To export to dol_eval function
|
||||
$leftmenu=$myleftmenu; // To export to dol_eval function
|
||||
$mainmenu = $mymainmenu; // To export to dol_eval function
|
||||
$leftmenu = $myleftmenu; // To export to dol_eval function
|
||||
|
||||
// Detect what is top mainmenu id
|
||||
$menutopid='';
|
||||
foreach($tabMenu as $key => $val)
|
||||
$menutopid = '';
|
||||
foreach ($tabMenu as $key => $val)
|
||||
{
|
||||
// Define menutopid of mainmenu
|
||||
if (empty($menutopid) && $val['type'] == 'top' && $val['mainmenu'] == $mainmenu)
|
||||
{
|
||||
$menutopid=$val['rowid'];
|
||||
$menutopid = $val['rowid'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -562,7 +562,7 @@ class Menubase
|
||||
$this->recur($tabMenu, $menutopid, 1);
|
||||
|
||||
// Now complete $this->newmenu->list when fk_menu value is -1 (left menu added by modules with no top menu)
|
||||
foreach($tabMenu as $key => $val)
|
||||
foreach ($tabMenu as $key => $val)
|
||||
{
|
||||
//var_dump($tabMenu);
|
||||
if ($val['fk_menu'] == -1 && $val['fk_mainmenu'] == $mainmenu) // We found a menu entry not linked to parent with good mainmenu
|
||||
@ -578,16 +578,16 @@ class Menubase
|
||||
else
|
||||
{
|
||||
// Search first menu with this couple (mainmenu,leftmenu)=(fk_mainmenu,fk_leftmenu)
|
||||
$searchlastsub=0;$lastid=0;$nextid=0;$found=0;
|
||||
foreach($this->newmenu->liste as $keyparent => $valparent)
|
||||
$searchlastsub = 0; $lastid = 0; $nextid = 0; $found = 0;
|
||||
foreach ($this->newmenu->liste as $keyparent => $valparent)
|
||||
{
|
||||
//var_dump($valparent);
|
||||
if ($searchlastsub) // If we started to search for last submenu
|
||||
{
|
||||
if ($valparent['level'] >= $searchlastsub) $lastid=$keyparent;
|
||||
if ($valparent['level'] >= $searchlastsub) $lastid = $keyparent;
|
||||
if ($valparent['level'] < $searchlastsub)
|
||||
{
|
||||
$nextid=$keyparent;
|
||||
$nextid = $keyparent;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -595,9 +595,9 @@ class Menubase
|
||||
{
|
||||
//print "We found parent: keyparent='.$keyparent.' - level=".$valparent['level'].' - '.join(',',$valparent).'<br>';
|
||||
// Now we look to find last subelement of this parent (we add at end)
|
||||
$searchlastsub=($valparent['level']+1);
|
||||
$lastid=$keyparent;
|
||||
$found=1;
|
||||
$searchlastsub = ($valparent['level'] + 1);
|
||||
$lastid = $keyparent;
|
||||
$found = 1;
|
||||
}
|
||||
}
|
||||
//print 'We must insert menu entry between entry '.$lastid.' and '.$nextid.'<br>';
|
||||
@ -629,16 +629,16 @@ class Menubase
|
||||
global $langs, $user, $conf; // To export to dol_eval function
|
||||
global $mainmenu, $leftmenu; // To export to dol_eval function
|
||||
|
||||
$mainmenu=$mymainmenu; // To export to dol_eval function
|
||||
$leftmenu=$myleftmenu; // To export to dol_eval function
|
||||
$mainmenu = $mymainmenu; // To export to dol_eval function
|
||||
$leftmenu = $myleftmenu; // To export to dol_eval function
|
||||
|
||||
$sql = "SELECT m.rowid, m.type, m.module, m.fk_menu, m.fk_mainmenu, m.fk_leftmenu, m.url, m.titre, m.langs, m.perms, m.enabled, m.target, m.mainmenu, m.leftmenu, m.position";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."menu as m";
|
||||
$sql.= " WHERE m.entity IN (0,".$conf->entity.")";
|
||||
$sql.= " AND m.menu_handler IN ('".$menu_handler."','all')";
|
||||
if ($type_user == 0) $sql.= " AND m.usertype IN (0,2)";
|
||||
if ($type_user == 1) $sql.= " AND m.usertype IN (1,2)";
|
||||
$sql.= " ORDER BY m.position, m.rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."menu as m";
|
||||
$sql .= " WHERE m.entity IN (0,".$conf->entity.")";
|
||||
$sql .= " AND m.menu_handler IN ('".$menu_handler."','all')";
|
||||
if ($type_user == 0) $sql .= " AND m.usertype IN (0,2)";
|
||||
if ($type_user == 1) $sql .= " AND m.usertype IN (1,2)";
|
||||
$sql .= " ORDER BY m.position, m.rowid";
|
||||
//print $sql;
|
||||
|
||||
//dol_syslog(get_class($this)."::menuLoad mymainmenu=".$mymainmenu." myleftmenu=".$myleftmenu." type_user=".$type_user." menu_handler=".$menu_handler." tabMenu size=".count($tabMenu)."", LOG_DEBUG);
|
||||
@ -658,8 +658,8 @@ class Menubase
|
||||
$perms = true;
|
||||
if ($menu['perms'])
|
||||
{
|
||||
$tmpcond=$menu['perms'];
|
||||
if ($leftmenu == 'all') $tmpcond=preg_replace('/\$leftmenu\s*==\s*["\'a-zA-Z_]+/', '1==1', $tmpcond); // Force part of condition to true
|
||||
$tmpcond = $menu['perms'];
|
||||
if ($leftmenu == 'all') $tmpcond = preg_replace('/\$leftmenu\s*==\s*["\'a-zA-Z_]+/', '1==1', $tmpcond); // Force part of condition to true
|
||||
$perms = verifCond($tmpcond);
|
||||
//print "verifCond rowid=".$menu['rowid']." ".$tmpcond.":".$perms."<br>\n";
|
||||
}
|
||||
@ -668,19 +668,19 @@ class Menubase
|
||||
$enabled = true;
|
||||
if ($menu['enabled'])
|
||||
{
|
||||
$tmpcond=$menu['enabled'];
|
||||
if ($leftmenu == 'all') $tmpcond=preg_replace('/\$leftmenu\s*==\s*["\'a-zA-Z_]+/', '1==1', $tmpcond); // Force part of condition to true
|
||||
$tmpcond = $menu['enabled'];
|
||||
if ($leftmenu == 'all') $tmpcond = preg_replace('/\$leftmenu\s*==\s*["\'a-zA-Z_]+/', '1==1', $tmpcond); // Force part of condition to true
|
||||
$enabled = verifCond($tmpcond);
|
||||
}
|
||||
|
||||
// Define $title
|
||||
if ($enabled)
|
||||
{
|
||||
$title = $langs->trans($menu['titre']); // If $menu['titre'] start with $, a dol_eval is done.
|
||||
$title = $langs->trans($menu['titre']); // If $menu['titre'] start with $, a dol_eval is done.
|
||||
//var_dump($title.'-'.$menu['titre']);
|
||||
if ($title == $menu['titre']) // Translation not found
|
||||
{
|
||||
if (! empty($menu['langs'])) // If there is a dedicated translation file
|
||||
if (!empty($menu['langs'])) // If there is a dedicated translation file
|
||||
{
|
||||
//print 'Load file '.$menu['langs'].'<br>';
|
||||
$langs->load($menu['langs']);
|
||||
@ -715,10 +715,10 @@ class Menubase
|
||||
$tabMenu[$b]['module'] = $menu['module'];
|
||||
$tabMenu[$b]['fk_menu'] = $menu['fk_menu'];
|
||||
$tabMenu[$b]['url'] = $menu['url'];
|
||||
if (! preg_match("/^(http:\/\/|https:\/\/)/i", $tabMenu[$b]['url']))
|
||||
if (!preg_match("/^(http:\/\/|https:\/\/)/i", $tabMenu[$b]['url']))
|
||||
{
|
||||
if (preg_match('/\?/', $tabMenu[$b]['url'])) $tabMenu[$b]['url'].='&idmenu='.$menu['rowid'];
|
||||
else $tabMenu[$b]['url'].='?idmenu='.$menu['rowid'];
|
||||
if (preg_match('/\?/', $tabMenu[$b]['url'])) $tabMenu[$b]['url'] .= '&idmenu='.$menu['rowid'];
|
||||
else $tabMenu[$b]['url'] .= '?idmenu='.$menu['rowid'];
|
||||
}
|
||||
$tabMenu[$b]['titre'] = $title;
|
||||
$tabMenu[$b]['target'] = $menu['target'];
|
||||
@ -767,10 +767,10 @@ class Menubase
|
||||
for ($x = 0; $x < $num; $x++)
|
||||
{
|
||||
//si un element a pour pere : $pere
|
||||
if ( (($tab[$x]['fk_menu'] >= 0 && $tab[$x]['fk_menu'] == $pere)) && $tab[$x]['enabled'])
|
||||
if ((($tab[$x]['fk_menu'] >= 0 && $tab[$x]['fk_menu'] == $pere)) && $tab[$x]['enabled'])
|
||||
{
|
||||
$this->newmenu->add($tab[$x]['url'], $tab[$x]['titre'], ($level-1), $tab[$x]['perms'], $tab[$x]['target'], $tab[$x]['mainmenu'], $tab[$x]['leftmenu']);
|
||||
$this->recur($tab, $tab[$x]['rowid'], ($level+1));
|
||||
$this->newmenu->add($tab[$x]['url'], $tab[$x]['titre'], ($level - 1), $tab[$x]['perms'], $tab[$x]['target'], $tab[$x]['mainmenu'], $tab[$x]['leftmenu']);
|
||||
$this->recur($tab, $tab[$x]['rowid'], ($level + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,8 +63,8 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Label")), null, 'errors');
|
||||
return -2;
|
||||
}
|
||||
if (! preg_match('/^(integer|price|sellist|date|varchar|double|text|html)/', $addfieldentry['type'])
|
||||
&& ! preg_match('/^(boolean|real|timestamp)$/', $addfieldentry['type']))
|
||||
if (! preg_match('/^(integer|price|sellist|varchar|double|text|html|duration)/', $addfieldentry['type'])
|
||||
&& ! preg_match('/^(boolean|real|date|datetime|timestamp)$/', $addfieldentry['type']))
|
||||
{
|
||||
setEventMessages($langs->trans('BadValueForType', $objectname), null, 'errors');
|
||||
return -2;
|
||||
@ -164,7 +164,7 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
|
||||
|
||||
if (count($object->fields))
|
||||
{
|
||||
$typetotypephp=array('integer'=>'integer', 'varchar'=>'string');
|
||||
//$typetotypephp=array('integer'=>'integer', 'duration'=>'integer', 'varchar'=>'string');
|
||||
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
@ -266,7 +266,7 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = '
|
||||
|
||||
if ($type == 'html') $type = 'text'; // html modulebuilder type is a text type in database
|
||||
elseif ($type == 'price') $type = 'double'; // html modulebuilder type is a text type in database
|
||||
elseif ($type == 'link' || $type == 'sellist') $type = 'integer';
|
||||
elseif (in_array($type, array('link', 'sellist', 'duration'))) $type = 'integer';
|
||||
$texttoinsert.= "\t".$key." ".$type;
|
||||
if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY';
|
||||
if ($key == 'entity') $texttoinsert.= ' DEFAULT 1';
|
||||
|
||||
@ -508,7 +508,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
|
||||
$title = $langs->trans("GoIntoSetupToChangeLogo");
|
||||
|
||||
print "\n".'<!-- Show logo on menu -->'."\n";
|
||||
print_start_menu_entry('companylogo', 'class="tmenu tmenucompanylogo"', 1);
|
||||
print_start_menu_entry('companylogo', 'class="tmenu tmenucompanylogo nohover"', 1);
|
||||
|
||||
|
||||
print '<div class="center '.$logoContainerAdditionalClass.' menulogocontainer"><img class="mycompany" title="'.dol_escape_htmltag($title).'" alt="" src="'.$urllogo.'" style="max-width: 100px"></div>'."\n";
|
||||
|
||||
@ -264,12 +264,12 @@ class modEmailCollector extends DolibarrModules
|
||||
*/
|
||||
public function init($options = '')
|
||||
{
|
||||
global $conf, $user;
|
||||
//$this->_load_tables('/dav/sql/');
|
||||
|
||||
// Create extrafields
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
$extrafields = new ExtraFields($this->db);
|
||||
|
||||
//include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
//$extrafields = new ExtraFields($this->db);
|
||||
//$result1=$extrafields->addExtraField('myattr1', "New Attr 1 label", 'boolean', 1, 3, 'thirdparty', 0, 0, '', '', 1, '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled');
|
||||
//$result2=$extrafields->addExtraField('myattr2', "New Attr 2 label", 'varchar', 1, 10, 'project', 0, 0, '', '', 1, '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled');
|
||||
//$result3=$extrafields->addExtraField('myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled');
|
||||
@ -278,6 +278,60 @@ class modEmailCollector extends DolibarrModules
|
||||
|
||||
$sql = array();
|
||||
|
||||
$tmpsql = "SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Ticket_Requets' and entity = ".$conf->entity;
|
||||
$tmpresql = $this->db->query($tmpsql);
|
||||
if ($tmpresql) {
|
||||
if ($this->db->num_rows($tmpresql) == 0) {
|
||||
$sqlforexampleA1 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollector (entity, ref, label, description, source_directory, date_creation, fk_user_creat, status)";
|
||||
$sqlforexampleA1 .= " VALUES (".$conf->entity.", 'Collect_Ticket_Requets', 'Example to collect ticket requests', 'This collector will scan your mailbox to find emails that match some rules and create automatically a ticket (Module Ticket must be enabled) with the email informations. You can use this collector if you provide some support by email, so your ticket request will be automatically generated. If the collector Collect_Responses is also enabled, when you send an email from the ticket, you may also see answers of your customers or partners directly on the ticket view.', 'INBOX', '".$this->db->idate(dol_now())."', ".$user->id.", 0)";
|
||||
$sqlforexampleA2 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, date_creation, fk_user_creat, status)";
|
||||
$sqlforexampleA2 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Ticket_Requets' and entity = ".$conf->entity."), 'withouttrackingid', '".$this->db->idate(dol_now())."', ".$user->id.", 1)";
|
||||
$sqlforexampleA3 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, rulevalue, date_creation, fk_user_creat, status)";
|
||||
$sqlforexampleA3 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Ticket_Requets' and entity = ".$conf->entity."), 'to', 'support@example.com', '".$this->db->idate(dol_now())."', ".$user->id.", 1)";
|
||||
$sqlforexampleA4 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectoraction (fk_emailcollector, type, date_creation, fk_user_creat, status)";
|
||||
$sqlforexampleA4 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Ticket_Requets' and entity = ".$conf->entity."), 'ticket', '".$this->db->idate(dol_now())."', ".$user->id.", 1)";
|
||||
$sql[] = $sqlforexampleA1;
|
||||
$sql[] = $sqlforexampleA2;
|
||||
$sql[] = $sqlforexampleA3;
|
||||
$sql[] = $sqlforexampleA4;
|
||||
}
|
||||
} else dol_print_error($this->db);
|
||||
|
||||
$tmpsql = "SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Responses' and entity = ".$conf->entity;
|
||||
$tmpresql = $this->db->query($tmpsql);
|
||||
if ($tmpresql) {
|
||||
if ($this->db->num_rows($tmpresql) == 0) {
|
||||
$sqlforexampleB1 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollector (entity, ref, label, description, source_directory, date_creation, fk_user_creat, status)";
|
||||
$sqlforexampleB1 .= " VALUES (".$conf->entity.", 'Collect_Responses', 'Example to collect any email responses', 'This collector will scan your mailbox to find all emails that are an answer of an email sent from your application. An event with the email response will be recorded at the good place (Module Agenda must be enabled). For example, if your send a commercial proposal, order or invoice by email and your customer answers your email, the system will automatically find the answer and add it into your ERP.', 'INBOX', '".$this->db->idate(dol_now())."', ".$user->id.", 0)";
|
||||
$sqlforexampleB2 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, date_creation, fk_user_creat, status)";
|
||||
$sqlforexampleB2 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Responses' and entity = ".$conf->entity."), 'withtrackingid', '".$this->db->idate(dol_now())."', ".$user->id.", 1)";
|
||||
$sqlforexampleB3 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectoraction (fk_emailcollector, type, date_creation, fk_user_creat, status)";
|
||||
$sqlforexampleB3 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Responses' and entity = ".$conf->entity."), 'recordevent', '".$this->db->idate(dol_now())."', ".$user->id.", 1)";
|
||||
$sql[] = $sqlforexampleB1;
|
||||
$sql[] = $sqlforexampleB2;
|
||||
$sql[] = $sqlforexampleB3;
|
||||
}
|
||||
} else dol_print_error($this->db);
|
||||
|
||||
$tmpsql = "SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Leads' and entity = ".$conf->entity;
|
||||
$tmpresql = $this->db->query($tmpsql);
|
||||
if ($tmpresql) {
|
||||
if ($this->db->num_rows($tmpresql) == 0) {
|
||||
$sqlforexampleC1 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollector (entity, ref, label, description, source_directory, date_creation, fk_user_creat, status)";
|
||||
$sqlforexampleC1 .= " VALUES (".$conf->entity.", 'Collect_Leads', 'Example to collect leads', 'This collector will scan your mailbox to find emails that match some rules and create automatically a lead (Module Project must be enabled) with the email informations. You can use this collector if you want to follow your lead using the module Project (1 lead = 1 project), so your leads will be automatically generated. If the collector Collect_Responses is also enabled, when you send an email from your leads, proposals or any other object, you may also see answers of your customers or partners directly on the application.<br>Note: With this initial example, the title of the lead is generated including the email. If the thirdparty can''t be found in database (new customer), the lead will be attached to the thirdparty with ID 1.', 'INBOX', '".$this->db->idate(dol_now())."', ".$user->id.", 0)";
|
||||
$sqlforexampleC2 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, date_creation, fk_user_creat, status)";
|
||||
$sqlforexampleC2 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Leads' and entity = ".$conf->entity."), 'withouttrackingid', '".$this->db->idate(dol_now())."', ".$user->id.", 1)";
|
||||
$sqlforexampleC3 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, rulevalue, date_creation, fk_user_creat, status)";
|
||||
$sqlforexampleC3 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Leads' and entity = ".$conf->entity."), 'to', 'sales@example.com', '".$this->db->idate(dol_now())."', ".$user->id.", 1)";
|
||||
$sqlforexampleC4 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectoraction (fk_emailcollector, type, actionparam, date_creation, fk_user_creat, status)";
|
||||
$sqlforexampleC4 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Leads' and entity = ".$conf->entity."), 'project', 'tmp_aaa=EXTRACT:HEADER:^From:(.*);description=EXTRACT:BODY:(.*);title=SET:Lead or message by __tmp_aaa__ receivied by email;socid=SETIFEMPTY:1', '".$this->db->idate(dol_now())."', ".$user->id.", 1)";
|
||||
$sql[] = $sqlforexampleC1;
|
||||
$sql[] = $sqlforexampleC2;
|
||||
$sql[] = $sqlforexampleC3;
|
||||
$sql[] = $sqlforexampleC4;
|
||||
}
|
||||
} else dol_print_error($this->db);
|
||||
|
||||
return $this->_init($sql, $options);
|
||||
}
|
||||
|
||||
|
||||
@ -29,70 +29,70 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("products","other"));
|
||||
$langs->loadLangs(array("products", "other"));
|
||||
|
||||
$id=GETPOST('id', 'int');
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$modulepart=GETPOST('modulepart', 'alpha')?GETPOST('modulepart', 'alpha'):'produit|service';
|
||||
$id = GETPOST('id', 'int');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$modulepart = GETPOST('modulepart', 'alpha') ?GETPOST('modulepart', 'alpha') : 'produit|service';
|
||||
$original_file = GETPOST("file");
|
||||
$backtourl=GETPOST('backtourl');
|
||||
$cancel=GETPOST('cancel', 'alpha');
|
||||
$backtourl = GETPOST('backtourl');
|
||||
$cancel = GETPOST('cancel', 'alpha');
|
||||
|
||||
// Security check
|
||||
if (empty($modulepart)) accessforbidden('Bad value for modulepart');
|
||||
$accessallowed=0;
|
||||
$accessallowed = 0;
|
||||
if ($modulepart == 'produit' || $modulepart == 'product' || $modulepart == 'service' || $modulepart == 'produit|service')
|
||||
{
|
||||
$result=restrictedArea($user, 'produit|service', $id, 'product&product');
|
||||
if ($modulepart=='produit|service' && (! $user->rights->produit->lire && ! $user->rights->service->lire)) accessforbidden();
|
||||
$accessallowed=1;
|
||||
$result = restrictedArea($user, 'produit|service', $id, 'product&product');
|
||||
if ($modulepart == 'produit|service' && (!$user->rights->produit->lire && !$user->rights->service->lire)) accessforbidden();
|
||||
$accessallowed = 1;
|
||||
}
|
||||
elseif ($modulepart == 'project')
|
||||
{
|
||||
$result=restrictedArea($user, 'projet', $id);
|
||||
if (! $user->rights->projet->lire) accessforbidden();
|
||||
$accessallowed=1;
|
||||
$result = restrictedArea($user, 'projet', $id);
|
||||
if (!$user->rights->projet->lire) accessforbidden();
|
||||
$accessallowed = 1;
|
||||
}
|
||||
elseif ($modulepart == 'bom')
|
||||
{
|
||||
$result=restrictedArea($user, $modulepart, $id, 'bom_bom');
|
||||
if (! $user->rights->bom->read) accessforbidden();
|
||||
$accessallowed=1;
|
||||
$result = restrictedArea($user, $modulepart, $id, 'bom_bom');
|
||||
if (!$user->rights->bom->read) accessforbidden();
|
||||
$accessallowed = 1;
|
||||
}
|
||||
elseif ($modulepart == 'member')
|
||||
{
|
||||
$result=restrictedArea($user, 'adherent', $id, '', '', 'fk_soc', 'rowid');
|
||||
if (! $user->rights->adherent->lire) accessforbidden();
|
||||
$accessallowed=1;
|
||||
$result = restrictedArea($user, 'adherent', $id, '', '', 'fk_soc', 'rowid');
|
||||
if (!$user->rights->adherent->lire) accessforbidden();
|
||||
$accessallowed = 1;
|
||||
}
|
||||
elseif ($modulepart == 'user')
|
||||
{
|
||||
$result=restrictedArea($user, $modulepart, $id, $modulepart);
|
||||
if (! $user->rights->user->user->lire) accessforbidden();
|
||||
$accessallowed=1;
|
||||
$result = restrictedArea($user, $modulepart, $id, $modulepart);
|
||||
if (!$user->rights->user->user->lire) accessforbidden();
|
||||
$accessallowed = 1;
|
||||
}
|
||||
elseif ($modulepart == 'tax')
|
||||
{
|
||||
$result=restrictedArea($user, $modulepart, $id, 'chargesociales', 'charges');
|
||||
if (! $user->rights->tax->charges->lire) accessforbidden();
|
||||
$accessallowed=1;
|
||||
$result = restrictedArea($user, $modulepart, $id, 'chargesociales', 'charges');
|
||||
if (!$user->rights->tax->charges->lire) accessforbidden();
|
||||
$accessallowed = 1;
|
||||
}
|
||||
elseif ($modulepart == 'bank')
|
||||
{
|
||||
$result=restrictedArea($user, 'banque', $id, 'bank_account');
|
||||
if (! $user->rights->banque->lire) accessforbidden();
|
||||
$accessallowed=1;
|
||||
$result = restrictedArea($user, 'banque', $id, 'bank_account');
|
||||
if (!$user->rights->banque->lire) accessforbidden();
|
||||
$accessallowed = 1;
|
||||
}
|
||||
else // ticket, holiday, expensereport, societe...
|
||||
{
|
||||
$result=restrictedArea($user, $modulepart, $id, $modulepart);
|
||||
$result = restrictedArea($user, $modulepart, $id, $modulepart);
|
||||
if (empty($user->rights->$modulepart->read) && empty($user->rights->$modulepart->lire)) accessforbidden();
|
||||
$accessallowed=1;
|
||||
$accessallowed = 1;
|
||||
}
|
||||
|
||||
// Security:
|
||||
// Limit access if permissions are wrong
|
||||
if (! $accessallowed)
|
||||
if (!$accessallowed)
|
||||
{
|
||||
accessforbidden();
|
||||
}
|
||||
@ -106,9 +106,9 @@ if ($modulepart == 'produit' || $modulepart == 'product' || $modulepart == 'serv
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
if ($result <= 0) dol_print_error($db, 'Failed to load object');
|
||||
$dir=$conf->product->multidir_output[$object->entity]; // By default
|
||||
if ($object->type == Product::TYPE_PRODUCT) $dir=$conf->product->multidir_output[$object->entity];
|
||||
if ($object->type == Product::TYPE_SERVICE) $dir=$conf->service->multidir_output[$object->entity];
|
||||
$dir = $conf->product->multidir_output[$object->entity]; // By default
|
||||
if ($object->type == Product::TYPE_PRODUCT) $dir = $conf->product->multidir_output[$object->entity];
|
||||
if ($object->type == Product::TYPE_SERVICE) $dir = $conf->service->multidir_output[$object->entity];
|
||||
}
|
||||
}
|
||||
elseif ($modulepart == 'project')
|
||||
@ -119,7 +119,7 @@ elseif ($modulepart == 'project')
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
if ($result <= 0) dol_print_error($db, 'Failed to load object');
|
||||
$dir=$conf->projet->dir_output; // By default
|
||||
$dir = $conf->projet->dir_output; // By default
|
||||
}
|
||||
}
|
||||
elseif ($modulepart == 'holiday')
|
||||
@ -130,7 +130,7 @@ elseif ($modulepart == 'holiday')
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
if ($result <= 0) dol_print_error($db, 'Failed to load object');
|
||||
$dir=$conf->$modulepart->dir_output; // By default
|
||||
$dir = $conf->$modulepart->dir_output; // By default
|
||||
}
|
||||
}
|
||||
elseif ($modulepart == 'member')
|
||||
@ -141,7 +141,7 @@ elseif ($modulepart == 'member')
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
if ($result <= 0) dol_print_error($db, 'Failed to load object');
|
||||
$dir=$conf->adherent->dir_output; // By default
|
||||
$dir = $conf->adherent->dir_output; // By default
|
||||
}
|
||||
}
|
||||
elseif ($modulepart == 'societe')
|
||||
@ -152,7 +152,7 @@ elseif ($modulepart == 'societe')
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
if ($result <= 0) dol_print_error($db, 'Failed to load object');
|
||||
$dir=$conf->$modulepart->dir_output;
|
||||
$dir = $conf->$modulepart->dir_output;
|
||||
}
|
||||
}
|
||||
elseif ($modulepart == 'user')
|
||||
@ -163,7 +163,7 @@ elseif ($modulepart == 'user')
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
if ($result <= 0) dol_print_error($db, 'Failed to load object');
|
||||
$dir=$conf->$modulepart->dir_output; // By default
|
||||
$dir = $conf->$modulepart->dir_output; // By default
|
||||
}
|
||||
}
|
||||
elseif ($modulepart == 'expensereport')
|
||||
@ -174,7 +174,7 @@ elseif ($modulepart == 'expensereport')
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
if ($result <= 0) dol_print_error($db, 'Failed to load object');
|
||||
$dir=$conf->expensereport->dir_output; // By default
|
||||
$dir = $conf->expensereport->dir_output; // By default
|
||||
}
|
||||
}
|
||||
elseif ($modulepart == 'tax')
|
||||
@ -185,7 +185,7 @@ elseif ($modulepart == 'tax')
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
if ($result <= 0) dol_print_error($db, 'Failed to load object');
|
||||
$dir=$conf->$modulepart->dir_output; // By default
|
||||
$dir = $conf->$modulepart->dir_output; // By default
|
||||
}
|
||||
}
|
||||
elseif ($modulepart == 'ticket')
|
||||
@ -196,7 +196,7 @@ elseif ($modulepart == 'ticket')
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
if ($result <= 0) dol_print_error($db, 'Failed to load object');
|
||||
$dir=$conf->$modulepart->dir_output; // By default
|
||||
$dir = $conf->$modulepart->dir_output; // By default
|
||||
}
|
||||
}
|
||||
elseif ($modulepart == 'bom')
|
||||
@ -207,7 +207,7 @@ elseif ($modulepart == 'bom')
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
if ($result <= 0) dol_print_error($db, 'Failed to load object');
|
||||
$dir=$conf->$modulepart->dir_output; // By default
|
||||
$dir = $conf->$modulepart->dir_output; // By default
|
||||
}
|
||||
}
|
||||
elseif ($modulepart == 'bank')
|
||||
@ -218,7 +218,7 @@ elseif ($modulepart == 'bank')
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
if ($result <= 0) dol_print_error($db, 'Failed to load object');
|
||||
$dir=$conf->bank->dir_output; // By default
|
||||
$dir = $conf->bank->dir_output; // By default
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -227,17 +227,17 @@ else {
|
||||
|
||||
if (empty($backtourl))
|
||||
{
|
||||
if (in_array($modulepart, array('product','produit','service','produit|service'))) $backtourl=DOL_URL_ROOT."/product/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
||||
elseif (in_array($modulepart, array('expensereport'))) $backtourl=DOL_URL_ROOT."/expensereport/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
||||
elseif (in_array($modulepart, array('holiday'))) $backtourl=DOL_URL_ROOT."/holiday/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
||||
elseif (in_array($modulepart, array('member'))) $backtourl=DOL_URL_ROOT."/adherents/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
||||
elseif (in_array($modulepart, array('project'))) $backtourl=DOL_URL_ROOT."/projet/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
||||
elseif (in_array($modulepart, array('societe'))) $backtourl=DOL_URL_ROOT."/societe/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
||||
elseif (in_array($modulepart, array('tax'))) $backtourl=DOL_URL_ROOT."/compta/sociales/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
||||
elseif (in_array($modulepart, array('ticket'))) $backtourl=DOL_URL_ROOT."/ticket/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
||||
elseif (in_array($modulepart, array('user'))) $backtourl=DOL_URL_ROOT."/user/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
||||
elseif (in_array($modulepart, array('bank'))) $backtourl=DOL_URL_ROOT."/compta/bank/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
||||
else $backtourl=DOL_URL_ROOT."/".$modulepart."/".$modulepart."_document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
||||
if (in_array($modulepart, array('product', 'produit', 'service', 'produit|service'))) $backtourl = DOL_URL_ROOT."/product/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
||||
elseif (in_array($modulepart, array('expensereport'))) $backtourl = DOL_URL_ROOT."/expensereport/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
||||
elseif (in_array($modulepart, array('holiday'))) $backtourl = DOL_URL_ROOT."/holiday/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
||||
elseif (in_array($modulepart, array('member'))) $backtourl = DOL_URL_ROOT."/adherents/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
||||
elseif (in_array($modulepart, array('project'))) $backtourl = DOL_URL_ROOT."/projet/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
||||
elseif (in_array($modulepart, array('societe'))) $backtourl = DOL_URL_ROOT."/societe/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
||||
elseif (in_array($modulepart, array('tax'))) $backtourl = DOL_URL_ROOT."/compta/sociales/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
||||
elseif (in_array($modulepart, array('ticket'))) $backtourl = DOL_URL_ROOT."/ticket/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
||||
elseif (in_array($modulepart, array('user'))) $backtourl = DOL_URL_ROOT."/user/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
||||
elseif (in_array($modulepart, array('bank'))) $backtourl = DOL_URL_ROOT."/compta/bank/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
||||
else $backtourl = DOL_URL_ROOT."/".$modulepart."/".$modulepart."_document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
||||
}
|
||||
|
||||
|
||||
@ -261,9 +261,9 @@ if ($cancel)
|
||||
|
||||
if ($action == 'confirm_resize' && (isset($_POST["file"]) != "") && (isset($_POST["sizex"]) != "") && (isset($_POST["sizey"]) != ""))
|
||||
{
|
||||
$fullpath=$dir."/".$original_file;
|
||||
$fullpath = $dir."/".$original_file;
|
||||
|
||||
$result=dol_imageResizeOrCrop($fullpath, 0, $_POST['sizex'], $_POST['sizey']);
|
||||
$result = dol_imageResizeOrCrop($fullpath, 0, $_POST['sizex'], $_POST['sizey']);
|
||||
|
||||
if ($result == $fullpath)
|
||||
{
|
||||
@ -274,7 +274,7 @@ if ($action == 'confirm_resize' && (isset($_POST["file"]) != "") && (isset($_POS
|
||||
$rel_filename = preg_replace('/^[\\/]/', '', $rel_filename);
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
|
||||
$ecmfile=new EcmFiles($db);
|
||||
$ecmfile = new EcmFiles($db);
|
||||
$result = $ecmfile->fetch(0, '', $rel_filename);
|
||||
if ($result > 0) // If found
|
||||
{
|
||||
@ -295,11 +295,11 @@ if ($action == 'confirm_resize' && (isset($_POST["file"]) != "") && (isset($_POS
|
||||
|
||||
$ecmfile->filepath = $rel_dir;
|
||||
$ecmfile->filename = $filename;
|
||||
$ecmfile->label = md5_file(dol_osencode($fullpath)); // $fullpath is a full path to file
|
||||
$ecmfile->label = md5_file(dol_osencode($fullpath)); // $fullpath is a full path to file
|
||||
$ecmfile->fullpath_orig = $fullpath;
|
||||
$ecmfile->gen_or_uploaded = 'unknown';
|
||||
$ecmfile->description = ''; // indexed content
|
||||
$ecmfile->keyword = ''; // keyword content
|
||||
$ecmfile->description = ''; // indexed content
|
||||
$ecmfile->keyword = ''; // keyword content
|
||||
$result = $ecmfile->create($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
@ -322,18 +322,18 @@ if ($action == 'confirm_resize' && (isset($_POST["file"]) != "") && (isset($_POS
|
||||
else
|
||||
{
|
||||
setEventMessages($result, null, 'errors');
|
||||
$_GET['file']=$_POST["file"];
|
||||
$action='';
|
||||
$_GET['file'] = $_POST["file"];
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Crop d'une image
|
||||
if ($action == 'confirm_crop')
|
||||
{
|
||||
$fullpath=$dir."/".$original_file;
|
||||
$fullpath = $dir."/".$original_file;
|
||||
|
||||
//var_dump($_POST['w'].'x'.$_POST['h'].'-'.$_POST['x'].'x'.$_POST['y']);exit;
|
||||
$result=dol_imageResizeOrCrop($fullpath, 1, $_POST['w'], $_POST['h'], $_POST['x'], $_POST['y']);
|
||||
$result = dol_imageResizeOrCrop($fullpath, 1, $_POST['w'], $_POST['h'], $_POST['x'], $_POST['y']);
|
||||
|
||||
if ($result == $fullpath)
|
||||
{
|
||||
@ -344,7 +344,7 @@ if ($action == 'confirm_crop')
|
||||
$rel_filename = preg_replace('/^[\\/]/', '', $rel_filename);
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
|
||||
$ecmfile=new EcmFiles($db);
|
||||
$ecmfile = new EcmFiles($db);
|
||||
$result = $ecmfile->fetch(0, '', $rel_filename);
|
||||
if ($result > 0) // If found
|
||||
{
|
||||
@ -365,11 +365,11 @@ if ($action == 'confirm_crop')
|
||||
|
||||
$ecmfile->filepath = $rel_dir;
|
||||
$ecmfile->filename = $filename;
|
||||
$ecmfile->label = md5_file(dol_osencode($fullpath)); // $fullpath is a full path to file
|
||||
$ecmfile->label = md5_file(dol_osencode($fullpath)); // $fullpath is a full path to file
|
||||
$ecmfile->fullpath_orig = $fullpath;
|
||||
$ecmfile->gen_or_uploaded = 'unknown';
|
||||
$ecmfile->description = ''; // indexed content
|
||||
$ecmfile->keyword = ''; // keyword content
|
||||
$ecmfile->description = ''; // indexed content
|
||||
$ecmfile->keyword = ''; // keyword content
|
||||
$result = $ecmfile->create($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
@ -392,8 +392,8 @@ if ($action == 'confirm_crop')
|
||||
else
|
||||
{
|
||||
setEventMessages($result, null, 'errors');
|
||||
$_GET['file']=$_POST["file"];
|
||||
$action='';
|
||||
$_GET['file'] = $_POST["file"];
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
|
||||
@ -402,14 +402,14 @@ if ($action == 'confirm_crop')
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader($head, $langs->trans("Image"), '', '', 0, 0, array('/includes/jquery/plugins/jcrop/js/jquery.Jcrop.min.js','/core/js/lib_photosresize.js'), array('/includes/jquery/plugins/jcrop/css/jquery.Jcrop.css'));
|
||||
llxHeader($head, $langs->trans("Image"), '', '', 0, 0, array('/includes/jquery/plugins/jcrop/js/jquery.Jcrop.min.js', '/core/js/lib_photosresize.js'), array('/includes/jquery/plugins/jcrop/css/jquery.Jcrop.css'));
|
||||
|
||||
|
||||
print load_fiche_titre($langs->trans("ImageEditor"));
|
||||
|
||||
$infoarray=dol_getImageSize($dir."/".GETPOST("file", 'alpha'));
|
||||
$height=$infoarray['height'];
|
||||
$width=$infoarray['width'];
|
||||
$infoarray = dol_getImageSize($dir."/".GETPOST("file", 'alpha'));
|
||||
$height = $infoarray['height'];
|
||||
$width = $infoarray['width'];
|
||||
print $langs->trans("CurrentInformationOnImage").': ';
|
||||
print $langs->trans("Width").': <strong>'.$width.'</strong> x '.$langs->trans("Height").': <strong>'.$height.'</strong><br>';
|
||||
|
||||
@ -450,18 +450,18 @@ print '<br>'."\n";
|
||||
|
||||
print '<br>'."\n";
|
||||
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
if (!empty($conf->use_javascript_ajax))
|
||||
{
|
||||
$infoarray=dol_getImageSize($dir."/".GETPOST("file"));
|
||||
$height=$infoarray['height'];
|
||||
$width=$infoarray['width'];
|
||||
$widthforcrop=$width; $refsizeforcrop='orig'; $ratioforcrop=1;
|
||||
$infoarray = dol_getImageSize($dir."/".GETPOST("file"));
|
||||
$height = $infoarray['height'];
|
||||
$width = $infoarray['width'];
|
||||
$widthforcrop = $width; $refsizeforcrop = 'orig'; $ratioforcrop = 1;
|
||||
// If image is too large, we use another scale.
|
||||
if (! empty($_SESSION['dol_screenwidth']) && ($widthforcrop > round($_SESSION['dol_screenwidth']/2)))
|
||||
if (!empty($_SESSION['dol_screenwidth']) && ($widthforcrop > round($_SESSION['dol_screenwidth'] / 2)))
|
||||
{
|
||||
$ratioforcrop=2;
|
||||
$widthforcrop=round($_SESSION['dol_screenwidth'] / $ratioforcrop);
|
||||
$refsizeforcrop='screenwidth';
|
||||
$ratioforcrop = 2;
|
||||
$widthforcrop = round($_SESSION['dol_screenwidth'] / $ratioforcrop);
|
||||
$refsizeforcrop = 'screenwidth';
|
||||
}
|
||||
|
||||
print '<!-- Form to crop -->'."\n";
|
||||
|
||||
@ -455,7 +455,7 @@ if ($action == 'create')
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook))
|
||||
{
|
||||
print $object->showOptionals($extrafields, 'edit');
|
||||
print $object->showOptionals($extrafields, 'edit', $parameters);
|
||||
}
|
||||
|
||||
print '</tbody>';
|
||||
@ -589,7 +589,7 @@ if (!empty($id) && $action == 'edit')
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook))
|
||||
{
|
||||
print $object->showOptionals($extrafields, 'edit');
|
||||
print $object->showOptionals($extrafields, 'edit', $parameters);
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
@ -864,17 +864,17 @@ class EmailCollector extends CommonObject
|
||||
|
||||
if (empty($this->host))
|
||||
{
|
||||
$this->error = $langs->trans('ErrorFieldRequired', 'EMailHost');
|
||||
$this->error = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('EMailHost'));
|
||||
return -1;
|
||||
}
|
||||
if (empty($this->login))
|
||||
{
|
||||
$this->error = $langs->trans('ErrorFieldRequired', 'Login');
|
||||
$this->error = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Login'));
|
||||
return -1;
|
||||
}
|
||||
if (empty($this->source_directory))
|
||||
{
|
||||
$this->error = $langs->trans('ErrorFieldRequired', 'MailboxSourceDirectory');
|
||||
$this->error = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('MailboxSourceDirectory'));
|
||||
return -1;
|
||||
}
|
||||
if (!function_exists('imap_open'))
|
||||
|
||||
@ -1025,7 +1025,7 @@ if ($action == 'create')
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Other attributes
|
||||
$parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"', 'socid'=>$socid);
|
||||
$parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"', 'cols' => '3', 'socid' => $socid);
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $expe, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
@ -1034,7 +1034,7 @@ if ($action == 'create')
|
||||
if ($object->fetch_optionals() > 0) {
|
||||
$expe->array_options = array_merge($expe->array_options, $object->array_options);
|
||||
}
|
||||
print $expe->showOptionals($extrafields, 'edit');
|
||||
print $expe->showOptionals($extrafields, 'edit', $parameters);
|
||||
}
|
||||
|
||||
|
||||
@ -1994,7 +1994,7 @@ elseif ($id || $ref)
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters = array('colspan' => ' colspan="3"');
|
||||
$parameters = array('colspan' => ' colspan="3"', 'cols' => '3');
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
|
||||
@ -1532,11 +1532,11 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters = array('colspan' => ' colspan="3"');
|
||||
$parameters = array('colspan' => ' colspan="3"', 'cols' => 3);
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook)) {
|
||||
print $object->showOptionals($extrafields, 'edit');
|
||||
print $object->showOptionals($extrafields, 'edit', $parameters);
|
||||
}
|
||||
|
||||
print '<tbody>';
|
||||
|
||||
@ -906,18 +906,17 @@ if ($action == 'create')
|
||||
|
||||
print '<form name="fichinter" action="'.$_SERVER['PHP_SELF'].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="socid" value='.$soc->id.'>';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
dol_fiche_head('');
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
print '<input type="hidden" name="socid" value='.$soc->id.'>';
|
||||
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("ThirdParty").'</td><td>'.$soc->getNomUrl(1).'</td></tr>';
|
||||
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Ref').'</td><td colspan="2">'.$langs->trans("Draft").'</td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Ref').'</td><td>'.$langs->trans("Draft").'</td></tr>';
|
||||
|
||||
// Description (must be a textarea and not html must be allowed (used in list view)
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td>';
|
||||
@ -963,15 +962,15 @@ if ($action == 'create')
|
||||
// Model
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("DefaultModel").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print '<td>';
|
||||
$liste = ModelePDFFicheinter::liste_modeles($db);
|
||||
print $form->selectarray('model', $liste, $conf->global->FICHEINTER_ADDON_PDF);
|
||||
print "</td></tr>";
|
||||
|
||||
// Public note
|
||||
print '<tr>';
|
||||
print '<td tdtop">'.$langs->trans('NotePublic').'</td>';
|
||||
print '<td colspan="2">';
|
||||
print '<td class="tdtop">'.$langs->trans('NotePublic').'</td>';
|
||||
print '<td>';
|
||||
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
|
||||
print $doleditor->Create(1);
|
||||
//print '<textarea name="note_public" cols="80" rows="'.ROWS_3.'">'.$note_public.'</textarea>';
|
||||
@ -982,7 +981,7 @@ if ($action == 'create')
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td class="tdtop">'.$langs->trans('NotePrivate').'</td>';
|
||||
print '<td colspan="2">';
|
||||
print '<td>';
|
||||
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
|
||||
print $doleditor->Create(1);
|
||||
//print '<textarea name="note_private" cols="80" rows="'.ROWS_3.'">'.$note_private.'</textarea>';
|
||||
@ -990,7 +989,7 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters = array('colspan' => ' colspan="2"');
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook))
|
||||
|
||||
@ -1610,15 +1610,13 @@ if ($action == 'create')
|
||||
print '<tr><td>'.$langs->trans('RefSupplier').'</td><td><input name="refsupplier" type="text"></td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
// Payment term
|
||||
print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td colspan="2">';
|
||||
print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>';
|
||||
$form->select_conditions_paiements(isset($_POST['cond_reglement_id']) ? $_POST['cond_reglement_id'] : $cond_reglement_id, 'cond_reglement_id');
|
||||
print '</td></tr>';
|
||||
|
||||
// Payment mode
|
||||
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td colspan="2">';
|
||||
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td>';
|
||||
$form->select_types_paiements(isset($_POST['mode_reglement_id']) ? $_POST['mode_reglement_id'] : $mode_reglement_id, 'mode_reglement_id');
|
||||
print '</td></tr>';
|
||||
|
||||
@ -1636,7 +1634,7 @@ if ($action == 'create')
|
||||
if (!empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER) && !empty($conf->banque->enabled))
|
||||
{
|
||||
$langs->load("bank");
|
||||
print '<tr><td>'.$langs->trans('BankAccount').'</td><td colspan="2">';
|
||||
print '<tr><td>'.$langs->trans('BankAccount').'</td><td>';
|
||||
$form->select_comptes($fk_account, 'fk_account', 0, '', 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -1647,10 +1645,9 @@ if ($action == 'create')
|
||||
$formproject = new FormProjets($db);
|
||||
|
||||
$langs->load('projects');
|
||||
print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">';
|
||||
print '<tr><td>'.$langs->trans('Project').'</td><td>';
|
||||
$formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $societe->id : -1), $projectid, 'projectid', 0, 0, 1, 1);
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$societe->id).'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddProject").'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
|
||||
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -1659,7 +1656,7 @@ if ($action == 'create')
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), $object->label_incoterms, 1).'</label></td>';
|
||||
print '<td colspan="3" class="maxwidthonsmartphone">';
|
||||
print '<td class="maxwidthonsmartphone">';
|
||||
print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''));
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -1669,7 +1666,7 @@ if ($action == 'create')
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td>'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).'</td>';
|
||||
print '<td colspan="3" class="maxwidthonsmartphone">';
|
||||
print '<td class="maxwidthonsmartphone">';
|
||||
print $form->selectMultiCurrency($currency_code, 'multicurrency_code');
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -1700,26 +1697,26 @@ if ($action == 'create')
|
||||
print '<input type="hidden" name="originid" value="'.$objectsrc->id.'">';
|
||||
|
||||
$newclassname = $classname;
|
||||
print '<tr><td>'.$langs->trans($newclassname).'</td><td colspan="2">'.$objectsrc->getNomUrl(1).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('AmountHT').'</td><td colspan="2">'.price($objectsrc->total_ht).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('AmountVAT').'</td><td colspan="2">'.price($objectsrc->total_tva)."</td></tr>";
|
||||
print '<tr><td>'.$langs->trans($newclassname).'</td><td>'.$objectsrc->getNomUrl(1).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('AmountHT').'</td><td>'.price($objectsrc->total_ht).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('AmountVAT').'</td><td>'.price($objectsrc->total_tva)."</td></tr>";
|
||||
if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0) // Localtax1 RE
|
||||
{
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td><td colspan="2">'.price($objectsrc->total_localtax1)."</td></tr>";
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td><td>'.price($objectsrc->total_localtax1)."</td></tr>";
|
||||
}
|
||||
|
||||
if ($mysoc->localtax2_assuj == "1" || $objectsrc->total_localtax2 != 0) // Localtax2 IRPF
|
||||
{
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td><td colspan="2">'.price($objectsrc->total_localtax2)."</td></tr>";
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td><td>'.price($objectsrc->total_localtax2)."</td></tr>";
|
||||
}
|
||||
|
||||
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td colspan="2">'.price($objectsrc->total_ttc)."</td></tr>";
|
||||
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td>'.price($objectsrc->total_ttc)."</td></tr>";
|
||||
|
||||
if (!empty($conf->multicurrency->enabled))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans('MulticurrencyAmountHT').'</td><td colspan="2">'.price($objectsrc->multicurrency_total_ht).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('MulticurrencyAmountVAT').'</td><td colspan="2">'.price($objectsrc->multicurrency_total_tva).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('MulticurrencyAmountTTC').'</td><td colspan="2">'.price($objectsrc->multicurrency_total_ttc).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('MulticurrencyAmountHT').'</td><td>'.price($objectsrc->multicurrency_total_ht).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('MulticurrencyAmountVAT').'</td><td>'.price($objectsrc->multicurrency_total_tva).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('MulticurrencyAmountTTC').'</td><td>'.price($objectsrc->multicurrency_total_ttc).'</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -336,22 +336,22 @@ if ($action == 'create' && !$error) {
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Ref').'</td><td colspan="2">'.$langs->trans('Draft').'</td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Ref').'</td><td>'.$langs->trans('Draft').'</td></tr>';
|
||||
|
||||
// Ref supplier
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('RefSupplier').'</td><td><input name="ref_supplier" value="'.dol_escape_htmltag(isset($_POST['ref_supplier']) ? GETPOST('ref_supplier', 'alpha', 2) : '').'" type="text"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Date invoice
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Date').'</td><td colspan="2">';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Date').'</td><td>';
|
||||
print $html->selectDate('', '', '', '', '', "add", 1, 1);
|
||||
print '</td></tr>';
|
||||
// Payment term
|
||||
print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td colspan="2">';
|
||||
print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>';
|
||||
$html->select_conditions_paiements(isset($_POST['cond_reglement_id']) ? $_POST['cond_reglement_id'] : $cond_reglement_id, 'cond_reglement_id');
|
||||
print '</td></tr>';
|
||||
// Payment mode
|
||||
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td colspan="2">';
|
||||
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td>';
|
||||
$html->select_types_paiements(isset($_POST['mode_reglement_id']) ? $_POST['mode_reglement_id'] : $mode_reglement_id, 'mode_reglement_id');
|
||||
print '</td></tr>';
|
||||
// Project
|
||||
@ -359,7 +359,7 @@ if ($action == 'create' && !$error) {
|
||||
$formproject = new FormProjets($db);
|
||||
|
||||
$langs->load('projects');
|
||||
print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">';
|
||||
print '<tr><td>'.$langs->trans('Project').'</td><td>';
|
||||
$formproject->select_projects($soc->id, $projectid, 'projectid');
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -367,9 +367,7 @@ if ($action == 'create' && !$error) {
|
||||
// Other attributes
|
||||
$parameters = array(
|
||||
'objectsrc' => $objectsrc,
|
||||
'idsrc' => $listoforders,
|
||||
'colspan' => ' colspan="2"',
|
||||
'cols'=>2
|
||||
'idsrc' => $listoforders
|
||||
);
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
@ -390,7 +388,7 @@ if ($action == 'create' && !$error) {
|
||||
// Public note
|
||||
print '<tr>';
|
||||
print '<td class="tdtop">'.$langs->trans('NotePublic').'</td>';
|
||||
print '<td colspan="2">';
|
||||
print '<td>';
|
||||
print '<textarea name="note_public" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">';
|
||||
|
||||
print $langs->trans("Orders").": ".implode(', ', $listoforders);
|
||||
@ -401,7 +399,7 @@ if ($action == 'create' && !$error) {
|
||||
if (empty($user->socid)) {
|
||||
print '<tr>';
|
||||
print '<td class="tdtop">'.$langs->trans('NotePrivate').'</td>';
|
||||
print '<td colspan="2">';
|
||||
print '<td>';
|
||||
print '<textarea name="note" wrap="soft" cols="70" rows="'.ROWS_3.'">';
|
||||
|
||||
print '</textarea></td></tr>';
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 104 KiB After Width: | Height: | Size: 29 KiB |
Binary file not shown.
@ -512,3 +512,29 @@ ALTER TABLE llx_categorie_actioncomm ADD INDEX idx_categorie_actioncomm_fk_actio
|
||||
|
||||
ALTER TABLE llx_categorie_actioncomm ADD CONSTRAINT fk_categorie_actioncomm_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid);
|
||||
ALTER TABLE llx_categorie_actioncomm ADD CONSTRAINT fk_categorie_actioncomm_fk_actioncomm FOREIGN KEY (fk_actioncomm) REFERENCES llx_actioncomm (id);
|
||||
|
||||
CREATE TABLE llx_mrp_production(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
|
||||
fk_mo integer NOT NULL,
|
||||
position integer NOT NULL DEFAULT 0,
|
||||
fk_product integer NOT NULL,
|
||||
fk_warehouse integer,
|
||||
qty integer NOT NULL DEFAULT 1,
|
||||
batch varchar(30),
|
||||
role varchar(10), -- 'toconsume' or 'toproduce' (initialized at MO creation), 'consumed' or 'produced' (added after MO validation)
|
||||
fk_mrp_production integer, -- if role = 'consumed', id of line with role 'toconsume', if role = 'produced' id of line with role 'toproduce'
|
||||
fk_stock_movement integer, -- id of stock movement when movements are validated
|
||||
date_creation datetime NOT NULL,
|
||||
tms timestamp,
|
||||
fk_user_creat integer NOT NULL,
|
||||
fk_user_modif integer,
|
||||
import_key varchar(14)
|
||||
) ENGINE=innodb;
|
||||
|
||||
ALTER TABLE llx_mrp_production ADD CONSTRAINT fk_mrp_production_mo FOREIGN KEY (fk_mo) REFERENCES llx_mrp_mo (rowid);
|
||||
ALTER TABLE llx_mrp_production ADD CONSTRAINT fk_mrp_production_product FOREIGN KEY (fk_product) REFERENCES llx_product (rowid);
|
||||
ALTER TABLE llx_mrp_production ADD CONSTRAINT fk_mrp_production_stock_movement FOREIGN KEY (fk_stock_movement) REFERENCES llx_stock_mouvement (rowid);
|
||||
|
||||
ALTER TABLE llx_mrp_production ADD INDEX idx_mrp_production_fk_mo (fk_mo);
|
||||
|
||||
ALTER TABLE llx_emailcollector_emailcollector ADD UNIQUE INDEX uk_emailcollector_emailcollector_ref(ref, entity);
|
||||
|
||||
0
htdocs/install/mysql/migration/3.5.0-3.6.0.sql
Executable file → Normal file
0
htdocs/install/mysql/migration/3.5.0-3.6.0.sql
Executable file → Normal file
0
htdocs/install/mysql/migration/3.6.0-3.7.0.sql
Executable file → Normal file
0
htdocs/install/mysql/migration/3.6.0-3.7.0.sql
Executable file → Normal file
0
htdocs/install/mysql/migration/3.7.0-3.8.0.sql
Executable file → Normal file
0
htdocs/install/mysql/migration/3.7.0-3.8.0.sql
Executable file → Normal file
0
htdocs/install/mysql/migration/repair.sql
Executable file → Normal file
0
htdocs/install/mysql/migration/repair.sql
Executable file → Normal file
@ -17,7 +17,7 @@
|
||||
--
|
||||
-- ============================================================================
|
||||
|
||||
CREATE TABLE llx_accounting_bookkeeping
|
||||
CREATE TABLE llx_accounting_bookkeeping
|
||||
(
|
||||
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
entity integer DEFAULT 1 NOT NULL, -- | multi company id
|
||||
@ -27,7 +27,7 @@ CREATE TABLE llx_accounting_bookkeeping
|
||||
doc_ref varchar(300) NOT NULL, -- FEC:PieceRef | facture_client/reglement_client/... reference number
|
||||
fk_doc integer NOT NULL, -- | facture_client/reglement_client/... rowid
|
||||
fk_docdet integer NOT NULL, -- | facture_client/reglement_client/... line rowid
|
||||
thirdparty_code varchar(32), -- Third party code (customer or supplier) when record is saved (may help debug)
|
||||
thirdparty_code varchar(32), -- Third party code (customer or supplier) when record is saved (may help debug)
|
||||
subledger_account varchar(32), -- FEC:CompAuxNum | account number of subledger account
|
||||
subledger_label varchar(255), -- FEC:CompAuxLib | label of subledger account
|
||||
numero_compte varchar(32) NOT NULL, -- FEC:CompteNum | account number
|
||||
@ -45,12 +45,12 @@ CREATE TABLE llx_accounting_bookkeeping
|
||||
fk_user_author integer NOT NULL, -- | user creating
|
||||
fk_user_modif integer, -- | user making last change
|
||||
date_creation datetime, -- FEC:EcritureDate | creation date
|
||||
tms timestamp, -- | date last modification
|
||||
tms timestamp, -- | date last modification
|
||||
fk_user integer NULL, -- The id of user that validate the accounting source document
|
||||
code_journal varchar(32) NOT NULL, -- FEC:JournalCode
|
||||
journal_label varchar(255), -- FEC:JournalLib
|
||||
date_validated datetime, -- FEC:ValidDate | if empty: movement not validated / if not empty: movement validated (No deleting / No modification)
|
||||
date_export datetime DEFAULT NULL, --
|
||||
date_validated datetime, -- FEC:ValidDate | if empty: movement not validated / if not empty: movement validated (No deleting / No modification)
|
||||
date_export datetime DEFAULT NULL, --
|
||||
import_key varchar(14),
|
||||
extraparams varchar(255) -- for other parameters with json format
|
||||
extraparams varchar(255) -- for other parameters with json format
|
||||
) ENGINE=innodb;
|
||||
|
||||
@ -19,7 +19,5 @@ ALTER TABLE llx_emailcollector_emailcollector ADD INDEX idx_emailcollector_entit
|
||||
ALTER TABLE llx_emailcollector_emailcollector ADD INDEX idx_emailcollector_status (status);
|
||||
-- END MODULEBUILDER INDEXES
|
||||
|
||||
--ALTER TABLE llx_emailcollector_emailcollector ADD UNIQUE INDEX uk_emailcollector_emailcollector_fieldxyz(fieldx, fieldy);
|
||||
|
||||
--ALTER TABLE llx_emailcollector_emailcollector ADD CONSTRAINT llx_emailcollector_emailcollector_field_id FOREIGN KEY (fk_field) REFERENCES llx_myotherobject(rowid);
|
||||
ALTER TABLE llx_emailcollector_emailcollector ADD UNIQUE INDEX uk_emailcollector_emailcollector_ref(ref, entity);
|
||||
|
||||
|
||||
21
htdocs/install/mysql/tables/llx_mrp_production.key.sql
Normal file
21
htdocs/install/mysql/tables/llx_mrp_production.key.sql
Normal file
@ -0,0 +1,21 @@
|
||||
-- Copyright (C) 2019 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
--
|
||||
-- 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
|
||||
-- the Free Software Foundation, either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
ALTER TABLE llx_mrp_production ADD CONSTRAINT fk_mrp_production_mo FOREIGN KEY (fk_mo) REFERENCES llx_mrp_mo (rowid);
|
||||
ALTER TABLE llx_mrp_production ADD CONSTRAINT fk_mrp_production_product FOREIGN KEY (fk_product) REFERENCES llx_product (rowid);
|
||||
ALTER TABLE llx_mrp_production ADD CONSTRAINT fk_mrp_production_stock_movement FOREIGN KEY (fk_stock_movement) REFERENCES llx_stock_mouvement (rowid);
|
||||
|
||||
ALTER TABLE llx_mrp_production ADD INDEX idx_mrp_production_fk_mo (fk_mo);
|
||||
|
||||
34
htdocs/install/mysql/tables/llx_mrp_production.sql
Normal file
34
htdocs/install/mysql/tables/llx_mrp_production.sql
Normal file
@ -0,0 +1,34 @@
|
||||
-- Copyright (C) 2019 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
--
|
||||
-- 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
|
||||
-- the Free Software Foundation, either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
|
||||
CREATE TABLE llx_mrp_production(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
|
||||
fk_mo integer NOT NULL,
|
||||
position integer NOT NULL DEFAULT 0,
|
||||
fk_product integer NOT NULL,
|
||||
fk_warehouse integer,
|
||||
qty integer NOT NULL DEFAULT 1,
|
||||
batch varchar(30),
|
||||
role varchar(10), -- 'toconsume' or 'toproduce' (initialized at MO creation), 'consumed' or 'produced' (added after MO validation)
|
||||
fk_mrp_production integer, -- if role = 'consumed', id of line with role 'toconsume', if role = 'produced' id of line with role 'toproduce'
|
||||
fk_stock_movement integer, -- id of stock movement when movements are validated
|
||||
date_creation datetime NOT NULL,
|
||||
tms timestamp,
|
||||
fk_user_creat integer NOT NULL,
|
||||
fk_user_modif integer,
|
||||
import_key varchar(14)
|
||||
) ENGINE=innodb;
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
--
|
||||
-- This table is dedicated to store detail (lots/serial) of a stock
|
||||
-- ============================================================================
|
||||
|
||||
CREATE TABLE llx_product_batch (
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
tms timestamp,
|
||||
|
||||
@ -49,4 +49,6 @@ DisableStockChangeHelp=When this flag is set, there is no stock change on this p
|
||||
BomAndBomLines=Bills Of Material and lines
|
||||
BOMLine=Line of BOM
|
||||
WarehouseForProduction=Warehouse for production
|
||||
CreateMO=Create MO
|
||||
CreateMO=Create MO
|
||||
ToConsume=A consommer
|
||||
Manufactured=Fabriqué
|
||||
|
||||
@ -2480,7 +2480,7 @@ elseif (! empty($module))
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th class="liste_titre">'.$langs->trans("Property");
|
||||
print '<th>'.$langs->trans("Property");
|
||||
print ' (<a class="" href="https://wiki.dolibarr.org/index.php/Language_and_development_rules#Table_and_fields_structures" target="_blank">'.$langs->trans("SeeExamples").'</a>)';
|
||||
print '</th>';
|
||||
print '<th>';
|
||||
|
||||
@ -64,7 +64,7 @@ class MyObject extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'text', 'html', 'datetime', 'timestamp', 'float')
|
||||
* 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
|
||||
* Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)"
|
||||
* 'label' the translation key.
|
||||
* 'enabled' is a condition when the field must be managed.
|
||||
@ -94,7 +94,7 @@ class MyObject extends CommonObject
|
||||
'ref' =>array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'noteditable'=>0, 'default'=>'', 'notnull'=> 1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
|
||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>20),
|
||||
'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth200', 'help'=>'Help text', 'showoncombobox'=>1),
|
||||
'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for amount'),
|
||||
'amount' =>array('type'=>'price', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for amount'),
|
||||
'qty' =>array('type'=>'real', 'label'=>'Qty', 'enabled'=>1, 'visible'=>1, 'default'=>'0', 'position'=>45, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for quantity', 'css'=>'maxwidth75imp'),
|
||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'LinkToThirparty'),
|
||||
'fk_project' =>array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1),
|
||||
|
||||
@ -251,7 +251,10 @@ if ($action == 'create')
|
||||
}
|
||||
});*/
|
||||
}
|
||||
else {
|
||||
else if (jQuery('#fk_bom').val() < 0) {
|
||||
// Redirect to page with all fields defined except fk_bom set
|
||||
console.log(jQuery('#fk_product').val());
|
||||
window.location.href = '<?php echo $_SERVER["PHP_SELF"] ?>?action=create&qty='+jQuery('#qty').val()+'&fk_product='+jQuery('#fk_product').val()+'&label='+jQuery('#label').val()+'&fk_project='+jQuery('#fk_project').val()+'&fk_warehouse='+jQuery('#fk_warehouse').val();
|
||||
/*
|
||||
$('#qty').val('');
|
||||
$("#fk_product").val('');
|
||||
@ -275,15 +278,19 @@ if ($action == 'create')
|
||||
print '<input type="'.($backtopage ? "submit" : "button").'" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'"'.($backtopage ? '' : ' onclick="javascript:history.go(-1)"').'>'; // Cancel for create does not post form if we don't know the backtopage
|
||||
print '</div>';
|
||||
|
||||
print load_fiche_titre($langs->trans("ToConsume"));
|
||||
if (GETPOST('fk_bom', 'int') > 0) {
|
||||
print load_fiche_titre($langs->trans("ToConsume"));
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
$object->lines = $objectbom->lines;
|
||||
$object->lines = $objectbom->lines;
|
||||
|
||||
$object->printOriginLinesList('', array());
|
||||
$object->printOriginLinesList('', array());
|
||||
|
||||
print '</table>';
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
@ -1146,7 +1146,7 @@ else
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters = array('colspan' => 3);
|
||||
$parameters = array('colspan' => 3, 'cols' => '3');
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook))
|
||||
@ -1528,12 +1528,12 @@ else
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters = array('colspan' => ' colspan="3"', 'cols'=>3);
|
||||
$parameters = array('colspan' => ' colspan="3"', 'cols' => 3);
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook))
|
||||
{
|
||||
print $object->showOptionals($extrafields, 'edit');
|
||||
print $object->showOptionals($extrafields, 'edit', $parameters);
|
||||
}
|
||||
|
||||
// Tags-Categories
|
||||
@ -1976,7 +1976,7 @@ else
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters = array('colspan' => ' colspan="'.(2 + (($showphoto || $showbarcode) ? 1 : 0)).'"');
|
||||
$parameters = array('colspan' => ' colspan="'.(2 + (($showphoto || $showbarcode) ? 1 : 0)).'"', 'cols' => (2 + (($showphoto || $showbarcode) ? 1 : 0)));
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
// Categories
|
||||
|
||||
@ -2684,12 +2684,13 @@ class Product extends CommonObject
|
||||
/**
|
||||
* Charge tableau des stats expedition client pour le produit/service
|
||||
*
|
||||
* @param int $socid Id societe pour filtrer sur une societe
|
||||
* @param string $filtrestatut Id statut pour filtrer sur un statut
|
||||
* @param int $forVirtualStock Ignore rights filter for virtual stock calculation.
|
||||
* @return array Tableau des stats
|
||||
* @param int $socid Id societe pour filtrer sur une societe
|
||||
* @param string $filtrestatut Id statut pour filtrer sur un statut
|
||||
* @param int $forVirtualStock Ignore rights filter for virtual stock calculation.
|
||||
* @param string $filterShipmentStatus [=''] Ids shipment status separated by comma
|
||||
* @return int <0 if KO, >0 if OK (Tableau des stats)
|
||||
*/
|
||||
public function load_stats_sending($socid = 0, $filtrestatut = '', $forVirtualStock = 0)
|
||||
public function load_stats_sending($socid = 0, $filtrestatut = '', $forVirtualStock = 0, $filterShipmentStatus = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf,$user;
|
||||
@ -2719,6 +2720,7 @@ class Product extends CommonObject
|
||||
if ($filtrestatut <> '') {
|
||||
$sql.= " AND c.fk_statut in (".$filtrestatut.")";
|
||||
}
|
||||
if (!empty($filterShipmentStatus)) $sql.= " AND e.fk_statut IN (" . $filterShipmentStatus . ")";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result ) {
|
||||
@ -4680,7 +4682,14 @@ class Product extends CommonObject
|
||||
}
|
||||
if (!empty($conf->expedition->enabled))
|
||||
{
|
||||
$result = $this->load_stats_sending(0, '1,2', 1);
|
||||
require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php';
|
||||
$filterShipmentStatus = '';
|
||||
if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)) {
|
||||
$filterShipmentStatus = Expedition::STATUS_VALIDATED . ',' . Expedition::STATUS_CLOSED;
|
||||
} elseif (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) {
|
||||
$filterShipmentStatus = Expedition::STATUS_CLOSED;
|
||||
}
|
||||
$result = $this->load_stats_sending(0, '1,2', 1, $filterShipmentStatus);
|
||||
if ($result < 0) dol_print_error($this->db, $this->error);
|
||||
$stock_sending_client = $this->stats_expedition['qty'];
|
||||
}
|
||||
|
||||
@ -1274,7 +1274,7 @@ if ($action == 'edit_price' && $object->getRights()->creer)
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$parameters = array('colspan' => 2);
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -721,12 +721,12 @@ else
|
||||
print '</td></tr>';
|
||||
|
||||
// Other attributes
|
||||
$parameters = array('colspan' => ' colspan="3"', 'cols'=>3);
|
||||
$parameters = array('colspan' => ' colspan="3"', 'cols' => '3');
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook))
|
||||
{
|
||||
print $object->showOptionals($extrafields, 'edit');
|
||||
print $object->showOptionals($extrafields, 'edit', $parameters);
|
||||
}
|
||||
// Tags-Categories
|
||||
if ($conf->categorie->enabled)
|
||||
|
||||
@ -661,8 +661,15 @@ if ($id > 0 || $ref)
|
||||
|
||||
// Number of product from customer order already sent (partial shipping)
|
||||
if (!empty($conf->expedition->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php';
|
||||
$filterShipmentStatus = '';
|
||||
if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)) {
|
||||
$filterShipmentStatus = Expedition::STATUS_VALIDATED . ',' . Expedition::STATUS_CLOSED;
|
||||
} elseif (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) {
|
||||
$filterShipmentStatus = Expedition::STATUS_CLOSED;
|
||||
}
|
||||
if ($found) $helpondiff .= '<br>'; else $found = 1;
|
||||
$result = $object->load_stats_sending(0, '2', 1);
|
||||
$result = $object->load_stats_sending(0, '2', 1, $filterShipmentStatus);
|
||||
$helpondiff .= $langs->trans("ProductQtyInShipmentAlreadySent").': '.$object->stats_expedition['qty'];
|
||||
}
|
||||
|
||||
|
||||
@ -864,7 +864,7 @@ if ($action == 'create')
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Other attributes
|
||||
$parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"', 'socid'=>$socid);
|
||||
$parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"', 'cols' => '3', 'socid'=>$socid);
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $recept, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
@ -875,7 +875,7 @@ if ($action == 'create')
|
||||
if ($object->fetch_optionals() > 0) {
|
||||
$recept->array_options = array_merge($recept->array_options, $object->array_options);
|
||||
}
|
||||
print $object->showOptionals($extrafields, 'edit');
|
||||
print $object->showOptionals($extrafields, 'edit', $parameters);
|
||||
}
|
||||
|
||||
// Incoterms
|
||||
|
||||
@ -1536,12 +1536,12 @@ else
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters = array('colspan' => ' colspan="3"', 'colspanvalue' => '3');
|
||||
$parameters = array('colspan' => ' colspan="3"', 'cols' => '3');
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook))
|
||||
{
|
||||
print $object->showOptionals($extrafields, 'edit');
|
||||
print $object->showOptionals($extrafields, 'edit', $parameters);
|
||||
}
|
||||
|
||||
// Assign a sale representative
|
||||
@ -2200,12 +2200,12 @@ else
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters = array('colspan' => ' colspan="3"', 'colspanvalue' => '3');
|
||||
$parameters = array('colspan' => ' colspan="3"', 'cols' => '3');
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook))
|
||||
{
|
||||
print $object->showOptionals($extrafields, 'edit');
|
||||
print $object->showOptionals($extrafields, 'edit', $parameters);
|
||||
}
|
||||
|
||||
// Webservices url/key
|
||||
|
||||
@ -912,20 +912,20 @@ class Thirdparties extends DolibarrApi
|
||||
{
|
||||
$obj_ret = array();
|
||||
|
||||
if(! DolibarrApiAccess::$user->rights->societe->lire) {
|
||||
if (!DolibarrApiAccess::$user->rights->societe->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
if(empty($id)) {
|
||||
if (empty($id)) {
|
||||
throw new RestException(400, 'Thirdparty ID is mandatory');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('societe', $id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('societe', $id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$result = $this->company->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Thirdparty not found');
|
||||
}
|
||||
|
||||
@ -1366,7 +1366,7 @@ class Thirdparties extends DolibarrApi
|
||||
foreach ($accounts as $account) {
|
||||
$object = array();
|
||||
foreach ($account as $key => $value) {
|
||||
if(in_array($key, $fields)) {
|
||||
if (in_array($key, $fields)) {
|
||||
$object[$key] = $value;
|
||||
}
|
||||
}
|
||||
@ -1488,11 +1488,11 @@ class Thirdparties extends DolibarrApi
|
||||
// We found an existing SocieteAccount entity, we are replacing it
|
||||
} else {
|
||||
if (isset($request_data['site']) && $request_data['site'] !== $site) {
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_account WHERE fk_soc = ".$id." AND site = '". $request_data['site']."' ";
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_account WHERE fk_soc = ".$id." AND site = '".$request_data['site']."' ";
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result->num_rows !== 0) {
|
||||
throw new RestException(409, "You are trying to update this thirdparty SocieteAccount (gateway record) from $site to ".$request_data['site'] . " but another SocieteAccount entity already exists with this site key.");
|
||||
throw new RestException(409, "You are trying to update this thirdparty SocieteAccount (gateway record) from $site to ".$request_data['site']." but another SocieteAccount entity already exists with this site key.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1676,9 +1676,9 @@ class Thirdparties extends DolibarrApi
|
||||
// phpcs:enable
|
||||
$object = parent::_cleanObjectDatas($object);
|
||||
|
||||
unset($object->nom); // ->name already defined and nom deprecated
|
||||
unset($object->name_bis); // ->name_alias already defined
|
||||
unset($object->note); // ->note_private and note_public already defined
|
||||
unset($object->nom); // ->name already defined and nom deprecated
|
||||
unset($object->name_bis); // ->name_alias already defined
|
||||
unset($object->note); // ->note_private and note_public already defined
|
||||
unset($object->departement);
|
||||
unset($object->departement_code);
|
||||
unset($object->pays);
|
||||
@ -1694,7 +1694,7 @@ class Thirdparties extends DolibarrApi
|
||||
unset($object->lines);
|
||||
unset($object->thirdparty);
|
||||
|
||||
unset($object->fk_delivery_address); // deprecated feature
|
||||
unset($object->fk_delivery_address); // deprecated feature
|
||||
|
||||
return $object;
|
||||
}
|
||||
@ -1742,20 +1742,20 @@ class Thirdparties extends DolibarrApi
|
||||
private function _fetch($rowid, $ref = '', $ref_ext = '', $ref_int = '', $idprof1 = '', $idprof2 = '', $idprof3 = '', $idprof4 = '', $idprof5 = '', $idprof6 = '', $email = '', $ref_alias = '')
|
||||
{
|
||||
global $conf;
|
||||
if(! DolibarrApiAccess::$user->rights->societe->lire) {
|
||||
if (!DolibarrApiAccess::$user->rights->societe->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->company->fetch($rowid, $ref, $ref_ext, $ref_int, $idprof1, $idprof2, $idprof3, $idprof4, $idprof5, $idprof6, $email, $ref_alias);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Thirdparty not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('societe', $this->company->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('societe', $this->company->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
|
||||
$filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
|
||||
} else {
|
||||
|
||||
@ -1244,11 +1244,11 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters = array('colspan' => ' colspan="3"');
|
||||
$parameters = array('colspan' => ' colspan="3"', 'cols' => 3);
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook)) {
|
||||
print $object->showOptionals($extrafields, 'edit');
|
||||
print $object->showOptionals($extrafields, 'edit', $parameters);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -809,7 +809,7 @@ table[summary="list_of_modules"] .fa-cog {
|
||||
|
||||
.img-skinthumb {
|
||||
width: 160px;
|
||||
height: 120px;
|
||||
height: 100px;
|
||||
}
|
||||
|
||||
|
||||
@ -2120,9 +2120,9 @@ img.login, img.printer, img.entity {
|
||||
background-size: contain;
|
||||
}
|
||||
img.userphoto { /* size for user photo in lists */
|
||||
border-radius: 0.725em;
|
||||
width: 1.45em;
|
||||
height: 1.45em;
|
||||
border-radius: 0.72em;
|
||||
width: 1.4em;
|
||||
height: 1.4em;
|
||||
background-size: contain;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
@ -968,6 +968,15 @@ table[summary="list_of_modules"] .fa-cog {
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
.linkedcol-element {
|
||||
min-width: 100px;
|
||||
}
|
||||
|
||||
.img-skinthumb {
|
||||
width: 160px;
|
||||
height: 100px;
|
||||
}
|
||||
|
||||
|
||||
/* ============================================================================== */
|
||||
/* Styles to hide objects */
|
||||
@ -1494,9 +1503,9 @@ div.nopadding {
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
table.noborder tr.liste_titre td {
|
||||
/*table.noborder tr.liste_titre td {
|
||||
padding: 3px !important;
|
||||
}
|
||||
}*/
|
||||
|
||||
.containercenter {
|
||||
display : table;
|
||||
@ -2738,7 +2747,7 @@ div.colorback
|
||||
border-left: 1px solid #ccc;
|
||||
}
|
||||
table.liste, table.noborder, table.formdoc, div.noborder {
|
||||
width: calc(100% - 1px); /* -1 to fix a bug. Without, a scroll appears dur to overflow-x: auto; of div-tableèresponsive
|
||||
width: calc(100% - 1px); /* -1 to fix a bug. Without, a scroll appears due to overflow-x: auto; of div-table-responsive */
|
||||
|
||||
border-collapse: separate !important;
|
||||
border-spacing: 0px;
|
||||
@ -3020,6 +3029,9 @@ ul.noborder li:nth-child(odd):not(.liste_titre) {
|
||||
|
||||
/* Set the color for hover lines */
|
||||
|
||||
.tmenucompanylogo.nohover, .tmenucompanylogo.nohover:hover {
|
||||
opacity: unset !important;
|
||||
}
|
||||
.nohoverborder:hover {
|
||||
border: unset;
|
||||
box-shadow: unset;
|
||||
|
||||
@ -71,7 +71,7 @@ class Users extends DolibarrApi
|
||||
|
||||
$obj_ret = array();
|
||||
|
||||
if(! DolibarrApiAccess::$user->rights->user->user->lire) {
|
||||
if (!DolibarrApiAccess::$user->rights->user->user->lire) {
|
||||
throw new RestException(401, "You are not allowed to read list of users");
|
||||
}
|
||||
|
||||
@ -79,29 +79,29 @@ class Users extends DolibarrApi
|
||||
//$socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : $societe;
|
||||
|
||||
$sql = "SELECT t.rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as t";
|
||||
$sql.= ' WHERE t.entity IN ('.getEntity('user').')';
|
||||
if ($user_ids) $sql.=" AND t.rowid IN (".$user_ids.")";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."user as t";
|
||||
$sql .= ' WHERE t.entity IN ('.getEntity('user').')';
|
||||
if ($user_ids) $sql .= " AND t.rowid IN (".$user_ids.")";
|
||||
// Add sql filters
|
||||
if ($sqlfilters)
|
||||
{
|
||||
if (! DolibarrApi::_checkFilters($sqlfilters))
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters))
|
||||
{
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
if ($page < 0)
|
||||
{
|
||||
$page = 0;
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
|
||||
$sql.= $db->plimit($limit + 1, $offset);
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
$result = $db->query($sql);
|
||||
@ -115,7 +115,7 @@ class Users extends DolibarrApi
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$user_static = new User($db);
|
||||
if($user_static->fetch($obj->rowid)) {
|
||||
if ($user_static->fetch($obj->rowid)) {
|
||||
$obj_ret[] = $this->_cleanObjectDatas($user_static);
|
||||
}
|
||||
$i++;
|
||||
@ -124,7 +124,7 @@ class Users extends DolibarrApi
|
||||
else {
|
||||
throw new RestException(503, 'Error when retrieve User list : '.$db->lasterror());
|
||||
}
|
||||
if( ! count($obj_ret)) {
|
||||
if (!count($obj_ret)) {
|
||||
throw new RestException(404, 'No User found');
|
||||
}
|
||||
return $obj_ret;
|
||||
@ -154,7 +154,7 @@ class Users extends DolibarrApi
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('user', $this->useraccount->id, 'user'))
|
||||
{
|
||||
throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
return $this->_cleanObjectDatas($this->useraccount);
|
||||
@ -181,7 +181,7 @@ class Users extends DolibarrApi
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('user', $this->useraccount->id, 'user')) {
|
||||
throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$usergroup = new UserGroup($this->db);
|
||||
@ -190,10 +190,9 @@ class Users extends DolibarrApi
|
||||
throw new RestException(404, 'User group not found');
|
||||
}
|
||||
|
||||
$this->useraccount = $this->_cleanObjectDatas($this->useraccount);
|
||||
$this->useraccount->user_group_list = $this->_cleanUserGroupListDatas($userGroupList);
|
||||
|
||||
return $this->useraccount;
|
||||
return $this->_cleanObjectDatas($this->useraccount);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -251,7 +250,7 @@ class Users extends DolibarrApi
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('user', $this->useraccount->id, 'user'))
|
||||
{
|
||||
throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
foreach ($request_data as $field => $value)
|
||||
@ -296,13 +295,13 @@ class Users extends DolibarrApi
|
||||
{
|
||||
$obj_ret = array();
|
||||
|
||||
if (! DolibarrApiAccess::$user->rights->user->user->lire) {
|
||||
if (!DolibarrApiAccess::$user->rights->user->user->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$user = new User($this->db);
|
||||
$result = $user->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'user not found');
|
||||
}
|
||||
|
||||
@ -342,12 +341,12 @@ class Users extends DolibarrApi
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('user', $this->useraccount->id, 'user'))
|
||||
{
|
||||
throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && ! empty(DolibarrApiAccess::$user->admin) && empty(DolibarrApiAccess::$user->entity))
|
||||
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && !empty(DolibarrApiAccess::$user->admin) && empty(DolibarrApiAccess::$user->entity))
|
||||
{
|
||||
$entity = (! empty($entity) ? $entity : $conf->entity);
|
||||
$entity = (!empty($entity) ? $entity : $conf->entity);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -357,7 +356,7 @@ class Users extends DolibarrApi
|
||||
}
|
||||
|
||||
$result = $this->useraccount->SetInGroup($group, $entity);
|
||||
if (! ($result > 0))
|
||||
if (!($result > 0))
|
||||
{
|
||||
throw new RestException(500, $this->useraccount->error);
|
||||
}
|
||||
@ -384,7 +383,7 @@ class Users extends DolibarrApi
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('user', $this->useraccount->id, 'user'))
|
||||
{
|
||||
throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
$this->useraccount->oldcopy = clone $this->useraccount;
|
||||
return $this->useraccount->delete(DolibarrApiAccess::$user);
|
||||
@ -436,10 +435,10 @@ class Users extends DolibarrApi
|
||||
unset($object->openid);
|
||||
|
||||
|
||||
$canreadsalary = ((! empty($conf->salaries->enabled) && ! empty(DolibarrApiAccess::$user->rights->salaries->read))
|
||||
|| (! empty($conf->hrm->enabled) && ! empty(DolibarrApiAccess::$user->rights->hrm->employee->read)));
|
||||
$canreadsalary = ((!empty($conf->salaries->enabled) && !empty(DolibarrApiAccess::$user->rights->salaries->read))
|
||||
|| (!empty($conf->hrm->enabled) && !empty(DolibarrApiAccess::$user->rights->hrm->employee->read)));
|
||||
|
||||
if (! $canreadsalary)
|
||||
if (!$canreadsalary)
|
||||
{
|
||||
unset($object->salary);
|
||||
unset($object->salaryextra);
|
||||
|
||||
@ -304,7 +304,7 @@ if ($action == 'create')
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Other attributes
|
||||
$parameters = array('object' => $object, 'colspan' => ' colspan="2"');
|
||||
$parameters = array('object' => $object);
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook))
|
||||
|
||||
@ -1398,7 +1398,7 @@ if ($action == 'updatemeta')
|
||||
$objectpage->keywords = GETPOST('WEBSITE_KEYWORDS', 'alpha');
|
||||
$objectpage->lang = GETPOST('WEBSITE_LANG', 'aZ09');
|
||||
$objectpage->htmlheader = trim(GETPOST('htmlheader', 'none'));
|
||||
$objectpage->fk_page = GETPOST('pageidfortranslation', 'int');
|
||||
$objectpage->fk_page = (GETPOST('pageidfortranslation', 'int') > 0 ? GETPOST('pageidfortranslation', 'int') : 0);
|
||||
|
||||
$newdatecreation = dol_mktime(GETPOST('datecreationhour', 'int'), GETPOST('datecreationmin', 'int'), GETPOST('datecreationsec', 'int'), GETPOST('datecreationmonth', 'int'), GETPOST('datecreationday', 'int'), GETPOST('datecreationyear', 'int'));
|
||||
if ($newdatecreation) $objectpage->date_creation = $newdatecreation;
|
||||
@ -3034,17 +3034,23 @@ if ($action == 'editmeta' || $action == 'createcontainer')
|
||||
$num_rows = $db->num_rows($resql);
|
||||
if ($num_rows > 0)
|
||||
{
|
||||
print '<span class="opacitymedium">'.$langs->trans('ThisPageHasTranslationPages').':</span><br>';
|
||||
print '<span class="opacitymedium">'.$langs->trans('ThisPageHasTranslationPages').':</span>';
|
||||
$i = 0;
|
||||
$tmppage = new WebsitePage($db);
|
||||
$tmpstring = '';
|
||||
while ($obj = $db->fetch_object($resql))
|
||||
{
|
||||
$tmppage = new WebsitePage($db);
|
||||
$tmppage->fetch($obj->rowid);
|
||||
if ($i > 0) print ' - ';
|
||||
print $tmppage->getNomUrl(1).' ('.$tmppage->lang.')<br>';
|
||||
$translatedby++;
|
||||
$i++;
|
||||
$result = $tmppage->fetch($obj->rowid);
|
||||
if ($result > 0) {
|
||||
if ($i > 0) $tmpstring .= '<br>';
|
||||
$tmpstring .= $tmppage->getNomUrl(1).' ('.$tmppage->lang.')';
|
||||
$translatedby++;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
if ($i > 1) print '<br>';
|
||||
else print ' ';
|
||||
print $tmpstring;
|
||||
}
|
||||
}
|
||||
else dol_print_error($db);
|
||||
@ -3059,10 +3065,12 @@ if ($action == 'editmeta' || $action == 'createcontainer')
|
||||
}
|
||||
elseif ($result > 0)
|
||||
{
|
||||
$translationof = 0;
|
||||
//$translationof = $sourcepage->id;
|
||||
$translationof = $objectpage->fk_page;
|
||||
print '<span class="opacitymedium">'.$langs->trans('ThisPageIsTranslationOf').'</span> ';
|
||||
print $formwebsite->selectContainer($website, 'pageidfortranslation', $translationof, 1, $action, 'minwidth300');
|
||||
print $formwebsite->selectContainer($website, 'pageidfortranslation', ($translationof ? $translationof : -1), 1, $action, 'minwidth300', array($objectpage->id));
|
||||
if ($translationof > 0) {
|
||||
print $sourcepage->getNomUrl(2).' ('.$sourcepage->lang.')';
|
||||
}
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user