mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-09 11:08:34 +01:00
Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into
develop_dict
This commit is contained in:
@@ -37,7 +37,7 @@ class AccountancySystem
|
|||||||
var $label;
|
var $label;
|
||||||
var $account_number;
|
var $account_number;
|
||||||
var $account_parent;
|
var $account_parent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
@@ -46,8 +46,8 @@ class AccountancySystem
|
|||||||
function __construct($db) {
|
function __construct($db) {
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load record in memory
|
* Load record in memory
|
||||||
*
|
*
|
||||||
@@ -55,11 +55,11 @@ class AccountancySystem
|
|||||||
* @param string $ref ref
|
* @param string $ref ref
|
||||||
* @return int <0 if KO, Id of record if OK and found
|
* @return int <0 if KO, Id of record if OK and found
|
||||||
*/
|
*/
|
||||||
function fetch($rowid = 0, $ref = '')
|
function fetch($rowid = 0, $ref = '')
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
if ($rowid > 0 || $ref)
|
if ($rowid > 0 || $ref)
|
||||||
{
|
{
|
||||||
$sql = "SELECT a.pcg_version, a.label, a.active";
|
$sql = "SELECT a.pcg_version, a.label, a.active";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_system as a";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_system as a";
|
||||||
@@ -69,12 +69,12 @@ class AccountancySystem
|
|||||||
} elseif ($ref) {
|
} elseif ($ref) {
|
||||||
$sql .= " a.pcg_version = '" . $ref . "'";
|
$sql .= " a.pcg_version = '" . $ref . "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);
|
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$obj = $this->db->fetch_object($result);
|
$obj = $this->db->fetch_object($result);
|
||||||
|
|
||||||
if ($obj) {
|
if ($obj) {
|
||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
$this->rowid = $obj->rowid;
|
$this->rowid = $obj->rowid;
|
||||||
@@ -82,7 +82,7 @@ class AccountancySystem
|
|||||||
$this->ref = $obj->pcg_version;
|
$this->ref = $obj->pcg_version;
|
||||||
$this->label = $obj->label;
|
$this->label = $obj->label;
|
||||||
$this->active = $obj->active;
|
$this->active = $obj->active;
|
||||||
|
|
||||||
return $this->id;
|
return $this->id;
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
@@ -94,8 +94,8 @@ class AccountancySystem
|
|||||||
}
|
}
|
||||||
return - 1;
|
return - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert accountancy system name into database
|
* Insert accountancy system name into database
|
||||||
*
|
*
|
||||||
@@ -104,16 +104,16 @@ class AccountancySystem
|
|||||||
*/
|
*/
|
||||||
function create($user) {
|
function create($user) {
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_system";
|
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_system";
|
||||||
$sql .= " (date_creation, fk_user_author, numero, label)";
|
$sql .= " (date_creation, fk_user_author, numero, label)";
|
||||||
$sql .= " VALUES (" . $this->db->idate($now) . "," . $user->id . ",'" . $this->numero . "','" . $this->label . "')";
|
$sql .= " VALUES ('" . $this->db->idate($now) . "'," . $user->id . ",'" . $this->numero . "','" . $this->label . "')";
|
||||||
|
|
||||||
dol_syslog(get_class($this) . "::create sql=" . $sql, LOG_DEBUG);
|
dol_syslog(get_class($this) . "::create sql=" . $sql, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$id = $this->db->last_insert_id(MAIN_DB_PREFIX . "accounting_system");
|
$id = $this->db->last_insert_id(MAIN_DB_PREFIX . "accounting_system");
|
||||||
|
|
||||||
if ($id > 0) {
|
if ($id > 0) {
|
||||||
$this->rowid = $id;
|
$this->rowid = $id;
|
||||||
$result = $this->rowid;
|
$result = $this->rowid;
|
||||||
@@ -127,7 +127,7 @@ class AccountancySystem
|
|||||||
$this->error = "AccountancySystem::Create Erreur $result";
|
$this->error = "AccountancySystem::Create Erreur $result";
|
||||||
dol_syslog($this->error, LOG_ERR);
|
dol_syslog($this->error, LOG_ERR);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -89,7 +89,7 @@ $hookmanager->initHooks(array('admin'));
|
|||||||
// Put here declaration of dictionaries properties
|
// Put here declaration of dictionaries properties
|
||||||
|
|
||||||
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
|
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
|
||||||
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,33,34,0,6,0,29,0,7,17,24,28,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,26,0);
|
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,33,34,0,6,0,29,0,7,17,35,36,24,28,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,26,0,);
|
||||||
|
|
||||||
// Name of SQL tables of dictionaries
|
// Name of SQL tables of dictionaries
|
||||||
$tabname=array();
|
$tabname=array();
|
||||||
@@ -127,6 +127,8 @@ $tabname[30]= MAIN_DB_PREFIX."c_format_cards";
|
|||||||
//$tabname[32]= MAIN_DB_PREFIX."c_accounting_category";
|
//$tabname[32]= MAIN_DB_PREFIX."c_accounting_category";
|
||||||
$tabname[33]= MAIN_DB_PREFIX."c_hrm_department";
|
$tabname[33]= MAIN_DB_PREFIX."c_hrm_department";
|
||||||
$tabname[34]= MAIN_DB_PREFIX."c_hrm_function";
|
$tabname[34]= MAIN_DB_PREFIX."c_hrm_function";
|
||||||
|
$tabname[35]= MAIN_DB_PREFIX."c_exp_tax_cat";
|
||||||
|
$tabname[36]= MAIN_DB_PREFIX."c_exp_tax_range";
|
||||||
|
|
||||||
// Dictionary labels
|
// Dictionary labels
|
||||||
$tablib=array();
|
$tablib=array();
|
||||||
@@ -164,6 +166,8 @@ $tablib[30]= "DictionaryFormatCards";
|
|||||||
//$tablib[32]= "DictionaryAccountancyCategory";
|
//$tablib[32]= "DictionaryAccountancyCategory";
|
||||||
$tablib[33]= "DictionaryDepartment";
|
$tablib[33]= "DictionaryDepartment";
|
||||||
$tablib[34]= "DictionaryFunction";
|
$tablib[34]= "DictionaryFunction";
|
||||||
|
$tablib[35]= "DictionaryExpenseTaxCat";
|
||||||
|
$tablib[36]= "DictionaryExpenseTaxRange";
|
||||||
|
|
||||||
// Requests to extract data
|
// Requests to extract data
|
||||||
$tabsql=array();
|
$tabsql=array();
|
||||||
@@ -201,6 +205,8 @@ $tabsql[30]= "SELECT rowid, code, name, paper_size, orientation, metric, leftmar
|
|||||||
//$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.sens, a.category_type, a.formula, a.position as position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
|
//$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.sens, a.category_type, a.formula, a.position as position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
|
||||||
$tabsql[33]= "SELECT rowid, pos, code, label, active FROM ".MAIN_DB_PREFIX."c_hrm_department";
|
$tabsql[33]= "SELECT rowid, pos, code, label, active FROM ".MAIN_DB_PREFIX."c_hrm_department";
|
||||||
$tabsql[34]= "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PREFIX."c_hrm_function";
|
$tabsql[34]= "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PREFIX."c_hrm_function";
|
||||||
|
$tabsql[35]= "SELECT c.rowid, c.label, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_cat c";
|
||||||
|
$tabsql[36]= "SELECT r.rowid, r.fk_c_exp_tax_cat, r.range_ik, r.active, r.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_range r";
|
||||||
|
|
||||||
// Criteria to sort dictionaries
|
// Criteria to sort dictionaries
|
||||||
$tabsqlsort=array();
|
$tabsqlsort=array();
|
||||||
@@ -238,6 +244,8 @@ $tabsqlsort[30]="code ASC";
|
|||||||
//$tabsqlsort[32]="position ASC";
|
//$tabsqlsort[32]="position ASC";
|
||||||
$tabsqlsort[33]="code ASC";
|
$tabsqlsort[33]="code ASC";
|
||||||
$tabsqlsort[34]="code ASC";
|
$tabsqlsort[34]="code ASC";
|
||||||
|
$tabsqlsort[35]="c.label ASC";
|
||||||
|
$tabsqlsort[36]="r.fk_c_exp_tax_cat ASC, r.range_ik ASC";
|
||||||
|
|
||||||
// Nom des champs en resultat de select pour affichage du dictionnaire
|
// Nom des champs en resultat de select pour affichage du dictionnaire
|
||||||
$tabfield=array();
|
$tabfield=array();
|
||||||
@@ -273,8 +281,8 @@ $tabfield[29]= "code,label,percent,position";
|
|||||||
$tabfield[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
|
$tabfield[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
|
||||||
//$tabfield[31]= "pcg_version,label";
|
//$tabfield[31]= "pcg_version,label";
|
||||||
//$tabfield[32]= "code,label,range_account,sens,category_type,formula,position,country_id,country";
|
//$tabfield[32]= "code,label,range_account,sens,category_type,formula,position,country_id,country";
|
||||||
$tabfield[33]= "code,label";
|
$tabfield[35]= "label";
|
||||||
$tabfield[34]= "code,label";
|
$tabfield[36]= "range_ik,fk_c_exp_tax_cat";
|
||||||
|
|
||||||
// Nom des champs d'edition pour modification d'un enregistrement
|
// Nom des champs d'edition pour modification d'un enregistrement
|
||||||
$tabfieldvalue=array();
|
$tabfieldvalue=array();
|
||||||
@@ -312,6 +320,8 @@ $tabfieldvalue[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargi
|
|||||||
//$tabfieldvalue[32]= "code,label,range_account,sens,category_type,formula,position,country";
|
//$tabfieldvalue[32]= "code,label,range_account,sens,category_type,formula,position,country";
|
||||||
$tabfieldvalue[33]= "code,label";
|
$tabfieldvalue[33]= "code,label";
|
||||||
$tabfieldvalue[34]= "code,label";
|
$tabfieldvalue[34]= "code,label";
|
||||||
|
$tabfieldvalue[35]= "label";
|
||||||
|
$tabfieldvalue[36]= "range_ik,fk_c_exp_tax_cat";
|
||||||
|
|
||||||
// Nom des champs dans la table pour insertion d'un enregistrement
|
// Nom des champs dans la table pour insertion d'un enregistrement
|
||||||
$tabfieldinsert=array();
|
$tabfieldinsert=array();
|
||||||
@@ -349,6 +359,8 @@ $tabfieldinsert[30]= "code,name,paper_size,orientation,metric,leftmargin,topmarg
|
|||||||
//$tabfieldinsert[32]= "code,label,range_account,sens,category_type,formula,position,fk_country";
|
//$tabfieldinsert[32]= "code,label,range_account,sens,category_type,formula,position,fk_country";
|
||||||
$tabfieldinsert[33]= "code,label";
|
$tabfieldinsert[33]= "code,label";
|
||||||
$tabfieldinsert[34]= "code,label";
|
$tabfieldinsert[34]= "code,label";
|
||||||
|
$tabfieldinsert[35]= "label";
|
||||||
|
$tabfieldinsert[36]= "range_ik,fk_c_exp_tax_cat";
|
||||||
|
|
||||||
// Nom du rowid si le champ n'est pas de type autoincrement
|
// Nom du rowid si le champ n'est pas de type autoincrement
|
||||||
// Example: "" if id field is "rowid" and has autoincrement on
|
// Example: "" if id field is "rowid" and has autoincrement on
|
||||||
@@ -388,6 +400,8 @@ $tabrowid[30]= "";
|
|||||||
//$tabrowid[32]= "";
|
//$tabrowid[32]= "";
|
||||||
$tabrowid[33]= "rowid";
|
$tabrowid[33]= "rowid";
|
||||||
$tabrowid[34]= "rowid";
|
$tabrowid[34]= "rowid";
|
||||||
|
$tabrowid[35]= "";
|
||||||
|
$tabrowid[36]= "";
|
||||||
|
|
||||||
// Condition to show dictionary in setup page
|
// Condition to show dictionary in setup page
|
||||||
$tabcond=array();
|
$tabcond=array();
|
||||||
@@ -425,6 +439,8 @@ $tabcond[30]= ! empty($conf->label->enabled);
|
|||||||
//$tabcond[32]= ! empty($conf->accounting->enabled);
|
//$tabcond[32]= ! empty($conf->accounting->enabled);
|
||||||
$tabcond[33]= ! empty($conf->hrm->enabled);
|
$tabcond[33]= ! empty($conf->hrm->enabled);
|
||||||
$tabcond[34]= ! empty($conf->hrm->enabled);
|
$tabcond[34]= ! empty($conf->hrm->enabled);
|
||||||
|
$tabcond[35]= ! empty($conf->expensereport->enabled);
|
||||||
|
$tabcond[36]= ! empty($conf->expensereport->enabled);
|
||||||
|
|
||||||
// List of help for fields
|
// List of help for fields
|
||||||
$tabhelp=array();
|
$tabhelp=array();
|
||||||
@@ -462,6 +478,8 @@ $tabhelp[30] = array('code'=>$langs->trans("EnterAnyCode"), 'name'=>$langs->tran
|
|||||||
//$tabhelp[32] = array('code'=>$langs->trans("EnterAnyCode"));
|
//$tabhelp[32] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||||
$tabhelp[33] = array('code'=>$langs->trans("EnterAnyCode"));
|
$tabhelp[33] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||||
$tabhelp[34] = array('code'=>$langs->trans("EnterAnyCode"));
|
$tabhelp[34] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||||
|
$tabhelp[35]= array();
|
||||||
|
$tabhelp[36]= array('range_ik'=>$langs->trans('PrevRangeToThisRange'));
|
||||||
|
|
||||||
// List of check for fields (NOT USED YET)
|
// List of check for fields (NOT USED YET)
|
||||||
$tabfieldcheck=array();
|
$tabfieldcheck=array();
|
||||||
@@ -499,6 +517,8 @@ $tabfieldcheck[30] = array();
|
|||||||
//$tabfieldcheck[32] = array();
|
//$tabfieldcheck[32] = array();
|
||||||
$tabfieldcheck[33] = array();
|
$tabfieldcheck[33] = array();
|
||||||
$tabfieldcheck[34] = array();
|
$tabfieldcheck[34] = array();
|
||||||
|
$tabfieldcheck[35]= array();
|
||||||
|
$tabfieldcheck[36]= array();
|
||||||
|
|
||||||
// Complete all arrays with entries found into modules
|
// Complete all arrays with entries found into modules
|
||||||
complete_dictionary_with_modules($taborder,$tabname,$tablib,$tabsql,$tabsqlsort,$tabfield,$tabfieldvalue,$tabfieldinsert,$tabrowid,$tabcond,$tabhelp,$tabfieldcheck);
|
complete_dictionary_with_modules($taborder,$tabname,$tablib,$tabsql,$tabsqlsort,$tabfield,$tabfieldvalue,$tabfieldinsert,$tabrowid,$tabcond,$tabhelp,$tabfieldcheck);
|
||||||
@@ -1074,6 +1094,9 @@ if ($id)
|
|||||||
if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("WithCounter"); }
|
if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("WithCounter"); }
|
||||||
if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); }
|
if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); }
|
||||||
if ($fieldlist[$field]=='newbymonth') { $valuetoshow=$langs->trans("NewByMonth"); }
|
if ($fieldlist[$field]=='newbymonth') { $valuetoshow=$langs->trans("NewByMonth"); }
|
||||||
|
if ($fieldlist[$field]=='fk_tva') { $valuetoshow=$langs->trans("VAT"); }
|
||||||
|
if ($fieldlist[$field]=='range_ik') { $valuetoshow=$langs->trans("RangeIk"); }
|
||||||
|
if ($fieldlist[$field]=='fk_c_exp_tax_cat'){ $valuetoshow=$langs->trans("CarCategory"); }
|
||||||
|
|
||||||
if ($id == 2) // Special cas for state page
|
if ($id == 2) // Special cas for state page
|
||||||
{
|
{
|
||||||
@@ -1299,6 +1322,9 @@ if ($id)
|
|||||||
if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("WithCounter"); }
|
if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("WithCounter"); }
|
||||||
if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); }
|
if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); }
|
||||||
if ($fieldlist[$field]=='newbymonth') { $valuetoshow=$langs->trans("NewByMonth"); }
|
if ($fieldlist[$field]=='newbymonth') { $valuetoshow=$langs->trans("NewByMonth"); }
|
||||||
|
if ($fieldlist[$field]=='fk_tva') { $valuetoshow=$langs->trans("VAT"); }
|
||||||
|
if ($fieldlist[$field]=='range_ik') { $valuetoshow=$langs->trans("RangeIk"); }
|
||||||
|
if ($fieldlist[$field]=='fk_c_exp_tax_cat'){ $valuetoshow=$langs->trans("CarCategory"); }
|
||||||
|
|
||||||
// Affiche nom du champ
|
// Affiche nom du champ
|
||||||
if ($showfield)
|
if ($showfield)
|
||||||
@@ -1528,6 +1554,26 @@ if ($id)
|
|||||||
else if ($fieldlist[$field]=='accountancy_code' || $fieldlist[$field]=='accountancy_code_sell' || $fieldlist[$field]=='accountancy_code_buy') {
|
else if ($fieldlist[$field]=='accountancy_code' || $fieldlist[$field]=='accountancy_code_sell' || $fieldlist[$field]=='accountancy_code_buy') {
|
||||||
$valuetoshow = length_accountg($valuetoshow);
|
$valuetoshow = length_accountg($valuetoshow);
|
||||||
}
|
}
|
||||||
|
elseif ($fieldlist[$field] == 'fk_tva')
|
||||||
|
{
|
||||||
|
foreach ($form->cache_vatrates as $key => $Tab)
|
||||||
|
{
|
||||||
|
if ($form->cache_vatrates[$key]['rowid'] == $valuetoshow)
|
||||||
|
{
|
||||||
|
$valuetoshow = $form->cache_vatrates[$key]['libtva'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif ($fieldlist[$field] == 'fk_c_exp_tax_cat')
|
||||||
|
{
|
||||||
|
$valuetoshow = getDictvalue(MAIN_DB_PREFIX.'c_exp_tax_cat', 'label', $valuetoshow);
|
||||||
|
$valuetoshow = $langs->trans($valuetoshow);
|
||||||
|
}
|
||||||
|
elseif ($tabname[$id] == MAIN_DB_PREFIX.'c_exp_tax_cat')
|
||||||
|
{
|
||||||
|
$valuetoshow = $langs->trans($valuetoshow);
|
||||||
|
}
|
||||||
|
|
||||||
$class='tddict';
|
$class='tddict';
|
||||||
if ($fieldlist[$field] == 'note' && $id == 10) $class.=' tdoverflowmax200';
|
if ($fieldlist[$field] == 'note' && $id == 10) $class.=' tdoverflowmax200';
|
||||||
@@ -1695,7 +1741,7 @@ $db->close();
|
|||||||
*/
|
*/
|
||||||
function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||||
{
|
{
|
||||||
global $conf,$langs,$db;
|
global $conf,$langs,$db,$mysoc;
|
||||||
global $form;
|
global $form;
|
||||||
global $region_id;
|
global $region_id;
|
||||||
global $elementList,$sourceList,$localtax_typeList;
|
global $elementList,$sourceList,$localtax_typeList;
|
||||||
@@ -1869,6 +1915,24 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
|||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
elseif ($fieldlist[$field] == 'fk_tva')
|
||||||
|
{
|
||||||
|
print '<td>';
|
||||||
|
print $form->load_tva('fk_tva', $obj->taux, $mysoc, new Societe($db), 0, 0, '', false, -1);
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
elseif ($fieldlist[$field] == 'fk_c_exp_tax_cat')
|
||||||
|
{
|
||||||
|
print '<td>';
|
||||||
|
print $form->selectExpenseCategories($obj->fk_c_exp_tax_cat);
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
elseif ($fieldlist[$field] == 'fk_range')
|
||||||
|
{
|
||||||
|
print '<td>';
|
||||||
|
print $form->selectExpenseRanges($obj->fk_range);
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$classtd=''; $class='';
|
$classtd=''; $class='';
|
||||||
|
|||||||
188
htdocs/admin/expensereport_ik.php
Normal file
188
htdocs/admin/expensereport_ik.php
Normal file
@@ -0,0 +1,188 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2012 Mikael Carlavan <contact@mika-carl.fr>
|
||||||
|
* Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
|
||||||
|
* Copyright (C) 2017 Pierre-Henry Favre <phf@atm-consulting.fr>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/admin/expensereport_ik.php
|
||||||
|
* \ingroup expensereport
|
||||||
|
* \brief Page to display expense tax ik
|
||||||
|
*/
|
||||||
|
|
||||||
|
require '../main.inc.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/expensereport.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport_ik.class.php';
|
||||||
|
|
||||||
|
$langs->load('admin');
|
||||||
|
$langs->load('other');
|
||||||
|
$langs->load('trips');
|
||||||
|
$langs->load('errors');
|
||||||
|
$langs->load('dict');
|
||||||
|
|
||||||
|
if (!$user->admin) accessforbidden();
|
||||||
|
|
||||||
|
//Init error
|
||||||
|
$error = false;
|
||||||
|
$message = false;
|
||||||
|
|
||||||
|
$action = GETPOST('action','alpha');
|
||||||
|
$id = GETPOST('id','int');
|
||||||
|
$offset = GETPOST('offset','int');
|
||||||
|
$coef = GETPOST('coef','int');
|
||||||
|
|
||||||
|
$fk_c_exp_tax_cat = GETPOST('fk_c_exp_tax_cat');
|
||||||
|
$fk_range = GETPOST('fk_range');
|
||||||
|
|
||||||
|
if ($action == 'updateik')
|
||||||
|
{
|
||||||
|
$expIk = new ExpenseReportIk($db);
|
||||||
|
if ($id > 0)
|
||||||
|
{
|
||||||
|
$result = $expIk->fetch($id);
|
||||||
|
if ($result < 0) dol_print_error('', $expIk->error, $expIk->errors);
|
||||||
|
}
|
||||||
|
|
||||||
|
$expIk->setValues($_POST);
|
||||||
|
$result = $expIk->create($user);
|
||||||
|
|
||||||
|
if ($result > 0) setEventMessages('SetupSaved', null, 'mesgs');
|
||||||
|
|
||||||
|
header('Location: '.$_SERVER['PHP_SELF']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
elseif ($action == 'delete') // TODO add confirm
|
||||||
|
{
|
||||||
|
$expIk = new ExpenseReportIk($db);
|
||||||
|
if ($id > 0)
|
||||||
|
{
|
||||||
|
$result = $expIk->fetch($id);
|
||||||
|
if ($result < 0) dol_print_error('', $expIk->error, $expIk->errors);
|
||||||
|
|
||||||
|
$expIk->delete($user);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
header('Location: '.$_SERVER['PHP_SELF']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$rangesbycateg = ExpenseReportIk::getAllRanges();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
llxHeader();
|
||||||
|
|
||||||
|
$form=new Form($db);
|
||||||
|
|
||||||
|
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||||
|
print load_fiche_titre($langs->trans("ExpenseReportsIkSetup"),$linkback,'title_setup');
|
||||||
|
|
||||||
|
$head=expensereport_admin_prepare_head();
|
||||||
|
dol_fiche_head($head, 'expenseik', $langs->trans("ExpenseReportsIk"), -1, 'trip');
|
||||||
|
|
||||||
|
echo $langs->trans('ExpenseReportIkDesc');
|
||||||
|
|
||||||
|
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">';
|
||||||
|
|
||||||
|
if ($action == 'edit')
|
||||||
|
{
|
||||||
|
echo '<input type="hidden" name="id" value="'.$id.'" />';
|
||||||
|
echo '<input type="hidden" name="fk_c_exp_tax_cat" value="'.$fk_c_exp_tax_cat.'" />';
|
||||||
|
echo '<input type="hidden" name="fk_range" value="'.$fk_range.'" />';
|
||||||
|
echo '<input type="hidden" name="action" value="updateik" />';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
|
||||||
|
|
||||||
|
echo '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
|
foreach ($rangesbycateg as $fk_c_exp_tax_cat => $Tab)
|
||||||
|
{
|
||||||
|
$title = ($Tab['active'] == 1) ? $langs->trans($Tab['label']) : $form->textwithpicto($langs->trans($Tab['label']), $langs->trans('expenseReportCatDisabled'), 1, 'help', '', 0, 3);
|
||||||
|
echo '<tr class="liste_titre">';
|
||||||
|
echo '<td>'.$title.'</td>';
|
||||||
|
echo '<td>'.$langs->trans('expenseReportOffset').'</td>';
|
||||||
|
echo '<td>'.$langs->trans('expenseReportCoef').'</td>';
|
||||||
|
echo '<td>'.$langs->trans('expenseReportTotalForFive').'</td>';
|
||||||
|
echo '<td> </td>';
|
||||||
|
echo '</tr>';
|
||||||
|
|
||||||
|
if ($Tab['active'] == 0) continue;
|
||||||
|
|
||||||
|
$tranche=1;
|
||||||
|
$var = true;
|
||||||
|
foreach ($Tab['ranges'] as $k => $range)
|
||||||
|
{
|
||||||
|
if (isset($Tab['ranges'][$k+1])) $label = $langs->trans('expenseReportRangeFromTo', $range->range_ik, ($Tab['ranges'][$k+1]->range_ik-1));
|
||||||
|
else $label = $langs->trans('expenseReportRangeMoreThan', $range->range_ik);
|
||||||
|
|
||||||
|
if ($range->range_active == 0) $label = $form->textwithpicto($label, $langs->trans('expenseReportRangeDisabled'), 1, 'help', '', 0, 3);
|
||||||
|
|
||||||
|
echo '<tr '.$bc[$var].'>';
|
||||||
|
|
||||||
|
// Label
|
||||||
|
echo '<td width="20%"><b>['.$langs->trans('RangeNum', $tranche++).']</b> - '.$label.'</td>';
|
||||||
|
|
||||||
|
// Offset
|
||||||
|
echo '<td width="20%">';
|
||||||
|
if ($action == 'edit' && $range->ik->id == $id && $range->rowid == $fk_range && $range->fk_c_exp_tax_cat == $fk_c_exp_tax_cat) echo '<input type="text" name="offset" value="'.$range->ik->offset.'" />';
|
||||||
|
else echo $range->ik->offset;
|
||||||
|
echo '</td>';
|
||||||
|
// Coef
|
||||||
|
echo '<td width="20%">';
|
||||||
|
if ($action == 'edit' && $range->ik->id == $id && $range->rowid == $fk_range && $range->fk_c_exp_tax_cat == $fk_c_exp_tax_cat) echo '<input type="text" name="coef" value="'.$range->ik->coef.'" />';
|
||||||
|
else echo ($range->ik->id > 0 ? $range->ik->coef : $langs->trans('expenseReportCoefUndefined'));
|
||||||
|
echo '</td>';
|
||||||
|
|
||||||
|
// Total for one
|
||||||
|
echo '<td width="30%">'.$langs->trans('expenseReportPrintExample', price($range->ik->offset + 5 * $range->ik->coef)).'</td>';
|
||||||
|
|
||||||
|
// Action
|
||||||
|
echo '<td align="right">';
|
||||||
|
if ($range->range_active == 1)
|
||||||
|
{
|
||||||
|
if ($action == 'edit' && $range->ik->id == $id && $range->rowid == $fk_range && $range->fk_c_exp_tax_cat == $fk_c_exp_tax_cat)
|
||||||
|
{
|
||||||
|
echo '<input id="" class="button" name="save" value="'.$langs->trans('Save').'" type="submit" />';
|
||||||
|
echo '<input class="button" value="'.$langs->trans('Cancel').'" onclick="javascript:history.go(-1)" type="button" />';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo '<a href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$range->ik->id.'&fk_c_exp_tax_cat='.$range->fk_c_exp_tax_cat.'&fk_range='.$range->rowid.'">'.img_edit().'</a>';
|
||||||
|
if (!empty($range->ik->id)) echo '<a href="'.$_SERVER['PHP_SELF'].'?action=delete&id='.$range->ik->id.'">'.img_delete().'</a>';
|
||||||
|
// TODO add delete link
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo '</td>';
|
||||||
|
|
||||||
|
echo '</tr>';
|
||||||
|
$var=!$var;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '</table>';
|
||||||
|
echo '</form>';
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
llxFooter();
|
||||||
|
|
||||||
|
$db->close();
|
||||||
366
htdocs/admin/expensereport_rules.php
Normal file
366
htdocs/admin/expensereport_rules.php
Normal file
@@ -0,0 +1,366 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2012 Mikael Carlavan <contact@mika-carl.fr>
|
||||||
|
* Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
|
||||||
|
* Copyright (C) 2017 Pierre-Henry Favre <phf@atm-consulting.fr>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/admin/expensereport_ik.php
|
||||||
|
* \ingroup expensereport
|
||||||
|
* \brief Page to display expense tax ik
|
||||||
|
*/
|
||||||
|
|
||||||
|
require '../main.inc.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/expensereport.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport_rule.class.php';
|
||||||
|
|
||||||
|
$langs->load('admin');
|
||||||
|
$langs->load('other');
|
||||||
|
$langs->load('trips');
|
||||||
|
$langs->load('errors');
|
||||||
|
$langs->load('dict');
|
||||||
|
|
||||||
|
if (!$user->admin) accessforbidden();
|
||||||
|
|
||||||
|
//Init error
|
||||||
|
$error = false;
|
||||||
|
$message = false;
|
||||||
|
|
||||||
|
$action = GETPOST('action','alpha');
|
||||||
|
$id = GETPOST('id','int');
|
||||||
|
|
||||||
|
$apply_to = GETPOST('apply_to');
|
||||||
|
$fk_user = GETPOST('fk_user');
|
||||||
|
$fk_usergroup = GETPOST('fk_usergroup');
|
||||||
|
|
||||||
|
$fk_c_type_fees = GETPOST('fk_c_type_fees');
|
||||||
|
$code_expense_rules_type = GETPOST('code_expense_rules_type');
|
||||||
|
$dates = dol_mktime(12, 0, 0, GETPOST('startmonth'), GETPOST('startday'), GETPOST('startyear'));
|
||||||
|
$datee = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
|
||||||
|
$amount = GETPOST('amount');
|
||||||
|
$restrictive = GETPOST('restrictive');
|
||||||
|
|
||||||
|
$object = new ExpenseReportRule($db);
|
||||||
|
if (!empty($id))
|
||||||
|
{
|
||||||
|
$result = $object->fetch($id);
|
||||||
|
if ($result < 0) dol_print_error('', $object->error, $object->errors);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO do action
|
||||||
|
if ($action == 'save')
|
||||||
|
{
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
|
// check parameters
|
||||||
|
if (empty($apply_to)) {
|
||||||
|
$error++;
|
||||||
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportApplyTo")), null, 'errors');
|
||||||
|
}
|
||||||
|
if (empty($fk_c_type_fees)) {
|
||||||
|
$error++;
|
||||||
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportDomain")), null, 'errors');
|
||||||
|
}
|
||||||
|
if (empty($code_expense_rules_type)) {
|
||||||
|
$error++;
|
||||||
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportLimitOn")), null, 'errors');
|
||||||
|
}
|
||||||
|
if (empty($dates)) {
|
||||||
|
$error++;
|
||||||
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportDateStart")), null, 'errors');
|
||||||
|
}
|
||||||
|
if (empty($datee)) {
|
||||||
|
$error++;
|
||||||
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportDateEnd")), null, 'errors');
|
||||||
|
}
|
||||||
|
if (empty($amount)) {
|
||||||
|
$error++;
|
||||||
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportLimitAmount")), null, 'errors');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($error))
|
||||||
|
{
|
||||||
|
$object->setValues($_POST);
|
||||||
|
|
||||||
|
if($apply_to=='U'){
|
||||||
|
$object->fk_user=$fk_user;
|
||||||
|
$object->fk_usergroup=0;
|
||||||
|
$object->is_for_all=0;
|
||||||
|
}elseif($apply_to=='G'){
|
||||||
|
$object->fk_usergroup=$fk_usergroup;
|
||||||
|
$object->fk_user=0;
|
||||||
|
$object->is_for_all=0;
|
||||||
|
}elseif($apply_to=='A'){
|
||||||
|
$object->is_for_all=1;
|
||||||
|
$object->fk_user=0;
|
||||||
|
$object->fk_usergroup=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$object->dates = $dates;
|
||||||
|
$object->datee = $datee;
|
||||||
|
|
||||||
|
$object->entity = $conf->entity;
|
||||||
|
|
||||||
|
$res = $object->create($user);
|
||||||
|
if ($res > 0) setEventMessages($langs->trans('ExpenseReportRuleSave'), null);
|
||||||
|
else dol_print_error($object->db);
|
||||||
|
|
||||||
|
header('Location: '.$_SERVER['PHP_SELF']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif ($action == 'delete')
|
||||||
|
{
|
||||||
|
// TODO add confirm
|
||||||
|
$res = $object->delete($user);
|
||||||
|
|
||||||
|
if ($res < 0) dol_print_error($object->db);
|
||||||
|
|
||||||
|
header('Location: '.$_SERVER['PHP_SELF']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$rules = ExpenseReportRule::getAllRule();
|
||||||
|
|
||||||
|
$tab_apply = array('A' => $langs->trans('All'), 'G' => $langs->trans('Group'), 'U' => $langs->trans('User'));
|
||||||
|
$tab_rules_type = array('EX_DAY' => $langs->trans('Day'), 'EX_MON' => $langs->trans('Month'), 'EX_YEA' => $langs->trans('Year'), 'EX_EXP' => $langs->trans('OnExpense'));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
llxHeader();
|
||||||
|
|
||||||
|
$form=new Form($db);
|
||||||
|
|
||||||
|
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||||
|
print load_fiche_titre($langs->trans("ExpenseReportsRulesSetup"),$linkback,'title_setup');
|
||||||
|
|
||||||
|
$head=expensereport_admin_prepare_head();
|
||||||
|
dol_fiche_head($head, 'expenserules', $langs->trans("ExpenseReportsRules"), -1, 'trip');
|
||||||
|
|
||||||
|
echo $langs->trans('ExpenseReportRulesDesc');
|
||||||
|
|
||||||
|
if ($action != 'edit')
|
||||||
|
{
|
||||||
|
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">';
|
||||||
|
echo '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
|
||||||
|
echo '<input type="hidden" name="action" value="save" />';
|
||||||
|
|
||||||
|
echo '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
|
echo '<tr class="liste_titre">';
|
||||||
|
echo '<th>'.$langs->trans('ExpenseReportApplyTo').'</th>';
|
||||||
|
echo '<th>'.$langs->trans('ExpenseReportDomain').'</th>';
|
||||||
|
echo '<th>'.$langs->trans('ExpenseReportLimitOn').'</th>';
|
||||||
|
echo '<th>'.$langs->trans('ExpenseReportDateStart').'</th>';
|
||||||
|
echo '<th>'.$langs->trans('ExpenseReportDateEnd').'</th>';
|
||||||
|
echo '<th>'.$langs->trans('ExpenseReportLimitAmount').'</th>';
|
||||||
|
echo '<th>'.$langs->trans('ExpenseReportRestrictive').'</th>';
|
||||||
|
echo '<th> </th>';
|
||||||
|
echo '</tr>';
|
||||||
|
|
||||||
|
$var=true;
|
||||||
|
echo '<tr '.$bc[$var].'>';
|
||||||
|
echo '<td>';
|
||||||
|
echo '<div class="float">'.$form->selectarray('apply_to', $tab_apply, '', 0).'</div>';
|
||||||
|
echo '<div id="user" class="float">'.$form->select_dolusers('', 'fk_user').'</div>';
|
||||||
|
echo '<div id="group" class="float">'.$form->select_dolgroups('', 'fk_usergroup').'</div>';
|
||||||
|
echo '</td>';
|
||||||
|
|
||||||
|
echo '<td>'.$form->selectExpense('', 'fk_c_type_fees', 0, 1, 1).'</td>';
|
||||||
|
echo '<td>'.$form->selectarray('code_expense_rules_type', $tab_rules_type, '', 0).'</td>';
|
||||||
|
echo '<td>'.$form->select_date(strtotime(date('Y-m-01', dol_now())), 'start', '', '', 0, '', 1, 0, 1).'</td>';
|
||||||
|
echo '<td>'.$form->select_date(strtotime(date('Y-m-t', dol_now())), 'end', '', '', 0, '', 1, 0, 1).'</td>';
|
||||||
|
echo '<td><input type="text" value="" name="amount" class="amount" />'.$conf->currency.'</td>';
|
||||||
|
echo '<td>'.$form->selectyesno('restrictive', 0, 1).'</td>';
|
||||||
|
echo '<td align="right"><input type="submit" class="button" value="'.$langs->trans('Add').'" /></td>';
|
||||||
|
echo '</tr>';
|
||||||
|
|
||||||
|
echo '</table>';
|
||||||
|
echo '</form>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">';
|
||||||
|
echo '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
|
||||||
|
|
||||||
|
if ($action == 'edit')
|
||||||
|
{
|
||||||
|
echo '<input type="hidden" name="id" value="'.$object->id.'" />';
|
||||||
|
echo '<input type="hidden" name="action" value="save" />';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
|
echo '<tr class="liste_titre">';
|
||||||
|
echo '<th>'.$langs->trans('ExpenseReportApplyTo').'</th>';
|
||||||
|
echo '<th>'.$langs->trans('ExpenseReportDomain').'</th>';
|
||||||
|
echo '<th>'.$langs->trans('ExpenseReportLimitOn').'</th>';
|
||||||
|
echo '<th>'.$langs->trans('ExpenseReportDateStart').'</th>';
|
||||||
|
echo '<th>'.$langs->trans('ExpenseReportDateEnd').'</th>';
|
||||||
|
echo '<th>'.$langs->trans('ExpenseReportLimitAmount').'</th>';
|
||||||
|
echo '<th>'.$langs->trans('ExpenseReportRestrictive').'</th>';
|
||||||
|
echo '<th> </th>';
|
||||||
|
echo '</tr>';
|
||||||
|
|
||||||
|
$var=true;
|
||||||
|
foreach ($rules as $rule)
|
||||||
|
{
|
||||||
|
echo '<tr '.$bc[$var].'>';
|
||||||
|
|
||||||
|
echo '<td>';
|
||||||
|
if ($action == 'edit' && $object->id == $rule->id)
|
||||||
|
{
|
||||||
|
$selected = ($object->is_for_all > 0) ? 'A' : ($object->fk_usergroup > 0 ? 'G' : 'U');
|
||||||
|
echo '<div class="float">'.$form->selectarray('apply_to', $tab_apply, $selected, 0).'</div>';
|
||||||
|
echo '<div id="user" class="float">'.$form->select_dolusers($object->fk_user, 'fk_user').'</div>';
|
||||||
|
echo '<div id="group" class="float">'.$form->select_dolgroups($object->fk_usergroup, 'fk_usergroup').'</div>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($rule->is_for_all > 0) echo $tab_apply['A'];
|
||||||
|
elseif ($rule->fk_usergroup > 0) echo $tab_apply['G'].' ('.$rule->getGroupLabel().')';
|
||||||
|
elseif ($rule->fk_user > 0) echo $tab_apply['U'].' ('.$rule->getUserName().')';
|
||||||
|
}
|
||||||
|
echo '</td>';
|
||||||
|
|
||||||
|
|
||||||
|
echo '<td>';
|
||||||
|
if ($action == 'edit' && $object->id == $rule->id)
|
||||||
|
{
|
||||||
|
echo $form->selectExpense($object->fk_c_type_fees, 'fk_c_type_fees', 0, 1, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($rule->fk_c_type_fees == -1) echo $langs->trans('AllExpenseReport');
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$key = getDictvalue(MAIN_DB_PREFIX.'c_type_fees', 'code', $rule->fk_c_type_fees, false, 'id');
|
||||||
|
if ($key != $langs->trans($key)) echo $langs->trans($key);
|
||||||
|
else echo $langs->trans(getDictvalue(MAIN_DB_PREFIX.'c_type_fees', 'label', $rule->fk_c_type_fees, false, 'id')); // TODO check to return trans of 'code'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo '</td>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
echo '<td>';
|
||||||
|
if ($action == 'edit' && $object->id == $rule->id)
|
||||||
|
{
|
||||||
|
echo $form->selectarray('code_expense_rules_type', $tab_rules_type, $object->code_expense_rules_type, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo $tab_rules_type[$rule->code_expense_rules_type];
|
||||||
|
}
|
||||||
|
echo '</td>';
|
||||||
|
|
||||||
|
|
||||||
|
echo '<td>';
|
||||||
|
if ($action == 'edit' && $object->id == $rule->id)
|
||||||
|
{
|
||||||
|
echo $form->select_date(strtotime(date('Y-m-d', $object->dates)), 'start', '', '', 0, '', 1, 0, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo dol_print_date($rule->dates, 'day');
|
||||||
|
}
|
||||||
|
echo '</td>';
|
||||||
|
|
||||||
|
|
||||||
|
echo '<td>';
|
||||||
|
if ($action == 'edit' && $object->id == $rule->id)
|
||||||
|
{
|
||||||
|
echo $form->select_date(strtotime(date('Y-m-d', $object->datee)), 'end', '', '', 0, '', 1, 0, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo dol_print_date($rule->datee, 'day');
|
||||||
|
}
|
||||||
|
echo '</td>';
|
||||||
|
|
||||||
|
|
||||||
|
echo '<td>';
|
||||||
|
if ($action == 'edit' && $object->id == $rule->id)
|
||||||
|
{
|
||||||
|
echo '<input type="text" value="'.price2num($object->amount).'" name="amount" class="amount" />'.$conf->currency;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo price($rule->amount, 0, $langs, 1, -1, -1, $conf->currency);
|
||||||
|
}
|
||||||
|
echo '</td>';
|
||||||
|
|
||||||
|
|
||||||
|
echo '<td>';
|
||||||
|
if ($action == 'edit' && $object->id == $rule->id)
|
||||||
|
{
|
||||||
|
echo $form->selectyesno('restrictive', $object->restrictive, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo yn($rule->restrictive, 1, 1);
|
||||||
|
}
|
||||||
|
echo '</td>';
|
||||||
|
|
||||||
|
|
||||||
|
echo '<td>';
|
||||||
|
if ($object->id != $rule->id)
|
||||||
|
{
|
||||||
|
echo '<a href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$rule->id.'">'.img_edit().'</a> ';
|
||||||
|
echo '<a href="'.$_SERVER['PHP_SELF'].'?action=delete&id='.$rule->id.'">'.img_delete().'</a>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo '<input type="submit" class="button" value="'.$langs->trans('Update').'" /> ';
|
||||||
|
echo '<a href="'.$_SERVER['PHP_SELF'].'" class="button">'.$langs->trans('Cancel').'</a>';
|
||||||
|
}
|
||||||
|
echo '</td>';
|
||||||
|
|
||||||
|
echo '</tr>';
|
||||||
|
$var=!$var;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
echo '</table>';
|
||||||
|
echo '</form>';
|
||||||
|
|
||||||
|
echo '<script type="text/javascript"> $(function() {
|
||||||
|
$("#apply_to").change(function() {
|
||||||
|
var value = $(this).val();
|
||||||
|
if (value == "A") {
|
||||||
|
$("#group").hide(); $("#user").hide();
|
||||||
|
} else if (value == "U") {
|
||||||
|
$("#user").show();
|
||||||
|
$("#group").hide();
|
||||||
|
} else if (value == "G") {
|
||||||
|
$("#group").show();
|
||||||
|
$("#user").hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#apply_to").change();
|
||||||
|
|
||||||
|
}); </script>';
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
llxFooter();
|
||||||
|
|
||||||
|
$db->close();
|
||||||
@@ -296,7 +296,7 @@ if ($conf->use_javascript_ajax)
|
|||||||
|
|
||||||
//puis tous les elements enfants
|
//puis tous les elements enfants
|
||||||
|
|
||||||
$sql = "SELECT m.rowid, m.titre, m.langs, m.mainmenu, m.leftmenu, m.fk_menu, m.fk_mainmenu, m.fk_leftmenu, m.module";
|
$sql = "SELECT m.rowid, m.titre, m.langs, m.mainmenu, m.leftmenu, m.fk_menu, m.fk_mainmenu, m.fk_leftmenu, m.position, m.module";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."menu as m";
|
$sql.= " FROM ".MAIN_DB_PREFIX."menu as m";
|
||||||
$sql.= " WHERE menu_handler = '".$db->escape($menu_handler_to_search)."'";
|
$sql.= " WHERE menu_handler = '".$db->escape($menu_handler_to_search)."'";
|
||||||
$sql.= " AND entity = ".$conf->entity;
|
$sql.= " AND entity = ".$conf->entity;
|
||||||
@@ -323,6 +323,7 @@ if ($conf->use_javascript_ajax)
|
|||||||
'leftmenu'=>$menu['leftmenu'],
|
'leftmenu'=>$menu['leftmenu'],
|
||||||
'fk_mainmenu'=>$menu['fk_mainmenu'],
|
'fk_mainmenu'=>$menu['fk_mainmenu'],
|
||||||
'fk_leftmenu'=>$menu['fk_leftmenu'],
|
'fk_leftmenu'=>$menu['fk_leftmenu'],
|
||||||
|
'position'=>$menu['position'],
|
||||||
'entry'=>'<table class="nobordernopadding centpercent"><tr><td>'.
|
'entry'=>'<table class="nobordernopadding centpercent"><tr><td>'.
|
||||||
'<strong> <a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&menuId='.$menu['rowid'].'">'.$titre.'</a></strong>'.
|
'<strong> <a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&menuId='.$menu['rowid'].'">'.$titre.'</a></strong>'.
|
||||||
'</td><td align="right">'.
|
'</td><td align="right">'.
|
||||||
@@ -344,10 +345,11 @@ if ($conf->use_javascript_ajax)
|
|||||||
|
|
||||||
global $tree_recur_alreadyadded; // This var was def into tree_recur
|
global $tree_recur_alreadyadded; // This var was def into tree_recur
|
||||||
|
|
||||||
// Appelle de la fonction recursive (ammorce)
|
|
||||||
// avec recherche depuis la racine.
|
|
||||||
//var_dump($data);
|
//var_dump($data);
|
||||||
tree_recur($data, $data[0], 0, 'iddivjstree'); // $data[0] is virtual record 'racine'
|
|
||||||
|
// Appelle de la fonction recursive (ammorce) avec recherche depuis la racine.
|
||||||
|
//tree_recur($data, $data[0], 0, 'iddivjstree', 0, 1); // use this to get info on name and foreign keys of menu entry
|
||||||
|
tree_recur($data, $data[0], 0, 'iddivjstree', 0, 0); // $data[0] is virtual record 'racine'
|
||||||
|
|
||||||
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@@ -376,7 +378,6 @@ if ($conf->use_javascript_ajax)
|
|||||||
|
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td colspan="2">';
|
print '<td colspan="2">';
|
||||||
|
|
||||||
foreach($remainingdata as $datar)
|
foreach($remainingdata as $datar)
|
||||||
{
|
{
|
||||||
$father = array('rowid'=>$datar['rowid'],'title'=>"???",'mainmenu'=>$datar['fk_mainmenu'],'leftmenu'=>$datar['fk_leftmenu'],'fk_mainmenu'=>'','fk_leftmenu'=>'');
|
$father = array('rowid'=>$datar['rowid'],'title'=>"???",'mainmenu'=>$datar['fk_mainmenu'],'leftmenu'=>$datar['fk_leftmenu'],'fk_mainmenu'=>'','fk_leftmenu'=>'');
|
||||||
|
|||||||
@@ -238,6 +238,7 @@ if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/resources.json'
|
|||||||
{
|
{
|
||||||
$classfile = str_replace('_', '', $module);
|
$classfile = str_replace('_', '', $module);
|
||||||
if ($module == 'supplierinvoices') $classfile = 'supplier_invoices';
|
if ($module == 'supplierinvoices') $classfile = 'supplier_invoices';
|
||||||
|
if ($module == 'supplierorders') $classfile = 'supplier_orders';
|
||||||
$dir_part_file = dol_buildpath('/'.$moduledirforclass.'/class/api_'.$classfile.'.class.php');
|
$dir_part_file = dol_buildpath('/'.$moduledirforclass.'/class/api_'.$classfile.'.class.php');
|
||||||
$classname=ucwords($module);
|
$classname=ucwords($module);
|
||||||
|
|
||||||
|
|||||||
@@ -38,11 +38,8 @@ require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.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.'/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';
|
||||||
|
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
@@ -585,6 +582,8 @@ if ($action == 'mupdate')
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$formproject=new FormProjets($db);
|
||||||
|
|
||||||
$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda';
|
$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda';
|
||||||
llxHeader('',$langs->trans("Agenda"),$help_url);
|
llxHeader('',$langs->trans("Agenda"),$help_url);
|
||||||
|
|
||||||
@@ -786,8 +785,6 @@ if ($action == 'create')
|
|||||||
// Project
|
// Project
|
||||||
if (! empty($conf->projet->enabled))
|
if (! empty($conf->projet->enabled))
|
||||||
{
|
{
|
||||||
$formproject=new FormProjets($db);
|
|
||||||
|
|
||||||
// Projet associe
|
// Projet associe
|
||||||
$langs->load("projects");
|
$langs->load("projects");
|
||||||
|
|
||||||
@@ -1133,8 +1130,6 @@ if ($id > 0)
|
|||||||
// Project
|
// Project
|
||||||
if (! empty($conf->projet->enabled))
|
if (! empty($conf->projet->enabled))
|
||||||
{
|
{
|
||||||
$formproject=new FormProjets($db);
|
|
||||||
|
|
||||||
$langs->load("projects");
|
$langs->load("projects");
|
||||||
|
|
||||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("Project").'</td><td>';
|
print '<tr><td class="titlefieldcreate">'.$langs->trans("Project").'</td><td>';
|
||||||
|
|||||||
@@ -30,15 +30,17 @@
|
|||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
|
||||||
if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||||
|
|
||||||
|
|
||||||
if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3;
|
if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3;
|
||||||
|
|
||||||
$filter = GETPOST("filter",'',3);
|
$filter = GETPOST("filter",'alpha',3);
|
||||||
$filtert = GETPOST("filtert","int",3);
|
$filtert = GETPOST("filtert","int",3);
|
||||||
$usergroup = GETPOST("usergroup","int",3);
|
$usergroup = GETPOST("usergroup","int",3);
|
||||||
//if (! ($usergroup > 0) && ! ($filtert > 0)) $filtert = $user->id;
|
//if (! ($usergroup > 0) && ! ($filtert > 0)) $filtert = $user->id;
|
||||||
@@ -55,7 +57,7 @@ $sortfield = GETPOST("sortfield",'alpha');
|
|||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
$page = GETPOST("page","int");
|
$page = GETPOST("page","int");
|
||||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
if (! $sortorder) $sortorder="ASC";
|
if (! $sortorder) $sortorder="ASC";
|
||||||
if (! $sortfield) $sortfield="a.datec";
|
if (! $sortfield) $sortfield="a.datec";
|
||||||
@@ -82,9 +84,9 @@ $month=GETPOST("month","int")?GETPOST("month","int"):date("m");
|
|||||||
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
|
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
|
||||||
$day=GETPOST("day","int")?GETPOST("day","int"):date("d");
|
$day=GETPOST("day","int")?GETPOST("day","int"):date("d");
|
||||||
$pid=GETPOST("projectid","int",3);
|
$pid=GETPOST("projectid","int",3);
|
||||||
$status=GETPOST("status");
|
$status=GETPOST("status",'alpha');
|
||||||
$type=GETPOST("type");
|
$type=GETPOST("type",'alpha');
|
||||||
$maxprint=(isset($_GET["maxprint"])?GETPOST("maxprint"):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
|
$maxprint=((GETPOST("maxprint",'int')!='')?GETPOST("maxprint",'int'):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
|
||||||
// Set actioncode (this code must be same for setting actioncode into peruser, listacton and index)
|
// Set actioncode (this code must be same for setting actioncode into peruser, listacton and index)
|
||||||
if (GETPOST('actioncode','array'))
|
if (GETPOST('actioncode','array'))
|
||||||
{
|
{
|
||||||
@@ -93,22 +95,22 @@ if (GETPOST('actioncode','array'))
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE));
|
$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode","alpha")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE));
|
||||||
}
|
}
|
||||||
if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE);
|
if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE);
|
||||||
|
|
||||||
$dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth'), GETPOST('dateselectday'), GETPOST('dateselectyear'));
|
$dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth','int'), GETPOST('dateselectday','int'), GETPOST('dateselectyear','int'));
|
||||||
if ($dateselect > 0)
|
if ($dateselect > 0)
|
||||||
{
|
{
|
||||||
$day=GETPOST('dateselectday');
|
$day=GETPOST('dateselectday','int');
|
||||||
$month=GETPOST('dateselectmonth');
|
$month=GETPOST('dateselectmonth','int');
|
||||||
$year=GETPOST('dateselectyear');
|
$year=GETPOST('dateselectyear','int');
|
||||||
}
|
}
|
||||||
|
|
||||||
$tmp=empty($conf->global->MAIN_DEFAULT_WORKING_HOURS)?'9-18':$conf->global->MAIN_DEFAULT_WORKING_HOURS;
|
$tmp=empty($conf->global->MAIN_DEFAULT_WORKING_HOURS)?'9-18':$conf->global->MAIN_DEFAULT_WORKING_HOURS;
|
||||||
$tmparray=explode('-',$tmp);
|
$tmparray=explode('-',$tmp);
|
||||||
$begin_h = GETPOST('begin_h')!=''?GETPOST('begin_h','int'):($tmparray[0] != '' ? $tmparray[0] : 9);
|
$begin_h = GETPOST('begin_h','int')!=''?GETPOST('begin_h','int'):($tmparray[0] != '' ? $tmparray[0] : 9);
|
||||||
$end_h = GETPOST('end_h')?GETPOST('end_h'):($tmparray[1] != '' ? $tmparray[1] : 18);
|
$end_h = GETPOST('end_h','int')?GETPOST('end_h','int'):($tmparray[1] != '' ? $tmparray[1] : 18);
|
||||||
if ($begin_h < 0 || $begin_h > 23) $begin_h = 9;
|
if ($begin_h < 0 || $begin_h > 23) $begin_h = 9;
|
||||||
if ($end_h < 1 || $end_h > 24) $end_h = 18;
|
if ($end_h < 1 || $end_h > 24) $end_h = 18;
|
||||||
if ($end_h <= $begin_h) $end_h = $begin_h + 1;
|
if ($end_h <= $begin_h) $end_h = $begin_h + 1;
|
||||||
@@ -124,13 +126,13 @@ if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $ac
|
|||||||
if (GETPOST('viewcal') && $action != 'show_day' && $action != 'show_week' && $action != 'show_peruser') {
|
if (GETPOST('viewcal') && $action != 'show_day' && $action != 'show_week' && $action != 'show_peruser') {
|
||||||
$action='show_month'; $day='';
|
$action='show_month'; $day='';
|
||||||
} // View by month
|
} // View by month
|
||||||
if (GETPOST('viewweek') || $action == 'show_week') {
|
if (GETPOST('viewweek','alpha') || $action == 'show_week') {
|
||||||
$action='show_week'; $week=($week?$week:date("W")); $day=($day?$day:date("d"));
|
$action='show_week'; $week=($week?$week:date("W")); $day=($day?$day:date("d"));
|
||||||
} // View by week
|
} // View by week
|
||||||
if (GETPOST('viewday') || $action == 'show_day') {
|
if (GETPOST('viewday','alpha') || $action == 'show_day') {
|
||||||
$action='show_day'; $day=($day?$day:date("d"));
|
$action='show_day'; $day=($day?$day:date("d"));
|
||||||
} // View by day
|
} // View by day
|
||||||
if (GETPOST('viewyear') || $action == 'show_year') {
|
if (GETPOST('viewyear','alpha') || $action == 'show_year') {
|
||||||
$action='show_year';
|
$action='show_year';
|
||||||
} // View by year
|
} // View by year
|
||||||
|
|
||||||
@@ -161,12 +163,12 @@ if ($action =='delete_action')
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
|
|
||||||
llxHeader('',$langs->trans("Agenda"),$help_url);
|
|
||||||
|
|
||||||
$form=new Form($db);
|
$form=new Form($db);
|
||||||
$companystatic=new Societe($db);
|
$companystatic=new Societe($db);
|
||||||
|
|
||||||
|
$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
|
||||||
|
llxHeader('',$langs->trans("Agenda"),$help_url);
|
||||||
|
|
||||||
$now=dol_now();
|
$now=dol_now();
|
||||||
$nowarray=dol_getdate($now);
|
$nowarray=dol_getdate($now);
|
||||||
$nowyear=$nowarray['year'];
|
$nowyear=$nowarray['year'];
|
||||||
@@ -354,7 +356,7 @@ $sql.= ' a.datep2,';
|
|||||||
$sql.= ' a.percent,';
|
$sql.= ' a.percent,';
|
||||||
$sql.= ' a.fk_user_author,a.fk_user_action,';
|
$sql.= ' a.fk_user_author,a.fk_user_action,';
|
||||||
$sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,';
|
$sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,';
|
||||||
$sql.= ' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype,';
|
$sql.= ' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype, a.fk_project,';
|
||||||
$sql.= ' ca.code, ca.color';
|
$sql.= ' ca.code, ca.color';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
|
||||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
||||||
@@ -456,11 +458,14 @@ if ($resql)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$datep=$db->jdate($obj->datep);
|
||||||
|
$datep2=$db->jdate($obj->datep2);
|
||||||
|
|
||||||
// Create a new object action
|
// Create a new object action
|
||||||
$event=new ActionComm($db);
|
$event=new ActionComm($db);
|
||||||
$event->id=$obj->id;
|
$event->id=$obj->id;
|
||||||
$event->datep=$db->jdate($obj->datep); // datep and datef are GMT date
|
$event->datep=$datep; // datep and datef are GMT date
|
||||||
$event->datef=$db->jdate($obj->datep2);
|
$event->datef=$datep2;
|
||||||
$event->type_code=$obj->code;
|
$event->type_code=$obj->code;
|
||||||
$event->type_color=$obj->color;
|
$event->type_color=$obj->color;
|
||||||
//$event->libelle=$obj->label; // deprecated
|
//$event->libelle=$obj->label; // deprecated
|
||||||
@@ -469,12 +474,13 @@ if ($resql)
|
|||||||
//$event->author->id=$obj->fk_user_author; // user id of creator
|
//$event->author->id=$obj->fk_user_author; // user id of creator
|
||||||
$event->authorid=$obj->fk_user_author; // user id of creator
|
$event->authorid=$obj->fk_user_author; // user id of creator
|
||||||
$event->userownerid=$obj->fk_user_action; // user id of owner
|
$event->userownerid=$obj->fk_user_action; // user id of owner
|
||||||
$event->fetch_userassigned(); // This load $event->userassigned
|
|
||||||
$event->priority=$obj->priority;
|
$event->priority=$obj->priority;
|
||||||
$event->fulldayevent=$obj->fulldayevent;
|
$event->fulldayevent=$obj->fulldayevent;
|
||||||
$event->location=$obj->location;
|
$event->location=$obj->location;
|
||||||
$event->transparency=$obj->transparency;
|
$event->transparency=$obj->transparency;
|
||||||
|
|
||||||
|
$event->fk_project=$obj->fk_project;
|
||||||
|
|
||||||
$event->socid=$obj->fk_soc;
|
$event->socid=$obj->fk_soc;
|
||||||
$event->contactid=$obj->fk_contact;
|
$event->contactid=$obj->fk_contact;
|
||||||
//$event->societe->id=$obj->fk_soc; // deprecated
|
//$event->societe->id=$obj->fk_soc; // deprecated
|
||||||
@@ -487,15 +493,15 @@ if ($resql)
|
|||||||
// They are date start and end of action but modified to not be outside calendar view.
|
// They are date start and end of action but modified to not be outside calendar view.
|
||||||
if ($event->percentage <= 0)
|
if ($event->percentage <= 0)
|
||||||
{
|
{
|
||||||
$event->date_start_in_calendar=$event->datep;
|
$event->date_start_in_calendar=$datep;
|
||||||
if ($event->datef != '' && $event->datef >= $event->datep) $event->date_end_in_calendar=$event->datef;
|
if ($datep2 != '' && $datep2 >= $datep) $event->date_end_in_calendar=$datep2;
|
||||||
else $event->date_end_in_calendar=$event->datep;
|
else $event->date_end_in_calendar=$datep;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$event->date_start_in_calendar=$event->datep;
|
$event->date_start_in_calendar=$datep;
|
||||||
if ($event->datef != '' && $event->datef >= $event->datep) $event->date_end_in_calendar=$event->datef;
|
if ($datep2 != '' && $datep2 >= $datep) $event->date_end_in_calendar=$datep2;
|
||||||
else $event->date_end_in_calendar=$event->datep;
|
else $event->date_end_in_calendar=$datep;
|
||||||
}
|
}
|
||||||
// Define ponctual property
|
// Define ponctual property
|
||||||
if ($event->date_start_in_calendar == $event->date_end_in_calendar)
|
if ($event->date_start_in_calendar == $event->date_end_in_calendar)
|
||||||
@@ -508,10 +514,14 @@ if ($resql)
|
|||||||
$event->date_start_in_calendar >= $lastdaytoshow)
|
$event->date_start_in_calendar >= $lastdaytoshow)
|
||||||
{
|
{
|
||||||
// This record is out of visible range
|
// This record is out of visible range
|
||||||
|
unset($event);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow;
|
//print $i.' - '.dol_print_date($this->date_start_in_calendar, 'dayhour').' - '.dol_print_date($this->date_end_in_calendar, 'dayhour').'<br>'."\n";
|
||||||
|
$event->fetch_userassigned(); // This load $event->userassigned
|
||||||
|
|
||||||
|
if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow;
|
||||||
if ($event->date_end_in_calendar >= $lastdaytoshow) $event->date_end_in_calendar=($lastdaytoshow - 1);
|
if ($event->date_end_in_calendar >= $lastdaytoshow) $event->date_end_in_calendar=($lastdaytoshow - 1);
|
||||||
|
|
||||||
// Add an entry in actionarray for each day
|
// Add an entry in actionarray for each day
|
||||||
@@ -881,11 +891,37 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s
|
|||||||
}
|
}
|
||||||
$cases1[$h][$event->id]['string'].=' - '.$event->label;
|
$cases1[$h][$event->id]['string'].=' - '.$event->label;
|
||||||
$cases1[$h][$event->id]['typecode']=$event->type_code;
|
$cases1[$h][$event->id]['typecode']=$event->type_code;
|
||||||
if ($event->socid)
|
|
||||||
{
|
|
||||||
//$cases1[$h][$event->id]['string'].='xxx';
|
|
||||||
}
|
|
||||||
$cases1[$h][$event->id]['color']=$color;
|
$cases1[$h][$event->id]['color']=$color;
|
||||||
|
if ($event->fk_project > 0)
|
||||||
|
{
|
||||||
|
if (empty($cache_project[$event->fk_project]))
|
||||||
|
{
|
||||||
|
$tmpproj=new Project($db);
|
||||||
|
$tmpproj->fetch($event->fk_project);
|
||||||
|
$cache_project[$event->fk_project]=$tmpproj;
|
||||||
|
}
|
||||||
|
$cases1[$h][$event->id]['string'].=', '.$langs->trans("Project").': '.$cache_project[$event->fk_project]->ref.' - '.$cache_project[$event->fk_project]->title;
|
||||||
|
}
|
||||||
|
if ($event->socid > 0)
|
||||||
|
{
|
||||||
|
if (empty($cache_thirdparty[$event->socid]))
|
||||||
|
{
|
||||||
|
$tmpthirdparty=new Societe($db);
|
||||||
|
$tmpthirdparty->fetch($event->socid);
|
||||||
|
$cache_thirdparty[$event->socid]=$tmpthirdparty;
|
||||||
|
}
|
||||||
|
$cases1[$h][$event->id]['string'].=', '.$cache_thirdparty[$event->socid]->name;
|
||||||
|
}
|
||||||
|
if ($event->contactid > 0)
|
||||||
|
{
|
||||||
|
if (empty($cache_contact[$event->contactid]))
|
||||||
|
{
|
||||||
|
$tmpcontact=new Contact($db);
|
||||||
|
$tmpcontact->fetch($event->contactid);
|
||||||
|
$cache_contact[$event->contactid]=$tmpcontact;
|
||||||
|
}
|
||||||
|
$cases1[$h][$event->id]['string'].=', '.$cache_contact[$event->contactid]->getFullName($langs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ($event->date_start_in_calendar < $c && $dateendtouse > $b)
|
if ($event->date_start_in_calendar < $c && $dateendtouse > $b)
|
||||||
{
|
{
|
||||||
@@ -901,11 +937,37 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s
|
|||||||
}
|
}
|
||||||
$cases2[$h][$event->id]['string'].=' - '.$event->label;
|
$cases2[$h][$event->id]['string'].=' - '.$event->label;
|
||||||
$cases2[$h][$event->id]['typecode']=$event->type_code;
|
$cases2[$h][$event->id]['typecode']=$event->type_code;
|
||||||
if ($event->socid)
|
|
||||||
{
|
|
||||||
//$cases2[$h][$event->id]['string'].='xxx';
|
|
||||||
}
|
|
||||||
$cases2[$h][$event->id]['color']=$color;
|
$cases2[$h][$event->id]['color']=$color;
|
||||||
|
if ($event->fk_project > 0)
|
||||||
|
{
|
||||||
|
if (empty($cache_project[$event->fk_project]))
|
||||||
|
{
|
||||||
|
$tmpproj=new Project($db);
|
||||||
|
$tmpproj->fetch($event->fk_project);
|
||||||
|
$cache_project[$event->fk_project]=$tmpproj;
|
||||||
|
}
|
||||||
|
$cases2[$h][$event->id]['string'].=', '.$langs->trans("Project").': '.$cache_project[$event->fk_project]->ref.' - '.$cache_project[$event->fk_project]->title;
|
||||||
|
}
|
||||||
|
if ($event->socid > 0)
|
||||||
|
{
|
||||||
|
if (empty($cache_thirdparty[$event->socid]))
|
||||||
|
{
|
||||||
|
$tmpthirdparty=new Societe($db);
|
||||||
|
$tmpthirdparty->fetch($event->socid);
|
||||||
|
$cache_thirdparty[$event->socid]=$tmpthirdparty;
|
||||||
|
}
|
||||||
|
$cases2[$h][$event->id]['string'].=', '.$cache_thirdparty[$event->socid]->name;
|
||||||
|
}
|
||||||
|
if ($event->contactid > 0)
|
||||||
|
{
|
||||||
|
if (empty($cache_contact[$event->contactid]))
|
||||||
|
{
|
||||||
|
$tmpcontact=new Contact($db);
|
||||||
|
$tmpcontact->fetch($event->contactid);
|
||||||
|
$cache_contact[$event->contactid]=$tmpcontact;
|
||||||
|
}
|
||||||
|
$cases2[$h][$event->id]['string'].=', '.$cache_contact[$event->contactid]->getFullName($langs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -928,6 +990,7 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Now output $casesX
|
||||||
for ($h = $begin_h; $h < $end_h; $h++)
|
for ($h = $begin_h; $h < $end_h; $h++)
|
||||||
{
|
{
|
||||||
$color1='';$color2='';
|
$color1='';$color2='';
|
||||||
|
|||||||
@@ -30,15 +30,17 @@
|
|||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
|
||||||
if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||||
|
|
||||||
|
|
||||||
if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3;
|
if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3;
|
||||||
|
|
||||||
$filter = GETPOST("filter",'',3);
|
$filter = GETPOST("filter",'alpha',3);
|
||||||
$filtert = GETPOST("filtert","int",3);
|
$filtert = GETPOST("filtert","int",3);
|
||||||
$usergroup = GETPOST("usergroup","int",3);
|
$usergroup = GETPOST("usergroup","int",3);
|
||||||
//if (! ($usergroup > 0) && ! ($filtert > 0)) $filtert = $user->id;
|
//if (! ($usergroup > 0) && ! ($filtert > 0)) $filtert = $user->id;
|
||||||
@@ -55,7 +57,7 @@ $sortfield = GETPOST("sortfield",'alpha');
|
|||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
$page = GETPOST("page","int");
|
$page = GETPOST("page","int");
|
||||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
if (! $sortorder) $sortorder="ASC";
|
if (! $sortorder) $sortorder="ASC";
|
||||||
if (! $sortfield) $sortfield="a.datec";
|
if (! $sortfield) $sortfield="a.datec";
|
||||||
@@ -82,9 +84,9 @@ $month=GETPOST("month","int")?GETPOST("month","int"):date("m");
|
|||||||
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
|
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
|
||||||
$day=GETPOST("day","int")?GETPOST("day","int"):date("d");
|
$day=GETPOST("day","int")?GETPOST("day","int"):date("d");
|
||||||
$pid=GETPOST("projectid","int",3);
|
$pid=GETPOST("projectid","int",3);
|
||||||
$status=GETPOST("status");
|
$status=GETPOST("status",'alpha');
|
||||||
$type=GETPOST("type");
|
$type=GETPOST("type",'alpha');
|
||||||
$maxprint=(isset($_GET["maxprint"])?GETPOST("maxprint"):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
|
$maxprint=((GETPOST("maxprint",'int')!='')?GETPOST("maxprint",'int'):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
|
||||||
// Set actioncode (this code must be same for setting actioncode into peruser, listacton and index)
|
// Set actioncode (this code must be same for setting actioncode into peruser, listacton and index)
|
||||||
if (GETPOST('actioncode','array'))
|
if (GETPOST('actioncode','array'))
|
||||||
{
|
{
|
||||||
@@ -93,29 +95,30 @@ if (GETPOST('actioncode','array'))
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE));
|
$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode","alpha")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE));
|
||||||
}
|
}
|
||||||
if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE);
|
if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE);
|
||||||
$dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth'), GETPOST('dateselectday'), GETPOST('dateselectyear'));
|
|
||||||
|
$dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth','int'), GETPOST('dateselectday','int'), GETPOST('dateselectyear','int'));
|
||||||
if ($dateselect > 0)
|
if ($dateselect > 0)
|
||||||
{
|
{
|
||||||
$day=GETPOST('dateselectday');
|
$day=GETPOST('dateselectday','int');
|
||||||
$month=GETPOST('dateselectmonth');
|
$month=GETPOST('dateselectmonth','int');
|
||||||
$year=GETPOST('dateselectyear');
|
$year=GETPOST('dateselectyear','int');
|
||||||
}
|
}
|
||||||
|
|
||||||
$tmp=empty($conf->global->MAIN_DEFAULT_WORKING_HOURS)?'9-18':$conf->global->MAIN_DEFAULT_WORKING_HOURS;
|
$tmp=empty($conf->global->MAIN_DEFAULT_WORKING_HOURS)?'9-18':$conf->global->MAIN_DEFAULT_WORKING_HOURS;
|
||||||
$tmparray=explode('-',$tmp);
|
$tmparray=explode('-',$tmp);
|
||||||
$begin_h = GETPOST('begin_h')!=''?GETPOST('begin_h','int'):($tmparray[0] != '' ? $tmparray[0] : 9);
|
$begin_h = GETPOST('begin_h','int')!=''?GETPOST('begin_h','int'):($tmparray[0] != '' ? $tmparray[0] : 9);
|
||||||
$end_h = GETPOST('end_h')?GETPOST('end_h'):($tmparray[1] != '' ? $tmparray[1] : 18);
|
$end_h = GETPOST('end_h','int')?GETPOST('end_h','int'):($tmparray[1] != '' ? $tmparray[1] : 18);
|
||||||
if ($begin_h < 0 || $begin_h > 23) $begin_h = 9;
|
if ($begin_h < 0 || $begin_h > 23) $begin_h = 9;
|
||||||
if ($end_h < 1 || $end_h > 24) $end_h = 18;
|
if ($end_h < 1 || $end_h > 24) $end_h = 18;
|
||||||
if ($end_h <= $begin_h) $end_h = $begin_h + 1;
|
if ($end_h <= $begin_h) $end_h = $begin_h + 1;
|
||||||
|
|
||||||
$tmp=empty($conf->global->MAIN_DEFAULT_WORKING_DAYS)?'1-5':$conf->global->MAIN_DEFAULT_WORKING_DAYS;
|
$tmp=empty($conf->global->MAIN_DEFAULT_WORKING_DAYS)?'1-5':$conf->global->MAIN_DEFAULT_WORKING_DAYS;
|
||||||
$tmparray=explode('-',$tmp);
|
$tmparray=explode('-',$tmp);
|
||||||
$begin_d = GETPOST('begin_d')?GETPOST('begin_d','int'):($tmparray[0] != '' ? $tmparray[0] : 1);
|
$begin_d = GETPOST('begin_d','int')?GETPOST('begin_d','int'):($tmparray[0] != '' ? $tmparray[0] : 1);
|
||||||
$end_d = GETPOST('end_d')?GETPOST('end_d'):($tmparray[1] != '' ? $tmparray[1] : 5);
|
$end_d = GETPOST('end_d','int')?GETPOST('end_d','int'):($tmparray[1] != '' ? $tmparray[1] : 5);
|
||||||
if ($begin_d < 1 || $begin_d > 7) $begin_d = 1;
|
if ($begin_d < 1 || $begin_d > 7) $begin_d = 1;
|
||||||
if ($end_d < 1 || $end_d > 7) $end_d = 7;
|
if ($end_d < 1 || $end_d > 7) $end_d = 7;
|
||||||
if ($end_d < $begin_d) $end_d = $begin_d + 1;
|
if ($end_d < $begin_d) $end_d = $begin_d + 1;
|
||||||
@@ -123,13 +126,13 @@ if ($end_d < $begin_d) $end_d = $begin_d + 1;
|
|||||||
if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS);
|
if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS);
|
||||||
if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW);
|
if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW);
|
||||||
|
|
||||||
if (GETPOST('viewcal') && $action != 'show_day' && $action != 'show_week' && $action != 'show_peruser') {
|
if (GETPOST('viewcal','alpha') && $action != 'show_day' && $action != 'show_week' && $action != 'show_peruser') {
|
||||||
$action='show_month'; $day='';
|
$action='show_month'; $day='';
|
||||||
} // View by month
|
} // View by month
|
||||||
if (GETPOST('viewweek') || $action == 'show_week') {
|
if (GETPOST('viewweek','alpha') || $action == 'show_week') {
|
||||||
$action='show_week'; $week=($week?$week:date("W")); $day=($day?$day:date("d"));
|
$action='show_week'; $week=($week?$week:date("W")); $day=($day?$day:date("d"));
|
||||||
} // View by week
|
} // View by week
|
||||||
if (GETPOST('viewday') || $action == 'show_day') {
|
if (GETPOST('viewday','alpha') || $action == 'show_day') {
|
||||||
$action='show_day'; $day=($day?$day:date("d"));
|
$action='show_day'; $day=($day?$day:date("d"));
|
||||||
} // View by day
|
} // View by day
|
||||||
|
|
||||||
@@ -160,12 +163,12 @@ if ($action =='delete_action')
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
|
|
||||||
llxHeader('',$langs->trans("Agenda"),$help_url);
|
|
||||||
|
|
||||||
$form=new Form($db);
|
$form=new Form($db);
|
||||||
$companystatic=new Societe($db);
|
$companystatic=new Societe($db);
|
||||||
|
|
||||||
|
$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
|
||||||
|
llxHeader('',$langs->trans("Agenda"),$help_url);
|
||||||
|
|
||||||
$now=dol_now();
|
$now=dol_now();
|
||||||
$nowarray=dol_getdate($now);
|
$nowarray=dol_getdate($now);
|
||||||
$nowyear=$nowarray['year'];
|
$nowyear=$nowarray['year'];
|
||||||
@@ -361,7 +364,7 @@ $sql.= ' a.datep2,';
|
|||||||
$sql.= ' a.percent,';
|
$sql.= ' a.percent,';
|
||||||
$sql.= ' a.fk_user_author,a.fk_user_action,';
|
$sql.= ' a.fk_user_author,a.fk_user_action,';
|
||||||
$sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,';
|
$sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,';
|
||||||
$sql.= ' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype,';
|
$sql.= ' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype, a.fk_project,';
|
||||||
$sql.= ' ca.code, ca.color';
|
$sql.= ' ca.code, ca.color';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
|
||||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
||||||
@@ -418,14 +421,14 @@ else
|
|||||||
{
|
{
|
||||||
// To limit array
|
// To limit array
|
||||||
$sql.= " AND (";
|
$sql.= " AND (";
|
||||||
$sql.= " (a.datep BETWEEN '".$db->idate(dol_mktime(0,0,0,$month,1,$year)-(60*60*24*7))."'"; // Start 7 days before
|
$sql.= " (a.datep BETWEEN '".$db->idate($firstdaytoshow-(60*60*24*2))."'"; // Start 2 day before $firstdaytoshow
|
||||||
$sql.= " AND '".$db->idate(dol_mktime(23,59,59,$month,28,$year)+(60*60*24*10))."')"; // End 7 days after + 3 to go from 28 to 31
|
$sql.= " AND '".$db->idate($lastdaytoshow+(60*60*24*2))."')"; // End 2 day after $lastdaytoshow
|
||||||
$sql.= " OR ";
|
$sql.= " OR ";
|
||||||
$sql.= " (a.datep2 BETWEEN '".$db->idate(dol_mktime(0,0,0,$month,1,$year)-(60*60*24*7))."'";
|
$sql.= " (a.datep2 BETWEEN '".$db->idate($firstdaytoshow-(60*60*24*2))."'";
|
||||||
$sql.= " AND '".$db->idate(dol_mktime(23,59,59,$month,28,$year)+(60*60*24*10))."')";
|
$sql.= " AND '".$db->idate($lastdaytoshow+(60*60*24*2))."')";
|
||||||
$sql.= " OR ";
|
$sql.= " OR ";
|
||||||
$sql.= " (a.datep < '".$db->idate(dol_mktime(0,0,0,$month,1,$year)-(60*60*24*7))."'";
|
$sql.= " (a.datep < '".$db->idate($firstdaytoshow-(60*60*24*2))."'";
|
||||||
$sql.= " AND a.datep2 > '".$db->idate(dol_mktime(23,59,59,$month,28,$year)+(60*60*24*10))."')";
|
$sql.= " AND a.datep2 > '".$db->idate($lastdaytoshow+(60*60*24*2))."')";
|
||||||
$sql.= ')';
|
$sql.= ')';
|
||||||
}
|
}
|
||||||
if ($type) $sql.= " AND ca.id = ".$type;
|
if ($type) $sql.= " AND ca.id = ".$type;
|
||||||
@@ -444,13 +447,14 @@ if ($filtert > 0 || $usergroup > 0)
|
|||||||
}
|
}
|
||||||
// Sort on date
|
// Sort on date
|
||||||
$sql.= ' ORDER BY fk_user_action, datep'; //fk_user_action
|
$sql.= ' ORDER BY fk_user_action, datep'; //fk_user_action
|
||||||
//print $sql;
|
//print $sql;exit;
|
||||||
|
|
||||||
dol_syslog("comm/action/peruser.php", LOG_DEBUG);
|
dol_syslog("comm/action/peruser.php", LOG_DEBUG);
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
$i=0;
|
$i=0;
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
@@ -463,11 +467,14 @@ if ($resql)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$datep=$db->jdate($obj->datep);
|
||||||
|
$datep2=$db->jdate($obj->datep2);
|
||||||
|
|
||||||
// Create a new object action
|
// Create a new object action
|
||||||
$event=new ActionComm($db);
|
$event=new ActionComm($db);
|
||||||
$event->id=$obj->id;
|
$event->id=$obj->id;
|
||||||
$event->datep=$db->jdate($obj->datep); // datep and datef are GMT date
|
$event->datep=$datep; // datep and datef are GMT date
|
||||||
$event->datef=$db->jdate($obj->datep2);
|
$event->datef=$datep2;
|
||||||
$event->type_code=$obj->code;
|
$event->type_code=$obj->code;
|
||||||
$event->type_color=$obj->color;
|
$event->type_color=$obj->color;
|
||||||
//$event->libelle=$obj->label; // deprecated
|
//$event->libelle=$obj->label; // deprecated
|
||||||
@@ -476,12 +483,13 @@ if ($resql)
|
|||||||
//$event->author->id=$obj->fk_user_author; // user id of creator
|
//$event->author->id=$obj->fk_user_author; // user id of creator
|
||||||
$event->authorid=$obj->fk_user_author; // user id of creator
|
$event->authorid=$obj->fk_user_author; // user id of creator
|
||||||
$event->userownerid=$obj->fk_user_action; // user id of owner
|
$event->userownerid=$obj->fk_user_action; // user id of owner
|
||||||
$event->fetch_userassigned(); // This load $event->userassigned
|
|
||||||
$event->priority=$obj->priority;
|
$event->priority=$obj->priority;
|
||||||
$event->fulldayevent=$obj->fulldayevent;
|
$event->fulldayevent=$obj->fulldayevent;
|
||||||
$event->location=$obj->location;
|
$event->location=$obj->location;
|
||||||
$event->transparency=$obj->transparency;
|
$event->transparency=$obj->transparency;
|
||||||
|
|
||||||
|
$event->fk_project=$obj->fk_project;
|
||||||
|
|
||||||
$event->socid=$obj->fk_soc;
|
$event->socid=$obj->fk_soc;
|
||||||
$event->contactid=$obj->fk_contact;
|
$event->contactid=$obj->fk_contact;
|
||||||
//$event->societe->id=$obj->fk_soc; // deprecated
|
//$event->societe->id=$obj->fk_soc; // deprecated
|
||||||
@@ -494,15 +502,15 @@ if ($resql)
|
|||||||
// They are date start and end of action but modified to not be outside calendar view.
|
// They are date start and end of action but modified to not be outside calendar view.
|
||||||
if ($event->percentage <= 0)
|
if ($event->percentage <= 0)
|
||||||
{
|
{
|
||||||
$event->date_start_in_calendar=$event->datep;
|
$event->date_start_in_calendar=$datep;
|
||||||
if ($event->datef != '' && $event->datef >= $event->datep) $event->date_end_in_calendar=$event->datef;
|
if ($datep2 != '' && $datep2 >= $datep) $event->date_end_in_calendar=$datep2;
|
||||||
else $event->date_end_in_calendar=$event->datep;
|
else $event->date_end_in_calendar=$datep;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$event->date_start_in_calendar=$event->datep;
|
$event->date_start_in_calendar=$datep;
|
||||||
if ($event->datef != '' && $event->datef >= $event->datep) $event->date_end_in_calendar=$event->datef;
|
if ($datep2 != '' && $datep2 >= $datep) $event->date_end_in_calendar=$datep2;
|
||||||
else $event->date_end_in_calendar=$event->datep;
|
else $event->date_end_in_calendar=$datep;
|
||||||
}
|
}
|
||||||
// Define ponctual property
|
// Define ponctual property
|
||||||
if ($event->date_start_in_calendar == $event->date_end_in_calendar)
|
if ($event->date_start_in_calendar == $event->date_end_in_calendar)
|
||||||
@@ -515,10 +523,14 @@ if ($resql)
|
|||||||
$event->date_start_in_calendar >= $lastdaytoshow)
|
$event->date_start_in_calendar >= $lastdaytoshow)
|
||||||
{
|
{
|
||||||
// This record is out of visible range
|
// This record is out of visible range
|
||||||
|
unset($event);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow;
|
//print $i.' - '.dol_print_date($this->date_start_in_calendar, 'dayhour').' - '.dol_print_date($this->date_end_in_calendar, 'dayhour').'<br>'."\n";
|
||||||
|
$event->fetch_userassigned(); // This load $event->userassigned
|
||||||
|
|
||||||
|
if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow;
|
||||||
if ($event->date_end_in_calendar >= $lastdaytoshow) $event->date_end_in_calendar=($lastdaytoshow - 1);
|
if ($event->date_end_in_calendar >= $lastdaytoshow) $event->date_end_in_calendar=($lastdaytoshow - 1);
|
||||||
|
|
||||||
// Add an entry in actionarray for each day
|
// Add an entry in actionarray for each day
|
||||||
@@ -548,6 +560,7 @@ if ($resql)
|
|||||||
$i++;
|
$i++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
$db->free($resql);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -865,11 +878,12 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
|
|||||||
global $theme_datacolor; // Array with a list of different we can use (come from theme)
|
global $theme_datacolor; // Array with a list of different we can use (come from theme)
|
||||||
global $cachethirdparties, $cachecontacts, $colorindexused;
|
global $cachethirdparties, $cachecontacts, $colorindexused;
|
||||||
global $begin_h, $end_h;
|
global $begin_h, $end_h;
|
||||||
|
global $cache_project, $cache_thirdparty, $cache_contact;
|
||||||
|
|
||||||
$cases1 = array(); // Color first half hour
|
$cases1 = array(); // Color first half hour
|
||||||
$cases2 = array(); // Color second half hour
|
$cases2 = array(); // Color second half hour
|
||||||
|
|
||||||
$curtime = dol_mktime(0, 0, 0, $month, $day, $year);
|
$curtime = dol_mktime(0, 0, 0, $month, $day, $year, false, 0);
|
||||||
|
|
||||||
$i=0; $nummytasks=0; $numother=0; $numbirthday=0; $numical=0; $numicals=array();
|
$i=0; $nummytasks=0; $numother=0; $numbirthday=0; $numical=0; $numicals=array();
|
||||||
$ymd=sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day);
|
$ymd=sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day);
|
||||||
@@ -980,13 +994,39 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
|
|||||||
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) $cases1[$h][$event->id]['string'].='-'.dol_print_date($event->date_end_in_calendar,'hour');
|
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) $cases1[$h][$event->id]['string'].='-'.dol_print_date($event->date_end_in_calendar,'hour');
|
||||||
else $cases1[$h][$event->id]['string'].='-'.dol_print_date($event->date_end_in_calendar,'dayhour');
|
else $cases1[$h][$event->id]['string'].='-'.dol_print_date($event->date_end_in_calendar,'dayhour');
|
||||||
}
|
}
|
||||||
$cases1[$h][$event->id]['string'].=' - '.$event->label;
|
if ($event->label) $cases1[$h][$event->id]['string'].=' - '.$event->label;
|
||||||
$cases1[$h][$event->id]['typecode']=$event->type_code;
|
$cases1[$h][$event->id]['typecode']=$event->type_code;
|
||||||
if ($event->socid)
|
|
||||||
{
|
|
||||||
//$cases1[$h][$event->id]['string'].='xxx';
|
|
||||||
}
|
|
||||||
$cases1[$h][$event->id]['color']=$color;
|
$cases1[$h][$event->id]['color']=$color;
|
||||||
|
if ($event->fk_project > 0)
|
||||||
|
{
|
||||||
|
if (empty($cache_project[$event->fk_project]))
|
||||||
|
{
|
||||||
|
$tmpproj=new Project($db);
|
||||||
|
$tmpproj->fetch($event->fk_project);
|
||||||
|
$cache_project[$event->fk_project]=$tmpproj;
|
||||||
|
}
|
||||||
|
$cases1[$h][$event->id]['string'].=', '.$langs->trans("Project").': '.$cache_project[$event->fk_project]->ref.' - '.$cache_project[$event->fk_project]->title;
|
||||||
|
}
|
||||||
|
if ($event->socid > 0)
|
||||||
|
{
|
||||||
|
if (empty($cache_thirdparty[$event->socid]))
|
||||||
|
{
|
||||||
|
$tmpthirdparty=new Societe($db);
|
||||||
|
$tmpthirdparty->fetch($event->socid);
|
||||||
|
$cache_thirdparty[$event->socid]=$tmpthirdparty;
|
||||||
|
}
|
||||||
|
$cases1[$h][$event->id]['string'].=', '.$cache_thirdparty[$event->socid]->name;
|
||||||
|
}
|
||||||
|
if ($event->contactid > 0)
|
||||||
|
{
|
||||||
|
if (empty($cache_contact[$event->contactid]))
|
||||||
|
{
|
||||||
|
$tmpcontact=new Contact($db);
|
||||||
|
$tmpcontact->fetch($event->contactid);
|
||||||
|
$cache_contact[$event->contactid]=$tmpcontact;
|
||||||
|
}
|
||||||
|
$cases1[$h][$event->id]['string'].=', '.$cache_contact[$event->contactid]->getFullName($langs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ($event->date_start_in_calendar < $c && $dateendtouse > $b)
|
if ($event->date_start_in_calendar < $c && $dateendtouse > $b)
|
||||||
{
|
{
|
||||||
@@ -1000,13 +1040,39 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
|
|||||||
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) $cases2[$h][$event->id]['string'].='-'.dol_print_date($event->date_end_in_calendar,'hour');
|
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) $cases2[$h][$event->id]['string'].='-'.dol_print_date($event->date_end_in_calendar,'hour');
|
||||||
else $cases2[$h][$event->id]['string'].='-'.dol_print_date($event->date_end_in_calendar,'dayhour');
|
else $cases2[$h][$event->id]['string'].='-'.dol_print_date($event->date_end_in_calendar,'dayhour');
|
||||||
}
|
}
|
||||||
$cases2[$h][$event->id]['string'].=' - '.$event->label;
|
if ($event->label) $cases2[$h][$event->id]['string'].=' - '.$event->label;
|
||||||
$cases2[$h][$event->id]['typecode']=$event->type_code;
|
$cases2[$h][$event->id]['typecode']=$event->type_code;
|
||||||
if ($event->socid)
|
|
||||||
{
|
|
||||||
//$cases2[$h][$event->id]['string'].='xxx';
|
|
||||||
}
|
|
||||||
$cases2[$h][$event->id]['color']=$color;
|
$cases2[$h][$event->id]['color']=$color;
|
||||||
|
if ($event->fk_project > 0)
|
||||||
|
{
|
||||||
|
if (empty($cache_project[$event->fk_project]))
|
||||||
|
{
|
||||||
|
$tmpproj=new Project($db);
|
||||||
|
$tmpproj->fetch($event->fk_project);
|
||||||
|
$cache_project[$event->fk_project]=$tmpproj;
|
||||||
|
}
|
||||||
|
$cases2[$h][$event->id]['string'].=', '.$langs->trans("Project").': '.$cache_project[$event->fk_project]->ref.' - '.$cache_project[$event->fk_project]->title;
|
||||||
|
}
|
||||||
|
if ($event->socid > 0)
|
||||||
|
{
|
||||||
|
if (empty($cache_thirdparty[$event->socid]))
|
||||||
|
{
|
||||||
|
$tmpthirdparty=new Societe($db);
|
||||||
|
$tmpthirdparty->fetch($event->socid);
|
||||||
|
$cache_thirdparty[$event->socid]=$tmpthirdparty;
|
||||||
|
}
|
||||||
|
$cases2[$h][$event->id]['string'].=', '.$cache_thirdparty[$event->socid]->name;
|
||||||
|
}
|
||||||
|
if ($event->contactid > 0)
|
||||||
|
{
|
||||||
|
if (empty($cache_contact[$event->contactid]))
|
||||||
|
{
|
||||||
|
$tmpcontact=new Contact($db);
|
||||||
|
$tmpcontact->fetch($event->contactid);
|
||||||
|
$cache_contact[$event->contactid]=$tmpcontact;
|
||||||
|
}
|
||||||
|
$cases2[$h][$event->id]['string'].=', '.$cache_contact[$event->contactid]->getFullName($langs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1029,6 +1095,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Now output $casesX
|
||||||
for ($h = $begin_h; $h < $end_h; $h++)
|
for ($h = $begin_h; $h < $end_h; $h++)
|
||||||
{
|
{
|
||||||
$color1='';$color2='';
|
$color1='';$color2='';
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ class AdvanceTargetingMailing extends CommonObject
|
|||||||
$sql.= " ".(! isset($this->fk_mailing)?'NULL':"'".$this->fk_mailing."'").",";
|
$sql.= " ".(! isset($this->fk_mailing)?'NULL':"'".$this->fk_mailing."'").",";
|
||||||
$sql.= " ".(! isset($this->filtervalue)?'NULL':"'".$this->db->escape($this->filtervalue)."'").",";
|
$sql.= " ".(! isset($this->filtervalue)?'NULL':"'".$this->db->escape($this->filtervalue)."'").",";
|
||||||
$sql.= " ".$user->id.",";
|
$sql.= " ".$user->id.",";
|
||||||
$sql.= " ".$this->db->idate(dol_now()).",";
|
$sql.= " '".$this->db->idate(dol_now())."',";
|
||||||
$sql.= " ".$user->id;
|
$sql.= " ".$user->id;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -24,14 +24,14 @@ require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
|||||||
/**
|
/**
|
||||||
* API class for orders
|
* API class for orders
|
||||||
*
|
*
|
||||||
* @access protected
|
* @access protected
|
||||||
* @class DolibarrApiAccess {@requires user,external}
|
* @class DolibarrApiAccess {@requires user,external}
|
||||||
*/
|
*/
|
||||||
class Proposals extends DolibarrApi
|
class Proposals extends DolibarrApi
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array $FIELDS Mandatory fields, checked when create and update object
|
* @var array $FIELDS Mandatory fields, checked when create and update object
|
||||||
*/
|
*/
|
||||||
static $FIELDS = array(
|
static $FIELDS = array(
|
||||||
'socid'
|
'socid'
|
||||||
@@ -56,36 +56,36 @@ class Proposals extends DolibarrApi
|
|||||||
* Get properties of a commercial proposal object
|
* Get properties of a commercial proposal object
|
||||||
*
|
*
|
||||||
* Return an array with commercial proposal informations
|
* Return an array with commercial proposal informations
|
||||||
*
|
*
|
||||||
* @param int $id ID of commercial proposal
|
* @param int $id ID of commercial proposal
|
||||||
* @return array|mixed data without useless information
|
* @return array|mixed data without useless information
|
||||||
*
|
*
|
||||||
* @throws RestException
|
* @throws RestException
|
||||||
*/
|
*/
|
||||||
function get($id)
|
function get($id)
|
||||||
{
|
{
|
||||||
if(! DolibarrApiAccess::$user->rights->propal->lire) {
|
if(! DolibarrApiAccess::$user->rights->propal->lire) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->propal->fetch($id);
|
$result = $this->propal->fetch($id);
|
||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Commercial Proposal not found');
|
throw new RestException(404, 'Commercial Proposal not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
|
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
|
||||||
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->propal->fetchObjectLinked();
|
$this->propal->fetchObjectLinked();
|
||||||
return $this->_cleanObjectDatas($this->propal);
|
return $this->_cleanObjectDatas($this->propal);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List commercial proposals
|
* List commercial proposals
|
||||||
*
|
*
|
||||||
* Get a list of commercial proposals
|
* Get a list of commercial proposals
|
||||||
*
|
*
|
||||||
* @param string $sortfield Sort field
|
* @param string $sortfield Sort field
|
||||||
* @param string $sortorder Sort order
|
* @param string $sortorder Sort order
|
||||||
* @param int $limit Limit for list
|
* @param int $limit Limit for list
|
||||||
@@ -96,12 +96,12 @@ class Proposals extends DolibarrApi
|
|||||||
*/
|
*/
|
||||||
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $thirdparty_ids = '', $sqlfilters = '') {
|
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $thirdparty_ids = '', $sqlfilters = '') {
|
||||||
global $db, $conf;
|
global $db, $conf;
|
||||||
|
|
||||||
$obj_ret = array();
|
$obj_ret = array();
|
||||||
|
|
||||||
// case of external user, $thirdparty_ids param is ignored and replaced by user's socid
|
// case of external user, $thirdparty_ids param is ignored and replaced by user's socid
|
||||||
$socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids;
|
$socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids;
|
||||||
|
|
||||||
// If the internal user must only see his customers, force searching by him
|
// If the internal user must only see his customers, force searching by him
|
||||||
$search_sale = 0;
|
$search_sale = 0;
|
||||||
if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id;
|
if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id;
|
||||||
@@ -109,7 +109,7 @@ class Proposals extends DolibarrApi
|
|||||||
$sql = "SELECT t.rowid";
|
$sql = "SELECT t.rowid";
|
||||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."propal as t";
|
$sql.= " FROM ".MAIN_DB_PREFIX."propal as t";
|
||||||
|
|
||||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||||
|
|
||||||
$sql.= ' WHERE t.entity IN ('.getEntity('propal').')';
|
$sql.= ' WHERE t.entity IN ('.getEntity('propal').')';
|
||||||
@@ -122,7 +122,7 @@ class Proposals extends DolibarrApi
|
|||||||
$sql .= " AND sc.fk_user = ".$search_sale;
|
$sql .= " AND sc.fk_user = ".$search_sale;
|
||||||
}
|
}
|
||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters)
|
if ($sqlfilters)
|
||||||
{
|
{
|
||||||
if (! DolibarrApi::_checkFilters($sqlfilters))
|
if (! DolibarrApi::_checkFilters($sqlfilters))
|
||||||
{
|
{
|
||||||
@@ -131,7 +131,7 @@ class Proposals extends DolibarrApi
|
|||||||
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||||
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql.= $db->order($sortfield, $sortorder);
|
$sql.= $db->order($sortfield, $sortorder);
|
||||||
if ($limit) {
|
if ($limit) {
|
||||||
if ($page < 0)
|
if ($page < 0)
|
||||||
@@ -144,7 +144,7 @@ class Proposals extends DolibarrApi
|
|||||||
}
|
}
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
|
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
@@ -195,7 +195,7 @@ class Proposals extends DolibarrApi
|
|||||||
if ($this->propal->create(DolibarrApiAccess::$user) < 0) {
|
if ($this->propal->create(DolibarrApiAccess::$user) < 0) {
|
||||||
throw new RestException(500, "Error creating order", array_merge(array($this->propal->error), $this->propal->errors));
|
throw new RestException(500, "Error creating order", array_merge(array($this->propal->error), $this->propal->errors));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->propal->id;
|
return $this->propal->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,21 +203,21 @@ class Proposals extends DolibarrApi
|
|||||||
* Get lines of a commercial proposal
|
* Get lines of a commercial proposal
|
||||||
*
|
*
|
||||||
* @param int $id Id of commercial proposal
|
* @param int $id Id of commercial proposal
|
||||||
*
|
*
|
||||||
* @url GET {id}/lines
|
* @url GET {id}/lines
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function getLines($id) {
|
function getLines($id) {
|
||||||
if(! DolibarrApiAccess::$user->rights->propal->lire) {
|
if(! DolibarrApiAccess::$user->rights->propal->lire) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->propal->fetch($id);
|
$result = $this->propal->fetch($id);
|
||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Commercial Proposal not found');
|
throw new RestException(404, 'Commercial Proposal not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
|
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
@@ -233,22 +233,22 @@ class Proposals extends DolibarrApi
|
|||||||
* Add a line to given commercial proposal
|
* Add a line to given commercial proposal
|
||||||
*
|
*
|
||||||
* @param int $id Id of commercial proposal to update
|
* @param int $id Id of commercial proposal to update
|
||||||
* @param array $request_data Commercial proposal line data
|
* @param array $request_data Commercial proposal line data
|
||||||
*
|
*
|
||||||
* @url POST {id}/lines
|
* @url POST {id}/lines
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function postLine($id, $request_data = NULL) {
|
function postLine($id, $request_data = NULL) {
|
||||||
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->propal->fetch($id);
|
$result = $this->propal->fetch($id);
|
||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Commercial Proposal not found');
|
throw new RestException(404, 'Commercial Proposal not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
|
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
@@ -294,22 +294,22 @@ class Proposals extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @param int $id Id of commercial proposal to update
|
* @param int $id Id of commercial proposal to update
|
||||||
* @param int $lineid Id of line to update
|
* @param int $lineid Id of line to update
|
||||||
* @param array $request_data Commercial proposal line data
|
* @param array $request_data Commercial proposal line data
|
||||||
*
|
*
|
||||||
* @url PUT {id}/lines/{lineid}
|
* @url PUT {id}/lines/{lineid}
|
||||||
*
|
*
|
||||||
* @return object
|
* @return object
|
||||||
*/
|
*/
|
||||||
function putLine($id, $lineid, $request_data = NULL) {
|
function putLine($id, $lineid, $request_data = NULL) {
|
||||||
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->propal->fetch($id);
|
$result = $this->propal->fetch($id);
|
||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Proposal not found');
|
throw new RestException(404, 'Proposal not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
|
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
@@ -352,21 +352,21 @@ class Proposals extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @param int $id Id of commercial proposal to update
|
* @param int $id Id of commercial proposal to update
|
||||||
* @param int $lineid Id of line to delete
|
* @param int $lineid Id of line to delete
|
||||||
*
|
*
|
||||||
* @url DELETE {id}/lines/{lineid}
|
* @url DELETE {id}/lines/{lineid}
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function delLine($id, $lineid) {
|
function delLine($id, $lineid) {
|
||||||
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->propal->fetch($id);
|
$result = $this->propal->fetch($id);
|
||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Proposal not found');
|
throw new RestException(404, 'Proposal not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
|
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
@@ -382,20 +382,20 @@ class Proposals extends DolibarrApi
|
|||||||
* Update commercial proposal general fields (won't touch lines of commercial proposal)
|
* Update commercial proposal general fields (won't touch lines of commercial proposal)
|
||||||
*
|
*
|
||||||
* @param int $id Id of commercial proposal to update
|
* @param int $id Id of commercial proposal to update
|
||||||
* @param array $request_data Datas
|
* @param array $request_data Datas
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function put($id, $request_data = NULL) {
|
function put($id, $request_data = NULL) {
|
||||||
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->propal->fetch($id);
|
$result = $this->propal->fetch($id);
|
||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Proposal not found');
|
throw new RestException(404, 'Proposal not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
|
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
@@ -403,18 +403,18 @@ class Proposals extends DolibarrApi
|
|||||||
if ($field == 'id') continue;
|
if ($field == 'id') continue;
|
||||||
$this->propal->$field = $value;
|
$this->propal->$field = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->propal->update($id, DolibarrApiAccess::$user,1,'','','update'))
|
if($this->propal->update($id, DolibarrApiAccess::$user,1,'','','update'))
|
||||||
return $this->get($id);
|
return $this->get($id);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete commercial proposal
|
* Delete commercial proposal
|
||||||
*
|
*
|
||||||
* @param int $id Commercial proposal ID
|
* @param int $id Commercial proposal ID
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function delete($id)
|
function delete($id)
|
||||||
@@ -426,32 +426,32 @@ class Proposals extends DolibarrApi
|
|||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Commercial Proposal not found');
|
throw new RestException(404, 'Commercial Proposal not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
|
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
|
||||||
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( ! $this->propal->delete(DolibarrApiAccess::$user)) {
|
if( ! $this->propal->delete(DolibarrApiAccess::$user)) {
|
||||||
throw new RestException(500, 'Error when delete Commercial Proposal : '.$this->propal->error);
|
throw new RestException(500, 'Error when delete Commercial Proposal : '.$this->propal->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'success' => array(
|
'success' => array(
|
||||||
'code' => 200,
|
'code' => 200,
|
||||||
'message' => 'Commercial Proposal deleted'
|
'message' => 'Commercial Proposal deleted'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate a commercial proposal
|
* Validate a commercial proposal
|
||||||
*
|
*
|
||||||
* @param int $id Commercial proposal ID
|
* @param int $id Commercial proposal ID
|
||||||
* @param int $notrigger Use {}
|
* @param int $notrigger Use {}
|
||||||
*
|
*
|
||||||
* @url POST {id}/validate
|
* @url POST {id}/validate
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
* FIXME An error 403 is returned if the request has an empty body.
|
* FIXME An error 403 is returned if the request has an empty body.
|
||||||
* Error message: "Forbidden: Content type `text/plain` is not supported."
|
* Error message: "Forbidden: Content type `text/plain` is not supported."
|
||||||
@@ -469,11 +469,11 @@ class Proposals extends DolibarrApi
|
|||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Commercial Proposal not found');
|
throw new RestException(404, 'Commercial Proposal not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
|
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->propal->valid(DolibarrApiAccess::$user, $notrigger);
|
$result = $this->propal->valid(DolibarrApiAccess::$user, $notrigger);
|
||||||
if ($result == 0) {
|
if ($result == 0) {
|
||||||
throw new RestException(500, 'Error nothing done. May be object is already validated');
|
throw new RestException(500, 'Error nothing done. May be object is already validated');
|
||||||
@@ -481,30 +481,30 @@ class Proposals extends DolibarrApi
|
|||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
throw new RestException(500, 'Error when validating Commercial Proposal: '.$this->propal->error);
|
throw new RestException(500, 'Error when validating Commercial Proposal: '.$this->propal->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'success' => array(
|
'success' => array(
|
||||||
'code' => 200,
|
'code' => 200,
|
||||||
'message' => 'Commercial Proposal validated'
|
'message' => 'Commercial Proposal validated (Ref='.$this->propal->ref.')'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate fields before create or update object
|
* Validate fields before create or update object
|
||||||
*
|
*
|
||||||
* @param array $data Array with data to verify
|
* @param array $data Array with data to verify
|
||||||
* @return array
|
* @return array
|
||||||
* @throws RestException
|
* @throws RestException
|
||||||
*/
|
*/
|
||||||
function _validate($data)
|
function _validate($data)
|
||||||
{
|
{
|
||||||
$propal = array();
|
$propal = array();
|
||||||
foreach (Orders::$FIELDS as $field) {
|
foreach (Proposals::$FIELDS as $field) {
|
||||||
if (!isset($data[$field]))
|
if (!isset($data[$field]))
|
||||||
throw new RestException(400, "$field field missing");
|
throw new RestException(400, "$field field missing");
|
||||||
$propal[$field] = $data[$field];
|
$propal[$field] = $data[$field];
|
||||||
|
|
||||||
}
|
}
|
||||||
return $propal;
|
return $propal;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,8 +80,8 @@ class Orders extends DolibarrApi
|
|||||||
return $this->_cleanObjectDatas($this->commande);
|
return $this->_cleanObjectDatas($this->commande);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List orders
|
* List orders
|
||||||
*
|
*
|
||||||
@@ -101,7 +101,7 @@ class Orders extends DolibarrApi
|
|||||||
global $db, $conf;
|
global $db, $conf;
|
||||||
|
|
||||||
$obj_ret = array();
|
$obj_ret = array();
|
||||||
|
|
||||||
// case of external user, $thirdparty_ids param is ignored and replaced by user's socid
|
// case of external user, $thirdparty_ids param is ignored and replaced by user's socid
|
||||||
$socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids;
|
$socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids;
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ class Orders extends DolibarrApi
|
|||||||
$sql .= " AND sc.fk_user = ".$search_sale;
|
$sql .= " AND sc.fk_user = ".$search_sale;
|
||||||
}
|
}
|
||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters)
|
if ($sqlfilters)
|
||||||
{
|
{
|
||||||
if (! DolibarrApi::_checkFilters($sqlfilters))
|
if (! DolibarrApi::_checkFilters($sqlfilters))
|
||||||
{
|
{
|
||||||
@@ -134,7 +134,7 @@ class Orders extends DolibarrApi
|
|||||||
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||||
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql.= $db->order($sortfield, $sortorder);
|
$sql.= $db->order($sortfield, $sortorder);
|
||||||
if ($limit) {
|
if ($limit) {
|
||||||
if ($page < 0)
|
if ($page < 0)
|
||||||
@@ -490,7 +490,7 @@ class Orders extends DolibarrApi
|
|||||||
return array(
|
return array(
|
||||||
'success' => array(
|
'success' => array(
|
||||||
'code' => 200,
|
'code' => 200,
|
||||||
'message' => 'Order validated'
|
'message' => 'Order validated (Ref='.$this->commande->ref.')'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -502,14 +502,14 @@ class Orders extends DolibarrApi
|
|||||||
* @return array Array of cleaned object properties
|
* @return array Array of cleaned object properties
|
||||||
*/
|
*/
|
||||||
function _cleanObjectDatas($object) {
|
function _cleanObjectDatas($object) {
|
||||||
|
|
||||||
$object = parent::_cleanObjectDatas($object);
|
$object = parent::_cleanObjectDatas($object);
|
||||||
|
|
||||||
unset($object->address);
|
unset($object->address);
|
||||||
|
|
||||||
return $object;
|
return $object;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate fields before create or update object
|
* Validate fields before create or update object
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -86,9 +86,9 @@ class PaymentVarious extends CommonObject
|
|||||||
// Update request
|
// Update request
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."payment_various SET";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."payment_various SET";
|
||||||
|
|
||||||
$sql.= " tms=".$this->db->idate($this->tms).",";
|
$sql.= " tms='".$this->db->idate($this->tms)."',";
|
||||||
$sql.= " datep=".$this->db->idate($this->datep).",";
|
$sql.= " datep='".$this->db->idate($this->datep)."',";
|
||||||
$sql.= " datev=".$this->db->idate($this->datev).",";
|
$sql.= " datev='".$this->db->idate($this->datev)."',";
|
||||||
$sql.= " sens=".$this->sens.",";
|
$sql.= " sens=".$this->sens.",";
|
||||||
$sql.= " amount=".price2num($this->amount).",";
|
$sql.= " amount=".price2num($this->amount).",";
|
||||||
$sql.= " fk_typepayment=".$this->fk_typepayment."',";
|
$sql.= " fk_typepayment=".$this->fk_typepayment."',";
|
||||||
|
|||||||
@@ -492,12 +492,10 @@ foreach ($accounts as $key=>$type)
|
|||||||
// Account number
|
// Account number
|
||||||
if (! empty($arrayfields['b.account_number']['checked']))
|
if (! empty($arrayfields['b.account_number']['checked']))
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
|
||||||
|
|
||||||
$accountingaccount = new AccountingAccount($db);
|
$accountingaccount = new AccountingAccount($db);
|
||||||
$accountingaccount->fetch('',$acc->account_number);
|
$accountingaccount->fetch('',$acc->account_number);
|
||||||
|
|
||||||
print '<td>'.length_accountg($accountingaccount->getNomUrl(0,1,1,'',1)).'</td>';
|
print '<td>'.$accountingaccount->getNomUrl(0,1,1,'',1).'</td>';
|
||||||
|
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
||||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||||
|
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
||||||
|
|
||||||
$langs->loadLangs(array("compta", "banks", "bills", "users", "accountancy"));
|
$langs->loadLangs(array("compta", "banks", "bills", "users", "accountancy"));
|
||||||
|
|
||||||
@@ -70,7 +71,7 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
if ($action != 'addlink')
|
if ($action != 'addlink')
|
||||||
{
|
{
|
||||||
$urltogo=$backtopage?$backtopage:dol_buildpath('/mymodule/myobject_list.php',1);
|
$urltogo=$backtopage?$backtopage:dol_buildpath('/compta/bank/various_payment/index.php',1);
|
||||||
header("Location: ".$urltogo);
|
header("Location: ".$urltogo);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@@ -172,7 +173,7 @@ if (empty($reshook))
|
|||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
header("Location: ".DOL_URL_ROOT.'/compta/salaries/index.php');
|
header("Location: ".DOL_URL_ROOT.'/compta/bank/various_payment/index.php');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -339,9 +340,9 @@ if ($id)
|
|||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/various_payment/index.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/various_payment/index.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
print "<tr>";
|
print "<tr>";
|
||||||
print '<td class="titlefield">'.$langs->trans("Ref").'</td><td>';
|
print '<td class="titlefield">'.$langs->trans("Ref").'</td><td>';
|
||||||
print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', '');
|
print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', '');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@@ -349,11 +350,13 @@ if ($id)
|
|||||||
// Label
|
// Label
|
||||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->label.'</td></tr>';
|
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->label.'</td></tr>';
|
||||||
|
|
||||||
|
// Payment date
|
||||||
print "<tr>";
|
print "<tr>";
|
||||||
print '<td>'.$langs->trans("DatePayment").'</td><td>';
|
print '<td>'.$langs->trans("DatePayment").'</td><td>';
|
||||||
print dol_print_date($object->datep,'day');
|
print dol_print_date($object->datep,'day');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Value date
|
||||||
print '<tr><td>'.$langs->trans("DateValue").'</td><td>';
|
print '<tr><td>'.$langs->trans("DateValue").'</td><td>';
|
||||||
print dol_print_date($object->datev,'day');
|
print dol_print_date($object->datev,'day');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@@ -370,11 +373,10 @@ if ($id)
|
|||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
if (! empty($conf->accounting->enabled))
|
if (! empty($conf->accounting->enabled))
|
||||||
{
|
{
|
||||||
$accountancyaccount = new AccountingAccount($db);
|
$accountingaccount = new AccountingAccount($db);
|
||||||
$accountancyaccount->fetch('',$object->accountancy_code);
|
$accountingaccount->fetch('',$object->accountancy_code);
|
||||||
|
|
||||||
print $accountancyaccount->getNomUrl(1);
|
print $accountingaccount->getNomUrl(0,1,1,'',1);
|
||||||
// print length_accountg($object->accountancy_code);
|
|
||||||
} else {
|
} else {
|
||||||
print $object->accountancy_code;
|
print $object->accountancy_code;
|
||||||
}
|
}
|
||||||
@@ -411,7 +413,7 @@ if ($id)
|
|||||||
print '<div class="tabsAction">'."\n";
|
print '<div class="tabsAction">'."\n";
|
||||||
if ($object->rappro == 0)
|
if ($object->rappro == 0)
|
||||||
{
|
{
|
||||||
if (! empty($user->rights->banque->delete))
|
if (! empty($user->rights->banque->modifier))
|
||||||
{
|
{
|
||||||
print '<a class="butActionDelete" href="card.php?id='.$object->id.'&action=delete">'.$langs->trans("Delete").'</a>';
|
print '<a class="butActionDelete" href="card.php?id='.$object->id.'&action=delete">'.$langs->trans("Delete").'</a>';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,14 +17,16 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/compta/bank/various_payment/index.php
|
* \file htdocs/compta/bank/various_payment/index.php
|
||||||
* \ingroup bank
|
* \ingroup bank
|
||||||
* \brief List of various payments
|
* \brief List of various payments
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require '../../../main.inc.php';
|
require '../../../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||||
|
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
||||||
|
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
||||||
|
|
||||||
$langs->load("compta");
|
$langs->load("compta");
|
||||||
$langs->load("banks");
|
$langs->load("banks");
|
||||||
@@ -90,8 +92,8 @@ $form = new Form($db);
|
|||||||
$variousstatic = new PaymentVarious($db);
|
$variousstatic = new PaymentVarious($db);
|
||||||
$accountstatic = new Account($db);
|
$accountstatic = new Account($db);
|
||||||
|
|
||||||
$sql = "SELECT v.rowid, v.amount, v.label, v.datep as datep, v.datev as datev, v.fk_typepayment as type, v.num_payment, v.fk_bank,";
|
$sql = "SELECT v.rowid, v.amount, v.label, v.datep as datep, v.datev as datev, v.fk_typepayment as type, v.num_payment, v.fk_bank, v.accountancy_code,";
|
||||||
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel,";
|
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number as bank_account_number, ba.fk_accountancy_journal as accountancy_journal, ba.label as blabel,";
|
||||||
$sql.= " pst.code as payment_code";
|
$sql.= " pst.code as payment_code";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."payment_various as v";
|
$sql.= " FROM ".MAIN_DB_PREFIX."payment_various as v";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON v.fk_typepayment = pst.id AND pst.entity = " . getEntity('c_paiement', 2);
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON v.fk_typepayment = pst.id AND pst.entity = " . getEntity('c_paiement', 2);
|
||||||
@@ -113,7 +115,6 @@ if ($typeid) {
|
|||||||
}
|
}
|
||||||
$sql.= $db->order($sortfield,$sortorder);
|
$sql.= $db->order($sortfield,$sortorder);
|
||||||
|
|
||||||
//$sql.= " GROUP BY u.rowid, u.lastname, u.firstname, v.rowid, v.fk_user, v.amount, v.label, v.datev, v.fk_typepayment, v.num_payment, pst.code";
|
|
||||||
$totalnboflines=0;
|
$totalnboflines=0;
|
||||||
$result=$db->query($sql);
|
$result=$db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
@@ -156,24 +157,30 @@ if ($result)
|
|||||||
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"v.datep","",$param,'align="center"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"v.datep","",$param,'align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("PaymentMode"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("PaymentMode"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder);
|
||||||
if (! empty($conf->banque->enabled)) print_liste_field_titre($langs->trans("BankAccount"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
|
if (! empty($conf->banque->enabled)) print_liste_field_titre($langs->trans("BankAccount"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre($langs->trans("AccountAccounting"),$_SERVER["PHP_SELF"],"v.accountancy_code","",$param,'align="left"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"v.amount","",$param,'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"v.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Sens"),$_SERVER["PHP_SELF"],"v.sens","",$param,'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Sens"),$_SERVER["PHP_SELF"],"v.sens","",$param,'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<td class="liste_titre" align="left">';
|
print '<td class="liste_titre" align="left">';
|
||||||
print '<input class="flat" type="text" size="3" name="search_ref" value="'.$search_ref.'">';
|
print '<input class="flat" type="text" size="3" name="search_ref" value="'.$search_ref.'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Label
|
// Label
|
||||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_label" value="'.$search_label.'"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_label" value="'.$search_label.'"></td>';
|
||||||
|
|
||||||
// Date
|
// Date
|
||||||
print '<td class="liste_titre"> </td>';
|
print '<td class="liste_titre"> </td>';
|
||||||
|
|
||||||
// Type
|
// Type
|
||||||
print '<td class="liste_titre" align="left">';
|
print '<td class="liste_titre" align="left">';
|
||||||
$form->select_types_paiements($typeid,'typeid','',0,0,1,16);
|
$form->select_types_paiements($typeid,'typeid','',0,0,1,16);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Account
|
// Account
|
||||||
if (! empty($conf->banque->enabled))
|
if (! empty($conf->banque->enabled))
|
||||||
{
|
{
|
||||||
@@ -181,8 +188,13 @@ if ($result)
|
|||||||
$form->select_comptes($search_account,'search_account',0,'',1);
|
$form->select_comptes($search_account,'search_account',0,'',1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Accounting account
|
||||||
|
if (! empty($conf->accounting->enabled)) print '<td class="liste_titre"> </td>';
|
||||||
|
|
||||||
// Amount
|
// Amount
|
||||||
print '<td class="liste_titre" align="right"><input name="search_amount" class="flat" type="text" size="8" value="'.$search_amount.'"></td>';
|
print '<td class="liste_titre" align="right"><input name="search_amount" class="flat" type="text" size="8" value="'.$search_amount.'"></td>';
|
||||||
|
|
||||||
// Sens
|
// Sens
|
||||||
print '<td class="liste_titre"> </td>';
|
print '<td class="liste_titre"> </td>';
|
||||||
|
|
||||||
@@ -201,34 +213,55 @@ if ($result)
|
|||||||
|
|
||||||
$variousstatic->id=$obj->rowid;
|
$variousstatic->id=$obj->rowid;
|
||||||
$variousstatic->ref=$obj->rowid;
|
$variousstatic->ref=$obj->rowid;
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print "<td>".$variousstatic->getNomUrl(1)."</td>\n";
|
print "<td>".$variousstatic->getNomUrl(1)."</td>\n";
|
||||||
|
|
||||||
// Label payment
|
// Label payment
|
||||||
print "<td>".dol_trunc($obj->label,40)."</td>\n";
|
print "<td>".dol_trunc($obj->label,40)."</td>\n";
|
||||||
|
|
||||||
// Date payment
|
// Date payment
|
||||||
print '<td align="center">'.dol_print_date($db->jdate($obj->datep),'day')."</td>\n";
|
print '<td align="center">'.dol_print_date($db->jdate($obj->datep),'day')."</td>\n";
|
||||||
|
|
||||||
// Type
|
// Type
|
||||||
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'</td>';
|
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'</td>';
|
||||||
|
|
||||||
// Account
|
// Account
|
||||||
if (! empty($conf->banque->enabled))
|
if (! empty($conf->banque->enabled))
|
||||||
{
|
{
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if ($obj->fk_bank > 0)
|
if ($obj->fk_bank > 0)
|
||||||
{
|
{
|
||||||
//$accountstatic->fetch($obj->fk_bank);
|
|
||||||
$accountstatic->id=$obj->bid;
|
$accountstatic->id=$obj->bid;
|
||||||
$accountstatic->ref=$obj->bref;
|
$accountstatic->ref=$obj->bref;
|
||||||
$accountstatic->number=$obj->bnumber;
|
$accountstatic->number=$obj->bnumber;
|
||||||
$accountstatic->accountancy_number=$obj->account_number;
|
|
||||||
$accountstatic->fk_accountancy_journal=$obj->fk_accountancy_journal;
|
if (! empty($conf->accounting->enabled)) {
|
||||||
|
$accountstatic->account_number=$obj->bank_account_number;
|
||||||
|
|
||||||
|
$accountingjournal = new AccountingJournal($db);
|
||||||
|
$accountingjournal->fetch($obj->accountancy_journal);
|
||||||
|
$accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0,1,1,'',1);
|
||||||
|
}
|
||||||
|
|
||||||
$accountstatic->label=$obj->blabel;
|
$accountstatic->label=$obj->blabel;
|
||||||
print $accountstatic->getNomUrl(1);
|
print $accountstatic->getNomUrl(1);
|
||||||
}
|
}
|
||||||
else print ' ';
|
else print ' ';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Accounting account
|
||||||
|
if (! empty($conf->accounting->enabled)) {
|
||||||
|
$accountingaccount = new AccountingAccount($db);
|
||||||
|
$accountingaccount->fetch('',$obj->accountancy_code);
|
||||||
|
|
||||||
|
print '<td>'.$accountingaccount->getNomUrl(0,1,1,'',1).'</td>';
|
||||||
|
}
|
||||||
|
|
||||||
// Amount
|
// Amount
|
||||||
print "<td align=\"right\">".price($obj->amount)."</td>";
|
print "<td align=\"right\">".price($obj->amount)."</td>";
|
||||||
|
|
||||||
// Sens
|
// Sens
|
||||||
if ($obj->sens == '1') $sens = $langs->trans("Credit"); else $sens = $langs->trans("Debit");
|
if ($obj->sens == '1') $sens = $langs->trans("Credit"); else $sens = $langs->trans("Debit");
|
||||||
print "<td align=\"right\">".$sens."</td>";
|
print "<td align=\"right\">".$sens."</td>";
|
||||||
@@ -240,7 +273,7 @@ if ($result)
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$colspan=4;
|
$colspan=5;
|
||||||
if (! empty($conf->banque->enabled)) $colspan++;
|
if (! empty($conf->banque->enabled)) $colspan++;
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
print '<td colspan="'.$colspan.'" class="liste_total">'.$langs->trans("Total").'</td>';
|
print '<td colspan="'.$colspan.'" class="liste_total">'.$langs->trans("Total").'</td>';
|
||||||
|
|||||||
@@ -22,14 +22,14 @@
|
|||||||
/**
|
/**
|
||||||
* API class for invoices
|
* API class for invoices
|
||||||
*
|
*
|
||||||
* @access protected
|
* @access protected
|
||||||
* @class DolibarrApiAccess {@requires user,external}
|
* @class DolibarrApiAccess {@requires user,external}
|
||||||
*/
|
*/
|
||||||
class Invoices extends DolibarrApi
|
class Invoices extends DolibarrApi
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var array $FIELDS Mandatory fields, checked when create and update object
|
* @var array $FIELDS Mandatory fields, checked when create and update object
|
||||||
*/
|
*/
|
||||||
static $FIELDS = array(
|
static $FIELDS = array(
|
||||||
'socid'
|
'socid'
|
||||||
@@ -54,23 +54,23 @@ class Invoices extends DolibarrApi
|
|||||||
* Get properties of a invoice object
|
* Get properties of a invoice object
|
||||||
*
|
*
|
||||||
* Return an array with invoice informations
|
* Return an array with invoice informations
|
||||||
*
|
*
|
||||||
* @param int $id ID of invoice
|
* @param int $id ID of invoice
|
||||||
* @return array|mixed data without useless information
|
* @return array|mixed data without useless information
|
||||||
*
|
*
|
||||||
* @throws RestException
|
* @throws RestException
|
||||||
*/
|
*/
|
||||||
function get($id)
|
function get($id)
|
||||||
{
|
{
|
||||||
if(! DolibarrApiAccess::$user->rights->facture->lire) {
|
if(! DolibarrApiAccess::$user->rights->facture->lire) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->invoice->fetch($id);
|
$result = $this->invoice->fetch($id);
|
||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Invoice not found');
|
throw new RestException(404, 'Invoice not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
|
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
@@ -80,9 +80,9 @@ class Invoices extends DolibarrApi
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* List invoices
|
* List invoices
|
||||||
*
|
*
|
||||||
* Get a list of invoices
|
* Get a list of invoices
|
||||||
*
|
*
|
||||||
* @param string $sortfield Sort field
|
* @param string $sortfield Sort field
|
||||||
* @param string $sortorder Sort order
|
* @param string $sortorder Sort order
|
||||||
* @param int $limit Limit for list
|
* @param int $limit Limit for list
|
||||||
@@ -96,12 +96,12 @@ class Invoices extends DolibarrApi
|
|||||||
*/
|
*/
|
||||||
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $thirdparty_ids='', $status='', $sqlfilters = '') {
|
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $thirdparty_ids='', $status='', $sqlfilters = '') {
|
||||||
global $db, $conf;
|
global $db, $conf;
|
||||||
|
|
||||||
$obj_ret = array();
|
$obj_ret = array();
|
||||||
|
|
||||||
// case of external user, $thirdparty_ids param is ignored and replaced by user's socid
|
// case of external user, $thirdparty_ids param is ignored and replaced by user's socid
|
||||||
$socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids;
|
$socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids;
|
||||||
|
|
||||||
// If the internal user must only see his customers, force searching by him
|
// If the internal user must only see his customers, force searching by him
|
||||||
$search_sale = 0;
|
$search_sale = 0;
|
||||||
if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id;
|
if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id;
|
||||||
@@ -109,7 +109,7 @@ class Invoices extends DolibarrApi
|
|||||||
$sql = "SELECT t.rowid";
|
$sql = "SELECT t.rowid";
|
||||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture as t";
|
$sql.= " FROM ".MAIN_DB_PREFIX."facture as t";
|
||||||
|
|
||||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||||
|
|
||||||
$sql.= ' WHERE t.entity IN ('.getEntity('facture').')';
|
$sql.= ' WHERE t.entity IN ('.getEntity('facture').')';
|
||||||
@@ -117,7 +117,7 @@ class Invoices extends DolibarrApi
|
|||||||
if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")";
|
if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")";
|
||||||
|
|
||||||
if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
||||||
|
|
||||||
// Filter by status
|
// Filter by status
|
||||||
if ($status == 'draft') $sql.= " AND t.fk_statut IN (0)";
|
if ($status == 'draft') $sql.= " AND t.fk_statut IN (0)";
|
||||||
if ($status == 'unpaid') $sql.= " AND t.fk_statut IN (1)";
|
if ($status == 'unpaid') $sql.= " AND t.fk_statut IN (1)";
|
||||||
@@ -129,7 +129,7 @@ class Invoices extends DolibarrApi
|
|||||||
$sql .= " AND sc.fk_user = ".$search_sale;
|
$sql .= " AND sc.fk_user = ".$search_sale;
|
||||||
}
|
}
|
||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters)
|
if ($sqlfilters)
|
||||||
{
|
{
|
||||||
if (! DolibarrApi::_checkFilters($sqlfilters))
|
if (! DolibarrApi::_checkFilters($sqlfilters))
|
||||||
{
|
{
|
||||||
@@ -138,7 +138,7 @@ class Invoices extends DolibarrApi
|
|||||||
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||||
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql.= $db->order($sortfield, $sortorder);
|
$sql.= $db->order($sortfield, $sortorder);
|
||||||
if ($limit) {
|
if ($limit) {
|
||||||
if ($page < 0)
|
if ($page < 0)
|
||||||
@@ -174,10 +174,10 @@ class Invoices extends DolibarrApi
|
|||||||
}
|
}
|
||||||
return $obj_ret;
|
return $obj_ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create invoice object
|
* Create invoice object
|
||||||
*
|
*
|
||||||
* @param array $request_data Request datas
|
* @param array $request_data Request datas
|
||||||
* @return int ID of invoice
|
* @return int ID of invoice
|
||||||
*/
|
*/
|
||||||
@@ -188,7 +188,7 @@ class Invoices extends DolibarrApi
|
|||||||
}
|
}
|
||||||
// Check mandatory fields
|
// Check mandatory fields
|
||||||
$result = $this->_validate($request_data);
|
$result = $this->_validate($request_data);
|
||||||
|
|
||||||
foreach($request_data as $field => $value) {
|
foreach($request_data as $field => $value) {
|
||||||
$this->invoice->$field = $value;
|
$this->invoice->$field = $value;
|
||||||
}
|
}
|
||||||
@@ -203,7 +203,7 @@ class Invoices extends DolibarrApi
|
|||||||
}
|
}
|
||||||
$this->invoice->lines = $lines;
|
$this->invoice->lines = $lines;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
if ($this->invoice->create(DolibarrApiAccess::$user) < 0) {
|
if ($this->invoice->create(DolibarrApiAccess::$user) < 0) {
|
||||||
throw new RestException(500, "Error creating invoice", array_merge(array($this->invoice->error), $this->invoice->errors));
|
throw new RestException(500, "Error creating invoice", array_merge(array($this->invoice->error), $this->invoice->errors));
|
||||||
}
|
}
|
||||||
@@ -214,20 +214,20 @@ class Invoices extends DolibarrApi
|
|||||||
* Update invoice
|
* Update invoice
|
||||||
*
|
*
|
||||||
* @param int $id Id of invoice to update
|
* @param int $id Id of invoice to update
|
||||||
* @param array $request_data Datas
|
* @param array $request_data Datas
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function put($id, $request_data = NULL)
|
function put($id, $request_data = NULL)
|
||||||
{
|
{
|
||||||
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->invoice->fetch($id);
|
$result = $this->invoice->fetch($id);
|
||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Invoice not found');
|
throw new RestException(404, 'Invoice not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
|
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
@@ -236,13 +236,13 @@ class Invoices extends DolibarrApi
|
|||||||
if ($field == 'id') continue;
|
if ($field == 'id') continue;
|
||||||
$this->invoice->$field = $value;
|
$this->invoice->$field = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->invoice->update($id, DolibarrApiAccess::$user))
|
if($this->invoice->update($id, DolibarrApiAccess::$user))
|
||||||
return $this->get ($id);
|
return $this->get ($id);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete invoice
|
* Delete invoice
|
||||||
*
|
*
|
||||||
@@ -258,16 +258,16 @@ class Invoices extends DolibarrApi
|
|||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Invoice not found');
|
throw new RestException(404, 'Invoice not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
|
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
|
||||||
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( $this->invoice->delete($id) < 0)
|
if( $this->invoice->delete($id) < 0)
|
||||||
{
|
{
|
||||||
throw new RestException(500);
|
throw new RestException(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'success' => array(
|
'success' => array(
|
||||||
'code' => 200,
|
'code' => 200,
|
||||||
@@ -275,13 +275,76 @@ class Invoices extends DolibarrApi
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate an order
|
||||||
|
*
|
||||||
|
* @param int $id Order ID
|
||||||
|
* @param int $idwarehouse Warehouse ID
|
||||||
|
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||||
|
*
|
||||||
|
* @url POST {id}/validate
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
* FIXME An error 403 is returned if the request has an empty body.
|
||||||
|
* Error message: "Forbidden: Content type `text/plain` is not supported."
|
||||||
|
* Workaround: send this in the body
|
||||||
|
* {
|
||||||
|
* "idwarehouse": 0,
|
||||||
|
* "notrigger": 0
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
function validate($id, $idwarehouse=0, $notrigger=0)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
$result = $this->invoice->fetch($id);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'Invoice not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->invoice->validate(DolibarrApiAccess::$user, '', $idwarehouse, $notrigger);
|
||||||
|
if ($result == 0) {
|
||||||
|
throw new RestException(500, 'Error nothing done. May be object is already validated');
|
||||||
|
}
|
||||||
|
if ($result < 0) {
|
||||||
|
throw new RestException(500, 'Error when validating Invoice: '.$this->invoice->error);
|
||||||
|
}
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'success' => array(
|
||||||
|
'code' => 200,
|
||||||
|
'message' => 'Invoice validated (Ref='.$this->invoice->ref.')'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean sensible object datas
|
||||||
|
*
|
||||||
|
* @param object $object Object to clean
|
||||||
|
* @return array Array of cleaned object properties
|
||||||
|
*/
|
||||||
|
function _cleanObjectDatas($object) {
|
||||||
|
|
||||||
|
$object = parent::_cleanObjectDatas($object);
|
||||||
|
|
||||||
|
unset($object->address);
|
||||||
|
|
||||||
|
return $object;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate fields before create or update object
|
* Validate fields before create or update object
|
||||||
*
|
*
|
||||||
* @param array|null $data Datas to validate
|
* @param array|null $data Datas to validate
|
||||||
* @return array
|
* @return array
|
||||||
*
|
*
|
||||||
* @throws RestException
|
* @throws RestException
|
||||||
*/
|
*/
|
||||||
function _validate($data)
|
function _validate($data)
|
||||||
@@ -294,5 +357,5 @@ class Invoices extends DolibarrApi
|
|||||||
}
|
}
|
||||||
return $invoice;
|
return $invoice;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -151,9 +151,9 @@ class Localtax extends CommonObject
|
|||||||
// Update request
|
// Update request
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."localtax SET";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."localtax SET";
|
||||||
$sql.= " localtaxtype=".$this->ltt.",";
|
$sql.= " localtaxtype=".$this->ltt.",";
|
||||||
$sql.= " tms=".$this->db->idate($this->tms).",";
|
$sql.= " tms='".$this->db->idate($this->tms)."',";
|
||||||
$sql.= " datep=".$this->db->idate($this->datep).",";
|
$sql.= " datep='".$this->db->idate($this->datep)."',";
|
||||||
$sql.= " datev=".$this->db->idate($this->datev).",";
|
$sql.= " datev='".$this->db->idate($this->datev)."',";
|
||||||
$sql.= " amount=".price2num($this->amount).",";
|
$sql.= " amount=".price2num($this->amount).",";
|
||||||
$sql.= " label='".$this->db->escape($this->label)."',";
|
$sql.= " label='".$this->db->escape($this->label)."',";
|
||||||
$sql.= " note='".$this->db->escape($this->note)."',";
|
$sql.= " note='".$this->db->escape($this->note)."',";
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
|
||||||
|
* Copyright (C) 2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -31,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||||
|
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
||||||
|
|
||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
$langs->load("compta");
|
$langs->load("compta");
|
||||||
@@ -130,7 +132,7 @@ else
|
|||||||
$sql = "SELECT DISTINCT p.rowid, p.ref, p.datep as dp, p.amount,"; // DISTINCT is to avoid duplicate when there is a link to sales representatives
|
$sql = "SELECT DISTINCT p.rowid, p.ref, p.datep as dp, p.amount,"; // DISTINCT is to avoid duplicate when there is a link to sales representatives
|
||||||
$sql.= " p.statut, p.num_paiement,";
|
$sql.= " p.statut, p.num_paiement,";
|
||||||
$sql.= " c.code as paiement_code,";
|
$sql.= " c.code as paiement_code,";
|
||||||
$sql.= " ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.accountancy_journal as accountancy_journal,";
|
$sql.= " ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.fk_accountancy_journal as accountancy_journal,";
|
||||||
$sql.= " s.rowid as socid, s.nom as name";
|
$sql.= " s.rowid as socid, s.nom as name";
|
||||||
// Add fields for extrafields
|
// Add fields for extrafields
|
||||||
foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
|
foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
|
||||||
@@ -331,7 +333,11 @@ if ($resql)
|
|||||||
$accountstatic->label=$objp->blabel;
|
$accountstatic->label=$objp->blabel;
|
||||||
$accountstatic->number=$objp->number;
|
$accountstatic->number=$objp->number;
|
||||||
$accountstatic->account_number=$objp->account_number;
|
$accountstatic->account_number=$objp->account_number;
|
||||||
$accountstatic->accountancy_journal=$objp->accountancy_journal;
|
|
||||||
|
$accountingjournal = new AccountingJournal($db);
|
||||||
|
$accountingjournal->fetch($objp->accountancy_journal);
|
||||||
|
$accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0,1,1,'',1);
|
||||||
|
|
||||||
print $accountstatic->getNomUrl(1);
|
print $accountstatic->getNomUrl(1);
|
||||||
}
|
}
|
||||||
else print ' ';
|
else print ' ';
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class PaymentSalary extends CommonObject
|
|||||||
//public $element='payment_salary'; //!< Id that identify managed objects
|
//public $element='payment_salary'; //!< Id that identify managed objects
|
||||||
//public $table_element='payment_salary'; //!< Name of table without prefix where object is stored
|
//public $table_element='payment_salary'; //!< Name of table without prefix where object is stored
|
||||||
public $picto='payment';
|
public $picto='payment';
|
||||||
|
|
||||||
public $tms;
|
public $tms;
|
||||||
public $fk_user;
|
public $fk_user;
|
||||||
public $datep;
|
public $datep;
|
||||||
@@ -97,16 +97,16 @@ class PaymentSalary extends CommonObject
|
|||||||
// Update request
|
// Update request
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."payment_salary SET";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."payment_salary SET";
|
||||||
|
|
||||||
$sql.= " tms=".$this->db->idate($this->tms).",";
|
$sql.= " tms='".$this->db->idate($this->tms)."',";
|
||||||
$sql.= " fk_user=".$this->fk_user.",";
|
$sql.= " fk_user=".$this->fk_user.",";
|
||||||
$sql.= " datep=".$this->db->idate($this->datep).",";
|
$sql.= " datep='".$this->db->idate($this->datep)."',";
|
||||||
$sql.= " datev=".$this->db->idate($this->datev).",";
|
$sql.= " datev='".$this->db->idate($this->datev)."',";
|
||||||
$sql.= " amount=".price2num($this->amount).",";
|
$sql.= " amount=".price2num($this->amount).",";
|
||||||
$sql.= " fk_typepayment=".$this->fk_typepayment."',";
|
$sql.= " fk_typepayment=".$this->fk_typepayment."',";
|
||||||
$sql.= " num_payment='".$this->db->escape($this->num_payment)."',";
|
$sql.= " num_payment='".$this->db->escape($this->num_payment)."',";
|
||||||
$sql.= " label='".$this->db->escape($this->label)."',";
|
$sql.= " label='".$this->db->escape($this->label)."',";
|
||||||
$sql.= " datesp=".$this->db->idate($this->datesp).",";
|
$sql.= " datesp='".$this->db->idate($this->datesp)."',";
|
||||||
$sql.= " dateep=".$this->db->idate($this->dateep).",";
|
$sql.= " dateep='".$this->db->idate($this->dateep)."',";
|
||||||
$sql.= " note='".$this->db->escape($this->note)."',";
|
$sql.= " note='".$this->db->escape($this->note)."',";
|
||||||
$sql.= " fk_bank=".($this->fk_bank > 0 ? "'".$this->fk_bank."'":"null").",";
|
$sql.= " fk_bank=".($this->fk_bank > 0 ? "'".$this->fk_bank."'":"null").",";
|
||||||
$sql.= " fk_user_author=".$this->fk_user_author.",";
|
$sql.= " fk_user_author=".$this->fk_user_author.",";
|
||||||
@@ -548,7 +548,7 @@ class PaymentSalary extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee)
|
* Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee)
|
||||||
*
|
*
|
||||||
@@ -559,7 +559,7 @@ class PaymentSalary extends CommonObject
|
|||||||
{
|
{
|
||||||
return $this->LibStatut($this->statut,$mode);
|
return $this->LibStatut($this->statut,$mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renvoi le libelle d'un statut donne
|
* Renvoi le libelle d'un statut donne
|
||||||
*
|
*
|
||||||
@@ -570,7 +570,7 @@ class PaymentSalary extends CommonObject
|
|||||||
function LibStatut($status,$mode=0)
|
function LibStatut($status,$mode=0)
|
||||||
{
|
{
|
||||||
global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage
|
global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage
|
||||||
|
|
||||||
$langs->load('compta');
|
$langs->load('compta');
|
||||||
/*if ($mode == 0)
|
/*if ($mode == 0)
|
||||||
{
|
{
|
||||||
@@ -609,5 +609,5 @@ class PaymentSalary extends CommonObject
|
|||||||
}*/
|
}*/
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -173,9 +173,9 @@ class Tva extends CommonObject
|
|||||||
|
|
||||||
// Update request
|
// Update request
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."tva SET";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."tva SET";
|
||||||
$sql.= " tms=".$this->db->idate($this->tms).",";
|
$sql.= " tms='".$this->db->idate($this->tms)."',";
|
||||||
$sql.= " datep=".$this->db->idate($this->datep).",";
|
$sql.= " datep='".$this->db->idate($this->datep)."',";
|
||||||
$sql.= " datev=".$this->db->idate($this->datev).",";
|
$sql.= " datev='".$this->db->idate($this->datev)."',";
|
||||||
$sql.= " amount=".price2num($this->amount).",";
|
$sql.= " amount=".price2num($this->amount).",";
|
||||||
$sql.= " label='".$this->db->escape($this->label)."',";
|
$sql.= " label='".$this->db->escape($this->label)."',";
|
||||||
$sql.= " note='".$this->db->escape($this->note)."',";
|
$sql.= " note='".$this->db->escape($this->note)."',";
|
||||||
|
|||||||
@@ -48,12 +48,15 @@ if ($user->societe_id) $socid=$user->societe_id;
|
|||||||
$result = restrictedArea($user, 'contact', $contactid,'');
|
$result = restrictedArea($user, 'contact', $contactid,'');
|
||||||
|
|
||||||
$sall=GETPOST('sall', 'alphanohtml');
|
$sall=GETPOST('sall', 'alphanohtml');
|
||||||
|
$search_cti=preg_replace('/^0+/', '', preg_replace('/[^0-9]/', '', GETPOST('search_cti', 'alphanohtml'))); // Phone number without any special chars
|
||||||
|
$search_phone=GETPOST("search_phone");
|
||||||
|
|
||||||
|
$search_id=trim(GETPOST("search_id","int"));
|
||||||
$search_firstlast_only=GETPOST("search_firstlast_only");
|
$search_firstlast_only=GETPOST("search_firstlast_only");
|
||||||
$search_lastname=GETPOST("search_lastname");
|
$search_lastname=GETPOST("search_lastname");
|
||||||
$search_firstname=GETPOST("search_firstname");
|
$search_firstname=GETPOST("search_firstname");
|
||||||
$search_societe=GETPOST("search_societe");
|
$search_societe=GETPOST("search_societe");
|
||||||
$search_poste=GETPOST("search_poste");
|
$search_poste=GETPOST("search_poste");
|
||||||
$search_phone=GETPOST("search_phone");
|
|
||||||
$search_phone_perso=GETPOST("search_phone_perso");
|
$search_phone_perso=GETPOST("search_phone_perso");
|
||||||
$search_phone_pro=GETPOST("search_phone_pro");
|
$search_phone_pro=GETPOST("search_phone_pro");
|
||||||
$search_phone_mobile=GETPOST("search_phone_mobile");
|
$search_phone_mobile=GETPOST("search_phone_mobile");
|
||||||
@@ -66,6 +69,7 @@ $search_categ_thirdparty=GETPOST("search_categ_thirdparty",'int');
|
|||||||
$search_categ_supplier=GETPOST("search_categ_supplier",'int');
|
$search_categ_supplier=GETPOST("search_categ_supplier",'int');
|
||||||
$search_status=GETPOST("search_status",'int');
|
$search_status=GETPOST("search_status",'int');
|
||||||
$search_type=GETPOST('search_type','alpha');
|
$search_type=GETPOST('search_type','alpha');
|
||||||
|
$search_import_key = GETPOST("search_import_key","alpha");
|
||||||
if ($search_status=='') $search_status=1; // always display activ customer first
|
if ($search_status=='') $search_status=1; // always display activ customer first
|
||||||
|
|
||||||
$optioncss = GETPOST('optioncss','alpha');
|
$optioncss = GETPOST('optioncss','alpha');
|
||||||
@@ -132,22 +136,24 @@ $fieldstosearchall = array(
|
|||||||
|
|
||||||
// Definition of fields for list
|
// Definition of fields for list
|
||||||
$arrayfields=array(
|
$arrayfields=array(
|
||||||
'p.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1),
|
'p.rowid'=>array('label'=>"TechnicalID", 'checked'=>($conf->global->MAIN_SHOW_TECHNICAL_ID?1:0), 'enabled'=>($conf->global->MAIN_SHOW_TECHNICAL_ID?1:0)),
|
||||||
'p.firstname'=>array('label'=>$langs->trans("Firstname"), 'checked'=>1),
|
'p.lastname'=>array('label'=>"Lastname", 'checked'=>1),
|
||||||
'p.poste'=>array('label'=>$langs->trans("PostOrFunction"), 'checked'=>1),
|
'p.firstname'=>array('label'=>"Firstname", 'checked'=>1),
|
||||||
'p.town'=>array('label'=>$langs->trans("Town"), 'checked'=>0),
|
'p.poste'=>array('label'=>"PostOrFunction", 'checked'=>1),
|
||||||
'p.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>0),
|
'p.town'=>array('label'=>"Town", 'checked'=>0),
|
||||||
'p.phone'=>array('label'=>$langs->trans("Phone"), 'checked'=>1),
|
'p.zip'=>array('label'=>"Zip", 'checked'=>0),
|
||||||
'p.phone_perso'=>array('label'=>$langs->trans("PhonePerso"), 'checked'=>0),
|
'p.phone'=>array('label'=>"Phone", 'checked'=>1),
|
||||||
'p.phone_mobile'=>array('label'=>$langs->trans("PhoneMobile"), 'checked'=>1),
|
'p.phone_perso'=>array('label'=>"PhonePerso", 'checked'=>0),
|
||||||
'p.fax'=>array('label'=>$langs->trans("Fax"), 'checked'=>1),
|
'p.phone_mobile'=>array('label'=>"PhoneMobile", 'checked'=>1),
|
||||||
'p.email'=>array('label'=>$langs->trans("EMail"), 'checked'=>1),
|
'p.fax'=>array('label'=>"Fax", 'checked'=>1),
|
||||||
'p.skype'=>array('label'=>$langs->trans("Skype"), 'checked'=>1, 'enabled'=>(! empty($conf->skype->enabled))),
|
'p.email'=>array('label'=>"EMail", 'checked'=>1),
|
||||||
'p.thirdparty'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1, 'enabled'=>empty($conf->global->SOCIETE_DISABLE_CONTACTS)),
|
'p.skype'=>array('label'=>"Skype", 'checked'=>1, 'enabled'=>(! empty($conf->skype->enabled))),
|
||||||
'p.priv'=>array('label'=>$langs->trans("ContactVisibility"), 'checked'=>1, 'position'=>200),
|
'p.thirdparty'=>array('label'=>"ThirdParty", 'checked'=>1, 'enabled'=>empty($conf->global->SOCIETE_DISABLE_CONTACTS)),
|
||||||
'p.datec'=>array('label'=>$langs->trans("DateCreationShort"), 'checked'=>0, 'position'=>500),
|
'p.priv'=>array('label'=>"ContactVisibility", 'checked'=>1, 'position'=>200),
|
||||||
'p.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
'p.datec'=>array('label'=>"DateCreationShort", 'checked'=>0, 'position'=>500),
|
||||||
'p.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
'p.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
|
||||||
|
'p.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
|
||||||
|
'p.import_key'=>array('label'=>"ImportId", 'checked'=>0, 'position'=>1100),
|
||||||
);
|
);
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||||
@@ -186,6 +192,7 @@ if (empty($reshook))
|
|||||||
if (GETPOST('button_removefilter_x') || GETPOST('button_removefilter.x') || GETPOST('button_removefilter')) // All tests are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x') || GETPOST('button_removefilter.x') || GETPOST('button_removefilter')) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$sall="";
|
$sall="";
|
||||||
|
$search_id='';
|
||||||
$search_firstlast_only="";
|
$search_firstlast_only="";
|
||||||
$search_lastname="";
|
$search_lastname="";
|
||||||
$search_firstname="";
|
$search_firstname="";
|
||||||
@@ -203,6 +210,7 @@ if (empty($reshook))
|
|||||||
$search_categ='';
|
$search_categ='';
|
||||||
$search_categ_thirdparty='';
|
$search_categ_thirdparty='';
|
||||||
$search_categ_supplier='';
|
$search_categ_supplier='';
|
||||||
|
$search_import_key='';
|
||||||
$toselect='';
|
$toselect='';
|
||||||
$search_array_options=array();
|
$search_array_options=array();
|
||||||
}
|
}
|
||||||
@@ -272,53 +280,27 @@ if ($search_categ > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_ca
|
|||||||
if ($search_categ == -2) $sql.= " AND cc.fk_categorie IS NULL";
|
if ($search_categ == -2) $sql.= " AND cc.fk_categorie IS NULL";
|
||||||
if ($search_categ_thirdparty > 0) $sql.= " AND cs.fk_categorie = ".$db->escape($search_categ_thirdparty);
|
if ($search_categ_thirdparty > 0) $sql.= " AND cs.fk_categorie = ".$db->escape($search_categ_thirdparty);
|
||||||
if ($search_categ_thirdparty == -2) $sql.= " AND cs.fk_categorie IS NULL";
|
if ($search_categ_thirdparty == -2) $sql.= " AND cs.fk_categorie IS NULL";
|
||||||
if ($search_categ_supplier > 0) $sql.= " AND cs2.fk_categorie = ".$db->escape($search_categ_supplier);
|
if ($search_categ_supplier > 0) $sql.= " AND cs2.fk_categorie = ".$db->escape($search_categ_supplier);
|
||||||
if ($search_categ_supplier == -2) $sql.= " AND cs2.fk_categorie IS NULL";
|
if ($search_categ_supplier == -2) $sql.= " AND cs2.fk_categorie IS NULL";
|
||||||
|
|
||||||
if ($search_firstlast_only) {
|
if ($sall) $sql.= natural_search(array_keys($fieldstosearchall), $sall);
|
||||||
$sql .= natural_search(array('p.lastname','p.firstname'), $search_firstlast_only);
|
if (strlen($search_phone)) $sql.= natural_search(array('p.phone', 'p.phone_perso', 'p.phone_mobile'), $search_phone);
|
||||||
}
|
if (strlen($search_cti)) $sql.= natural_search(array('p.phone', 'p.phone_perso', 'p.phone_mobile'), $search_cti);
|
||||||
if ($search_lastname) { // filter on lastname
|
if (strlen($search_firstlast_only)) $sql.= natural_search(array('p.lastname', 'p.firstname'), $search_firstlast_only);
|
||||||
$sql .= natural_search('p.lastname', $search_lastname);
|
|
||||||
}
|
if ($search_id > 0) $sql.= natural_search("p.rowid",$search_id,1);
|
||||||
if ($search_firstname) { // filter on firstname
|
if ($search_lastname) $sql.= natural_search('p.lastname', $search_lastname);
|
||||||
$sql .= natural_search('p.firstname', $search_firstname);
|
if ($search_firstname) $sql.= natural_search('p.firstname', $search_firstname);
|
||||||
}
|
if ($search_societe) $sql.= natural_search('s.nom', $search_societe);
|
||||||
if ($search_societe) { // filtre sur la societe
|
if (strlen($search_poste)) $sql.= natural_search('p.poste', $search_poste);
|
||||||
$sql .= natural_search('s.nom', $search_societe);
|
if (strlen($search_phone_perso)) $sql.= natural_search('p.phone_perso', $search_phone_perso);
|
||||||
}
|
if (strlen($search_phone_pro)) $sql.= natural_search('p.phone', $search_phone);
|
||||||
if (strlen($search_poste)) { // filtre sur la societe
|
if (strlen($search_phone_mobile)) $sql.= natural_search('p.phone_mobile', $search_phone_mobile);
|
||||||
$sql .= natural_search('p.poste', $search_poste);
|
if (strlen($search_fax)) $sql.= natural_search('p.phone_fax', $search_fax);
|
||||||
}
|
if (strlen($search_skype)) $sql.= natural_search('p.skype', $search_skype);
|
||||||
if (strlen($search_phone))
|
if (strlen($search_email)) $sql.= natural_search('p.email', $search_email);
|
||||||
{
|
if ($search_status != '' && $search_status >= 0) $sql.= " AND p.statut = ".$db->escape($search_status);
|
||||||
$sql .= " AND (p.phone LIKE '%".$db->escape($search_phone)."%' OR p.phone_perso LIKE '%".$db->escape($search_phone)."%' OR p.phone_mobile LIKE '%".$db->escape($search_phone)."%')";
|
if ($search_import_key) $sql.= natural_search("p.import_key",$search_import_key);
|
||||||
}
|
|
||||||
if (strlen($search_phone_perso))
|
|
||||||
{
|
|
||||||
$sql .= " AND p.phone_perso LIKE '%".$db->escape($search_phone_perso)."%'";
|
|
||||||
}
|
|
||||||
if (strlen($search_phone_pro))
|
|
||||||
{
|
|
||||||
$sql .= " AND p.phone LIKE '%".$db->escape($search_phone_pro)."%'";
|
|
||||||
}
|
|
||||||
if (strlen($search_phone_mobile))
|
|
||||||
{
|
|
||||||
$sql .= " AND p.phone_mobile LIKE '%".$db->escape($search_phone_mobile)."%'";
|
|
||||||
}
|
|
||||||
if (strlen($search_fax))
|
|
||||||
{
|
|
||||||
$sql .= " AND p.fax LIKE '%".$db->escape($search_fax)."%'";
|
|
||||||
}
|
|
||||||
if (strlen($search_email)) // filtre sur l'email
|
|
||||||
{
|
|
||||||
$sql .= " AND p.email LIKE '%".$db->escape($search_email)."%'";
|
|
||||||
}
|
|
||||||
if (strlen($search_skype)) // filtre sur skype
|
|
||||||
{
|
|
||||||
$sql .= " AND p.skype LIKE '%".$db->escape($search_skype)."%'";
|
|
||||||
}
|
|
||||||
if ($search_status != '' && $search_status >= 0) $sql .= " AND p.statut = ".$db->escape($search_status);
|
|
||||||
if ($type == "o") // filtre sur type
|
if ($type == "o") // filtre sur type
|
||||||
{
|
{
|
||||||
$sql .= " AND p.fk_soc IS NULL";
|
$sql .= " AND p.fk_soc IS NULL";
|
||||||
@@ -335,10 +317,6 @@ else if ($type == "p") // filtre sur type
|
|||||||
{
|
{
|
||||||
$sql .= " AND s.client IN (2, 3)";
|
$sql .= " AND s.client IN (2, 3)";
|
||||||
}
|
}
|
||||||
if ($sall)
|
|
||||||
{
|
|
||||||
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
|
||||||
}
|
|
||||||
if (! empty($socid))
|
if (! empty($socid))
|
||||||
{
|
{
|
||||||
$sql .= " AND s.rowid = ".$socid;
|
$sql .= " AND s.rowid = ".$socid;
|
||||||
@@ -391,7 +369,7 @@ $num = $db->num_rows($result);
|
|||||||
|
|
||||||
$arrayofselected=is_array($toselect)?$toselect:array();
|
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||||
|
|
||||||
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall)
|
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && ($sall != '' || $seearch_cti != ''))
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
$id = $obj->rowid;
|
$id = $obj->rowid;
|
||||||
@@ -411,6 +389,7 @@ if (!empty($search_categ)) $param.='&search_categ='.urlencode($search_categ);
|
|||||||
if (!empty($search_categ_thirdparty)) $param.='&search_categ_thirdparty='.urlencode($search_categ_thirdparty);
|
if (!empty($search_categ_thirdparty)) $param.='&search_categ_thirdparty='.urlencode($search_categ_thirdparty);
|
||||||
if (!empty($search_categ_supplier)) $param.='&search_categ_supplier='.urlencode($search_categ_supplier);
|
if (!empty($search_categ_supplier)) $param.='&search_categ_supplier='.urlencode($search_categ_supplier);
|
||||||
if ($sall != '') $param.='&sall='.urlencode($sall);
|
if ($sall != '') $param.='&sall='.urlencode($sall);
|
||||||
|
if ($search_id > 0) $param.= "&search_id=".urlencode($search_id);
|
||||||
if ($search_lastname != '') $param.='&search_lastname='.urlencode($search_lastname);
|
if ($search_lastname != '') $param.='&search_lastname='.urlencode($search_lastname);
|
||||||
if ($search_firstname != '') $param.='&search_firstname='.urlencode($search_firstname);
|
if ($search_firstname != '') $param.='&search_firstname='.urlencode($search_firstname);
|
||||||
if ($search_societe != '') $param.='&search_societe='.urlencode($search_societe);
|
if ($search_societe != '') $param.='&search_societe='.urlencode($search_societe);
|
||||||
@@ -424,6 +403,7 @@ if ($search_fax != '') $param.='&search_fax='.urlencode($search_fax);
|
|||||||
if ($search_email != '') $param.='&search_email='.urlencode($search_email);
|
if ($search_email != '') $param.='&search_email='.urlencode($search_email);
|
||||||
if ($search_status != '') $param.='&search_status='.urlencode($search_status);
|
if ($search_status != '') $param.='&search_status='.urlencode($search_status);
|
||||||
if ($search_priv == '0' || $search_priv == '1') $param.="&search_priv=".urlencode($search_priv);
|
if ($search_priv == '0' || $search_priv == '1') $param.="&search_priv=".urlencode($search_priv);
|
||||||
|
if ($search_import_key != '') $param.='&search_import_key='.urlencode($search_import_key);
|
||||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||||
// Add $param from extra fields
|
// Add $param from extra fields
|
||||||
foreach ($search_array_options as $key => $val)
|
foreach ($search_array_options as $key => $val)
|
||||||
@@ -508,6 +488,12 @@ print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"")
|
|||||||
|
|
||||||
// Lines for filter fields
|
// Lines for filter fields
|
||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
|
if (! empty($arrayfields['p.rowid']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre">';
|
||||||
|
print '<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dol_escape_htmltag($search_id).'">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
if (! empty($arrayfields['p.lastname']['checked']))
|
if (! empty($arrayfields['p.lastname']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
@@ -629,10 +615,16 @@ if (! empty($arrayfields['p.tms']['checked']))
|
|||||||
// Status
|
// Status
|
||||||
if (! empty($arrayfields['p.statut']['checked']))
|
if (! empty($arrayfields['p.statut']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre" align="center">';
|
print '<td class="liste_titre center">';
|
||||||
print $form->selectarray('search_status', array('-1'=>'', '0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status);
|
print $form->selectarray('search_status', array('-1'=>'', '0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
if (! empty($arrayfields['p.import_key']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre center">';
|
||||||
|
print '<input class="flat searchstring" type="text" name="search_import_key" size="3" value="'.dol_escape_htmltag($search_import_key).'">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
// Action column
|
// Action column
|
||||||
print '<td class="liste_titre" align="right">';
|
print '<td class="liste_titre" align="right">';
|
||||||
$searchpicto=$form->showFilterButtons();
|
$searchpicto=$form->showFilterButtons();
|
||||||
@@ -643,19 +635,20 @@ print '</tr>';
|
|||||||
|
|
||||||
// Ligne des titres
|
// Ligne des titres
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
if (! empty($arrayfields['p.lastname']['checked'])) print_liste_field_titre($langs->trans("Lastname"),$_SERVER["PHP_SELF"],"p.lastname", $begin, $param, '', $sortfield,$sortorder);
|
if (! empty($arrayfields['p.rowid']['checked'])) print_liste_field_titre($arrayfields['p.rowid']['label'], $_SERVER["PHP_SELF"],"p.rowid","",$param,"",$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['p.firstname']['checked'])) print_liste_field_titre($langs->trans("Firstname"),$_SERVER["PHP_SELF"],"p.firstname", $begin, $param, '', $sortfield,$sortorder);
|
if (! empty($arrayfields['p.lastname']['checked'])) print_liste_field_titre($arrayfields['p.lastname']['label'],$_SERVER["PHP_SELF"],"p.lastname", $begin, $param, '', $sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['p.zip']['checked'])) print_liste_field_titre($langs->trans("Zip"),$_SERVER["PHP_SELF"],"p.zip", $begin, $param, '', $sortfield,$sortorder);
|
if (! empty($arrayfields['p.firstname']['checked'])) print_liste_field_titre($arrayfields['p.firstname']['label'],$_SERVER["PHP_SELF"],"p.firstname", $begin, $param, '', $sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['p.town']['checked'])) print_liste_field_titre($langs->trans("Town"),$_SERVER["PHP_SELF"],"p.town", $begin, $param, '', $sortfield,$sortorder);
|
if (! empty($arrayfields['p.zip']['checked'])) print_liste_field_titre($arrayfields['p.zip']['label'],$_SERVER["PHP_SELF"],"p.zip", $begin, $param, '', $sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['p.poste']['checked'])) print_liste_field_titre($langs->trans("PostOrFunction"),$_SERVER["PHP_SELF"],"p.poste", $begin, $param, '', $sortfield,$sortorder);
|
if (! empty($arrayfields['p.town']['checked'])) print_liste_field_titre($arrayfields['p.town']['label'],$_SERVER["PHP_SELF"],"p.town", $begin, $param, '', $sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['p.phone']['checked'])) print_liste_field_titre($langs->trans("Phone"),$_SERVER["PHP_SELF"],"p.phone", $begin, $param, '', $sortfield,$sortorder);
|
if (! empty($arrayfields['p.poste']['checked'])) print_liste_field_titre($arrayfields['p.poste']['label'],$_SERVER["PHP_SELF"],"p.poste", $begin, $param, '', $sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['p.phone_perso']['checked'])) print_liste_field_titre($langs->trans("PhonePerso"),$_SERVER["PHP_SELF"],"p.phone_perso", $begin, $param, '', $sortfield,$sortorder);
|
if (! empty($arrayfields['p.phone']['checked'])) print_liste_field_titre($arrayfields['p.phone']['label'],$_SERVER["PHP_SELF"],"p.phone", $begin, $param, '', $sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['p.phone_mobile']['checked'])) print_liste_field_titre($langs->trans("PhoneMobile"),$_SERVER["PHP_SELF"],"p.phone_mobile", $begin, $param, '', $sortfield,$sortorder);
|
if (! empty($arrayfields['p.phone_perso']['checked'])) print_liste_field_titre($arrayfields['p.phone_perso']['label'],$_SERVER["PHP_SELF"],"p.phone_perso", $begin, $param, '', $sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['p.fax']['checked'])) print_liste_field_titre($langs->trans("Fax"),$_SERVER["PHP_SELF"],"p.fax", $begin, $param, '', $sortfield,$sortorder);
|
if (! empty($arrayfields['p.phone_mobile']['checked'])) print_liste_field_titre($arrayfields['p.phone_mobile']['label'],$_SERVER["PHP_SELF"],"p.phone_mobile", $begin, $param, '', $sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['p.email']['checked'])) print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"p.email", $begin, $param, '', $sortfield,$sortorder);
|
if (! empty($arrayfields['p.fax']['checked'])) print_liste_field_titre($arrayfields['p.fax']['label'],$_SERVER["PHP_SELF"],"p.fax", $begin, $param, '', $sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['p.skype']['checked'])) print_liste_field_titre($langs->trans("Skype"),$_SERVER["PHP_SELF"],"p.skype", $begin, $param, '', $sortfield,$sortorder);
|
if (! empty($arrayfields['p.email']['checked'])) print_liste_field_titre($arrayfields['p.email']['label'],$_SERVER["PHP_SELF"],"p.email", $begin, $param, '', $sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['p.thirdparty']['checked'])) print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom", $begin, $param, '', $sortfield,$sortorder);
|
if (! empty($arrayfields['p.skype']['checked'])) print_liste_field_titre($arrayfields['p.skype']['label'],$_SERVER["PHP_SELF"],"p.skype", $begin, $param, '', $sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['p.priv']['checked'])) print_liste_field_titre($langs->trans("ContactVisibility"),$_SERVER["PHP_SELF"],"p.priv", $begin, $param, 'align="center"', $sortfield,$sortorder);
|
if (! empty($arrayfields['p.thirdparty']['checked'])) print_liste_field_titre($arrayfields['p.thirdparty']['label'],$_SERVER["PHP_SELF"],"s.nom", $begin, $param, '', $sortfield,$sortorder);
|
||||||
|
if (! empty($arrayfields['p.priv']['checked'])) print_liste_field_titre($arrayfields['p.priv']['label'],$_SERVER["PHP_SELF"],"p.priv", $begin, $param, 'align="center"', $sortfield,$sortorder);
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||||
{
|
{
|
||||||
@@ -674,9 +667,10 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
$parameters=array('arrayfields'=>$arrayfields);
|
$parameters=array('arrayfields'=>$arrayfields);
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($langs->trans("DateCreationShort"),$_SERVER["PHP_SELF"],"p.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'],$_SERVER["PHP_SELF"],"p.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"p.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'],$_SERVER["PHP_SELF"],"p.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['p.statut']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut","",$param,'align="center"',$sortfield,$sortorder);
|
if (! empty($arrayfields['p.statut']['checked'])) print_liste_field_titre($arrayfields['p.statut']['label'],$_SERVER["PHP_SELF"],"p.statut","",$param,'align="center"',$sortfield,$sortorder);
|
||||||
|
if (! empty($arrayfields['p.import_key']['checked'])) print_liste_field_titre($arrayfields['p.import_key']['label'],$_SERVER["PHP_SELF"],"p.import_key","",$param,'align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
|
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
@@ -701,7 +695,15 @@ while ($i < min($num,$limit))
|
|||||||
$contactstatic->zip=$obj->zip;
|
$contactstatic->zip=$obj->zip;
|
||||||
$contactstatic->town=$obj->town;
|
$contactstatic->town=$obj->town;
|
||||||
|
|
||||||
// Name
|
// ID
|
||||||
|
if (! empty($arrayfields['p.rowid']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="tdoverflowmax50">';
|
||||||
|
print $obj->rowid;
|
||||||
|
print "</td>\n";
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
// Name
|
||||||
if (! empty($arrayfields['p.lastname']['checked']))
|
if (! empty($arrayfields['p.lastname']['checked']))
|
||||||
{
|
{
|
||||||
print '<td valign="middle">';
|
print '<td valign="middle">';
|
||||||
@@ -836,8 +838,15 @@ while ($i < min($num,$limit))
|
|||||||
print '<td align="center">'.$contactstatic->getLibStatut(3).'</td>';
|
print '<td align="center">'.$contactstatic->getLibStatut(3).'</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
|
if (! empty($arrayfields['p.import_key']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="tdoverflowmax100">';
|
||||||
|
print $obj->import_key;
|
||||||
|
print "</td>\n";
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
// Action column
|
// Action column
|
||||||
print '<td class="nowrap" align="center">';
|
print '<td class="nowrap" align="center">';
|
||||||
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -83,17 +83,17 @@ class box_activity extends ModeleBoxes
|
|||||||
$cachetime = 3600;
|
$cachetime = 3600;
|
||||||
$fileid = '-e'.$conf->entity.'-u'.$user->id.'-s'.$user->societe_id.'-r'.($user->rights->societe->client->voir?'1':'0').'.cache';
|
$fileid = '-e'.$conf->entity.'-u'.$user->id.'-s'.$user->societe_id.'-r'.($user->rights->societe->client->voir?'1':'0').'.cache';
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
$nbofyears=2;
|
$nbofperiod=3;
|
||||||
|
|
||||||
if (! empty($conf->global->MAIN_BOX_ACTIVITY_DURATION)) $nbofyears=$conf->global->MAIN_BOX_ACTIVITY_DURATION;
|
if (! empty($conf->global->MAIN_BOX_ACTIVITY_DURATION)) $nbofperiod=$conf->global->MAIN_BOX_ACTIVITY_DURATION;
|
||||||
$textHead = $langs->trans("Activity").' - '.$langs->trans("LastXMonthRolling", $nbofyears*12);
|
$textHead = $langs->trans("Activity").' - '.$langs->trans("LastXMonthRolling", $nbofperiod);
|
||||||
$this->info_box_head = array(
|
$this->info_box_head = array(
|
||||||
'text' => $textHead,
|
'text' => $textHead,
|
||||||
'limit'=> dol_strlen($textHead),
|
'limit'=> dol_strlen($textHead),
|
||||||
);
|
);
|
||||||
|
|
||||||
// compute the year limit to show
|
// compute the year limit to show
|
||||||
$tmpdate= dol_time_plus_duree(dol_now(), -1*$nbofyears, "y");
|
$tmpdate= dol_time_plus_duree(dol_now(), -1*$nbofperiod, "m");
|
||||||
|
|
||||||
$cumuldata = array();
|
$cumuldata = array();
|
||||||
|
|
||||||
@@ -103,6 +103,7 @@ class box_activity extends ModeleBoxes
|
|||||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||||
$facturestatic=new Facture($db);
|
$facturestatic=new Facture($db);
|
||||||
|
|
||||||
|
// part 1
|
||||||
$cachedir = DOL_DATA_ROOT.'/facture/temp';
|
$cachedir = DOL_DATA_ROOT.'/facture/temp';
|
||||||
$filename = '/boxactivity-invoice'.$fileid;
|
$filename = '/boxactivity-invoice'.$fileid;
|
||||||
|
|
||||||
@@ -189,6 +190,7 @@ class box_activity extends ModeleBoxes
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// part 2
|
||||||
$cachedir = DOL_DATA_ROOT.'/facture/temp';
|
$cachedir = DOL_DATA_ROOT.'/facture/temp';
|
||||||
$filename = '/boxactivity-invoice2'.$fileid;
|
$filename = '/boxactivity-invoice2'.$fileid;
|
||||||
|
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ class Events // extends CommonObject
|
|||||||
// Update request
|
// Update request
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."events SET";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."events SET";
|
||||||
$sql.= " type='".$this->db->escape($this->type)."',";
|
$sql.= " type='".$this->db->escape($this->type)."',";
|
||||||
$sql.= " dateevent=".$this->db->idate($this->dateevent).",";
|
$sql.= " dateevent='".$this->db->idate($this->dateevent)."',";
|
||||||
$sql.= " description='".$this->db->escape($this->description)."'";
|
$sql.= " description='".$this->db->escape($this->description)."'";
|
||||||
$sql.= " WHERE rowid=".$this->id;
|
$sql.= " WHERE rowid=".$this->id;
|
||||||
|
|
||||||
|
|||||||
@@ -6327,5 +6327,175 @@ class Form
|
|||||||
}
|
}
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return HTML to show the select categories of expense category
|
||||||
|
*
|
||||||
|
* @param string $selected preselected category
|
||||||
|
* @param string $htmlname name of HTML select list
|
||||||
|
* @param integer $useempty 1=Add empty line
|
||||||
|
* @param array $excludeid id to exclude
|
||||||
|
* @param string $target htmlname of target select to bind event
|
||||||
|
* @param int $default_selected default category to select if fk_c_type_fees change = EX_KME
|
||||||
|
* @param array $params param to give
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function selectExpenseCategories($selected='', $htmlname='fk_c_exp_tax_cat', $useempty=0, $excludeid=array(), $target='', $default_selected=0, $params=array())
|
||||||
|
{
|
||||||
|
global $db,$conf,$langs;
|
||||||
|
|
||||||
|
$sql = 'SELECT rowid, label FROM '.MAIN_DB_PREFIX.'c_exp_tax_cat WHERE active = 1';
|
||||||
|
$sql.= ' AND entity IN (0,'.getEntity('').')';
|
||||||
|
if (!empty($excludeid)) $sql.= ' AND rowid NOT IN ('.implode(',', $excludeid).')';
|
||||||
|
$sql.= ' ORDER BY label';
|
||||||
|
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$out = '<select name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';
|
||||||
|
if ($useempty) $out.= '<option value="0"></option>';
|
||||||
|
|
||||||
|
while ($obj = $db->fetch_object($resql))
|
||||||
|
{
|
||||||
|
$out.= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.$langs->trans($obj->label).'</option>';
|
||||||
|
}
|
||||||
|
$out.= '</select>';
|
||||||
|
|
||||||
|
if (!empty($target))
|
||||||
|
{
|
||||||
|
$sql = "SELECT c.id FROM ".MAIN_DB_PREFIX."c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1";
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
if ($db->num_rows($resql) > 0)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
$out.= '<script type="text/javascript">
|
||||||
|
$(function() {
|
||||||
|
$("select[name='.$target.']").on("change", function() {
|
||||||
|
var current_val = $(this).val();
|
||||||
|
if (current_val == '.$obj->id.') {';
|
||||||
|
if (!empty($default_selected) || !empty($selected)) $out.= '$("select[name='.$htmlname.']").val("'.($default_selected > 0 ? $default_selected : $selected).'");';
|
||||||
|
|
||||||
|
$out.= '
|
||||||
|
$("select[name='.$htmlname.']").change();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$("select[name='.$htmlname.']").change(function() {
|
||||||
|
|
||||||
|
if ($("select[name='.$target.']").val() == '.$obj->id.') {
|
||||||
|
// get price of kilometer to fill the unit price
|
||||||
|
var data = '.json_encode($params).';
|
||||||
|
data.fk_c_exp_tax_cat = $(this).val();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
method: "POST",
|
||||||
|
dataType: "json",
|
||||||
|
data: data,
|
||||||
|
url: "'.(DOL_URL_ROOT.'/expensereport/ajax/ajaxik.php').'",
|
||||||
|
}).done(function( data, textStatus, jqXHR ) {
|
||||||
|
console.log(data);
|
||||||
|
if (typeof data.up != "undefined") {
|
||||||
|
$("input[name=value_unit]").val(data.up);
|
||||||
|
$("select[name='.$htmlname.']").attr("title", data.title);
|
||||||
|
} else {
|
||||||
|
$("input[name=value_unit]").val("");
|
||||||
|
$("select[name='.$htmlname.']").attr("title", "");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return HTML to show the select ranges of expense range
|
||||||
|
*
|
||||||
|
* @param string $selected preselected category
|
||||||
|
* @param string $htmlname name of HTML select list
|
||||||
|
* @param integer $useempty 1=Add empty line
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function selectExpenseRanges($selected='', $htmlname='fk_range', $useempty=0)
|
||||||
|
{
|
||||||
|
global $db,$conf,$langs;
|
||||||
|
|
||||||
|
$sql = 'SELECT rowid, range_ik FROM '.MAIN_DB_PREFIX.'c_exp_tax_range';
|
||||||
|
$sql.= ' WHERE entity = '.$conf->entity.' AND active = 1';
|
||||||
|
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$out = '<select name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';
|
||||||
|
if ($useempty) $out.= '<option value="0"></option>';
|
||||||
|
|
||||||
|
while ($obj = $db->fetch_object($resql))
|
||||||
|
{
|
||||||
|
$out.= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.price($obj->range_ik, 0, $langs, 1, 0).'</option>';
|
||||||
|
}
|
||||||
|
$out.= '</select>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return HTML to show a select of expense
|
||||||
|
*
|
||||||
|
* @param string $selected preselected category
|
||||||
|
* @param string $htmlname name of HTML select list
|
||||||
|
* @param integer $useempty 1=Add empty choice
|
||||||
|
* @param integer $allchoice 1=Add all choice
|
||||||
|
* @param integer $useid 0=use 'code' as key, 1=use 'id' as key
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function selectExpense($selected='', $htmlname='fk_c_type_fees', $useempty=0, $allchoice=1, $useid=0)
|
||||||
|
{
|
||||||
|
global $db,$langs;
|
||||||
|
|
||||||
|
$sql = 'SELECT id, code, label FROM '.MAIN_DB_PREFIX.'c_type_fees';
|
||||||
|
$sql.= ' WHERE active = 1';
|
||||||
|
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$out = '<select name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';
|
||||||
|
if ($useempty) $out.= '<option value="0"></option>';
|
||||||
|
if ($allchoice) $out.= '<option value="-1">'.$langs->trans('AllExpenseReport').'</option>';
|
||||||
|
|
||||||
|
$field = 'code';
|
||||||
|
if ($useid) $field = 'id';
|
||||||
|
|
||||||
|
while ($obj = $db->fetch_object($resql))
|
||||||
|
{
|
||||||
|
$key = $langs->trans($obj->code);
|
||||||
|
$out.= '<option '.($selected == $obj->{$field} ? 'selected="selected"' : '').' value="'.$obj->{$field}.'">'.($key != $obj->code ? $key : $obj->label).'</option>';
|
||||||
|
}
|
||||||
|
$out.= '</select>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
60
htdocs/core/commonfieldsinexport.inc.php
Normal file
60
htdocs/core/commonfieldsinexport.inc.php
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if (empty($keyforclass) || empty($keyforclassfile) || empty($keyforelement))
|
||||||
|
{
|
||||||
|
//print $keyforclass.' - '.$keyforclassfile.' - '.$keyforelement;
|
||||||
|
dol_print_error('', 'include of file commonfieldsinexport.inc.php was done but var $keyforclass or $keyforclassfile or $keyforelement was not set');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
dol_include_once($keyforclassfile);
|
||||||
|
if (class_exists($keyforclass))
|
||||||
|
{
|
||||||
|
$tmpobject=new $keyforclass($this->db);
|
||||||
|
|
||||||
|
// Add common fields
|
||||||
|
foreach($tmpobject->fields as $keyfield => $valuefield)
|
||||||
|
{
|
||||||
|
$fieldname = 't' . '.' . $keyfield;
|
||||||
|
$fieldlabel = ucfirst($valuefield['label']);
|
||||||
|
$typeFilter = "Text";
|
||||||
|
$typefield=preg_replace('/\(.*$/', '', $valuefield['type']); // double(24,8) -> double
|
||||||
|
switch ($typefield) {
|
||||||
|
case 'int':
|
||||||
|
case 'integer':
|
||||||
|
case 'double':
|
||||||
|
case 'price':
|
||||||
|
$typeFilter = "Numeric";
|
||||||
|
break;
|
||||||
|
case 'date':
|
||||||
|
case 'datetime':
|
||||||
|
case 'timestamp':
|
||||||
|
$typeFilter = "Date";
|
||||||
|
break;
|
||||||
|
case 'boolean':
|
||||||
|
$typeFilter = "Boolean";
|
||||||
|
break;
|
||||||
|
/*
|
||||||
|
* case 'sellist':
|
||||||
|
* $tmp='';
|
||||||
|
* $tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null
|
||||||
|
* if ($tmpparam['options'] && is_array($tmpparam['options'])) {
|
||||||
|
* $tmpkeys=array_keys($tmpparam['options']);
|
||||||
|
* $tmp=array_shift($tmpkeys);
|
||||||
|
* }
|
||||||
|
* if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp;
|
||||||
|
* break;
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
if ($valuefield['enabled']) {
|
||||||
|
$this->export_fields_array[$r][$fieldname] = $fieldlabel;
|
||||||
|
$this->export_TypeFields_array[$r][$fieldname] = $typeFilter;
|
||||||
|
$this->export_entities_array[$r][$fieldname] = $keyforelement;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($this->db, 'Failed to find class '.$keyforclass.', even after the include of '.$keyforclassfile);
|
||||||
|
}
|
||||||
|
// End add common fields
|
||||||
@@ -18,15 +18,17 @@ if ($resql) // This can fail when class is used on old database (during migra
|
|||||||
$fieldname=$keyforaliasextra.'.'.$obj->name;
|
$fieldname=$keyforaliasextra.'.'.$obj->name;
|
||||||
$fieldlabel=ucfirst($obj->label);
|
$fieldlabel=ucfirst($obj->label);
|
||||||
$typeFilter="Text";
|
$typeFilter="Text";
|
||||||
switch($obj->type)
|
$typefield=preg_replace('/\(.*$/', '', $obj->type); // double(24,8) -> double
|
||||||
{
|
switch ($typefield) {
|
||||||
case 'int':
|
case 'int':
|
||||||
|
case 'integer':
|
||||||
case 'double':
|
case 'double':
|
||||||
case 'price':
|
case 'price':
|
||||||
$typeFilter="Numeric";
|
$typeFilter="Numeric";
|
||||||
break;
|
break;
|
||||||
case 'date':
|
case 'date':
|
||||||
case 'datetime':
|
case 'datetime':
|
||||||
|
case 'timestamp':
|
||||||
$typeFilter="Date";
|
$typeFilter="Date";
|
||||||
break;
|
break;
|
||||||
case 'boolean':
|
case 'boolean':
|
||||||
|
|||||||
@@ -46,6 +46,12 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
|
|||||||
{
|
{
|
||||||
if (empty($minLength)) $minLength=1;
|
if (empty($minLength)) $minLength=1;
|
||||||
|
|
||||||
|
$dataforrenderITem='ui-autocomplete';
|
||||||
|
$dataforitem='ui-autocomplete-item';
|
||||||
|
// Allow two constant to use other values for backward compatibility
|
||||||
|
if (defined('JS_QUERY_AUTOCOMPLETE_RENDERITEM')) $dataforrenderITem=constant('JS_QUERY_AUTOCOMPLETE_RENDERITEM');
|
||||||
|
if (defined('JS_QUERY_AUTOCOMPLETE_ITEM')) $dataforitem=constant('JS_QUERY_AUTOCOMPLETE_ITEM');
|
||||||
|
|
||||||
// Input search_htmlname is original field
|
// Input search_htmlname is original field
|
||||||
// Input htmlname is a second input field used when using ajax autocomplete.
|
// Input htmlname is a second input field used when using ajax autocomplete.
|
||||||
$script = '<input type="hidden" name="'.$htmlname.'" id="'.$htmlname.'" value="'.$selected.'" />';
|
$script = '<input type="hidden" name="'.$htmlname.'" id="'.$htmlname.'" value="'.$selected.'" />';
|
||||||
@@ -185,10 +191,10 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
|
|||||||
$("#search_'.$htmlname.'").trigger("change"); // We have changed value of the combo select, we must be sure to trigger all js hook binded on this event. This is required to trigger other javascript change method binded on original field by other code.
|
$("#search_'.$htmlname.'").trigger("change"); // We have changed value of the combo select, we must be sure to trigger all js hook binded on this event. This is required to trigger other javascript change method binded on original field by other code.
|
||||||
}
|
}
|
||||||
,delay: 500
|
,delay: 500
|
||||||
}).data("ui-autocomplete")._renderItem = function( ul, item ) {
|
}).data("'.$dataforrenderITem.'")._renderItem = function( ul, item ) {
|
||||||
|
|
||||||
return $("<li>")
|
return $("<li>")
|
||||||
.data( "ui-autocomplete-item", item ) // jQuery UI > 1.10.0
|
.data( "'.$dataforitem.'", item ) // jQuery UI > 1.10.0
|
||||||
.append( \'<a><span class="tag">\' + item.label + "</span></a>" )
|
.append( \'<a><span class="tag">\' + item.label + "</span></a>" )
|
||||||
.appendTo(ul);
|
.appendTo(ul);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -132,6 +132,22 @@ function expensereport_admin_prepare_head()
|
|||||||
$head[$h][2] = 'expensereport';
|
$head[$h][2] = 'expensereport';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
|
if (!empty($conf->global->MAIN_USE_EXPENSE_IK))
|
||||||
|
{
|
||||||
|
$head[$h][0] = DOL_URL_ROOT."/admin/expensereport_ik.php";
|
||||||
|
$head[$h][1] = $langs->trans("ExpenseReportsIk");
|
||||||
|
$head[$h][2] = 'expenseik';
|
||||||
|
$h++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($conf->global->MAIN_USE_EXPENSE_RULE))
|
||||||
|
{
|
||||||
|
$head[$h][0] = DOL_URL_ROOT."/admin/expensereport_rules.php";
|
||||||
|
$head[$h][1] = $langs->trans("ExpenseReportsRules");
|
||||||
|
$head[$h][2] = 'expenserules';
|
||||||
|
$h++;
|
||||||
|
}
|
||||||
|
|
||||||
// Show more tabs from modules
|
// Show more tabs from modules
|
||||||
// Entries must be declared in modules descriptor with line
|
// Entries must be declared in modules descriptor with line
|
||||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||||
|
|||||||
@@ -6180,7 +6180,7 @@ function dol_getmypid()
|
|||||||
* or like "keyword1|keyword2" = We want record field like keyword1 OR field like keyword2
|
* or like "keyword1|keyword2" = We want record field like keyword1 OR field like keyword2
|
||||||
* If param $mode is 1, can contains an operator <, > or = like "<10" or ">=100.5 < 1000"
|
* If param $mode is 1, can contains an operator <, > or = like "<10" or ">=100.5 < 1000"
|
||||||
* If param $mode is 2, can contains a list of id separated by comma like "1,3,4"
|
* If param $mode is 2, can contains a list of id separated by comma like "1,3,4"
|
||||||
* @param integer $mode 0=value is list of keywords, 1=value is a numeric test (Example ">5.5 <10"), 2=value is a list of id separated with comma (Example '1,3,4')
|
* @param integer $mode 0=value is list of keyword strings, 1=value is a numeric test (Example ">5.5 <10"), 2=value is a list of id separated with comma (Example '1,3,4')
|
||||||
* @param integer $nofirstand 1=Do not output the first 'AND'
|
* @param integer $nofirstand 1=Do not output the first 'AND'
|
||||||
* @return string $res The statement to append to the SQL query
|
* @return string $res The statement to append to the SQL query
|
||||||
*/
|
*/
|
||||||
@@ -6458,3 +6458,43 @@ function dol_mimetype($file,$default='application/octet-stream',$mode=0)
|
|||||||
return $mime;
|
return $mime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return value from dictionary
|
||||||
|
*
|
||||||
|
* @param string $tablename name of dictionary
|
||||||
|
* @param string $field the value to return
|
||||||
|
* @param int $id id of line
|
||||||
|
* @param bool $checkentity add filter on entity
|
||||||
|
* @param string $rowidfield name of the column rowid
|
||||||
|
*/
|
||||||
|
function getDictvalue($tablename, $field, $id, $checkentity=false, $rowidfield='rowid')
|
||||||
|
{
|
||||||
|
global $dictvalues,$db,$langs;
|
||||||
|
|
||||||
|
if (!isset($dictvalues[$tablename]))
|
||||||
|
{
|
||||||
|
$dictvalues[$tablename] = array();
|
||||||
|
$sql = 'SELECT * FROM '.$tablename.' WHERE 1';
|
||||||
|
if ($checkentity) $sql.= ' entity IN (0,'.getEntity('').')';
|
||||||
|
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
while ($obj = $db->fetch_object($resql))
|
||||||
|
{
|
||||||
|
$dictvalues[$tablename][$obj->{$rowidfield}] = $obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($dictvalues[$tablename][$id])) return $dictvalues[$tablename][$id]->{$field}; // Found
|
||||||
|
else // Not found
|
||||||
|
{
|
||||||
|
if ($id > 0) return $id;
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2200,7 +2200,7 @@ function getModuleDirForApiClass($module)
|
|||||||
elseif ($module == 'stock' || $module == 'stockmovements' || $module == 'warehouses') {
|
elseif ($module == 'stock' || $module == 'stockmovements' || $module == 'warehouses') {
|
||||||
$moduledirforclass = 'product/stock';
|
$moduledirforclass = 'product/stock';
|
||||||
}
|
}
|
||||||
elseif ($module == 'fournisseur' || $module == 'supplierinvoices') {
|
elseif ($module == 'fournisseur' || $module == 'supplierinvoices' || $module == 'supplierorders') {
|
||||||
$moduledirforclass = 'fourn';
|
$moduledirforclass = 'fourn';
|
||||||
}
|
}
|
||||||
elseif ($module == 'expensereports') {
|
elseif ($module == 'expensereports') {
|
||||||
|
|||||||
@@ -629,9 +629,11 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
|||||||
print '<tr class="oddeven">'."\n";
|
print '<tr class="oddeven">'."\n";
|
||||||
|
|
||||||
// User
|
// User
|
||||||
|
/*
|
||||||
print '<td class="nowrap">';
|
print '<td class="nowrap">';
|
||||||
print $fuser->getNomUrl(1, 'withproject', 'time');
|
print $fuser->getNomUrl(1, 'withproject', 'time');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
*/
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<td>';
|
print '<td>';
|
||||||
@@ -835,9 +837,11 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
|||||||
print '<tr class="oddeven">'."\n";
|
print '<tr class="oddeven">'."\n";
|
||||||
|
|
||||||
// User
|
// User
|
||||||
|
/*
|
||||||
print '<td class="nowrap">';
|
print '<td class="nowrap">';
|
||||||
print $fuser->getNomUrl(1, 'withproject', 'time');
|
print $fuser->getNomUrl(1, 'withproject', 'time');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
*/
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<td class="nowrap">';
|
print '<td class="nowrap">';
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree', $donoresetal
|
|||||||
//print ' -> A '.$tab[$x]['rowid'].' mainmenu='.$tab[$x]['mainmenu'].' leftmenu='.$tab[$x]['leftmenu'].' fk_mainmenu='.$tab[$x]['fk_mainmenu'].' fk_leftmenu='.$tab[$x]['fk_leftmenu'].'<br>'."\n";
|
//print ' -> A '.$tab[$x]['rowid'].' mainmenu='.$tab[$x]['mainmenu'].' leftmenu='.$tab[$x]['leftmenu'].' fk_mainmenu='.$tab[$x]['fk_mainmenu'].' fk_leftmenu='.$tab[$x]['fk_leftmenu'].'<br>'."\n";
|
||||||
$tree_recur_alreadyadded[$tab[$x]['rowid']]=($rang + 1);
|
$tree_recur_alreadyadded[$tab[$x]['rowid']]=($rang + 1);
|
||||||
// And now we search all its sons of lower level
|
// And now we search all its sons of lower level
|
||||||
tree_recur($tab,$tab[$x],$rang+1);
|
tree_recur($tab, $tab[$x], $rang+1, 'iddivjstree', 0, $showfk);
|
||||||
print '</li>';
|
print '</li>';
|
||||||
}
|
}
|
||||||
elseif (! empty($tab[$x]['rowid']) && $tab[$x]['fk_menu'] == -1 && $tab[$x]['fk_mainmenu'] == $pere['mainmenu'] && $tab[$x]['fk_leftmenu'] == $pere['leftmenu'])
|
elseif (! empty($tab[$x]['rowid']) && $tab[$x]['fk_menu'] == -1 && $tab[$x]['fk_mainmenu'] == $pere['mainmenu'] && $tab[$x]['fk_leftmenu'] == $pere['leftmenu'])
|
||||||
@@ -206,7 +206,7 @@ function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree', $donoresetal
|
|||||||
print '<strong> <a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&menuId='.$menu['rowid'].'">';
|
print '<strong> <a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&menuId='.$menu['rowid'].'">';
|
||||||
print $tab[$x]['title'];
|
print $tab[$x]['title'];
|
||||||
print '</a></strong>';
|
print '</a></strong>';
|
||||||
print ' (fk_mainmenu='.$tab[$x]['fk_mainmenu'].' fk_leftmenu='.$tab[$x]['fk_leftmenu'].')';
|
print ' (mainmenu='.$tab[$x]['mainmenu'].' leftmenu='.$tab[$x]['leftmenu'].' - fk_mainmenu='.$tab[$x]['fk_mainmenu'].' fk_leftmenu='.$tab[$x]['fk_leftmenu'].')';
|
||||||
print '</td><td align="right">';
|
print '</td><td align="right">';
|
||||||
print $tab[$x]['buttons'];
|
print $tab[$x]['buttons'];
|
||||||
print '</td></tr></table>';
|
print '</td></tr></table>';
|
||||||
@@ -219,7 +219,7 @@ function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree', $donoresetal
|
|||||||
$tree_recur_alreadyadded[$tab[$x]['rowid']]=($rang + 1);
|
$tree_recur_alreadyadded[$tab[$x]['rowid']]=($rang + 1);
|
||||||
// And now we search all its sons of lower level
|
// And now we search all its sons of lower level
|
||||||
//print 'Call tree_recur for x='.$x.' rowid='.$tab[$x]['rowid']." fk_mainmenu pere = ".$tab[$x]['fk_mainmenu']." fk_leftmenu pere = ".$tab[$x]['fk_leftmenu']."<br>\n";
|
//print 'Call tree_recur for x='.$x.' rowid='.$tab[$x]['rowid']." fk_mainmenu pere = ".$tab[$x]['fk_mainmenu']." fk_leftmenu pere = ".$tab[$x]['fk_leftmenu']."<br>\n";
|
||||||
tree_recur($tab,$tab[$x],$rang+1);
|
tree_recur($tab, $tab[$x], $rang+1, 'iddivjstree', 0, $showfk);
|
||||||
print '</li>';
|
print '</li>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,14 +33,16 @@ function dolWebsiteOutput($content)
|
|||||||
global $db, $langs, $conf, $user;
|
global $db, $langs, $conf, $user;
|
||||||
global $dolibarr_main_url_root, $dolibarr_main_data_root;
|
global $dolibarr_main_url_root, $dolibarr_main_data_root;
|
||||||
|
|
||||||
dol_syslog("dolWebsiteOutput start");
|
dol_syslog("dolWebsiteOutput start (mode=".(defined('USEDOLIBARRSERVER')?'USEDOLIBARRSERVER':'').')');
|
||||||
|
|
||||||
// Define $urlwithroot
|
// Define $urlwithroot
|
||||||
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
|
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
|
||||||
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||||
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||||
|
|
||||||
if (! defined('USEDOLIBARRSERVER'))
|
// Note: This seems never called when page is output inside the website editor (search 'REPLACEMENT OF LINKS When page called by website editor')
|
||||||
|
|
||||||
|
if (! defined('USEDOLIBARRSERVER')) // REPLACEMENT OF LINKS When page called from virtual host
|
||||||
{
|
{
|
||||||
$symlinktomediaexists=1;
|
$symlinktomediaexists=1;
|
||||||
|
|
||||||
@@ -52,6 +54,7 @@ function dolWebsiteOutput($content)
|
|||||||
if (! $symlinktomediaexists)
|
if (! $symlinktomediaexists)
|
||||||
{
|
{
|
||||||
$content=preg_replace('/(<img.*src=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^\/]*\/>)/', '\1'.$urlwithroot.'/viewimage.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
|
$content=preg_replace('/(<img.*src=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^\/]*\/>)/', '\1'.$urlwithroot.'/viewimage.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
|
||||||
|
$content=preg_replace('/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)modulepart=medias([^\)]*)file=([^\)]*)(["\']?\))/', '\1'.$urlwithroot.'/viewimage.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -59,14 +62,22 @@ function dolWebsiteOutput($content)
|
|||||||
$content=preg_replace('/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)modulepart=medias([^\)]*)file=([^\)]*)(["\']?\))/', '\1medias/\4\5', $content, -1, $nbrep);
|
$content=preg_replace('/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)modulepart=medias([^\)]*)file=([^\)]*)(["\']?\))/', '\1medias/\4\5', $content, -1, $nbrep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else // REPLACEMENT OF LINKS When page called from dolibarr server
|
||||||
{
|
{
|
||||||
global $website;
|
global $website;
|
||||||
|
|
||||||
// Replace relative link / with dolibarr URL
|
// Replace relative link / with dolibarr URL: ...href="/"...
|
||||||
$content=preg_replace('/(href=")\/\"/', '\1'.DOL_URL_ROOT.'/public/websites/index.php?website='.$website->ref.'&pageid='.$website->fk_default_home.'"', $content, -1, $nbrep);
|
$content=preg_replace('/(href=")\/\"/', '\1'.DOL_URL_ROOT.'/public/websites/index.php?website='.$website->ref.'&pageid='.$website->fk_default_home.'"', $content, -1, $nbrep);
|
||||||
// Replace relative link /xxx.php with dolibarr URL
|
// Replace relative link /xxx.php with dolibarr URL: ...href="....php"
|
||||||
$content=preg_replace('/(href=")\/?([^\"]*)(\.php\")/', '\1'.DOL_URL_ROOT.'/public/websites/index.php?website='.$website->ref.'&pageref=\2"', $content, -1, $nbrep);
|
$content=preg_replace('/(href=")\/?([^\"]*)(\.php\")/', '\1'.DOL_URL_ROOT.'/public/websites/index.php?website='.$website->ref.'&pageref=\2"', $content, -1, $nbrep);
|
||||||
|
|
||||||
|
// Fix relative link /document.php with correct URL after the DOL_URL_ROOT: ...href="/document.php?modulepart="
|
||||||
|
$content=preg_replace('/(href=")(\/?document\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1'.DOL_URL_ROOT.'\2\3"', $content, -1, $nbrep);
|
||||||
|
// Fix relative link /viewimage.php with correct URL after the DOL_URL_ROOT: ...href="/viewimage.php?modulepart="
|
||||||
|
$content=preg_replace('/(href=")(\/?viewimage\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1'.DOL_URL_ROOT.'\2\3"', $content, -1, $nbrep);
|
||||||
|
|
||||||
|
// Fix relative link into medias with correct URL after the DOL_URL_ROOT: ../url("medias/
|
||||||
|
$content=preg_replace('/url\((["\']?)medias\//', 'url(\1'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_syslog("dolWebsiteOutput end");
|
dol_syslog("dolWebsiteOutput end");
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, left
|
|||||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('societe|fournisseur', '( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)', 2__+MAX_llx_menu__, __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__);
|
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('societe|fournisseur', '( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)', 2__+MAX_llx_menu__, __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('product|service', '$conf->product->enabled || $conf->service->enabled', 3__+MAX_llx_menu__, __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'Products/Services', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 30, __ENTITY__);
|
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('product|service', '$conf->product->enabled || $conf->service->enabled', 3__+MAX_llx_menu__, __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'Products/Services', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 30, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('propal|commande|fournisseur|contrat|ficheinter', '$conf->propal->enabled || $conf->commande->enabled || $conf->supplier_order->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled', 5__+MAX_llx_menu__, __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__);
|
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('propal|commande|fournisseur|contrat|ficheinter', '$conf->propal->enabled || $conf->commande->enabled || $conf->supplier_order->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled', 5__+MAX_llx_menu__, __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('comptabilite|accounting|facture|don|tax|salaries|loan', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled', 6__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->compta->resultat->lire || $user->rights->accounting->plancompte->lire || $user->rights->facture->lire|| $user->rights->don->lire || $user->rights->tax->charges->lire || $user->rights->salaries->read || $user->rights->loan->read', '', 2, 50, __ENTITY__);
|
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('comptabilite|accounting|facture|don|tax|salaries|loan|banque', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', 6__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->compta->resultat->lire || $user->rights->accounting->plancompte->lire || $user->rights->facture->lire|| $user->rights->don->lire || $user->rights->tax->charges->lire || $user->rights->salaries->read || $user->rights->loan->read || $user->rights->banque->lire', '', 2, 50, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/index.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 60, __ENTITY__);
|
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/index.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 60, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('projet', '$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 70, __ENTITY__);
|
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('projet', '$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 70, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('mailing|export|import|opensurvey|resource', '$conf->mailing->enabled || $conf->export->enabled || $conf->import->enabled || $conf->opensurvey->enabled || $conf->resource->enabled', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '$user->rights->mailing->lire || $user->rights->export->lire || $user->rights->import->run || $user->rights->opensurvey->read || $user->rights->resource->read', '', 2, 90, __ENTITY__);
|
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('mailing|export|import|opensurvey|resource', '$conf->mailing->enabled || $conf->export->enabled || $conf->import->enabled || $conf->opensurvey->enabled || $conf->resource->enabled', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '$user->rights->mailing->lire || $user->rights->export->lire || $user->rights->import->run || $user->rights->opensurvey->read || $user->rights->resource->read', '', 2, 90, __ENTITY__);
|
||||||
@@ -192,7 +192,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
|||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2002__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/don/list.php?leftmenu=donations&mainmenu=accountancy', 'List', 1, 'donations', '$user->rights->don->lire', '', 2, 1, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2002__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/don/list.php?leftmenu=donations&mainmenu=accountancy', 'List', 1, 'donations', '$user->rights->don->lire', '', 2, 1, __ENTITY__);
|
||||||
-- insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2003__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/don/stats/index.php?leftmenu=donations&mainmenu=accountancy', 'Statistics', 1, 'donations', '$user->rights->don->lire', '', 2, 2, __ENTITY__);
|
-- insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2003__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/don/stats/index.php?leftmenu=donations&mainmenu=accountancy', 'Statistics', 1, 'donations', '$user->rights->don->lire', '', 2, 2, __ENTITY__);
|
||||||
-- Special expenses
|
-- Special expenses
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled || $conf->salaries->enabled', __HANDLER__, 'left', 2200__+MAX_llx_menu__, 'accountancy', 'tax', 6__+MAX_llx_menu__, '/compta/charges/index.php?leftmenu=tax&mainmenu=accountancy', 'MenuSpecialExpenses', 0, 'compta', '(! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) || (! empty($conf->salaries->enabled) && $user->rights->salaries->read)', '', 0, 6, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled || $conf->salaries->enabled || $conf->loan->enabled || $conf->banque->enabled', __HANDLER__, 'left', 2200__+MAX_llx_menu__, 'accountancy', 'tax', 6__+MAX_llx_menu__, '/compta/charges/index.php?leftmenu=tax&mainmenu=accountancy', 'MenuSpecialExpenses', 0, 'compta', '(! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) || (! empty($conf->salaries->enabled) && $user->rights->salaries->read) || (! empty($conf->loan->enabled) && $user->rights->loan->read) || (! empty($conf->banque->enabled) && $user->rights->banque->lire)', '', 0, 6, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled', __HANDLER__, 'left', 2210__+MAX_llx_menu__, 'accountancy', 'tax_sal', 2200__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_salary&mainmenu=accountancy', 'Salaries', 1, 'salaries', '$user->rights->salaries->payment->read', '', 0, 1, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled', __HANDLER__, 'left', 2210__+MAX_llx_menu__, 'accountancy', 'tax_sal', 2200__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_salary&mainmenu=accountancy', 'Salaries', 1, 'salaries', '$user->rights->salaries->payment->read', '', 0, 1, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2211__+MAX_llx_menu__, 'accountancy', '', 2210__+MAX_llx_menu__, '/compta/salaries/card.php?leftmenu=tax_salary&action=create', 'NewPayment', 2, 'companies', '$user->rights->salaries->payment->write', '', 0, 2, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2211__+MAX_llx_menu__, 'accountancy', '', 2210__+MAX_llx_menu__, '/compta/salaries/card.php?leftmenu=tax_salary&action=create', 'NewPayment', 2, 'companies', '$user->rights->salaries->payment->write', '', 0, 2, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2212__+MAX_llx_menu__, 'accountancy', '', 2210__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_salary', 'Payments', 2, 'companies', '$user->rights->salaries->payment->read', '', 0, 3, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2212__+MAX_llx_menu__, 'accountancy', '', 2210__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_salary', 'Payments', 2, 'companies', '$user->rights->salaries->payment->read', '', 0, 3, __ENTITY__);
|
||||||
@@ -208,6 +208,9 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
|||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2302__+MAX_llx_menu__, 'accountancy', '', 2300__+MAX_llx_menu__, '/compta/tva/reglement.php?leftmenu=tax_vat', 'List', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 1, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2302__+MAX_llx_menu__, 'accountancy', '', 2300__+MAX_llx_menu__, '/compta/tva/reglement.php?leftmenu=tax_vat', 'List', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 1, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2303__+MAX_llx_menu__, 'accountancy', '', 2300__+MAX_llx_menu__, '/compta/tva/clients.php?leftmenu=tax_vat', 'ReportByCustomers', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 2, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2303__+MAX_llx_menu__, 'accountancy', '', 2300__+MAX_llx_menu__, '/compta/tva/clients.php?leftmenu=tax_vat', 'ReportByCustomers', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 2, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2304__+MAX_llx_menu__, 'accountancy', '', 2300__+MAX_llx_menu__, '/compta/tva/quadri_detail.php?leftmenu=tax_vat', 'ReportByQuarter', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 3, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2304__+MAX_llx_menu__, 'accountancy', '', 2300__+MAX_llx_menu__, '/compta/tva/quadri_detail.php?leftmenu=tax_vat', 'ReportByQuarter', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 3, __ENTITY__);
|
||||||
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled', __HANDLER__, 'left', 2350__+MAX_llx_menu__, 'accountancy', 'tax_various', 2200__+MAX_llx_menu__, '/bank/various_payment/index.php?leftmenu=tax_various&mainmenu=accountancy', 'MenuVariousPayment', 1, 'various_payment', '$user->rights->banque->lire', '', 0, 1, __ENTITY__);
|
||||||
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && $leftmenu=="tax_various"', __HANDLER__, 'left', 2351__+MAX_llx_menu__, 'accountancy', '', 2350__+MAX_llx_menu__, '/bank/various_payment/card.php?leftmenu=tax_various&action=create', 'MenuNewVariousPayment', 2, 'various_payment', '$user->rights->banque->modifier', '', 0, 2, __ENTITY__);
|
||||||
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && $leftmenu=="tax_various"', __HANDLER__, 'left', 2352__+MAX_llx_menu__, 'accountancy', '', 2350__+MAX_llx_menu__, '/bank/various_payment/index.php?leftmenu=tax_various', 'List', 2, 'various_payment', '$user->rights->banque->lire', '', 0, 3, __ENTITY__);
|
||||||
-- Accounting Expert
|
-- Accounting Expert
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2400__+MAX_llx_menu__, 'accountancy', 'accounting', 6__+MAX_llx_menu__, '/accountancy/index.php?leftmenu=accountancy', 'MenuAccountancy', 0, 'accountancy', '! empty($conf->accounting->enabled) || $user->rights->accounting->bind->write || $user->rights->accounting->bind->write || $user->rights->compta->resultat->lire', '', 0, 7, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2400__+MAX_llx_menu__, 'accountancy', 'accounting', 6__+MAX_llx_menu__, '/accountancy/index.php?leftmenu=accountancy', 'MenuAccountancy', 0, 'accountancy', '! empty($conf->accounting->enabled) || $user->rights->accounting->bind->write || $user->rights->accounting->bind->write || $user->rights->compta->resultat->lire', '', 0, 7, __ENTITY__);
|
||||||
-- Setup
|
-- Setup
|
||||||
|
|||||||
@@ -148,10 +148,11 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
|
|||||||
if (! empty($conf->salaries->enabled)) $menuqualified++;
|
if (! empty($conf->salaries->enabled)) $menuqualified++;
|
||||||
if (! empty($conf->supplier_invoice->enabled)) $menuqualified++;
|
if (! empty($conf->supplier_invoice->enabled)) $menuqualified++;
|
||||||
if (! empty($conf->loan->enabled)) $menuqualified++;
|
if (! empty($conf->loan->enabled)) $menuqualified++;
|
||||||
|
if (! empty($conf->banque->enabled)) $menuqualified++;
|
||||||
$tmpentry=array(
|
$tmpentry=array(
|
||||||
'enabled'=>$menuqualified,
|
'enabled'=>$menuqualified,
|
||||||
'perms'=>(! empty($user->rights->compta->resultat->lire) || ! empty($user->rights->accounting->mouvements->lire) || ! empty($user->rights->facture->lire) || ! empty($user->rights->don->lire) || ! empty($user->rights->tax->charges->lire) || ! empty($user->rights->salaries->read) || ! empty($user->rights->fournisseur->facture->lire) || ! empty($user->rights->loan->read)),
|
'perms'=>(! empty($user->rights->compta->resultat->lire) || ! empty($user->rights->accounting->mouvements->lire) || ! empty($user->rights->facture->lire) || ! empty($user->rights->don->lire) || ! empty($user->rights->tax->charges->lire) || ! empty($user->rights->salaries->read) || ! empty($user->rights->fournisseur->facture->lire) || ! empty($user->rights->loan->read) || ! empty($user->rights->banque->lire)),
|
||||||
'module'=>'comptabilite|accounting|facture|supplier_invoice|don|tax|salaries|loan');
|
'module'=>'comptabilite|accounting|facture|supplier_invoice|don|tax|salaries|loan|banque');
|
||||||
$showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal);
|
$showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal);
|
||||||
if ($showmode)
|
if ($showmode)
|
||||||
{
|
{
|
||||||
@@ -854,11 +855,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Taxes and social contributions
|
// Taxes and social contributions
|
||||||
if (! empty($conf->tax->enabled) || ! empty($conf->salaries->enabled) || ! empty($conf->loan->enabled))
|
if (! empty($conf->tax->enabled) || ! empty($conf->salaries->enabled) || ! empty($conf->loan->enabled) || ! empty($conf->banque->enabled))
|
||||||
{
|
{
|
||||||
global $mysoc;
|
global $mysoc;
|
||||||
|
|
||||||
$permtoshowmenu=((! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) || (! empty($conf->salaries->enabled) && $user->rights->salaries->read) || (! empty($conf->loan->enabled) && $user->rights->loan->read));
|
$permtoshowmenu=((! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) || (! empty($conf->salaries->enabled) && $user->rights->salaries->read) || (! empty($conf->loan->enabled) && $user->rights->loan->read) || (! empty($conf->banque->enabled) && $user->rights->banque->lire));
|
||||||
$newmenu->add("/compta/charges/index.php?leftmenu=tax&mainmenu=accountancy",$langs->trans("MenuSpecialExpenses"), 0, $permtoshowmenu, '', $mainmenu, 'tax');
|
$newmenu->add("/compta/charges/index.php?leftmenu=tax&mainmenu=accountancy",$langs->trans("MenuSpecialExpenses"), 0, $permtoshowmenu, '', $mainmenu, 'tax');
|
||||||
|
|
||||||
// Social contributions
|
// Social contributions
|
||||||
@@ -918,6 +919,14 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
|||||||
//if (empty($leftmenu) || preg_match('/^tax_loan/i',$leftmenu)) $newmenu->add("/loan/payment/list.php?leftmenu=tax_loan",$langs->trans("Payments"),2,$user->rights->loan->read);
|
//if (empty($leftmenu) || preg_match('/^tax_loan/i',$leftmenu)) $newmenu->add("/loan/payment/list.php?leftmenu=tax_loan",$langs->trans("Payments"),2,$user->rights->loan->read);
|
||||||
if (($usemenuhider || empty($leftmenu) || preg_match('/^tax_loan/i',$leftmenu)) && ! empty($conf->global->LOAN_SHOW_CALCULATOR)) $newmenu->add("/loan/calc.php?leftmenu=tax_loan",$langs->trans("Calculator"),2,$user->rights->loan->calc);
|
if (($usemenuhider || empty($leftmenu) || preg_match('/^tax_loan/i',$leftmenu)) && ! empty($conf->global->LOAN_SHOW_CALCULATOR)) $newmenu->add("/loan/calc.php?leftmenu=tax_loan",$langs->trans("Calculator"),2,$user->rights->loan->calc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Various payment
|
||||||
|
if (! empty($conf->banque->enabled))
|
||||||
|
{
|
||||||
|
$newmenu->add("/compta/bank/various_payment/index.php?leftmenu=tax_various&mainmenu=accountancy",$langs->trans("MenuVariousPayment"),1,$user->rights->banque->lire, '', $mainmenu, 'tax_various');
|
||||||
|
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_various/i',$leftmenu)) $newmenu->add("/compta/bank/various_payment/card.php?leftmenu=tax_various&action=create",$langs->trans("MenuNewVariousPayment"), 2, $user->rights->banque->modifier);
|
||||||
|
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_various/i',$leftmenu)) $newmenu->add("/compta/bank/various_payment/index.php?leftmenu=tax_various",$langs->trans("List"),2,$user->rights->banque->lire);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Accounting Expert
|
// Accounting Expert
|
||||||
|
|||||||
@@ -363,10 +363,6 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor. Define names, constants, directories, boxes, permissions
|
* Constructor. Define names, constants, directories, boxes, permissions
|
||||||
*
|
*
|
||||||
@@ -381,6 +377,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
|||||||
// a try catch on Fatal error to manage this correctly.
|
// a try catch on Fatal error to manage this correctly.
|
||||||
// We need constructor into function unActivateModule into admin.lib.php
|
// We need constructor into function unActivateModule into admin.lib.php
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enables a module.
|
* Enables a module.
|
||||||
* Inserts all informations into database
|
* Inserts all informations into database
|
||||||
@@ -2161,5 +2158,4 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
|||||||
{
|
{
|
||||||
return $this->_remove(array(), $options);
|
return $this->_remove(array(), $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ class modStripe extends DolibarrModules
|
|||||||
// Name of image file used for this module.
|
// Name of image file used for this module.
|
||||||
// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
|
// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
|
||||||
// If file is in module/img directory, use this->picto=DOL_URL_ROOT.'/module/img/file.png'
|
// If file is in module/img directory, use this->picto=DOL_URL_ROOT.'/module/img/file.png'
|
||||||
$this->picto='stripe@stripe';
|
$this->picto='stripe';
|
||||||
|
|
||||||
// Data directories to create when module is enabled.
|
// Data directories to create when module is enabled.
|
||||||
$this->dirs = array();
|
$this->dirs = array();
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ class modVariants extends DolibarrModules
|
|||||||
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
|
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
|
||||||
$this->description = 'Allows creating products variant based on new attributes';
|
$this->description = 'Allows creating products variant based on new attributes';
|
||||||
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
|
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
|
||||||
$this->version = 'experimental';
|
$this->version = 'dolibarr';
|
||||||
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
|
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
|
||||||
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||||
// Where to store the module in setup page (0=common,1=interface,2=others,3=very specific)
|
// Where to store the module in setup page (0=common,1=interface,2=others,3=very specific)
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ class modWebsites extends DolibarrModules
|
|||||||
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
|
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
|
||||||
$this->name = preg_replace('/^mod/i','',get_class($this));
|
$this->name = preg_replace('/^mod/i','',get_class($this));
|
||||||
$this->description = "Enable to build and serve public websites with CMS features";
|
$this->description = "Enable to build and serve public websites with CMS features";
|
||||||
$this->version = 'experimental'; // 'experimental' or 'dolibarr' or version
|
$this->version = 'development'; // 'experimental' or 'dolibarr' or version
|
||||||
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
|
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
|
||||||
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||||
// Where to store the module in setup page (0=common,1=interface,2=others,3=very specific)
|
// Where to store the module in setup page (0=common,1=interface,2=others,3=very specific)
|
||||||
@@ -71,7 +71,7 @@ class modWebsites extends DolibarrModules
|
|||||||
$this->depends = array('modFckeditor'); // List of modules id that must be enabled if this module is enabled
|
$this->depends = array('modFckeditor'); // List of modules id that must be enabled if this module is enabled
|
||||||
$this->requiredby = array(); // List of modules id to disable if this one is disabled
|
$this->requiredby = array(); // List of modules id to disable if this one is disabled
|
||||||
$this->conflictwith = array(); // List of modules id this module is in conflict with
|
$this->conflictwith = array(); // List of modules id this module is in conflict with
|
||||||
$this->langfiles = array("websites");
|
$this->langfiles = array("website");
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
//-----------
|
//-----------
|
||||||
@@ -122,5 +122,22 @@ class modWebsites extends DolibarrModules
|
|||||||
'target'=>'',
|
'target'=>'',
|
||||||
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||||
$r++;
|
$r++;
|
||||||
|
|
||||||
|
// Exports
|
||||||
|
$r=1;
|
||||||
|
|
||||||
|
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||||
|
$this->export_label[$r]='MyWebsitePages'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||||
|
$this->export_icon[$r]='globe';
|
||||||
|
$keyforclass = 'WebsitePage'; $keyforclassfile='/websites/class/websitepage.class.php'; $keyforelement='Website';
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
|
||||||
|
//$keyforselect='myobject'; $keyforelement='myobject'; $keyforaliasextra='extra';
|
||||||
|
//include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||||
|
//$this->export_dependencies_array[$r]=array('mysubobject'=>'ts.rowid', 't.myfield'=>array('t.myfield2','t.myfield3')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields)
|
||||||
|
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||||
|
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'website_page as t, '.MAIN_DB_PREFIX.'website as p';
|
||||||
|
$this->export_sql_end[$r] .=' WHERE t.fk_website = p.rowid';
|
||||||
|
$this->export_sql_end[$r] .=' AND p.entity IN ('.getEntity('website').')';
|
||||||
|
$r++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
76
htdocs/expensereport/ajax/ajaxik.php
Normal file
76
htdocs/expensereport/ajax/ajaxik.php
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
|
||||||
|
* Copyright (C) 2017 Pierre-Henry Favre <phf@atm-consulting.fr>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/expensereport/ajax/ajaxprojet.php
|
||||||
|
* \ingroup expensereport
|
||||||
|
* \brief File to return Ajax response on third parties request
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); // Disables token renewal
|
||||||
|
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
|
||||||
|
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
|
||||||
|
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||||
|
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||||
|
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1');
|
||||||
|
|
||||||
|
$res=0;
|
||||||
|
require '../../main.inc.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport_ik.class.php';
|
||||||
|
|
||||||
|
$langs->load('errors');
|
||||||
|
$langs->load('trips');
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
top_httphead();
|
||||||
|
|
||||||
|
|
||||||
|
dol_syslog(join(',',$_POST));
|
||||||
|
|
||||||
|
$fk_expense = GETPOST('fk_expense');
|
||||||
|
$fk_c_exp_tax_cat = GETPOST('fk_c_exp_tax_cat');
|
||||||
|
|
||||||
|
|
||||||
|
if (empty($fk_expense) || $fk_expense < 0) echo json_encode(array('error' => $langs->transnoentitiesnoconv('ErrorBadValueForParameter', $fk_expense, 'fk_expense')));
|
||||||
|
elseif (empty($fk_c_exp_tax_cat) || $fk_c_exp_tax_cat < 0) echo json_encode(array('error' => $langs->transnoentitiesnoconv('ErrorBadValueForParameter', $fk_c_exp_tax_cat, 'fk_c_exp_tax_cat')));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// @see ndfp.class.php:3576 (method: compute_total_km)
|
||||||
|
$expense = new ExpenseReport($db);
|
||||||
|
if ($expense->fetch($fk_expense) <= 0) echo json_encode(array('error' => $langs->transnoentitiesnoconv('ErrorRecordNotFound'), 'fk_expense' => $fk_expense));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$userauthor = new User($db);
|
||||||
|
if ($userauthor->fetch($expense->fk_user_author) <= 0) echo json_encode(array('error' => $langs->transnoentitiesnoconv('ErrorRecordNotFound'), 'fk_user_author' => $expense->fk_user_author));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$range = ExpenseReportIk::getRangeByUser($userauthor, $fk_c_exp_tax_cat);
|
||||||
|
|
||||||
|
if (empty($range)) echo json_encode(array('error' => $langs->transnoentitiesnoconv('ErrorRecordNotFound'), 'range' => $range));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$offset = price($range->offset, 0, $langs, 1, -1, -1, $conf->currency);
|
||||||
|
echo json_encode(array('up' => $range->coef, 'offset' => $range->offset, 'title' => $langs->transnoentitiesnoconv('ExpenseRangeOffset', $offset), 'comment' => 'offset should be apply on addline or updateline'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1059,31 +1059,18 @@ if (empty($reshook))
|
|||||||
if ($action == "addline" && $user->rights->expensereport->creer)
|
if ($action == "addline" && $user->rights->expensereport->creer)
|
||||||
{
|
{
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
$db->begin();
|
// if VAT is not used in Dolibarr, set VAT rate to 0 because VAT rate is necessary.
|
||||||
|
if (empty($vatrate)) $vatrate = "0.000";
|
||||||
$object_ligne = new ExpenseReportLine($db);
|
$vatrate = price2num($vatrate);
|
||||||
|
|
||||||
$vatrate = GETPOST('vatrate','alpha'); // May be 8.5* (8.5NPROM)
|
$value_unit=price2num(GETPOST('value_unit'),'MU');
|
||||||
|
$fk_c_exp_tax_cat = GETPOST('fk_c_exp_tax_cat');
|
||||||
$object_ligne->comments = GETPOST('comments');
|
|
||||||
$qty = GETPOST('qty','int');
|
$qty = GETPOST('qty','int');
|
||||||
if (empty($qty)) $qty=1;
|
if (empty($qty)) $qty=1;
|
||||||
$object_ligne->qty = $qty;
|
|
||||||
|
if (! $fk_c_type_fees > 0)
|
||||||
$up=price2num(GETPOST('value_unit'),'MU');
|
|
||||||
$object_ligne->value_unit = $up;
|
|
||||||
|
|
||||||
$object_ligne->date = $date;
|
|
||||||
|
|
||||||
$object_ligne->fk_c_type_fees = GETPOST('fk_c_type_fees');
|
|
||||||
|
|
||||||
// if VAT is not used in Dolibarr, set VAT rate to 0 because VAT rate is necessary.
|
|
||||||
if (empty($vatrate)) $vatrate = "0.000";
|
|
||||||
|
|
||||||
$object_ligne->fk_projet = $fk_projet;
|
|
||||||
|
|
||||||
if (! (GETPOST('fk_c_type_fees') > 0))
|
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
|
||||||
@@ -1108,13 +1095,13 @@ if (empty($reshook))
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
// Si aucune date n'est rentrée
|
// Si aucune date n'est rentrée
|
||||||
if (empty($object_ligne->date) || $object_ligne->date=="--")
|
if (empty($date) || $date=="--")
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||||
}
|
}
|
||||||
// Si aucun prix n'est rentré
|
// Si aucun prix n'est rentré
|
||||||
if($object_ligne->value_unit==0)
|
if($value_unit==0)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PriceUTTC")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PriceUTTC")), null, 'errors');
|
||||||
@@ -1123,50 +1110,39 @@ if (empty($reshook))
|
|||||||
// S'il y'a eu au moins une erreur
|
// S'il y'a eu au moins une erreur
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$object_ligne->fk_expensereport = $_POST['fk_expensereport'];
|
|
||||||
|
|
||||||
$type = 0; // TODO What if service ?
|
$type = 0; // TODO What if service ?
|
||||||
|
|
||||||
// We don't know seller and buyer for expense reports
|
// Insert line
|
||||||
$seller = $mysoc;
|
$result = $object->addline($qty,$value_unit,$fk_c_type_fees,$vatrate,$date,$comments,$fk_projet,$fk_c_exp_tax_cat,$type);
|
||||||
$buyer = new Societe($db);
|
if ($result > 0) {
|
||||||
|
$ret = $object->fetch($object->id); // Reload to get new records
|
||||||
|
|
||||||
$localtaxes_type=getLocalTaxesFromRate($vatrate,0,$buyer,$seller);
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||||
|
// Define output language
|
||||||
|
$outputlangs = $langs;
|
||||||
|
$newlang = GETPOST('lang_id', 'alpha');
|
||||||
|
if (! empty($conf->global->MAIN_MULTILANGS) && empty($newlang))
|
||||||
|
$newlang = $object->thirdparty->default_lang;
|
||||||
|
if (! empty($newlang)) {
|
||||||
|
$outputlangs = new Translate("", $conf);
|
||||||
|
$outputlangs->setDefaultLang($newlang);
|
||||||
|
}
|
||||||
|
|
||||||
// Clean vat code
|
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
$vat_src_code='';
|
}
|
||||||
|
|
||||||
if (preg_match('/\((.*)\)/', $vatrate, $reg))
|
unset($qty);
|
||||||
{
|
unset($value_unit);
|
||||||
$vat_src_code = $reg[1];
|
unset($vatrate);
|
||||||
$vatrate = preg_replace('/\s*\(.*\)/', '', $vatrate); // Remove code into vatrate.
|
unset($comments);
|
||||||
}
|
unset($fk_c_type_fees);
|
||||||
$vatrate = preg_replace('/\*/','',$vatrate);
|
unset($fk_projet);
|
||||||
|
|
||||||
$tmp = calcul_price_total($qty, $up, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type, $seller, $localtaxes_type);
|
unset($date);
|
||||||
|
|
||||||
$object_ligne->vat_src_code = $vat_src_code;
|
} else {
|
||||||
$object_ligne->vatrate = price2num($vatrate);
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$object_ligne->total_ttc = $tmp[2];
|
}
|
||||||
$object_ligne->total_ht = $tmp[0];
|
|
||||||
$object_ligne->total_tva = $tmp[1];
|
|
||||||
$object_ligne->localtax1_tx = $localtaxes_type[1];
|
|
||||||
$object_ligne->localtax2_tx = $localtaxes_type[3];
|
|
||||||
$object_ligne->localtax1_type = $localtaxes_type[0];
|
|
||||||
$object_ligne->localtax2_type = $localtaxes_type[2];
|
|
||||||
|
|
||||||
$result = $object_ligne->insert();
|
|
||||||
if ($result > 0)
|
|
||||||
{
|
|
||||||
$db->commit();
|
|
||||||
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_print_error($db,$object->error);
|
|
||||||
$db->rollback();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$action='';
|
$action='';
|
||||||
@@ -1222,6 +1198,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
$rowid = $_POST['rowid'];
|
$rowid = $_POST['rowid'];
|
||||||
$type_fees_id = GETPOST('fk_c_type_fees');
|
$type_fees_id = GETPOST('fk_c_type_fees');
|
||||||
|
$fk_c_exp_tax_cat = GETPOST('fk_c_exp_tax_cat');
|
||||||
$projet_id = $fk_projet;
|
$projet_id = $fk_projet;
|
||||||
$comments = GETPOST('comments');
|
$comments = GETPOST('comments');
|
||||||
$qty = GETPOST('qty');
|
$qty = GETPOST('qty');
|
||||||
@@ -1248,7 +1225,7 @@ if (empty($reshook))
|
|||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
// TODO Use update method of ExpenseReportLine
|
// TODO Use update method of ExpenseReportLine
|
||||||
$result = $object->updateline($rowid, $type_fees_id, $projet_id, $vatrate, $comments, $qty, $value_unit, $date, $id);
|
$result = $object->updateline($rowid, $type_fees_id, $projet_id, $vatrate, $comments, $qty, $value_unit, $date, $id, $fk_c_exp_tax_cat);
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
@@ -1947,17 +1924,6 @@ else
|
|||||||
|
|
||||||
print '<div class="clearboth"></div><br>';
|
print '<div class="clearboth"></div><br>';
|
||||||
|
|
||||||
// Fetch Lines of current expense report
|
|
||||||
$sql = 'SELECT fde.rowid, fde.fk_expensereport, fde.fk_c_type_fees, fde.fk_projet, fde.date,';
|
|
||||||
$sql.= ' fde.tva_tx as vatrate, fde.vat_src_code, fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc,';
|
|
||||||
$sql.= ' ctf.code as type_fees_code, ctf.label as type_fees_libelle,';
|
|
||||||
$sql.= ' pjt.rowid as projet_id, pjt.title as projet_title, pjt.ref as projet_ref';
|
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'expensereport_det as fde';
|
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_type_fees as ctf ON fde.fk_c_type_fees=ctf.id';
|
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pjt ON fde.fk_projet=pjt.rowid';
|
|
||||||
$sql.= ' WHERE fde.fk_expensereport = '.$object->id;
|
|
||||||
$sql.= ' ORDER BY fde.date ASC';
|
|
||||||
|
|
||||||
print '<div style="clear: both;"></div>';
|
print '<div style="clear: both;"></div>';
|
||||||
|
|
||||||
$actiontouse='updateligne';
|
$actiontouse='updateligne';
|
||||||
@@ -1972,235 +1938,244 @@ else
|
|||||||
print '<div class="div-table-responsive">';
|
print '<div class="div-table-responsive">';
|
||||||
print '<table id="tablelines" class="noborder" width="100%">';
|
print '<table id="tablelines" class="noborder" width="100%">';
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
if (!empty($object->lines))
|
||||||
if ($resql)
|
|
||||||
{
|
{
|
||||||
$num_lignes = $db->num_rows($resql);
|
|
||||||
$i = 0;$total = 0;
|
$i = 0;$total = 0;
|
||||||
|
|
||||||
if ($num_lignes)
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td style="text-align:center;">'.$langs->trans('Piece').'</td>';
|
||||||
|
print '<td style="text-align:center;">'.$langs->trans('Date').'</td>';
|
||||||
|
if (! empty($conf->projet->enabled)) print '<td class="minwidth100imp">'.$langs->trans('Project').'</td>';
|
||||||
|
if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) print '<td>'.$langs->trans('CarCategory').'</td>';
|
||||||
|
print '<td style="text-align:center;">'.$langs->trans('Type').'</td>';
|
||||||
|
print '<td style="text-align:left;">'.$langs->trans('Description').'</td>';
|
||||||
|
print '<td style="text-align:right;">'.$langs->trans('VAT').'</td>';
|
||||||
|
print '<td style="text-align:right;">'.$langs->trans('PriceUTTC').'</td>';
|
||||||
|
print '<td style="text-align:right;">'.$langs->trans('Qty').'</td>';
|
||||||
|
if ($action != 'editline')
|
||||||
{
|
{
|
||||||
print '<tr class="liste_titre">';
|
print '<td style="text-align:right;">'.$langs->trans('AmountHT').'</td>';
|
||||||
print '<td style="text-align:center;">'.$langs->trans('Piece').'</td>';
|
print '<td style="text-align:right;">'.$langs->trans('AmountTTC').'</td>';
|
||||||
print '<td style="text-align:center;">'.$langs->trans('Date').'</td>';
|
}
|
||||||
if (! empty($conf->projet->enabled)) print '<td class="minwidth100imp">'.$langs->trans('Project').'</td>';
|
// Ajout des boutons de modification/suppression
|
||||||
print '<td style="text-align:center;">'.$langs->trans('Type').'</td>';
|
if (($object->fk_statut < 2 || $object->fk_statut == 99) && $user->rights->expensereport->creer)
|
||||||
print '<td style="text-align:left;">'.$langs->trans('Description').'</td>';
|
{
|
||||||
print '<td style="text-align:right;">'.$langs->trans('VAT').'</td>';
|
print '<td style="text-align:right;"></td>';
|
||||||
print '<td style="text-align:right;">'.$langs->trans('PriceUTTC').'</td>';
|
}
|
||||||
print '<td style="text-align:right;">'.$langs->trans('Qty').'</td>';
|
print '</tr>';
|
||||||
if ($action != 'editline')
|
|
||||||
{
|
|
||||||
print '<td style="text-align:right;">'.$langs->trans('AmountHT').'</td>';
|
|
||||||
print '<td style="text-align:right;">'.$langs->trans('AmountTTC').'</td>';
|
|
||||||
}
|
|
||||||
// Ajout des boutons de modification/suppression
|
|
||||||
if (($object->fk_statut < 2 || $object->fk_statut == 99) && $user->rights->expensereport->creer)
|
|
||||||
{
|
|
||||||
print '<td style="text-align:right;"></td>';
|
|
||||||
}
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
while ($i < $num_lignes)
|
foreach ($object->lines as &$line)
|
||||||
{
|
{
|
||||||
$piece_comptable = $i + 1;
|
$piece_comptable = $i + 1;
|
||||||
$objp = $db->fetch_object($resql);
|
|
||||||
|
|
||||||
if ($action != 'editline' || $objp->rowid != GETPOST('rowid'))
|
if ($action != 'editline' || $line->rowid != GETPOST('rowid'))
|
||||||
|
{
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
|
print '<td style="text-align:center;">';
|
||||||
|
print img_picto($langs->trans("Document"), "object_generic");
|
||||||
|
print ' <span>'.$piece_comptable.'</span></td>';
|
||||||
|
print '<td style="text-align:center;">'.dol_print_date($db->jdate($line->date), 'day').'</td>';
|
||||||
|
if (! empty($conf->projet->enabled))
|
||||||
{
|
{
|
||||||
|
print '<td>';
|
||||||
|
if ($line->fk_projet > 0)
|
||||||
|
{
|
||||||
|
$projecttmp->id=$line->fk_projet;
|
||||||
|
$projecttmp->ref=$line->projet_ref;
|
||||||
|
print $projecttmp->getNomUrl(1);
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
if (!empty($conf->global->MAIN_USE_EXPENSE_IK))
|
||||||
|
{
|
||||||
|
print '<td class="fk_c_exp_tax_cat">';
|
||||||
|
print dol_getIdFromCode($db, $line->fk_c_exp_tax_cat, 'c_exp_tax_cat', 'rowid', 'label');
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
// print '<td style="text-align:center;">'.$langs->trans("TF_".strtoupper(empty($objp->type_fees_libelle)?'OTHER':$objp->type_fees_libelle)).'</td>';
|
||||||
|
print '<td style="text-align:center;">'.($langs->trans(($line->type_fees_code)) == $line->type_fees_code ? $line->type_fees_libelle : $langs->trans(($line->type_fees_code))).'</td>';
|
||||||
|
print '<td style="text-align:left;">'.$line->comments.'</td>';
|
||||||
|
print '<td style="text-align:right;">'.vatrate($line->vatrate,true).'</td>';
|
||||||
|
print '<td style="text-align:right;">'.price($line->value_unit).'</td>';
|
||||||
|
print '<td style="text-align:right;">'.$line->qty.'</td>';
|
||||||
|
|
||||||
|
if ($action != 'editline')
|
||||||
|
{
|
||||||
|
print '<td style="text-align:right;">'.price($line->total_ht).'</td>';
|
||||||
|
print '<td style="text-align:right;">'.price($line->total_ttc).'</td>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ajout des boutons de modification/suppression
|
||||||
|
if (($object->fk_statut < 2 || $object->fk_statut == 99) && $user->rights->expensereport->creer)
|
||||||
|
{
|
||||||
|
print '<td style="text-align:right;" class="nowrap">';
|
||||||
|
|
||||||
|
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=editline&rowid='.$line->rowid.'#'.$line->rowid.'">';
|
||||||
|
print img_edit();
|
||||||
|
print '</a> ';
|
||||||
|
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete_line&rowid='.$line->rowid.'">';
|
||||||
|
print img_delete();
|
||||||
|
print '</a>';
|
||||||
|
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action == 'editline' && $line->rowid == GETPOST('rowid'))
|
||||||
|
{
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
print '<td style="text-align:center;">';
|
print '<td></td>';
|
||||||
print img_picto($langs->trans("Document"), "object_generic");
|
|
||||||
print ' <span>'.$piece_comptable.'</span></td>';
|
// Select date
|
||||||
print '<td style="text-align:center;">'.dol_print_date($db->jdate($objp->date), 'day').'</td>';
|
print '<td class="center">';
|
||||||
|
$form->select_date($line->date,'date');
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
// Select project
|
||||||
if (! empty($conf->projet->enabled))
|
if (! empty($conf->projet->enabled))
|
||||||
{
|
{
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if ($objp->projet_id > 0)
|
$formproject->select_projects(-1, $line->fk_projet,'fk_projet', 0, 0, 1, 1);
|
||||||
{
|
print '</td>';
|
||||||
$projecttmp->id=$objp->projet_id;
|
|
||||||
$projecttmp->ref=$objp->projet_ref;
|
|
||||||
print $projecttmp->getNomUrl(1);
|
|
||||||
}
|
|
||||||
print '</td>';
|
|
||||||
}
|
}
|
||||||
// print '<td style="text-align:center;">'.$langs->trans("TF_".strtoupper(empty($objp->type_fees_libelle)?'OTHER':$objp->type_fees_libelle)).'</td>';
|
|
||||||
print '<td style="text-align:center;">'.($langs->trans(($objp->type_fees_code)) == $objp->type_fees_code ? $objp->type_fees_libelle : $langs->trans(($objp->type_fees_code))).'</td>';
|
if (!empty($conf->global->MAIN_USE_EXPENSE_IK))
|
||||||
print '<td style="text-align:left;">'.$objp->comments.'</td>';
|
{
|
||||||
print '<td style="text-align:right;">'.vatrate($objp->vatrate.($objp->vat_src_code?' ('.$objp->vat_src_code.')':''),true).'</td>';
|
print '<td class="fk_c_exp_tax_cat">';
|
||||||
print '<td style="text-align:right;">'.price($objp->value_unit).'</td>';
|
$params = array('fk_expense' => $object->id, 'fk_expense_det' => $line->rowid, 'date' => $line->dates);
|
||||||
print '<td style="text-align:right;">'.$objp->qty.'</td>';
|
print $form->selectExpenseCategories($line->fk_c_exp_tax_cat, 'fk_c_exp_tax_cat', 1, array(), 'fk_c_type_fees', $userauthor->default_c_exp_tax_cat, $params);
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Select type
|
||||||
|
print '<td class="center">';
|
||||||
|
select_type_fees_id($line->fk_c_type_fees,'fk_c_type_fees');
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
// Add comments
|
||||||
|
print '<td>';
|
||||||
|
print '<textarea name="comments" class="flat_ndf centpercent">'.$line->comments.'</textarea>';
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
// VAT
|
||||||
|
print '<td style="text-align:right;">';
|
||||||
|
print $form->load_tva('vatrate', (isset($_POST["vatrate"])?$_POST["vatrate"]:$line->vatrate), $mysoc, '');
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
// Unit price
|
||||||
|
print '<td style="text-align:right;">';
|
||||||
|
print '<input type="text" min="0" class="maxwidth100" name="value_unit" value="'.$line->value_unit.'" />';
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
// Quantity
|
||||||
|
print '<td style="text-align:right;">';
|
||||||
|
print '<input type="number" min="0" class="maxwidth100" name="qty" value="'.$line->qty.'" />';
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
if ($action != 'editline')
|
if ($action != 'editline')
|
||||||
{
|
{
|
||||||
print '<td style="text-align:right;">'.price($objp->total_ht).'</td>';
|
print '<td style="text-align:right;">'.$langs->trans('AmountHT').'</td>';
|
||||||
print '<td style="text-align:right;">'.price($objp->total_ttc).'</td>';
|
print '<td style="text-align:right;">'.$langs->trans('AmountTTC').'</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ajout des boutons de modification/suppression
|
print '<td style="text-align:center;">';
|
||||||
if (($object->fk_statut < 2 || $object->fk_statut == 99) && $user->rights->expensereport->creer)
|
print '<input type="hidden" name="rowid" value="'.$line->rowid.'">';
|
||||||
{
|
print '<input type="submit" class="button" name="save" value="'.$langs->trans('Save').'">';
|
||||||
print '<td style="text-align:right;" class="nowrap">';
|
print '<br /><input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'">';
|
||||||
|
print '</td>';
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=editline&rowid='.$objp->rowid.'#'.$objp->rowid.'">';
|
|
||||||
print img_edit();
|
|
||||||
print '</a> ';
|
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete_line&rowid='.$objp->rowid.'">';
|
|
||||||
print img_delete();
|
|
||||||
print '</a>';
|
|
||||||
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($action == 'editline' && $objp->rowid == GETPOST('rowid'))
|
|
||||||
{
|
|
||||||
print '<tr class="oddeven">';
|
|
||||||
|
|
||||||
print '<td></td>';
|
|
||||||
|
|
||||||
// Select date
|
|
||||||
print '<td class="center">';
|
|
||||||
$form->select_date($objp->date,'date');
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
// Select project
|
|
||||||
if (! empty($conf->projet->enabled))
|
|
||||||
{
|
|
||||||
print '<td>';
|
|
||||||
$formproject->select_projects(-1, $objp->fk_projet,'fk_projet', 0, 0, 1, 1);
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Select type
|
|
||||||
print '<td class="center">';
|
|
||||||
select_type_fees_id($objp->type_fees_code,'fk_c_type_fees');
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
// Add comments
|
|
||||||
print '<td>';
|
|
||||||
print '<textarea name="comments" class="flat_ndf centpercent">'.dol_escape_htmltag($objp->comments).'</textarea>';
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
// VAT
|
|
||||||
print '<td style="text-align:right;">';
|
|
||||||
$seller=$mysoc;
|
|
||||||
$buyer=new Societe($db);
|
|
||||||
$selectedvat=(GETPOST("vatrate",'alpha')?GETPOST("vatrate",'alpha'):$objp->vatrate.($objp->vat_src_code?' ('.$objp->vat_src_code.')':''));
|
|
||||||
print $form->load_tva('vatrate', $selectedvat, $seller, $buyer, 0, 0, '', false, 1);
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
// Unit price
|
|
||||||
print '<td style="text-align:right;">';
|
|
||||||
print '<input type="text" min="0" class="maxwidth100" name="value_unit" value="'.dol_escape_htmltag($objp->value_unit).'" />';
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
// Quantity
|
|
||||||
print '<td style="text-align:right;">';
|
|
||||||
print '<input type="text" min="0" class="maxwidth50" name="qty" value="'.$objp->qty.'" />'; // We must be able to enter decimal qty
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
if ($action != 'editline')
|
|
||||||
{
|
|
||||||
print '<td style="text-align:right;">'.$langs->trans('AmountHT').'</td>';
|
|
||||||
print '<td style="text-align:right;">'.$langs->trans('AmountTTC').'</td>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<td style="text-align:center;">';
|
|
||||||
print '<input type="hidden" name="rowid" value="'.$objp->rowid.'">';
|
|
||||||
print '<input type="submit" class="button" name="save" value="'.$langs->trans('Save').'">';
|
|
||||||
print '<br /><input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'">';
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$i++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->free($resql);
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add a line
|
||||||
|
if (($object->fk_statut==0 || $object->fk_statut==99) && $action != 'editline' && $user->rights->expensereport->creer)
|
||||||
|
{
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td></td>';
|
||||||
|
print '<td align="center">'.$langs->trans('Date').'</td>';
|
||||||
|
if (! empty($conf->projet->enabled)) print '<td class="minwidth100imp">'.$langs->trans('Project').'</td>';
|
||||||
|
if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) print '<td>'.$langs->trans('CarCategory').'</td>';
|
||||||
|
print '<td align="center">'.$langs->trans('Type').'</td>';
|
||||||
|
print '<td>'.$langs->trans('Description').'</td>';
|
||||||
|
print '<td align="right">'.$langs->trans('VAT').'</td>';
|
||||||
|
print '<td align="right">'.$langs->trans('PriceUTTC').'</td>';
|
||||||
|
print '<td align="right">'.$langs->trans('Qty').'</td>';
|
||||||
|
print '<td colspan="3"></td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
print '<tr '.$bc[true].'>';
|
||||||
|
|
||||||
|
print '<td></td>';
|
||||||
|
|
||||||
|
// Select date
|
||||||
|
print '<td align="center">';
|
||||||
|
$form->select_date($date?$date:-1,'date');
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
// Select project
|
||||||
|
if (! empty($conf->projet->enabled))
|
||||||
|
{
|
||||||
|
print '<td>';
|
||||||
|
$formproject->select_projects(-1, $fk_projet, 'fk_projet', 0, 0, 1, 1);
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($conf->global->MAIN_USE_EXPENSE_IK))
|
||||||
|
{
|
||||||
|
print '<td class="fk_c_exp_tax_cat">';
|
||||||
|
$params = array('fk_expense' => $object->id);
|
||||||
|
print $form->selectExpenseCategories('', 'fk_c_exp_tax_cat', 1, array(), 'fk_c_type_fees', $userauthor->default_c_exp_tax_cat, $params);
|
||||||
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add a line
|
// Select type
|
||||||
if (($object->fk_statut==0 || $object->fk_statut==99) && $action != 'editline' && $user->rights->expensereport->creer)
|
print '<td align="center">';
|
||||||
|
select_type_fees_id($fk_c_type_fees,'fk_c_type_fees',1);
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
// Add comments
|
||||||
|
print '<td>';
|
||||||
|
print '<textarea class="flat_ndf centpercent" name="comments">'.$comments.'</textarea>';
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
// Select VAT
|
||||||
|
print '<td align="right">';
|
||||||
|
$defaultvat=-1;
|
||||||
|
if (! empty($conf->global->EXPENSEREPORT_NO_DEFAULT_VAT)) $conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS = 'none';
|
||||||
|
print $form->load_tva('vatrate', ($vatrate!=''?$vatrate:$defaultvat), $mysoc, '', 0, 0, '', false, 1);
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
// Unit price
|
||||||
|
print '<td align="right">';
|
||||||
|
print '<input type="text" class="right maxwidth50" name="value_unit" value="'.$value_unit.'">';
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
// Quantity
|
||||||
|
print '<td align="right">';
|
||||||
|
print '<input type="text" min="0" class="right maxwidth50" name="qty" value="'.($qty?$qty:1).'">'; // We must be able to enter decimal qty
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
if ($action != 'editline')
|
||||||
{
|
{
|
||||||
print '<tr class="liste_titre">';
|
print '<td align="right"></td>';
|
||||||
print '<td></td>';
|
print '<td align="right"></td>';
|
||||||
print '<td align="center">'.$langs->trans('Date').'</td>';
|
}
|
||||||
if (! empty($conf->projet->enabled)) print '<td class="minwidth100imp">'.$langs->trans('Project').'</td>';
|
|
||||||
print '<td align="center">'.$langs->trans('Type').'</td>';
|
|
||||||
print '<td>'.$langs->trans('Description').'</td>';
|
|
||||||
print '<td align="right">'.$langs->trans('VAT').'</td>';
|
|
||||||
print '<td align="right">'.$langs->trans('PriceUTTC').'</td>';
|
|
||||||
print '<td align="right">'.$langs->trans('Qty').'</td>';
|
|
||||||
print '<td colspan="3"></td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
print '<tr '.$bc[true].'>';
|
print '<td align="center"><input type="submit" value="'.$langs->trans("Add").'" name="bouton" class="button"></td>';
|
||||||
|
|
||||||
print '<td></td>';
|
print '</tr>';
|
||||||
|
} // Fin si c'est payé/validé
|
||||||
|
|
||||||
// Select date
|
print '</table>';
|
||||||
print '<td align="center">';
|
print '</div>';
|
||||||
$form->select_date($date?$date:-1,'date');
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
// Select project
|
print '</form>';
|
||||||
if (! empty($conf->projet->enabled))
|
|
||||||
{
|
|
||||||
print '<td>';
|
|
||||||
$formproject->select_projects(-1, $fk_projet, 'fk_projet', 0, 0, 1, 1);
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Select type
|
|
||||||
print '<td align="center">';
|
|
||||||
select_type_fees_id($fk_c_type_fees,'fk_c_type_fees',1);
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
// Add comments
|
|
||||||
print '<td>';
|
|
||||||
print '<textarea class="flat_ndf centpercent" name="comments">'.$comments.'</textarea>';
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
// Select VAT
|
|
||||||
print '<td align="right">';
|
|
||||||
$defaultvat=-1;
|
|
||||||
if (! empty($conf->global->EXPENSEREPORT_NO_DEFAULT_VAT)) $conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS = 'none';
|
|
||||||
print $form->load_tva('vatrate', ($vatrate!=''?$vatrate:$defaultvat), $mysoc, '', 0, 0, '', false, 1);
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
// Unit price
|
|
||||||
print '<td align="right">';
|
|
||||||
print '<input type="text" class="right maxwidth50" name="value_unit" value="'.(GETPOST('value_unit','alpha')?GETPOST('value_unit','alpha'):dol_escape_htmltag($value_unit)).'">';
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
// Quantity
|
|
||||||
print '<td align="right">';
|
|
||||||
print '<input type="text" min="0" class="right maxwidth50" name="qty" value="'.($qty?$qty:1).'">'; // We must be able to enter decimal qty
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
if ($action != 'editline')
|
|
||||||
{
|
|
||||||
print '<td align="right"></td>';
|
|
||||||
print '<td align="right"></td>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<td align="center"><input type="submit" value="'.$langs->trans("Add").'" name="bouton" class="button"></td>';
|
|
||||||
|
|
||||||
print '</tr>';
|
|
||||||
} // Fin si c'est payé/validé
|
|
||||||
|
|
||||||
print '</table>';
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
print '</form>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
@@ -2370,6 +2345,8 @@ if ($action != 'create' && $action != 'edit')
|
|||||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$object->id.'">'.$langs->trans('Delete').'</a></div>';
|
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$object->id.'">'.$langs->trans('Delete').'</a></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$parameters = array();
|
||||||
|
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
@@ -24,6 +24,8 @@
|
|||||||
* \brief File to manage Expense Reports
|
* \brief File to manage Expense Reports
|
||||||
*/
|
*/
|
||||||
require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
|
require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT .'/expensereport/class/expensereport_ik.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT .'/expensereport/class/expensereport_rule.class.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to manage Trips and Expenses
|
* Class to manage Trips and Expenses
|
||||||
@@ -37,9 +39,9 @@ class ExpenseReport extends CommonObject
|
|||||||
var $picto = 'trip';
|
var $picto = 'trip';
|
||||||
|
|
||||||
var $lignes=array();
|
var $lignes=array();
|
||||||
|
|
||||||
public $date_debut;
|
public $date_debut;
|
||||||
|
|
||||||
public $date_fin;
|
public $date_fin;
|
||||||
|
|
||||||
var $fk_user_validator;
|
var $fk_user_validator;
|
||||||
@@ -65,7 +67,7 @@ class ExpenseReport extends CommonObject
|
|||||||
// Update
|
// Update
|
||||||
var $date_modif;
|
var $date_modif;
|
||||||
var $fk_user_modif;
|
var $fk_user_modif;
|
||||||
|
|
||||||
// Refus
|
// Refus
|
||||||
var $date_refuse;
|
var $date_refuse;
|
||||||
var $detail_refuse;
|
var $detail_refuse;
|
||||||
@@ -91,9 +93,35 @@ class ExpenseReport extends CommonObject
|
|||||||
/*
|
/*
|
||||||
END ACTIONS
|
END ACTIONS
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draft
|
||||||
|
*/
|
||||||
|
const STATUS_DRAFT = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validated (need to be paid)
|
||||||
|
*/
|
||||||
|
const STATUS_VALIDATED = 2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Classified approved
|
||||||
|
*/
|
||||||
|
const STATUS_APPROVED = 5;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Classified refused
|
||||||
|
*/
|
||||||
|
const STATUS_REFUSED = 99;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Classified paid.
|
||||||
|
*/
|
||||||
|
const STATUS_CLOSED = 6;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param DoliDB $db Handler acces base de donnees
|
* @param DoliDB $db Handler acces base de donnees
|
||||||
@@ -268,6 +296,7 @@ class ExpenseReport extends CommonObject
|
|||||||
if (empty($fk_user_author)) $fk_user_author = $user->id;
|
if (empty($fk_user_author)) $fk_user_author = $user->id;
|
||||||
|
|
||||||
$this->context['createfromclone'] = 'createfromclone';
|
$this->context['createfromclone'] = 'createfromclone';
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
// get extrafields so they will be clone
|
// get extrafields so they will be clone
|
||||||
@@ -306,7 +335,6 @@ class ExpenseReport extends CommonObject
|
|||||||
|
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('EXPENSEREPORT_CLONE',$user);
|
$result=$this->call_trigger('EXPENSEREPORT_CLONE',$user);
|
||||||
|
|
||||||
if ($result < 0) $error++;
|
if ($result < 0) $error++;
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
@@ -912,7 +940,7 @@ class ExpenseReport extends CommonObject
|
|||||||
$this->lines=array();
|
$this->lines=array();
|
||||||
|
|
||||||
$sql = ' SELECT de.rowid, de.comments, de.qty, de.value_unit, de.date,';
|
$sql = ' SELECT de.rowid, de.comments, de.qty, de.value_unit, de.date,';
|
||||||
$sql.= ' de.'.$this->fk_element.', de.fk_c_type_fees, de.fk_projet, de.tva_tx,';
|
$sql.= ' de.'.$this->fk_element.', de.fk_c_type_fees, de.fk_c_exp_tax_cat, de.fk_projet, de.tva_tx,';
|
||||||
$sql.= ' de.total_ht, de.total_tva, de.total_ttc,';
|
$sql.= ' de.total_ht, de.total_tva, de.total_ttc,';
|
||||||
$sql.= ' ctf.code as code_type_fees, ctf.label as libelle_type_fees,';
|
$sql.= ' ctf.code as code_type_fees, ctf.label as libelle_type_fees,';
|
||||||
$sql.= ' p.ref as ref_projet, p.title as title_projet';
|
$sql.= ' p.ref as ref_projet, p.title as title_projet';
|
||||||
@@ -934,13 +962,16 @@ class ExpenseReport extends CommonObject
|
|||||||
$deplig = new ExpenseReportLine($this->db);
|
$deplig = new ExpenseReportLine($this->db);
|
||||||
|
|
||||||
$deplig->rowid = $objp->rowid;
|
$deplig->rowid = $objp->rowid;
|
||||||
|
$deplig->id = $objp->id;
|
||||||
$deplig->comments = $objp->comments;
|
$deplig->comments = $objp->comments;
|
||||||
$deplig->qty = $objp->qty;
|
$deplig->qty = $objp->qty;
|
||||||
$deplig->value_unit = $objp->value_unit;
|
$deplig->value_unit = $objp->value_unit;
|
||||||
$deplig->date = $objp->date;
|
$deplig->date = $objp->date;
|
||||||
|
$deplig->dates = $this->db->jdate($objp->date);
|
||||||
|
|
||||||
$deplig->fk_expensereport = $objp->fk_expensereport;
|
$deplig->fk_expensereport = $objp->fk_expensereport;
|
||||||
$deplig->fk_c_type_fees = $objp->fk_c_type_fees;
|
$deplig->fk_c_type_fees = $objp->fk_c_type_fees;
|
||||||
|
$deplig->fk_c_exp_tax_cat = $objp->fk_c_exp_tax_cat;
|
||||||
$deplig->fk_projet = $objp->fk_projet;
|
$deplig->fk_projet = $objp->fk_projet;
|
||||||
|
|
||||||
$deplig->total_ht = $objp->total_ht;
|
$deplig->total_ht = $objp->total_ht;
|
||||||
@@ -1571,7 +1602,244 @@ class ExpenseReport extends CommonObject
|
|||||||
endif;
|
endif;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* addline
|
||||||
|
*
|
||||||
|
* @param real $qty Qty
|
||||||
|
* @param double $up Value init
|
||||||
|
* @param int $fk_c_type_fees Type payment
|
||||||
|
* @param double $vatrate Vat rate
|
||||||
|
* @param string $date Date
|
||||||
|
* @param string $comments Description
|
||||||
|
* @param int $fk_project Project id
|
||||||
|
* @param int $fk_c_exp_tax_cat Car category id
|
||||||
|
* @param int $type Type line
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
function addline($qty=0, $up=0, $fk_c_type_fees=0, $vatrate=0, $date='', $comments='', $fk_project=0, $fk_c_exp_tax_cat=0, $type=0)
|
||||||
|
{
|
||||||
|
global $conf,$langs;
|
||||||
|
|
||||||
|
dol_syslog(get_class($this)."::addline qty=$qty, up=$up, fk_c_type_fees=$fk_c_type_fees, vatrate=$vatrate, date=$date, fk_project=$fk_project, type=$type, comments=$comments", LOG_DEBUG);
|
||||||
|
|
||||||
|
if (empty($qty)) $qty = 0;
|
||||||
|
if (empty($fk_c_type_fees) || $fk_c_type_fees < 0) $fk_c_type_fees = 0;
|
||||||
|
if (empty($fk_c_exp_tax_cat) || $fk_c_exp_tax_cat < 0) $fk_c_exp_tax_cat = 0;
|
||||||
|
if (empty($vatrate) || $vatrate < 0) $vatrate = 0;
|
||||||
|
if (empty($date)) $date = '';
|
||||||
|
if (empty($fk_project)) $fk_project = 0;
|
||||||
|
|
||||||
|
$qty = price2num($qty);
|
||||||
|
$vatrate = price2num($vatrate);
|
||||||
|
$up = price2num($up);
|
||||||
|
|
||||||
|
if ($this->fk_statut == self::STATUS_DRAFT)
|
||||||
|
{
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
|
$this->line = new ExpenseReportLine($this->db);
|
||||||
|
|
||||||
|
$seller = ''; // seller is unknown
|
||||||
|
$tmp = calcul_price_total($qty, $up, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type, $seller);
|
||||||
|
|
||||||
|
$this->line->value_unit = $up;
|
||||||
|
$this->line->vatrate = price2num($vatrate);
|
||||||
|
$this->line->total_ttc = $tmp[2];
|
||||||
|
$this->line->total_ht = $tmp[0];
|
||||||
|
$this->line->total_tva = $tmp[1];
|
||||||
|
|
||||||
|
$this->line->fk_expensereport = $this->id;
|
||||||
|
$this->line->qty = $qty;
|
||||||
|
$this->line->date = $date;
|
||||||
|
$this->line->fk_c_type_fees = $fk_c_type_fees;
|
||||||
|
$this->line->fk_c_exp_tax_cat = $fk_c_exp_tax_cat;
|
||||||
|
$this->line->comments = $comments;
|
||||||
|
$this->line->fk_projet = $fk_project;
|
||||||
|
|
||||||
|
$this->applyOffset();
|
||||||
|
$this->checkRules($type, $seller);
|
||||||
|
|
||||||
|
$result=$this->line->insert(0, true);
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
$result=$this->update_price(); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
$this->db->commit();
|
||||||
|
return $this->line->rowid;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error=$this->line->error;
|
||||||
|
dol_syslog(get_class($this)."::addline error=".$this->error, LOG_ERR);
|
||||||
|
$this->db->rollback();
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_syslog(get_class($this)."::addline status of expense report must be Draft to allow use of ->addline()", LOG_ERR);
|
||||||
|
$this->error = 'ErrorExpenseNotDraft';
|
||||||
|
return -3;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check constraint of rules and update price if needed
|
||||||
|
*
|
||||||
|
* @param int $type type of line
|
||||||
|
* @param string $seller seller, but actually he is unknown
|
||||||
|
* @return true or false
|
||||||
|
*/
|
||||||
|
function checkRules($type=0, $seller='')
|
||||||
|
{
|
||||||
|
global $user,$conf,$db,$langs;
|
||||||
|
|
||||||
|
$langs->load('trips');
|
||||||
|
|
||||||
|
if (empty($conf->global->MAIN_USE_EXPENSE_RULE)) return true; // if don't use rules
|
||||||
|
|
||||||
|
$rulestocheck = ExpenseReportRule::getAllRule($this->line->fk_c_type_fees, $this->line->date, $this->fk_user_author);
|
||||||
|
|
||||||
|
$violation = 0;
|
||||||
|
$rule_warning_message_tab = array();
|
||||||
|
|
||||||
|
$current_total_ttc = $this->line->total_ttc;
|
||||||
|
$new_current_total_ttc = $this->line->total_ttc;
|
||||||
|
|
||||||
|
// check if one is violated
|
||||||
|
foreach ($rulestocheck as $rule)
|
||||||
|
{
|
||||||
|
if (in_array($rule->code_expense_rules_type, array('EX_DAY', 'EX_MON', 'EX_YEA'))) $amount_to_test = $this->line->getExpAmount($rule, $this->fk_user_author, $rule->code_expense_rules_type);
|
||||||
|
else $amount_to_test = $current_total_ttc; // EX_EXP
|
||||||
|
|
||||||
|
$amount_to_test = $amount_to_test - $current_total_ttc + $new_current_total_ttc; // if amount as been modified by a previous rule
|
||||||
|
|
||||||
|
if ($amount_to_test > $rule->amount)
|
||||||
|
{
|
||||||
|
$violation++;
|
||||||
|
|
||||||
|
if ($rule->restrictive)
|
||||||
|
{
|
||||||
|
$this->error = 'ExpenseReportConstraintViolationError';
|
||||||
|
$this->errors[] = $this->error;
|
||||||
|
|
||||||
|
$new_current_total_ttc -= $amount_to_test - $rule->amount; // ex, entered 16€, limit 12€, subtracts 4€;
|
||||||
|
$rule_warning_message_tab[] = $langs->trans('ExpenseReportConstraintViolationError', $rule->id, price($amount_to_test,0,$langs,1,-1,-1,$conf->currency), price($rule->amount,0,$langs,1,-1,-1,$conf->currency), $langs->trans('by'.$rule->code_expense_rules_type, price($new_current_total_ttc,0,$langs,1,-1,-1,$conf->currency)));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error = 'ExpenseReportConstraintViolationWarning';
|
||||||
|
$this->errors[] = $this->error;
|
||||||
|
|
||||||
|
$rule_warning_message_tab[] = $langs->trans('ExpenseReportConstraintViolationWarning', $rule->id, price($amount_to_test,0,$langs,1,-1,-1,$conf->currency), price($rule->amount,0,$langs,1,-1,-1,$conf->currency), $langs->trans('nolimitby'.$rule->code_expense_rules_type));
|
||||||
|
}
|
||||||
|
|
||||||
|
// No break, we sould test if another rule is violated
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->line->rule_warning_message = implode('\n', $rule_warning_message_tab);
|
||||||
|
|
||||||
|
if ($violation > 0)
|
||||||
|
{
|
||||||
|
$tmp = calcul_price_total($this->line->qty, $new_current_total_ttc/$this->line->qty, 0, $this->line->vatrate, 0, 0, 0, 'TTC', 0, $type, $seller);
|
||||||
|
|
||||||
|
$this->line->value_unit = $tmp[5];
|
||||||
|
$this->line->total_ttc = $tmp[2];
|
||||||
|
$this->line->total_ht = $tmp[0];
|
||||||
|
$this->line->total_tva = $tmp[1];
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to apply the offset if needed
|
||||||
|
*
|
||||||
|
* @return boolean true=applied, false=not applied
|
||||||
|
*/
|
||||||
|
function applyOffset()
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
if (empty($conf->global->MAIN_USE_EXPENSE_IK)) return false;
|
||||||
|
|
||||||
|
$userauthor = new User($this->db);
|
||||||
|
if ($userauthor->fetch($this->fk_user_author) <= 0)
|
||||||
|
{
|
||||||
|
$this->error = 'ErrorCantFetchUser';
|
||||||
|
$this->errors[] = 'ErrorCantFetchUser';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$range = ExpenseReportIk::getRangeByUser($userauthor, $this->line->fk_c_exp_tax_cat);
|
||||||
|
|
||||||
|
if (empty($range))
|
||||||
|
{
|
||||||
|
$this->error = 'ErrorNoRangeAvailable';
|
||||||
|
$this->errors[] = 'ErrorNoRangeAvailable';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($conf->global->MAIN_EXPENSE_APPLY_ENTIRE_OFFSET)) $offset = $range->offset;
|
||||||
|
else $offset = $range->offset / 12; // The amount of offset is a global value for the year
|
||||||
|
|
||||||
|
// Test if offset has been applied for the current month
|
||||||
|
if (!$this->offsetAlreadyGiven())
|
||||||
|
{
|
||||||
|
$new_up = $range->coef + ($offset / $this->line->qty);
|
||||||
|
$tmp = calcul_price_total($this->line->qty, $new_up, 0, $this->line->vatrate, 0, 0, 0, 'TTC', 0, $type, $seller);
|
||||||
|
|
||||||
|
$this->line->value_unit = $tmp[5];
|
||||||
|
$this->line->total_ttc = $tmp[2];
|
||||||
|
$this->line->total_ht = $tmp[0];
|
||||||
|
$this->line->total_tva = $tmp[1];
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the sql find any rows then the offset is already given (offset is applied at the first expense report line)
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
function offsetAlreadyGiven()
|
||||||
|
{
|
||||||
|
$sql = 'SELECT e.rowid FROM '.MAIN_DB_PREFIX.'expensereport e';
|
||||||
|
$sql.= ' INNER JOIN '.MAIN_DB_PREFIX.'expensereport_det d ON (e.rowid = d.fk_expensereport)';
|
||||||
|
$sql.= ' INNER JOIN '.MAIN_DB_PREFIX.'c_type_fees f ON (d.fk_c_type_fees = f.id AND f.code = "EX_KME")';
|
||||||
|
$sql.= ' WHERE e.fk_user_author = '.(int) $this->fk_user_author;
|
||||||
|
$sql.= ' AND YEAR(d.date) = "'.dol_print_date($this->line->date, '%Y').'" AND MONTH(d.date) = "'.dol_print_date($this->line->date, '%m').'"';
|
||||||
|
if (!empty($this->line->id)) $sql.= ' AND d.rowid <> '.$this->line->id;
|
||||||
|
|
||||||
|
dol_syslog(get_class($this)."::offsetAlreadyGiven sql=".$sql);
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$num = $this->db->num_rows($resql);
|
||||||
|
if ($num > 0) return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($this->db);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* updateline
|
* updateline
|
||||||
*
|
*
|
||||||
@@ -1584,9 +1852,10 @@ class ExpenseReport extends CommonObject
|
|||||||
* @param double $value_unit Value init
|
* @param double $value_unit Value init
|
||||||
* @param int $date Date
|
* @param int $date Date
|
||||||
* @param int $expensereport_id Expense report id
|
* @param int $expensereport_id Expense report id
|
||||||
|
* @param int $fk_c_exp_tax_cat id of category of car
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function updateline($rowid, $type_fees_id, $projet_id, $vatrate, $comments, $qty, $value_unit, $date, $expensereport_id)
|
function updateline($rowid, $type_fees_id, $projet_id, $vatrate, $comments, $qty, $value_unit, $date, $expensereport_id, $fk_c_exp_tax_cat=0)
|
||||||
{
|
{
|
||||||
global $user, $mysoc;
|
global $user, $mysoc;
|
||||||
|
|
||||||
@@ -1624,34 +1893,29 @@ class ExpenseReport extends CommonObject
|
|||||||
$total_tva = price2num($total_ttc - $total_ht, 'MT');
|
$total_tva = price2num($total_ttc - $total_ht, 'MT');
|
||||||
// fin calculs
|
// fin calculs
|
||||||
|
|
||||||
$ligne = new ExpenseReportLine($this->db);
|
$this->line = new ExpenseReportLine($this->db);
|
||||||
|
$this->line->comments = $comments;
|
||||||
|
$this->line->qty = $qty;
|
||||||
|
$this->line->value_unit = $value_unit;
|
||||||
|
$this->line->date = $date;
|
||||||
|
|
||||||
$ligne->rowid = $rowid;
|
$this->line->fk_expensereport= $expensereport_id;
|
||||||
|
$this->line->fk_c_type_fees = $type_fees_id;
|
||||||
|
$this->line->fk_c_exp_tax_cat = $fk_c_exp_tax_cat;
|
||||||
|
$this->line->fk_projet = $projet_id;
|
||||||
|
|
||||||
$ligne->comments = $comments;
|
$this->line->vat_src_code = $vat_src_code;
|
||||||
$ligne->qty = $qty;
|
$this->line->vatrate = price2num($vatrate);
|
||||||
$ligne->value_unit = $value_unit;
|
$this->line->total_ttc = $tmp[2];
|
||||||
$ligne->date = $date;
|
$this->line->total_ht = $tmp[0];
|
||||||
|
$this->line->total_tva = $tmp[1];
|
||||||
$ligne->fk_expensereport= $expensereport_id;
|
$this->line->localtax1_tx = $localtaxes_type[1];
|
||||||
$ligne->fk_c_type_fees = $type_fees_id;
|
$this->line->localtax2_tx = $localtaxes_type[3];
|
||||||
$ligne->fk_projet = $projet_id;
|
$this->line->localtax1_type = $localtaxes_type[0];
|
||||||
|
$this->line->localtax2_type = $localtaxes_type[2];
|
||||||
//$ligne->total_ht = $total_ht;
|
|
||||||
//$ligne->total_tva = $total_tva;
|
|
||||||
//$ligne->total_ttc = $total_ttc;
|
|
||||||
//$ligne->vatrate = price2num($vatrate);
|
|
||||||
|
|
||||||
$ligne->vat_src_code = $vat_src_code;
|
|
||||||
$ligne->vatrate = price2num($vatrate);
|
|
||||||
$ligne->total_ttc = $tmp[2];
|
|
||||||
$ligne->total_ht = $tmp[0];
|
|
||||||
$ligne->total_tva = $tmp[1];
|
|
||||||
$ligne->localtax1_tx = $localtaxes_type[1];
|
|
||||||
$ligne->localtax2_tx = $localtaxes_type[3];
|
|
||||||
$ligne->localtax1_type = $localtaxes_type[0];
|
|
||||||
$ligne->localtax2_type = $localtaxes_type[2];
|
|
||||||
|
|
||||||
|
$this->line->rowid = $rowid;
|
||||||
|
$this->line->id = $rowid;
|
||||||
|
|
||||||
// Select des infos sur le type fees
|
// Select des infos sur le type fees
|
||||||
$sql = "SELECT c.code as code_type_fees, c.label as libelle_type_fees";
|
$sql = "SELECT c.code as code_type_fees, c.label as libelle_type_fees";
|
||||||
@@ -1659,8 +1923,8 @@ class ExpenseReport extends CommonObject
|
|||||||
$sql.= " WHERE c.id = ".$type_fees_id;
|
$sql.= " WHERE c.id = ".$type_fees_id;
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
$objp_fees = $this->db->fetch_object($result);
|
$objp_fees = $this->db->fetch_object($result);
|
||||||
$ligne->type_fees_code = $objp_fees->code_type_fees;
|
$this->line->type_fees_code = $objp_fees->code_type_fees;
|
||||||
$ligne->type_fees_libelle = $objp_fees->libelle_type_fees;
|
$this->line->type_fees_libelle = $objp_fees->libelle_type_fees;
|
||||||
|
|
||||||
// Select des informations du projet
|
// Select des informations du projet
|
||||||
$sql = "SELECT p.ref as ref_projet, p.title as title_projet";
|
$sql = "SELECT p.ref as ref_projet, p.title as title_projet";
|
||||||
@@ -1670,10 +1934,13 @@ class ExpenseReport extends CommonObject
|
|||||||
if ($result) {
|
if ($result) {
|
||||||
$objp_projet = $this->db->fetch_object($result);
|
$objp_projet = $this->db->fetch_object($result);
|
||||||
}
|
}
|
||||||
$ligne->projet_ref = $objp_projet->ref_projet;
|
$this->line->projet_ref = $objp_projet->ref_projet;
|
||||||
$ligne->projet_title = $objp_projet->title_projet;
|
$this->line->projet_title = $objp_projet->title_projet;
|
||||||
|
|
||||||
$result = $ligne->update($user);
|
$this->applyOffset();
|
||||||
|
$this->checkRules();
|
||||||
|
|
||||||
|
$result = $this->line->update($user);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
@@ -1681,8 +1948,8 @@ class ExpenseReport extends CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$ligne->error;
|
$this->error=$this->line->error;
|
||||||
$this->errors=$ligne->errors;
|
$this->errors=$this->line->errors;
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
@@ -2026,6 +2293,7 @@ class ExpenseReportLine
|
|||||||
var $date;
|
var $date;
|
||||||
|
|
||||||
var $fk_c_type_fees;
|
var $fk_c_type_fees;
|
||||||
|
var $fk_c_exp_tax_cat;
|
||||||
var $fk_projet;
|
var $fk_projet;
|
||||||
var $fk_expensereport;
|
var $fk_expensereport;
|
||||||
|
|
||||||
@@ -2058,7 +2326,7 @@ class ExpenseReportLine
|
|||||||
*/
|
*/
|
||||||
function fetch($rowid)
|
function fetch($rowid)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT fde.rowid, fde.fk_expensereport, fde.fk_c_type_fees, fde.fk_projet, fde.date,';
|
$sql = 'SELECT fde.rowid, fde.fk_expensereport, fde.fk_c_type_fees, fde.fk_c_exp_tax_cat, fde.fk_projet, fde.date,';
|
||||||
$sql.= ' fde.tva_tx as vatrate, fde.vat_src_code, fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc,';
|
$sql.= ' fde.tva_tx as vatrate, fde.vat_src_code, fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc,';
|
||||||
$sql.= ' ctf.code as type_fees_code, ctf.label as type_fees_libelle,';
|
$sql.= ' ctf.code as type_fees_code, ctf.label as type_fees_libelle,';
|
||||||
$sql.= ' pjt.rowid as projet_id, pjt.title as projet_title, pjt.ref as projet_ref';
|
$sql.= ' pjt.rowid as projet_id, pjt.title as projet_title, pjt.ref as projet_ref';
|
||||||
@@ -2080,8 +2348,10 @@ class ExpenseReportLine
|
|||||||
$this->comments = $objp->comments;
|
$this->comments = $objp->comments;
|
||||||
$this->qty = $objp->qty;
|
$this->qty = $objp->qty;
|
||||||
$this->date = $objp->date;
|
$this->date = $objp->date;
|
||||||
|
$this->dates = $this->db->jdate($objp->date);
|
||||||
$this->value_unit = $objp->value_unit;
|
$this->value_unit = $objp->value_unit;
|
||||||
$this->fk_c_type_fees = $objp->fk_c_type_fees;
|
$this->fk_c_type_fees = $objp->fk_c_type_fees;
|
||||||
|
$this->fk_c_exp_tax_cat = $objp->fk_c_exp_tax_cat;
|
||||||
$this->fk_projet = $objp->fk_projet;
|
$this->fk_projet = $objp->fk_projet;
|
||||||
$this->type_fees_code = $objp->type_fees_code;
|
$this->type_fees_code = $objp->type_fees_code;
|
||||||
$this->type_fees_libelle = $objp->type_fees_libelle;
|
$this->type_fees_libelle = $objp->type_fees_libelle;
|
||||||
@@ -2103,9 +2373,10 @@ class ExpenseReportLine
|
|||||||
* insert
|
* insert
|
||||||
*
|
*
|
||||||
* @param int $notrigger 1=No trigger
|
* @param int $notrigger 1=No trigger
|
||||||
|
* @param bool $fromaddline false=keep default behavior, true=exclude the update_price() of parent object
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function insert($notrigger=0)
|
function insert($notrigger=0,$fromaddline=false)
|
||||||
{
|
{
|
||||||
global $langs,$user,$conf;
|
global $langs,$user,$conf;
|
||||||
|
|
||||||
@@ -2118,12 +2389,13 @@ class ExpenseReportLine
|
|||||||
if (!$this->value_unit_HT) $this->value_unit_HT=0;
|
if (!$this->value_unit_HT) $this->value_unit_HT=0;
|
||||||
$this->qty = price2num($this->qty);
|
$this->qty = price2num($this->qty);
|
||||||
$this->vatrate = price2num($this->vatrate);
|
$this->vatrate = price2num($this->vatrate);
|
||||||
|
if (empty($this->fk_c_exp_tax_cat)) $this->fk_c_exp_tax_cat = 0;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'expensereport_det';
|
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'expensereport_det';
|
||||||
$sql.= ' (fk_expensereport, fk_c_type_fees, fk_projet,';
|
$sql.= ' (fk_expensereport, fk_c_type_fees, fk_projet,';
|
||||||
$sql.= ' tva_tx, vat_src_code, comments, qty, value_unit, total_ht, total_tva, total_ttc, date)';
|
$sql.= ' tva_tx, vat_src_code, comments, qty, value_unit, total_ht, total_tva, total_ttc, date, rule_warning_message, fk_c_exp_tax_cat)';
|
||||||
$sql.= " VALUES (".$this->fk_expensereport.",";
|
$sql.= " VALUES (".$this->fk_expensereport.",";
|
||||||
$sql.= " ".$this->fk_c_type_fees.",";
|
$sql.= " ".$this->fk_c_type_fees.",";
|
||||||
$sql.= " ".($this->fk_projet>0?$this->fk_projet:'null').",";
|
$sql.= " ".($this->fk_projet>0?$this->fk_projet:'null').",";
|
||||||
@@ -2135,7 +2407,9 @@ class ExpenseReportLine
|
|||||||
$sql.= " ".$this->total_ht.",";
|
$sql.= " ".$this->total_ht.",";
|
||||||
$sql.= " ".$this->total_tva.",";
|
$sql.= " ".$this->total_tva.",";
|
||||||
$sql.= " ".$this->total_ttc.",";
|
$sql.= " ".$this->total_ttc.",";
|
||||||
$sql.= "'".$this->db->idate($this->date)."'";
|
$sql.= "'".$this->db->idate($this->date)."',";
|
||||||
|
$sql.= " '".$this->db->escape($this->rule_warning_message)."',";
|
||||||
|
$sql.= " ".$this->fk_c_exp_tax_cat;
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
dol_syslog("ExpenseReportLine::insert sql=".$sql);
|
dol_syslog("ExpenseReportLine::insert sql=".$sql);
|
||||||
@@ -2145,16 +2419,23 @@ class ExpenseReportLine
|
|||||||
{
|
{
|
||||||
$this->rowid=$this->db->last_insert_id(MAIN_DB_PREFIX.'expensereport_det');
|
$this->rowid=$this->db->last_insert_id(MAIN_DB_PREFIX.'expensereport_det');
|
||||||
|
|
||||||
$tmpparent=new ExpenseReport($this->db);
|
if (! $fromaddline)
|
||||||
$tmpparent->fetch($this->fk_expensereport);
|
{
|
||||||
$result = $tmpparent->update_price();
|
$tmpparent=new ExpenseReport($this->db);
|
||||||
if ($result < 0)
|
$tmpparent->fetch($this->fk_expensereport);
|
||||||
{
|
$result = $tmpparent->update_price();
|
||||||
$error++;
|
if ($result < 0)
|
||||||
$this->error = $tmpparent->error;
|
{
|
||||||
$this->errors = $tmpparent->errors;
|
$error++;
|
||||||
}
|
$this->error = $tmpparent->error;
|
||||||
|
$this->errors = $tmpparent->errors;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
@@ -2169,7 +2450,50 @@ class ExpenseReportLine
|
|||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to get total amount in expense reports for a same rule
|
||||||
|
*
|
||||||
|
* @param ExpenseReportRule $rule object rule to check
|
||||||
|
* @param int $fk_user user author id
|
||||||
|
* @param string $mode day|EX_DAY / month|EX_MON / year|EX_YEA to get amount
|
||||||
|
* @return amount
|
||||||
|
*/
|
||||||
|
public function getExpAmount(ExpenseReportRule $rule, $fk_user, $mode='day')
|
||||||
|
{
|
||||||
|
$amount = 0;
|
||||||
|
|
||||||
|
$sql = 'SELECT SUM(d.total_ttc) as total_amount';
|
||||||
|
$sql .= ' FROM '.MAIN_DB_PREFIX.'expensereport_det d';
|
||||||
|
$sql .= ' INNER JOIN '.MAIN_DB_PREFIX.'expensereport e ON (d.fk_expensereport = e.rowid)';
|
||||||
|
$sql .= ' WHERE e.fk_user_author = '.$fk_user;
|
||||||
|
if (!empty($this->id)) $sql.= ' AND d.rowid <> '.$this->id;
|
||||||
|
$sql .= ' AND d.fk_c_type_fees = '.$rule->fk_c_type_fees;
|
||||||
|
if ($mode == 'day' || $mode == 'EX_DAY') $sql .= ' AND d.date = \''.dol_print_date($this->date, '%Y-%m-%d').'\'';
|
||||||
|
elseif ($mode == 'mon' || $mode == 'EX_MON') $sql .= ' AND DATE_FORMAT(d.date, \'%Y-%m\') = \''.dol_print_date($this->date, '%Y-%m').'\'';
|
||||||
|
elseif ($mode == 'year' || $mode == 'EX_YEA') $sql .= ' AND DATE_FORMAT(d.date, \'%Y\') = \''.dol_print_date($this->date, '%Y').'\'';
|
||||||
|
|
||||||
|
dol_syslog('ExpenseReportLine::getExpAmountByDay sql='.$sql);
|
||||||
|
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$num = $this->db->num_rows($resql);
|
||||||
|
if ($num > 0)
|
||||||
|
{
|
||||||
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
$amount = (double) $obj->total_amount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($this->db);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $amount + $this->total_ttc;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* update
|
* update
|
||||||
*
|
*
|
||||||
@@ -2186,6 +2510,7 @@ class ExpenseReportLine
|
|||||||
$this->comments=trim($this->comments);
|
$this->comments=trim($this->comments);
|
||||||
$this->vatrate = price2num($this->vatrate);
|
$this->vatrate = price2num($this->vatrate);
|
||||||
$this->value_unit = price2num($this->value_unit);
|
$this->value_unit = price2num($this->value_unit);
|
||||||
|
if (empty($this->fk_c_exp_tax_cat)) $this->fk_c_exp_tax_cat = 0;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
@@ -2199,7 +2524,9 @@ class ExpenseReportLine
|
|||||||
$sql.= ",total_tva=".$this->total_tva."";
|
$sql.= ",total_tva=".$this->total_tva."";
|
||||||
$sql.= ",total_ttc=".$this->total_ttc."";
|
$sql.= ",total_ttc=".$this->total_ttc."";
|
||||||
$sql.= ",tva_tx=".$this->vatrate;
|
$sql.= ",tva_tx=".$this->vatrate;
|
||||||
$sql.= ",vat_src_code='".$this->db->escape($this->vat_src_code)."'";
|
$sql.= ",vat_src_code='".$this->db->escape($this->vat_src_code)."'";
|
||||||
|
$sql.= ",rule_warning_message='".$this->db->escape($this->rule_warning_message)."'";
|
||||||
|
$sql.= ",fk_c_exp_tax_cat=".$this->fk_c_exp_tax_cat;
|
||||||
if ($this->fk_c_type_fees) $sql.= ",fk_c_type_fees=".$this->fk_c_type_fees;
|
if ($this->fk_c_type_fees) $sql.= ",fk_c_type_fees=".$this->fk_c_type_fees;
|
||||||
else $sql.= ",fk_c_type_fees=null";
|
else $sql.= ",fk_c_type_fees=null";
|
||||||
if ($this->fk_projet) $sql.= ",fk_projet=".$this->fk_projet;
|
if ($this->fk_projet) $sql.= ",fk_projet=".$this->fk_projet;
|
||||||
|
|||||||
248
htdocs/expensereport/class/expensereport_ik.class.php
Normal file
248
htdocs/expensereport/class/expensereport_ik.class.php
Normal file
@@ -0,0 +1,248 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2017 ATM Consulting <support@atm-consulting.fr>
|
||||||
|
* Copyright (C) 2017 Pierre-Henry Favre <phf@atm-consulting.fr>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/expensereport/class/expensereport_ik.class.php
|
||||||
|
* \ingroup expenseik
|
||||||
|
* \brief File of class to manage expense ik
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/coreobject.class.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to manage inventories
|
||||||
|
*/
|
||||||
|
class ExpenseReportIk extends CoreObject
|
||||||
|
{
|
||||||
|
public $element='expenseik';
|
||||||
|
public $table_element='expensereport_ik';
|
||||||
|
public $fk_element='fk_expense_ik';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* c_exp_tax_cat Id
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $fk_c_exp_tax_cat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* c_exp_tax_range id
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $fk_range;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Coef
|
||||||
|
* @var double
|
||||||
|
*/
|
||||||
|
public $coef;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Offset
|
||||||
|
* @var double
|
||||||
|
*/
|
||||||
|
public $offset;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attribute object linked with database
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $fields=array(
|
||||||
|
'rowid'=>array('type'=>'integer','index'=>true)
|
||||||
|
,'fk_c_exp_tax_cat'=>array('type'=>'integer','index'=>true)
|
||||||
|
,'fk_range'=>array('type'=>'integer','index'=>true)
|
||||||
|
,'coef'=>array('type'=>'double')
|
||||||
|
,'offset'=>array('type'=>'double')
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param DoliDB $db Database handler
|
||||||
|
*/
|
||||||
|
public function __construct(DoliDB &$db)
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
parent::__construct($db);
|
||||||
|
parent::init();
|
||||||
|
|
||||||
|
$this->errors = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return expense categories in array
|
||||||
|
*
|
||||||
|
* @param int $mode 1=only active; 2=only inactive; other value return all
|
||||||
|
* @return array of category
|
||||||
|
*/
|
||||||
|
public static function getTaxCategories($mode=1)
|
||||||
|
{
|
||||||
|
global $db;
|
||||||
|
|
||||||
|
$categories = array();
|
||||||
|
|
||||||
|
$sql = 'SELECT rowid, label, entity, active';
|
||||||
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_exp_tax_cat';
|
||||||
|
$sql.= ' WHERE entity IN (0,'. getEntity('').')';
|
||||||
|
if ($mode == 1) $sql.= ' AND active = 1';
|
||||||
|
elseif ($mode == 2) $sql.= 'AND active = 0';
|
||||||
|
|
||||||
|
dol_syslog(get_called_class().'::getTaxCategories sql='.$sql, LOG_DEBUG);
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
while ($obj = $db->fetch_object($resql))
|
||||||
|
{
|
||||||
|
$categories[$obj->rowid] = $obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $categories;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getRangeByUser(User $userauthor, $fk_c_exp_tax_cat)
|
||||||
|
{
|
||||||
|
$default_range = (int) $userauthor->default_range; // if not defined, then 0
|
||||||
|
$ranges = self::getRangesByCategory($fk_c_exp_tax_cat);
|
||||||
|
|
||||||
|
// substract 1 because array start from 0
|
||||||
|
if (empty($ranges) || !isset($ranges[$default_range-1])) return false;
|
||||||
|
else return $ranges[$default_range-1];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return an array of ranges for a category
|
||||||
|
*
|
||||||
|
* @param int $fk_c_exp_tax_cat category id
|
||||||
|
* @param int $active active
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getRangesByCategory($fk_c_exp_tax_cat, $active=1)
|
||||||
|
{
|
||||||
|
global $db;
|
||||||
|
|
||||||
|
$ranges = array();
|
||||||
|
|
||||||
|
$sql = 'SELECT r.rowid FROM '.MAIN_DB_PREFIX.'c_exp_tax_range r';
|
||||||
|
if ($active) $sql.= ' INNER JOIN '.MAIN_DB_PREFIX.'c_exp_tax_cat c ON (r.fk_c_exp_tax_cat = c.rowid)';
|
||||||
|
$sql.= ' WHERE r.fk_c_exp_tax_cat = '.$fk_c_exp_tax_cat;
|
||||||
|
if ($active) $sql.= ' AND r.active = 1 AND c.active = 1';
|
||||||
|
$sql.= ' ORDER BY r.range_ik';
|
||||||
|
|
||||||
|
dol_syslog(get_called_class().'::getRangesByCategory sql='.$sql, LOG_DEBUG);
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
if ($num > 0)
|
||||||
|
{
|
||||||
|
while ($obj = $db->fetch_object($resql))
|
||||||
|
{
|
||||||
|
$object = new ExpenseReportIk($db);
|
||||||
|
$object->fetch($obj->rowid);
|
||||||
|
|
||||||
|
$ranges[] = $object;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ranges;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return an array of ranges grouped by category
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getAllRanges()
|
||||||
|
{
|
||||||
|
global $db;
|
||||||
|
|
||||||
|
$ranges = array();
|
||||||
|
|
||||||
|
$sql = ' SELECT r.rowid, r.fk_c_exp_tax_cat, r.range_ik, c.label, i.rowid as fk_expense_ik, r.active as range_active, c.active as cat_active';
|
||||||
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_exp_tax_range r';
|
||||||
|
$sql.= ' INNER JOIN '.MAIN_DB_PREFIX.'c_exp_tax_cat c ON (r.fk_c_exp_tax_cat = c.rowid)';
|
||||||
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'expensereport_ik i ON (r.rowid = i.fk_range)';
|
||||||
|
$sql.= ' WHERE r.entity IN (0, '. getEntity('').')';
|
||||||
|
$sql.= ' ORDER BY r.fk_c_exp_tax_cat, r.range_ik';
|
||||||
|
|
||||||
|
dol_syslog(get_called_class().'::getAllRanges sql='.$sql, LOG_DEBUG);
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
while ($obj = $db->fetch_object($resql))
|
||||||
|
{
|
||||||
|
$ik = new ExpenseReportIk($db);
|
||||||
|
if ($obj->fk_expense_ik > 0) $ik->fetch($obj->fk_expense_ik);
|
||||||
|
$obj->ik = $ik;
|
||||||
|
|
||||||
|
if (!isset($ranges[$obj->fk_c_exp_tax_cat])) $ranges[$obj->fk_c_exp_tax_cat] = array('label' => $obj->label, 'active' => $obj->cat_active, 'ranges' => array());
|
||||||
|
$ranges[$obj->fk_c_exp_tax_cat]['ranges'][] = $obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ranges;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the max number of range by a category
|
||||||
|
*
|
||||||
|
* @param int $default_c_exp_tax_cat id
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public static function getMaxRangeNumber($default_c_exp_tax_cat=0)
|
||||||
|
{
|
||||||
|
global $db,$conf;
|
||||||
|
|
||||||
|
$sql = 'SELECT MAX(counted) as nbRange FROM (';
|
||||||
|
$sql.= ' SELECT COUNT(*) as counted';
|
||||||
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_exp_tax_range r';
|
||||||
|
$sql.= ' WHERE r.entity IN (0, '.$conf->entity.')';
|
||||||
|
if ($default_c_exp_tax_cat > 0) $sql .= ' AND r.fk_c_exp_tax_cat = '.$default_c_exp_tax_cat;
|
||||||
|
$sql.= ' GROUP BY r.fk_c_exp_tax_cat';
|
||||||
|
$sql .= ') as counts';
|
||||||
|
|
||||||
|
dol_syslog(get_called_class().'::getMaxRangeNumber sql='.$sql, LOG_DEBUG);
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
return $obj->nbRange;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
237
htdocs/expensereport/class/expensereport_rule.class.php
Normal file
237
htdocs/expensereport/class/expensereport_rule.class.php
Normal file
@@ -0,0 +1,237 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2017 ATM Consulting <support@atm-consulting.fr>
|
||||||
|
* Copyright (C) 2017 Pierre-Henry Favre <phf@atm-consulting.fr>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/expensereport/class/expensereport_ik.class.php
|
||||||
|
* \ingroup expenseik
|
||||||
|
* \brief File of class to manage expense ik
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/coreobject.class.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to manage inventories
|
||||||
|
*/
|
||||||
|
class ExpenseReportRule extends CoreObject
|
||||||
|
{
|
||||||
|
public $element='expenserule';
|
||||||
|
public $table_element='expensereport_rules';
|
||||||
|
public $fk_element='fk_expense_rule';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* date start
|
||||||
|
* @var date
|
||||||
|
*/
|
||||||
|
public $dates;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* date end
|
||||||
|
* @var date
|
||||||
|
*/
|
||||||
|
public $datee;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* amount
|
||||||
|
* @var double
|
||||||
|
*/
|
||||||
|
public $amount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* restrective
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $restrictive;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* rule for user
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $fk_user;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* rule for group
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $fk_usergroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* c_type_fees id
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $fk_c_type_fees;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* code type of expense report
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $code_expense_rules_type;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* rule for all
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $is_for_all;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* entity
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $entity;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attribute object linked with database
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $fields=array(
|
||||||
|
'rowid'=>array('type'=>'integer','index'=>true)
|
||||||
|
,'dates'=>array('type'=>'date')
|
||||||
|
,'datee'=>array('type'=>'date')
|
||||||
|
,'amount'=>array('type'=>'double')
|
||||||
|
,'restrictive'=>array('type'=>'integer')
|
||||||
|
,'fk_user'=>array('type'=>'integer')
|
||||||
|
,'fk_usergroup'=>array('type'=>'integer')
|
||||||
|
,'fk_c_type_fees'=>array('type'=>'integer')
|
||||||
|
,'code_expense_rules_type'=>array('type'=>'string')
|
||||||
|
,'is_for_all'=>array('type'=>'integer')
|
||||||
|
,'entity'=>array('type'=>'integer')
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param DoliDB $db Database handler
|
||||||
|
*/
|
||||||
|
public function __construct(DoliDB &$db)
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
parent::__construct($db);
|
||||||
|
parent::init();
|
||||||
|
|
||||||
|
$this->errors = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all rules or filtered by something
|
||||||
|
*
|
||||||
|
* @param int $fk_c_type_fees type of expense
|
||||||
|
* @param date $date date of expense
|
||||||
|
* @param type $fk_user user of expense
|
||||||
|
* @return array \ExpenseReportRule
|
||||||
|
*/
|
||||||
|
public static function getAllRule($fk_c_type_fees='', $date='', $fk_user='')
|
||||||
|
{
|
||||||
|
global $db;
|
||||||
|
|
||||||
|
$rules = array();
|
||||||
|
$sql = 'SELECT er.rowid';
|
||||||
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'expensereport_rules er';
|
||||||
|
$sql.= ' WHERE er.entity IN (0,'. getEntity('').')';
|
||||||
|
if (!empty($fk_c_type_fees))
|
||||||
|
{
|
||||||
|
$sql.= ' AND er.fk_c_type_fees IN (-1, '.$fk_c_type_fees.')';
|
||||||
|
}
|
||||||
|
if (!empty($date))
|
||||||
|
{
|
||||||
|
$date = dol_print_date($date, '%Y-%m-%d');
|
||||||
|
$sql.= ' AND er.dates <= \''.$date.'\'';
|
||||||
|
$sql.= ' AND er.datee >= \''.$date.'\'';
|
||||||
|
}
|
||||||
|
if ($fk_user > 0)
|
||||||
|
{
|
||||||
|
$sql.= ' AND (er.is_for_all = 1';
|
||||||
|
$sql.= ' OR er.fk_user = '.$fk_user;
|
||||||
|
$sql.= ' OR er.fk_usergroup IN (SELECT ugu.fk_usergroup FROM '.MAIN_DB_PREFIX.'usergroup_user ugu WHERE ugu.fk_user = '.$fk_user.') )';
|
||||||
|
}
|
||||||
|
$sql.= ' ORDER BY er.is_for_all, er.fk_usergroup, er.fk_user';
|
||||||
|
|
||||||
|
dol_syslog("ExpenseReportRule::getAllRule sql=".$sql);
|
||||||
|
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
while ($obj = $db->fetch_object($resql))
|
||||||
|
{
|
||||||
|
$rule = new ExpenseReportRule($db);
|
||||||
|
if ($rule->fetch($obj->rowid) > 0) $rules[$rule->id] = $rule;
|
||||||
|
else dol_print_error($db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $rules;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the label of group for the current object
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getGroupLabel()
|
||||||
|
{
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
|
||||||
|
|
||||||
|
if ($this->fk_usergroup > 0)
|
||||||
|
{
|
||||||
|
$group = new UserGroup($this->db);
|
||||||
|
if ($group->fetch($this->fk_usergroup) > 0)
|
||||||
|
{
|
||||||
|
return $group->nom;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error = $group->error;
|
||||||
|
$this->errors[] = $this->error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the name of user for the current object
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getUserName()
|
||||||
|
{
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||||
|
|
||||||
|
if ($this->fk_user > 0)
|
||||||
|
{
|
||||||
|
$u = new User($this->db);
|
||||||
|
if ($u->fetch($this->fk_user) > 0)
|
||||||
|
{
|
||||||
|
return dolGetFirstLastname($u->firstname, $u->lastname);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error = $u->error;
|
||||||
|
$this->errors[] = $this->error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -127,20 +127,23 @@ class Export
|
|||||||
|
|
||||||
// Test if permissions are ok
|
// Test if permissions are ok
|
||||||
$bool=true;
|
$bool=true;
|
||||||
foreach($module->export_permission[$r] as $val)
|
if (isset($module->export_permission))
|
||||||
{
|
{
|
||||||
$perm=$val;
|
foreach($module->export_permission[$r] as $val)
|
||||||
//print_r("$perm[0]-$perm[1]-$perm[2]<br>");
|
{
|
||||||
if (! empty($perm[2]))
|
$perm=$val;
|
||||||
{
|
//print_r("$perm[0]-$perm[1]-$perm[2]<br>");
|
||||||
$bool=$user->rights->{$perm[0]}->{$perm[1]}->{$perm[2]};
|
if (! empty($perm[2]))
|
||||||
}
|
{
|
||||||
else
|
$bool=$user->rights->{$perm[0]}->{$perm[1]}->{$perm[2]};
|
||||||
{
|
}
|
||||||
$bool=$user->rights->{$perm[0]}->{$perm[1]};
|
else
|
||||||
}
|
{
|
||||||
if ($perm[0]=='user' && $user->admin) $bool=true;
|
$bool=$user->rights->{$perm[0]}->{$perm[1]};
|
||||||
if (! $bool) break;
|
}
|
||||||
|
if ($perm[0]=='user' && $user->admin) $bool=true;
|
||||||
|
if (! $bool) break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//print $bool." $perm[0]"."<br>";
|
//print $bool." $perm[0]"."<br>";
|
||||||
|
|
||||||
|
|||||||
@@ -591,7 +591,7 @@ if ($step == 2 && $datatoexport)
|
|||||||
$i++;
|
$i++;
|
||||||
|
|
||||||
$entity=(! empty($objexport->array_export_entities[0][$code])?$objexport->array_export_entities[0][$code]:$objexport->array_export_icon[0]);
|
$entity=(! empty($objexport->array_export_entities[0][$code])?$objexport->array_export_entities[0][$code]:$objexport->array_export_icon[0]);
|
||||||
$entityicon=(! empty($entitytoicon[$entity])?$entitytoicon[$entity]:$entity);
|
$entityicon=strtolower(! empty($entitytoicon[$entity])?$entitytoicon[$entity]:$entity);
|
||||||
$entitylang=(! empty($entitytolang[$entity])?$entitytolang[$entity]:$entity);
|
$entitylang=(! empty($entitytolang[$entity])?$entitytolang[$entity]:$entity);
|
||||||
|
|
||||||
print '<td class="nowrap">';
|
print '<td class="nowrap">';
|
||||||
@@ -783,7 +783,7 @@ if ($step == 3 && $datatoexport)
|
|||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
$entity=(! empty($objexport->array_export_entities[0][$code])?$objexport->array_export_entities[0][$code]:$objexport->array_export_icon[0]);
|
$entity=(! empty($objexport->array_export_entities[0][$code])?$objexport->array_export_entities[0][$code]:$objexport->array_export_icon[0]);
|
||||||
$entityicon=(! empty($entitytoicon[$entity])?$entitytoicon[$entity]:$entity);
|
$entityicon=strtolower(! empty($entitytoicon[$entity])?$entitytoicon[$entity]:$entity);
|
||||||
$entitylang=(! empty($entitytolang[$entity])?$entitytolang[$entity]:$entity);
|
$entitylang=(! empty($entitytolang[$entity])?$entitytolang[$entity]:$entity);
|
||||||
|
|
||||||
print '<td class="nowrap">';
|
print '<td class="nowrap">';
|
||||||
@@ -978,7 +978,7 @@ if ($step == 4 && $datatoexport)
|
|||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
$entity=(! empty($objexport->array_export_entities[0][$code])?$objexport->array_export_entities[0][$code]:$objexport->array_export_icon[0]);
|
$entity=(! empty($objexport->array_export_entities[0][$code])?$objexport->array_export_entities[0][$code]:$objexport->array_export_icon[0]);
|
||||||
$entityicon=(! empty($entitytoicon[$entity])?$entitytoicon[$entity]:$entity);
|
$entityicon=strtolower(! empty($entitytoicon[$entity])?$entitytoicon[$entity]:$entity);
|
||||||
$entitylang=(! empty($entitytolang[$entity])?$entitytolang[$entity]:$entity);
|
$entitylang=(! empty($entitytolang[$entity])?$entitytolang[$entity]:$entity);
|
||||||
|
|
||||||
print '<td class="nowrap">';
|
print '<td class="nowrap">';
|
||||||
|
|||||||
@@ -23,14 +23,14 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
|||||||
/**
|
/**
|
||||||
* API class for supplier invoices
|
* API class for supplier invoices
|
||||||
*
|
*
|
||||||
* @access protected
|
* @access protected
|
||||||
* @class DolibarrApiAccess {@requires user,external}
|
* @class DolibarrApiAccess {@requires user,external}
|
||||||
*/
|
*/
|
||||||
class SupplierInvoices extends DolibarrApi
|
class SupplierInvoices extends DolibarrApi
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var array $FIELDS Mandatory fields, checked when create and update object
|
* @var array $FIELDS Mandatory fields, checked when create and update object
|
||||||
*/
|
*/
|
||||||
static $FIELDS = array(
|
static $FIELDS = array(
|
||||||
'socid'
|
'socid'
|
||||||
@@ -55,24 +55,24 @@ class SupplierInvoices extends DolibarrApi
|
|||||||
* Get properties of a supplier invoice object
|
* Get properties of a supplier invoice object
|
||||||
*
|
*
|
||||||
* Return an array with supplier invoice information
|
* Return an array with supplier invoice information
|
||||||
*
|
*
|
||||||
* @param int $id ID of supplier invoice
|
* @param int $id ID of supplier invoice
|
||||||
* @return array|mixed data without useless information
|
* @return array|mixed data without useless information
|
||||||
*
|
*
|
||||||
* @throws RestException
|
* @throws RestException
|
||||||
*/
|
*/
|
||||||
function get($id)
|
function get($id)
|
||||||
{
|
{
|
||||||
if(! DolibarrApiAccess::$user->rights->fournisseur->facture->lire) {
|
if(! DolibarrApiAccess::$user->rights->fournisseur->facture->lire) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->invoice->fetch($id);
|
$result = $this->invoice->fetch($id);
|
||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Supplier invoice not found');
|
throw new RestException(404, 'Supplier invoice not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
|
if( ! DolibarrApi::_checkAccessToResource('fournisseur',$this->invoice->id,'facture_fourn','facture')) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,9 +81,9 @@ class SupplierInvoices extends DolibarrApi
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* List invoices
|
* List invoices
|
||||||
*
|
*
|
||||||
* Get a list of supplier invoices
|
* Get a list of supplier invoices
|
||||||
*
|
*
|
||||||
* @param string $sortfield Sort field
|
* @param string $sortfield Sort field
|
||||||
* @param string $sortorder Sort order
|
* @param string $sortorder Sort order
|
||||||
* @param int $limit Limit for list
|
* @param int $limit Limit for list
|
||||||
@@ -97,12 +97,12 @@ class SupplierInvoices extends DolibarrApi
|
|||||||
*/
|
*/
|
||||||
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $thirdparty_ids='', $status='', $sqlfilters = '') {
|
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $thirdparty_ids='', $status='', $sqlfilters = '') {
|
||||||
global $db, $conf;
|
global $db, $conf;
|
||||||
|
|
||||||
$obj_ret = array();
|
$obj_ret = array();
|
||||||
|
|
||||||
// case of external user, $thirdparty_ids param is ignored and replaced by user's socid
|
// case of external user, $thirdparty_ids param is ignored and replaced by user's socid
|
||||||
$socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids;
|
$socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids;
|
||||||
|
|
||||||
// If the internal user must only see his customers, force searching by him
|
// If the internal user must only see his customers, force searching by him
|
||||||
$search_sale = 0;
|
$search_sale = 0;
|
||||||
if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id;
|
if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id;
|
||||||
@@ -110,14 +110,14 @@ class SupplierInvoices extends DolibarrApi
|
|||||||
$sql = "SELECT t.rowid";
|
$sql = "SELECT t.rowid";
|
||||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as t";
|
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as t";
|
||||||
|
|
||||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||||
|
|
||||||
$sql.= ' WHERE t.entity IN ('.getEntity('supplier_invoice').')';
|
$sql.= ' WHERE t.entity IN ('.getEntity('supplier_invoice').')';
|
||||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc";
|
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc";
|
||||||
if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")";
|
if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")";
|
||||||
if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
||||||
|
|
||||||
// Filter by status
|
// Filter by status
|
||||||
if ($status == 'draft') $sql.= " AND t.fk_statut IN (0)";
|
if ($status == 'draft') $sql.= " AND t.fk_statut IN (0)";
|
||||||
if ($status == 'unpaid') $sql.= " AND t.fk_statut IN (1)";
|
if ($status == 'unpaid') $sql.= " AND t.fk_statut IN (1)";
|
||||||
@@ -129,7 +129,7 @@ class SupplierInvoices extends DolibarrApi
|
|||||||
$sql .= " AND sc.fk_user = ".$search_sale;
|
$sql .= " AND sc.fk_user = ".$search_sale;
|
||||||
}
|
}
|
||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters)
|
if ($sqlfilters)
|
||||||
{
|
{
|
||||||
if (! DolibarrApi::_checkFilters($sqlfilters))
|
if (! DolibarrApi::_checkFilters($sqlfilters))
|
||||||
{
|
{
|
||||||
@@ -138,7 +138,7 @@ class SupplierInvoices extends DolibarrApi
|
|||||||
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||||
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql.= $db->order($sortfield, $sortorder);
|
$sql.= $db->order($sortfield, $sortorder);
|
||||||
if ($limit) {
|
if ($limit) {
|
||||||
if ($page < 0)
|
if ($page < 0)
|
||||||
@@ -174,10 +174,10 @@ class SupplierInvoices extends DolibarrApi
|
|||||||
}
|
}
|
||||||
return $obj_ret;
|
return $obj_ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create supplier invoice object
|
* Create supplier invoice object
|
||||||
*
|
*
|
||||||
* @param array $request_data Request datas
|
* @param array $request_data Request datas
|
||||||
* @return int ID of supplier invoice
|
* @return int ID of supplier invoice
|
||||||
*/
|
*/
|
||||||
@@ -188,7 +188,7 @@ class SupplierInvoices extends DolibarrApi
|
|||||||
}
|
}
|
||||||
// Check mandatory fields
|
// Check mandatory fields
|
||||||
$result = $this->_validate($request_data);
|
$result = $this->_validate($request_data);
|
||||||
|
|
||||||
foreach($request_data as $field => $value) {
|
foreach($request_data as $field => $value) {
|
||||||
$this->invoice->$field = $value;
|
$this->invoice->$field = $value;
|
||||||
}
|
}
|
||||||
@@ -203,7 +203,7 @@ class SupplierInvoices extends DolibarrApi
|
|||||||
}
|
}
|
||||||
$this->invoice->lines = $lines;
|
$this->invoice->lines = $lines;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
if ($this->invoice->create(DolibarrApiAccess::$user) < 0) {
|
if ($this->invoice->create(DolibarrApiAccess::$user) < 0) {
|
||||||
throw new RestException(500, "Error creating order", array_merge(array($this->invoice->error), $this->invoice->errors));
|
throw new RestException(500, "Error creating order", array_merge(array($this->invoice->error), $this->invoice->errors));
|
||||||
}
|
}
|
||||||
@@ -214,21 +214,21 @@ class SupplierInvoices extends DolibarrApi
|
|||||||
* Update supplier invoice
|
* Update supplier invoice
|
||||||
*
|
*
|
||||||
* @param int $id Id of supplier invoice to update
|
* @param int $id Id of supplier invoice to update
|
||||||
* @param array $request_data Datas
|
* @param array $request_data Datas
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function put($id, $request_data = NULL)
|
function put($id, $request_data = NULL)
|
||||||
{
|
{
|
||||||
if(! DolibarrApiAccess::$user->rights->fournisseur->facture->creer) {
|
if(! DolibarrApiAccess::$user->rights->fournisseur->facture->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->invoice->fetch($id);
|
$result = $this->invoice->fetch($id);
|
||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Supplier invoice not found');
|
throw new RestException(404, 'Supplier invoice not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
|
if( ! DolibarrApi::_checkAccessToResource('fournisseur',$this->invoice->id,'facture_fourn','facture')) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,13 +236,13 @@ class SupplierInvoices extends DolibarrApi
|
|||||||
if ($field == 'id') continue;
|
if ($field == 'id') continue;
|
||||||
$this->invoice->$field = $value;
|
$this->invoice->$field = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->invoice->update($id, DolibarrApiAccess::$user))
|
if($this->invoice->update($id, DolibarrApiAccess::$user))
|
||||||
return $this->get ($id);
|
return $this->get ($id);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete supplier invoice
|
* Delete supplier invoice
|
||||||
*
|
*
|
||||||
@@ -258,16 +258,16 @@ class SupplierInvoices extends DolibarrApi
|
|||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Supplier invoice not found');
|
throw new RestException(404, 'Supplier invoice not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
|
if( ! DolibarrApi::_checkAccessToResource('fournisseur',$this->invoice->id,'facture_fourn','facture')) {
|
||||||
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( $this->invoice->delete(DolibarrApiAccess::$user) < 0)
|
if( $this->invoice->delete(DolibarrApiAccess::$user) < 0)
|
||||||
{
|
{
|
||||||
throw new RestException(500);
|
throw new RestException(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'success' => array(
|
'success' => array(
|
||||||
'code' => 200,
|
'code' => 200,
|
||||||
@@ -275,8 +275,56 @@ class SupplierInvoices extends DolibarrApi
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate an order
|
||||||
|
*
|
||||||
|
* @param int $id Order ID
|
||||||
|
* @param int $idwarehouse Warehouse ID
|
||||||
|
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||||
|
*
|
||||||
|
* @url POST {id}/validate
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
* FIXME An error 403 is returned if the request has an empty body.
|
||||||
|
* Error message: "Forbidden: Content type `text/plain` is not supported."
|
||||||
|
* Workaround: send this in the body
|
||||||
|
* {
|
||||||
|
* "idwarehouse": 0,
|
||||||
|
* "notrigger": 0
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
function validate($id, $idwarehouse=0, $notrigger=0)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->fournisseur->facture->creer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
$result = $this->invoice->fetch($id);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'Invoice not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! DolibarrApi::_checkAccessToResource('fournisseur',$this->invoice->id,'facture_fourn','facture')) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->invoice->validate(DolibarrApiAccess::$user, '', $idwarehouse, $notrigger);
|
||||||
|
if ($result == 0) {
|
||||||
|
throw new RestException(500, 'Error nothing done. May be object is already validated');
|
||||||
|
}
|
||||||
|
if ($result < 0) {
|
||||||
|
throw new RestException(500, 'Error when validating Invoice: '.$this->invoice->error);
|
||||||
|
}
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'success' => array(
|
||||||
|
'code' => 200,
|
||||||
|
'message' => 'Invoice validated (Ref='.$this->invoice->ref.')'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean sensible object datas
|
* Clean sensible object datas
|
||||||
*
|
*
|
||||||
@@ -284,20 +332,20 @@ class SupplierInvoices extends DolibarrApi
|
|||||||
* @return array Array of cleaned object properties
|
* @return array Array of cleaned object properties
|
||||||
*/
|
*/
|
||||||
function _cleanObjectDatas($object) {
|
function _cleanObjectDatas($object) {
|
||||||
|
|
||||||
$object = parent::_cleanObjectDatas($object);
|
$object = parent::_cleanObjectDatas($object);
|
||||||
|
|
||||||
unset($object->rowid);
|
unset($object->rowid);
|
||||||
|
|
||||||
return $object;
|
return $object;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate fields before create or update object
|
* Validate fields before create or update object
|
||||||
*
|
*
|
||||||
* @param array $data Datas to validate
|
* @param array $data Datas to validate
|
||||||
* @return array
|
* @return array
|
||||||
*
|
*
|
||||||
* @throws RestException
|
* @throws RestException
|
||||||
*/
|
*/
|
||||||
function _validate($data)
|
function _validate($data)
|
||||||
|
|||||||
365
htdocs/fourn/class/api_supplier_orders.class.php
Normal file
365
htdocs/fourn/class/api_supplier_orders.class.php
Normal file
@@ -0,0 +1,365 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
|
* Copyright (C) 2016 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
use Luracast\Restler\RestException;
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API class for supplier orders
|
||||||
|
*
|
||||||
|
* @access protected
|
||||||
|
* @class DolibarrApiAccess {@requires user,external}
|
||||||
|
*/
|
||||||
|
class SupplierOrders extends DolibarrApi
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var array $FIELDS Mandatory fields, checked when create and update object
|
||||||
|
*/
|
||||||
|
static $FIELDS = array(
|
||||||
|
'socid'
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var CommandeFournisseur $order {@type CommandeFournisseur}
|
||||||
|
*/
|
||||||
|
public $order;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
global $db, $conf;
|
||||||
|
$this->db = $db;
|
||||||
|
$this->order = new CommandeFournisseur($this->db);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get properties of a supplier order object
|
||||||
|
*
|
||||||
|
* Return an array with supplier order information
|
||||||
|
*
|
||||||
|
* @param int $id ID of supplier order
|
||||||
|
* @return array|mixed data without useless information
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
*/
|
||||||
|
function get($id)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->fournisseur->commande->lire) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->order->fetch($id);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'Supplier order not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! DolibarrApi::_checkAccessToResource('fournisseur',$this->order->id,'','commande')) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->_cleanObjectDatas($this->order);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List orders
|
||||||
|
*
|
||||||
|
* Get a list of supplier orders
|
||||||
|
*
|
||||||
|
* @param string $sortfield Sort field
|
||||||
|
* @param string $sortorder Sort order
|
||||||
|
* @param int $limit Limit for list
|
||||||
|
* @param int $page Page number
|
||||||
|
* @param string $thirdparty_ids Thirdparty ids to filter orders of. {@example '1' or '1,2,3'} {@pattern /^[0-9,]*$/i}
|
||||||
|
* @param string $status Filter by order status : draft | validated | approved | running | received_start | received_end | cancelled | refused
|
||||||
|
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')"
|
||||||
|
* @return array Array of order objects
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
*/
|
||||||
|
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $thirdparty_ids='', $status='', $sqlfilters = '') {
|
||||||
|
global $db, $conf;
|
||||||
|
|
||||||
|
$obj_ret = array();
|
||||||
|
|
||||||
|
// case of external user, $thirdparty_ids param is ignored and replaced by user's socid
|
||||||
|
$socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids;
|
||||||
|
|
||||||
|
// If the internal user must only see his customers, force searching by him
|
||||||
|
$search_sale = 0;
|
||||||
|
if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id;
|
||||||
|
|
||||||
|
$sql = "SELECT t.rowid";
|
||||||
|
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as t";
|
||||||
|
|
||||||
|
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||||
|
|
||||||
|
$sql.= ' WHERE t.entity IN ('.getEntity('supplier_order').')';
|
||||||
|
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc";
|
||||||
|
if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")";
|
||||||
|
if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
||||||
|
|
||||||
|
// Filter by status
|
||||||
|
if ($status == 'draft') $sql.= " AND t.fk_statut IN (0)";
|
||||||
|
if ($status == 'validated') $sql.= " AND t.fk_statut IN (1)";
|
||||||
|
if ($status == 'approved') $sql.= " AND t.fk_statut IN (2)";
|
||||||
|
if ($status == 'running') $sql.= " AND t.fk_statut IN (3)";
|
||||||
|
if ($status == 'received_start') $sql.= " AND t.fk_statut IN (4)";
|
||||||
|
if ($status == 'received_end') $sql.= " AND t.fk_statut IN (5)";
|
||||||
|
if ($status == 'cancelled') $sql.= " AND t.fk_statut IN (6,7)";
|
||||||
|
if ($status == 'refused') $sql.= " AND t.fk_statut IN (9)";
|
||||||
|
// Insert sale filter
|
||||||
|
if ($search_sale > 0)
|
||||||
|
{
|
||||||
|
$sql .= " AND sc.fk_user = ".$search_sale;
|
||||||
|
}
|
||||||
|
// Add sql filters
|
||||||
|
if ($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).")";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql.= $db->order($sortfield, $sortorder);
|
||||||
|
if ($limit) {
|
||||||
|
if ($page < 0)
|
||||||
|
{
|
||||||
|
$page = 0;
|
||||||
|
}
|
||||||
|
$offset = $limit * $page;
|
||||||
|
|
||||||
|
$sql.= $db->plimit($limit + 1, $offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $db->query($sql);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
$i = 0;
|
||||||
|
$num = $db->num_rows($result);
|
||||||
|
$min = min($num, ($limit <= 0 ? $num : $limit));
|
||||||
|
while ($i < $min)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($result);
|
||||||
|
$order_static = new CommandeFournisseur($db);
|
||||||
|
if($order_static->fetch($obj->rowid)) {
|
||||||
|
$obj_ret[] = $this->_cleanObjectDatas($order_static);
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new RestException(503, 'Error when retrieve supplier order list : '.$db->lasterror());
|
||||||
|
}
|
||||||
|
if( ! count($obj_ret)) {
|
||||||
|
throw new RestException(404, 'No supplier order found');
|
||||||
|
}
|
||||||
|
return $obj_ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create supplier order object
|
||||||
|
*
|
||||||
|
* @param array $request_data Request datas
|
||||||
|
* @return int ID of supplier order
|
||||||
|
*/
|
||||||
|
function post($request_data = NULL)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->fournisseur->commande->creer) {
|
||||||
|
throw new RestException(401, "Insuffisant rights");
|
||||||
|
}
|
||||||
|
// Check mandatory fields
|
||||||
|
$result = $this->_validate($request_data);
|
||||||
|
|
||||||
|
foreach($request_data as $field => $value) {
|
||||||
|
$this->order->$field = $value;
|
||||||
|
}
|
||||||
|
if(! array_keys($request_data,'date')) {
|
||||||
|
$this->order->date = dol_now();
|
||||||
|
}
|
||||||
|
/* We keep lines as an array
|
||||||
|
if (isset($request_data["lines"])) {
|
||||||
|
$lines = array();
|
||||||
|
foreach ($request_data["lines"] as $line) {
|
||||||
|
array_push($lines, (object) $line);
|
||||||
|
}
|
||||||
|
$this->order->lines = $lines;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
if ($this->order->create(DolibarrApiAccess::$user) < 0) {
|
||||||
|
throw new RestException(500, "Error creating order", array_merge(array($this->order->error), $this->order->errors));
|
||||||
|
}
|
||||||
|
return $this->order->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update supplier order
|
||||||
|
*
|
||||||
|
* @param int $id Id of supplier order to update
|
||||||
|
* @param array $request_data Datas
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
function put($id, $request_data = NULL)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->fournisseur->commande->creer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->order->fetch($id);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'Supplier order not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! DolibarrApi::_checkAccessToResource('fournisseur',$this->order->id,'','commande')) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($request_data as $field => $value) {
|
||||||
|
if ($field == 'id') continue;
|
||||||
|
$this->order->$field = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($this->order->update($id, DolibarrApiAccess::$user))
|
||||||
|
return $this->get ($id);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete supplier order
|
||||||
|
*
|
||||||
|
* @param int $id Supplier order ID
|
||||||
|
* @return type
|
||||||
|
*/
|
||||||
|
function delete($id)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->fournisseur->commande->supprimer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
$result = $this->order->fetch($id);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'Supplier order not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! DolibarrApi::_checkAccessToResource('fournisseur',$this->order->id,'','commande')) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( $this->order->delete(DolibarrApiAccess::$user) < 0)
|
||||||
|
{
|
||||||
|
throw new RestException(500);
|
||||||
|
}
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'success' => array(
|
||||||
|
'code' => 200,
|
||||||
|
'message' => 'Supplier order deleted'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate an order
|
||||||
|
*
|
||||||
|
* @param int $id Order ID
|
||||||
|
* @param int $idwarehouse Warehouse ID
|
||||||
|
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||||
|
*
|
||||||
|
* @url POST {id}/validate
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
* FIXME An error 403 is returned if the request has an empty body.
|
||||||
|
* Error message: "Forbidden: Content type `text/plain` is not supported."
|
||||||
|
* Workaround: send this in the body
|
||||||
|
* {
|
||||||
|
* "idwarehouse": 0,
|
||||||
|
* "notrigger": 0
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
function validate($id, $idwarehouse=0, $notrigger=0)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->fournisseur->commande->creer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
$result = $this->order->fetch($id);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'Order not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! DolibarrApi::_checkAccessToResource('fournisseur',$this->order->id,'','commande')) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->order->valid(DolibarrApiAccess::$user, $idwarehouse, $notrigger);
|
||||||
|
if ($result == 0) {
|
||||||
|
throw new RestException(500, 'Error nothing done. May be object is already validated');
|
||||||
|
}
|
||||||
|
if ($result < 0) {
|
||||||
|
throw new RestException(500, 'Error when validating Order: '.$this->order->error);
|
||||||
|
}
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'success' => array(
|
||||||
|
'code' => 200,
|
||||||
|
'message' => 'Order validated (Ref='.$this->order->ref.')'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean sensible object datas
|
||||||
|
*
|
||||||
|
* @param Object $object Object to clean
|
||||||
|
* @return array Array of cleaned object properties
|
||||||
|
*/
|
||||||
|
function _cleanObjectDatas($object) {
|
||||||
|
|
||||||
|
$object = parent::_cleanObjectDatas($object);
|
||||||
|
|
||||||
|
unset($object->rowid);
|
||||||
|
|
||||||
|
return $object;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate fields before create or update object
|
||||||
|
*
|
||||||
|
* @param array $data Datas to validate
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
*/
|
||||||
|
function _validate($data)
|
||||||
|
{
|
||||||
|
$order = array();
|
||||||
|
foreach (SupplierOrders::$FIELDS as $field) {
|
||||||
|
if (!isset($data[$field]))
|
||||||
|
throw new RestException(400, "$field field missing");
|
||||||
|
$order[$field] = $data[$field];
|
||||||
|
}
|
||||||
|
return $order;
|
||||||
|
}
|
||||||
|
}
|
||||||
56
htdocs/install/mysql/data/llx_c_exp_tax_cat.sql
Normal file
56
htdocs/install/mysql/data/llx_c_exp_tax_cat.sql
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
-- Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
|
||||||
|
-- Copyright (C) 2017 Pierre-Henry Favre <phf@atm-consulting.fr>
|
||||||
|
--
|
||||||
|
-- This program is free software; you can redistribute it and/or modify
|
||||||
|
-- it under the terms of the GNU General Public License as published by
|
||||||
|
-- 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/>.
|
||||||
|
--
|
||||||
|
--
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors
|
||||||
|
-- de l'install et tous les sigles '--' sont supprimés.
|
||||||
|
--
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Categories expense
|
||||||
|
--
|
||||||
|
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (1,'ExpAutoCat', 1, 0);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (2,'ExpCycloCat', 1, 0);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (3,'ExpMotoCat', 1, 0);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (4,'ExpAuto3CV', 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (5,'ExpAuto4CV', 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (6,'ExpAuto5CV', 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (7,'ExpAuto6CV', 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (8,'ExpAuto7CV', 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (9,'ExpAuto8CV', 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (10,'ExpAuto9CV', 1, 0);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (11,'ExpAuto10CV', 1, 0);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (12,'ExpAuto11CV', 1, 0);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (13,'ExpAuto12CV', 1, 0);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (14,'ExpAuto3PCV', 1, 0);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (15,'ExpAuto4PCV', 1, 0);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (16,'ExpAuto5PCV', 1, 0);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (17,'ExpAuto6PCV', 1, 0);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (18,'ExpAuto7PCV', 1, 0);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (19,'ExpAuto8PCV', 1, 0);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (20,'ExpAuto9PCV', 1, 0);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (21,'ExpAuto10PCV', 1, 0);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (22,'ExpAuto11PCV', 1, 0);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (23,'ExpAuto12PCV', 1, 0);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (24,'ExpAuto13PCV', 1, 0);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (25,'ExpCyclo', 1, 0);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (26,'ExpMoto12CV', 1, 0);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (27,'ExpMoto345CV', 1, 0);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (28,'ExpMoto5PCV', 1, 0);
|
||||||
47
htdocs/install/mysql/data/llx_c_exp_tax_range.sql
Normal file
47
htdocs/install/mysql/data/llx_c_exp_tax_range.sql
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
-- Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
|
||||||
|
-- Copyright (C) 2017 Pierre-Henry Favre <phf@atm-consulting.fr>
|
||||||
|
--
|
||||||
|
-- This program is free software; you can redistribute it and/or modify
|
||||||
|
-- it under the terms of the GNU General Public License as published by
|
||||||
|
-- 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/>.
|
||||||
|
--
|
||||||
|
--
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors
|
||||||
|
-- de l'install et tous les sigles '--' sont supprimés.
|
||||||
|
--
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Range expense
|
||||||
|
--
|
||||||
|
|
||||||
|
INSERT INTO llx_c_exp_tax_range (rowid,fk_c_exp_tax_cat,range_ik, entity, active) values (1,4, 0, 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_range (rowid,fk_c_exp_tax_cat,range_ik, entity, active) values (2,4, 5000, 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_range (rowid,fk_c_exp_tax_cat,range_ik, entity, active) values (3,4, 20000, 1, 1);
|
||||||
|
|
||||||
|
INSERT INTO llx_c_exp_tax_range (rowid,fk_c_exp_tax_cat,range_ik, entity, active) values (4,5, 0, 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_range (rowid,fk_c_exp_tax_cat,range_ik, entity, active) values (5,5, 5000, 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_range (rowid,fk_c_exp_tax_cat,range_ik, entity, active) values (6,5, 20000, 1, 1);
|
||||||
|
|
||||||
|
INSERT INTO llx_c_exp_tax_range (rowid,fk_c_exp_tax_cat,range_ik, entity, active) values (7,6, 0, 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_range (rowid,fk_c_exp_tax_cat,range_ik, entity, active) values (8,6, 5000, 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_range (rowid,fk_c_exp_tax_cat,range_ik, entity, active) values (9,6, 20000, 1, 1);
|
||||||
|
|
||||||
|
INSERT INTO llx_c_exp_tax_range (rowid,fk_c_exp_tax_cat,range_ik, entity, active) values (10,7, 0, 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_range (rowid,fk_c_exp_tax_cat,range_ik, entity, active) values (11,7, 5000, 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_range (rowid,fk_c_exp_tax_cat,range_ik, entity, active) values (12,7, 20000, 1, 1);
|
||||||
|
|
||||||
|
INSERT INTO llx_c_exp_tax_range (rowid,fk_c_exp_tax_cat,range_ik, entity, active) values (13,8, 0, 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_range (rowid,fk_c_exp_tax_cat,range_ik, entity, active) values (14,8, 5000, 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_range (rowid,fk_c_exp_tax_cat,range_ik, entity, active) values (15,8, 20000, 1, 1);
|
||||||
@@ -5,6 +5,8 @@
|
|||||||
-- Copyright (C) 2004 Guillaume Delecourt <guillaume.delecourt@opensides.be>
|
-- Copyright (C) 2004 Guillaume Delecourt <guillaume.delecourt@opensides.be>
|
||||||
-- Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
-- Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
-- Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
-- Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||||
|
-- Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
|
||||||
|
-- Copyright (C) 2017 Pierre-Henry Favre <phf@atm-consulting.fr>
|
||||||
--
|
--
|
||||||
-- This program is free software; you can redistribute it and/or modify
|
-- This program is free software; you can redistribute it and/or modify
|
||||||
-- it under the terms of the GNU General Public License as published by
|
-- it under the terms of the GNU General Public License as published by
|
||||||
@@ -33,3 +35,27 @@
|
|||||||
insert into llx_c_type_fees (code,label,active) values ('TF_OTHER', 'Other', 1);
|
insert into llx_c_type_fees (code,label,active) values ('TF_OTHER', 'Other', 1);
|
||||||
insert into llx_c_type_fees (code,label,active) values ('TF_TRIP', 'Transportation', 1);
|
insert into llx_c_type_fees (code,label,active) values ('TF_TRIP', 'Transportation', 1);
|
||||||
insert into llx_c_type_fees (code,label,active) values ('TF_LUNCH', 'Lunch', 1);
|
insert into llx_c_type_fees (code,label,active) values ('TF_LUNCH', 'Lunch', 1);
|
||||||
|
|
||||||
|
INSERT INTO llx_c_type_fees (code, label, active, accountancy_code) VALUES
|
||||||
|
('EX_KME', 'ExpLabelKm', 1, '625100'),
|
||||||
|
('EX_FUE', 'ExpLabelFuelCV', 0, '606150'),
|
||||||
|
('EX_HOT', 'ExpLabelHotel', 0, '625160'),
|
||||||
|
('EX_PAR', 'ExpLabelParkingCV', 0, '625160'),
|
||||||
|
('EX_TOL', 'ExpLabelTollCV', 0, '625160'),
|
||||||
|
('EX_TAX', 'ExpLabelVariousTaxes', 0, '637800'),
|
||||||
|
('EX_IND', 'ExpLabelIndemnityTransportationSubscription', 0, '648100'),
|
||||||
|
('EX_SUM', 'ExpLabelMaintenanceSupply', 0, '606300'),
|
||||||
|
('EX_SUO', 'ExpLabelOfficeSupplies', 0, '606400'),
|
||||||
|
('EX_CAR', 'ExpLabelCarRental', 0, '613000'),
|
||||||
|
('EX_DOC', 'ExpLabelDocumentation', 0, '618100'),
|
||||||
|
('EX_CUR', 'ExpLabelCustomersReceiving', 0, '625710'),
|
||||||
|
('EX_OTR', 'ExpLabelOtherReceiving', 0, '625700'),
|
||||||
|
('EX_POS', 'ExpLabelPostage', 0, '626100'),
|
||||||
|
('EX_CAM', 'ExpLabelMaintenanceRepairCV', 0, '615300'),
|
||||||
|
('EX_EMM', 'ExpLabelEmployeesMeal', 0, '625160'),
|
||||||
|
('EX_GUM', 'ExpLabelGuestsMeal', 0, '625160'),
|
||||||
|
('EX_BRE', 'ExpLabelBreakfast', 0, '625160'),
|
||||||
|
('EX_FUE_VP', 'ExpLabelFuelPV', 0, '606150'),
|
||||||
|
('EX_TOL_VP', 'ExpLabelTollPV', 0, '625160'),
|
||||||
|
('EX_PAR_VP', 'ExpLabelParkingPV', 0, '625160'),
|
||||||
|
('EX_CAM_VP', 'ExpLabelMaintenanceRepairPV', 0, '615300');
|
||||||
47
htdocs/install/mysql/data/llx_expensereport_ik.sql
Normal file
47
htdocs/install/mysql/data/llx_expensereport_ik.sql
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
-- Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
|
||||||
|
-- Copyright (C) 2017 Pierre-Henry Favre <phf@atm-consulting.fr>
|
||||||
|
--
|
||||||
|
-- This program is free software; you can redistribute it and/or modify
|
||||||
|
-- it under the terms of the GNU General Public License as published by
|
||||||
|
-- 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/>.
|
||||||
|
--
|
||||||
|
--
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors
|
||||||
|
-- de l'install et tous les sigles '--' sont supprimés.
|
||||||
|
--
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Coef expense
|
||||||
|
--
|
||||||
|
|
||||||
|
INSERT INTO llx_expensereport_ik (rowid,fk_c_exp_tax_cat, fk_range, coef, offset) values (1,4, 1, 0.41, 0);
|
||||||
|
INSERT INTO llx_expensereport_ik (rowid,fk_c_exp_tax_cat, fk_range, coef, offset) values (2,4, 2, 0.244, 824);
|
||||||
|
INSERT INTO llx_expensereport_ik (rowid,fk_c_exp_tax_cat, fk_range, coef, offset) values (3,4, 3, 0.286, 0);
|
||||||
|
|
||||||
|
INSERT INTO llx_expensereport_ik (rowid,fk_c_exp_tax_cat, fk_range, coef, offset) values (4,5, 4, 0.493, 0);
|
||||||
|
INSERT INTO llx_expensereport_ik (rowid,fk_c_exp_tax_cat, fk_range, coef, offset) values (5,5, 5, 0.277, 1082);
|
||||||
|
INSERT INTO llx_expensereport_ik (rowid,fk_c_exp_tax_cat, fk_range, coef, offset) values (6,5, 6, 0.332, 0);
|
||||||
|
|
||||||
|
INSERT INTO llx_expensereport_ik (rowid,fk_c_exp_tax_cat, fk_range, coef, offset) values (7,6, 7, 0.543, 0);
|
||||||
|
INSERT INTO llx_expensereport_ik (rowid,fk_c_exp_tax_cat, fk_range, coef, offset) values (8,6, 8, 0.305, 1180);
|
||||||
|
INSERT INTO llx_expensereport_ik (rowid,fk_c_exp_tax_cat, fk_range, coef, offset) values (9,6, 9, 0.364, 0);
|
||||||
|
|
||||||
|
INSERT INTO llx_expensereport_ik (rowid,fk_c_exp_tax_cat, fk_range, coef, offset) values (10,7, 10, 0.568, 0);
|
||||||
|
INSERT INTO llx_expensereport_ik (rowid,fk_c_exp_tax_cat, fk_range, coef, offset) values (11,7, 11, 0.32, 1244);
|
||||||
|
INSERT INTO llx_expensereport_ik (rowid,fk_c_exp_tax_cat, fk_range, coef, offset) values (12,7, 12, 0.382, 0);
|
||||||
|
|
||||||
|
INSERT INTO llx_expensereport_ik (rowid,fk_c_exp_tax_cat, fk_range, coef, offset) values (13,8, 13, 0.595, 0);
|
||||||
|
INSERT INTO llx_expensereport_ik (rowid,fk_c_exp_tax_cat, fk_range, coef, offset) values (14,8, 14, 0.337, 1288);
|
||||||
|
INSERT INTO llx_expensereport_ik (rowid,fk_c_exp_tax_cat, fk_range, coef, offset) values (15,8, 15, 0.401, 0);
|
||||||
@@ -32,6 +32,11 @@ ALTER TABLE llx_website_page MODIFY COLUMN pageurl varchar(255);
|
|||||||
ALTER TABLE llx_website_page ADD COLUMN lang varchar(6);
|
ALTER TABLE llx_website_page ADD COLUMN lang varchar(6);
|
||||||
ALTER TABLE llx_website_page ADD COLUMN fk_page integer;
|
ALTER TABLE llx_website_page ADD COLUMN fk_page integer;
|
||||||
|
|
||||||
|
ALTER TABLE llx_website_page MODIFY COLUMN status INTEGER DEFAULT 1;
|
||||||
|
UPDATE llx_website_page set status = 1 WHERE status IS NULL;
|
||||||
|
|
||||||
|
ALTER TABLE llx_website ADD COLUMN import_key varchar(14);
|
||||||
|
ALTER TABLE llx_website_page ADD COLUMN import_key varchar(14);
|
||||||
ALTER TABLE llx_fichinter ADD COLUMN import_key varchar(14);
|
ALTER TABLE llx_fichinter ADD COLUMN import_key varchar(14);
|
||||||
ALTER TABLE llx_livraison ADD COLUMN import_key varchar(14);
|
ALTER TABLE llx_livraison ADD COLUMN import_key varchar(14);
|
||||||
ALTER TABLE llx_livraison ADD COLUMN extraparams varchar(255);
|
ALTER TABLE llx_livraison ADD COLUMN extraparams varchar(255);
|
||||||
@@ -44,6 +49,140 @@ ALTER TABLE llx_accounting_bookkeeping ADD COLUMN extraparams varchar(255);
|
|||||||
|
|
||||||
ALTER TABLE llx_accounting_bookkeeping ADD COLUMN date_lim_reglement datetime;
|
ALTER TABLE llx_accounting_bookkeeping ADD COLUMN date_lim_reglement datetime;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS llx_expensereport_ik (
|
||||||
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
datec datetime DEFAULT NULL,
|
||||||
|
tms timestamp,
|
||||||
|
fk_c_exp_tax_cat integer DEFAULT 0 NOT NULL,
|
||||||
|
fk_range integer DEFAULT 0 NOT NULL,
|
||||||
|
coef double DEFAULT 0 NOT NULL,
|
||||||
|
offset double DEFAULT 0 NOT NULL
|
||||||
|
)ENGINE=innodb DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS llx_c_exp_tax_cat (
|
||||||
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
label varchar(48) NOT NULL,
|
||||||
|
entity integer DEFAULT 1 NOT NULL,
|
||||||
|
active integer DEFAULT 1 NOT NULL
|
||||||
|
)ENGINE=innodb DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS llx_c_exp_tax_range (
|
||||||
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
fk_c_exp_tax_cat integer DEFAULT 1 NOT NULL,
|
||||||
|
range_ik double DEFAULT 0 NOT NULL,
|
||||||
|
entity integer DEFAULT 1 NOT NULL,
|
||||||
|
active integer DEFAULT 1 NOT NULL
|
||||||
|
)ENGINE=innodb DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
INSERT INTO llx_c_type_fees (code, label, active, accountancy_code) VALUES
|
||||||
|
('EX_KME', 'ExpLabelKm', 1, '625100'),
|
||||||
|
('EX_FUE', 'ExpLabelFuelCV', 0, '606150'),
|
||||||
|
('EX_HOT', 'ExpLabelHotel', 0, '625160'),
|
||||||
|
('EX_PAR', 'ExpLabelParkingCV', 0, '625160'),
|
||||||
|
('EX_TOL', 'ExpLabelTollCV', 0, '625160'),
|
||||||
|
('EX_TAX', 'ExpLabelVariousTaxes', 0, '637800'),
|
||||||
|
('EX_IND', 'ExpLabelIndemnityTranspSub', 0, '648100'),
|
||||||
|
('EX_SUM', 'ExpLabelMaintenanceSupply', 0, '606300'),
|
||||||
|
('EX_SUO', 'ExpLabelOfficeSupplies', 0, '606400'),
|
||||||
|
('EX_CAR', 'ExpLabelCarRental', 0, '613000'),
|
||||||
|
('EX_DOC', 'ExpLabelDocumentation', 0, '618100'),
|
||||||
|
('EX_CUR', 'ExpLabelCustomersReceiving', 0, '625710'),
|
||||||
|
('EX_OTR', 'ExpLabelOtherReceiving', 0, '625700'),
|
||||||
|
('EX_POS', 'ExpLabelPostage', 0, '626100'),
|
||||||
|
('EX_CAM', 'ExpLabelMaintenanceRepairCV', 0, '615300'),
|
||||||
|
('EX_EMM', 'ExpLabelEmployeesMeal', 0, '625160'),
|
||||||
|
('EX_GUM', 'ExpLabelGuestsMeal', 0, '625160'),
|
||||||
|
('EX_BRE', 'ExpLabelBreakfast', 0, '625160'),
|
||||||
|
('EX_FUE_VP', 'ExpLabelFuelPV', 0, '606150'),
|
||||||
|
('EX_TOL_VP', 'ExpLabelTollPV', 0, '625160'),
|
||||||
|
('EX_PAR_VP', 'ExpLabelParkingPV', 0, '625160'),
|
||||||
|
('EX_CAM_VP', 'ExpLabelMaintenanceRepairPV', 0, '615300');
|
||||||
|
|
||||||
|
INSERT INTO llx_expensereport_ik (rowid,fk_c_exp_tax_cat, fk_range, coef, offset) values (1,4, 1, 0.41, 0);
|
||||||
|
INSERT INTO llx_expensereport_ik (rowid,fk_c_exp_tax_cat, fk_range, coef, offset) values (2,4, 2, 0.244, 824);
|
||||||
|
INSERT INTO llx_expensereport_ik (rowid,fk_c_exp_tax_cat, fk_range, coef, offset) values (3,4, 3, 0.286, 0);
|
||||||
|
INSERT INTO llx_expensereport_ik (rowid,fk_c_exp_tax_cat, fk_range, coef, offset) values (4,5, 4, 0.493, 0);
|
||||||
|
INSERT INTO llx_expensereport_ik (rowid,fk_c_exp_tax_cat, fk_range, coef, offset) values (5,5, 5, 0.277, 1082);
|
||||||
|
INSERT INTO llx_expensereport_ik (rowid,fk_c_exp_tax_cat, fk_range, coef, offset) values (6,5, 6, 0.332, 0);
|
||||||
|
INSERT INTO llx_expensereport_ik (rowid,fk_c_exp_tax_cat, fk_range, coef, offset) values (7,6, 7, 0.543, 0);
|
||||||
|
INSERT INTO llx_expensereport_ik (rowid,fk_c_exp_tax_cat, fk_range, coef, offset) values (8,6, 8, 0.305, 1180);
|
||||||
|
INSERT INTO llx_expensereport_ik (rowid,fk_c_exp_tax_cat, fk_range, coef, offset) values (9,6, 9, 0.364, 0);
|
||||||
|
INSERT INTO llx_expensereport_ik (rowid,fk_c_exp_tax_cat, fk_range, coef, offset) values (10,7, 10, 0.568, 0);
|
||||||
|
INSERT INTO llx_expensereport_ik (rowid,fk_c_exp_tax_cat, fk_range, coef, offset) values (11,7, 11, 0.32, 1244);
|
||||||
|
INSERT INTO llx_expensereport_ik (rowid,fk_c_exp_tax_cat, fk_range, coef, offset) values (12,7, 12, 0.382, 0);
|
||||||
|
INSERT INTO llx_expensereport_ik (rowid,fk_c_exp_tax_cat, fk_range, coef, offset) values (13,8, 13, 0.595, 0);
|
||||||
|
INSERT INTO llx_expensereport_ik (rowid,fk_c_exp_tax_cat, fk_range, coef, offset) values (14,8, 14, 0.337, 1288);
|
||||||
|
INSERT INTO llx_expensereport_ik (rowid,fk_c_exp_tax_cat, fk_range, coef, offset) values (15,8, 15, 0.401, 0);
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (1,'ExpAutoCat', 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (2,'ExpCycloCat', 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (3,'ExpMotoCat', 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (4,'ExpAuto3CV', 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (5,'ExpAuto4CV', 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (6,'ExpAuto5CV', 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (7,'ExpAuto6CV', 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (8,'ExpAuto7CV', 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (9,'ExpAuto8CV', 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (10,'ExpAuto9CV', 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (11,'ExpAuto10CV', 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (12,'ExpAuto11CV', 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (13,'ExpAuto12CV', 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (14,'ExpAuto3PCV', 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (15,'ExpAuto4PCV', 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (16,'ExpAuto5PCV', 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (17,'ExpAuto6PCV', 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (18,'ExpAuto7PCV', 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (19,'ExpAuto8PCV', 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (20,'ExpAuto9PCV', 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (21,'ExpAuto10PCV', 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (22,'ExpAuto11PCV', 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (23,'ExpAuto12PCV', 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (24,'ExpAuto13PCV', 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (25,'ExpCyclo', 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (26,'ExpMoto12CV', 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (27,'ExpMoto345CV', 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_cat (rowid, label, entity, active) values (28,'ExpMoto5PCV', 1, 1);
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO llx_c_exp_tax_range (rowid,fk_c_exp_tax_cat,range_ik, entity, active) values (1,4, 0, 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_range (rowid,fk_c_exp_tax_cat,range_ik, entity, active) values (2,4, 5000, 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_range (rowid,fk_c_exp_tax_cat,range_ik, entity, active) values (3,4, 20000, 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_range (rowid,fk_c_exp_tax_cat,range_ik, entity, active) values (4,5, 0, 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_range (rowid,fk_c_exp_tax_cat,range_ik, entity, active) values (5,5, 5000, 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_range (rowid,fk_c_exp_tax_cat,range_ik, entity, active) values (6,5, 20000, 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_range (rowid,fk_c_exp_tax_cat,range_ik, entity, active) values (7,6, 0, 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_range (rowid,fk_c_exp_tax_cat,range_ik, entity, active) values (8,6, 5000, 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_range (rowid,fk_c_exp_tax_cat,range_ik, entity, active) values (9,6, 20000, 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_range (rowid,fk_c_exp_tax_cat,range_ik, entity, active) values (10,7, 0, 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_range (rowid,fk_c_exp_tax_cat,range_ik, entity, active) values (11,7, 5000, 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_range (rowid,fk_c_exp_tax_cat,range_ik, entity, active) values (12,7, 20000, 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_range (rowid,fk_c_exp_tax_cat,range_ik, entity, active) values (13,8, 0, 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_range (rowid,fk_c_exp_tax_cat,range_ik, entity, active) values (14,8, 5000, 1, 1);
|
||||||
|
INSERT INTO llx_c_exp_tax_range (rowid,fk_c_exp_tax_cat,range_ik, entity, active) values (15,8, 20000, 1, 1);
|
||||||
|
|
||||||
|
CREATE TABLE llx_expensereport_rules (
|
||||||
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
datec datetime DEFAULT NULL,
|
||||||
|
tms timestamp,
|
||||||
|
dates datetime NOT NULL,
|
||||||
|
datee datetime NOT NULL,
|
||||||
|
amount numeric(24,8) NOT NULL,
|
||||||
|
restrictive tinyint NOT NULL,
|
||||||
|
fk_user integer DEFAULT NULL,
|
||||||
|
fk_usergroup integer DEFAULT NULL,
|
||||||
|
fk_c_type_fees integer NOT NULL,
|
||||||
|
code_expense_rules_type varchar(50) NOT NULL,
|
||||||
|
is_for_all tinyint DEFAULT '0',
|
||||||
|
entity integer DEFAULT 1
|
||||||
|
);
|
||||||
|
|
||||||
|
ALTER TABLE llx_expensereport_det ADD COLUMN rule_warning_message text;
|
||||||
|
ALTER TABLE llx_expensereport_det ADD COLUMN fk_c_exp_tax_cat integer;
|
||||||
|
|
||||||
|
ALTER TABLE llx_user ADD COLUMN default_range integer;
|
||||||
|
ALTER TABLE llx_user ADD COLUMN default_c_exp_tax_cat integer;
|
||||||
|
|
||||||
ALTER TABLE llx_c_paiement DROP PRIMARY KEY;
|
ALTER TABLE llx_c_paiement DROP PRIMARY KEY;
|
||||||
ALTER TABLE llx_c_paiement ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER id;
|
ALTER TABLE llx_c_paiement ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER id;
|
||||||
ALTER TABLE llx_c_paiement DROP INDEX uk_c_paiement;
|
ALTER TABLE llx_c_paiement DROP INDEX uk_c_paiement;
|
||||||
@@ -51,4 +190,4 @@ ALTER TABLE llx_c_paiement ADD UNIQUE INDEX uk_c_paiement(id, entity, code);
|
|||||||
|
|
||||||
ALTER TABLE llx_c_payment_term DROP PRIMARY KEY;
|
ALTER TABLE llx_c_payment_term DROP PRIMARY KEY;
|
||||||
ALTER TABLE llx_c_payment_term ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER rowid;
|
ALTER TABLE llx_c_payment_term ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER rowid;
|
||||||
ALTER TABLE llx_c_payment_term ADD UNIQUE INDEX uk_c_payment_term(rowid, entity, code);
|
ALTER TABLE llx_c_payment_term ADD UNIQUE INDEX uk_c_payment_term(rowid, entity, code);
|
||||||
@@ -21,12 +21,21 @@
|
|||||||
|
|
||||||
-- Request to change character set and collation of a varchar column.
|
-- Request to change character set and collation of a varchar column.
|
||||||
-- utf8 and utf8_unicode_ci is recommended (or even better utf8mb4 and utf8mb4_unicode_ci with mysql 5.5.3+)
|
-- utf8 and utf8_unicode_ci is recommended (or even better utf8mb4 and utf8mb4_unicode_ci with mysql 5.5.3+)
|
||||||
-- ALTER TABLE llx_accounting_account MODIFY account_number VARCHAR(20) CHARACTER SET utf8;
|
-- ALTER TABLE name_of_table MODIFY field VARCHAR(20) CHARACTER SET utf8;
|
||||||
-- ALTER TABLE llx_accounting_account MODIFY account_number VARCHAR(20) COLLATE utf8_unicode_ci;
|
-- ALTER TABLE name_of_table MODIFY field VARCHAR(20) COLLATE utf8_unicode_ci;
|
||||||
-- You can check with 'show full columns from mytablename';
|
-- You can check with 'show full columns from mytablename';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- VMYSQLUTF8UNICODE ALTER TABLE llx_accounting_account MODIFY account_number VARCHAR(20) CHARACTER SET utf8;
|
||||||
|
-- VMYSQLUTF8UNICODE ALTER TABLE llx_accounting_account MODIFY account_number VARCHAR(20) COLLATE utf8_unicode_ci;
|
||||||
|
-- VMYSQLUTF8UNICODE ALTER TABLE llx_stock_mouvement MODIFY batch VARCHAR(30) CHARACTER SET utf8;
|
||||||
|
-- VMYSQLUTF8UNICODE ALTER TABLE llx_stock_mouvement MODIFY batch VARCHAR(30) COLLATE utf8_unicode_ci;
|
||||||
|
-- VMYSQLUTF8UNICODE ALTER TABLE llx_product_lot MODIFY batch VARCHAR(30) CHARACTER SET utf8;
|
||||||
|
-- VMYSQLUTF8UNICODE ALTER TABLE llx_product_lot MODIFY batch VARCHAR(30) COLLATE utf8_unicode_ci;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES';
|
-- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES';
|
||||||
-- VMYSQL4.1 update llx_facture set date_pointoftax = NULL where DATE(STR_TO_DATE(date_pointoftax, '%Y-%m-%d')) IS NULL;
|
-- VMYSQL4.1 update llx_facture set date_pointoftax = NULL where DATE(STR_TO_DATE(date_pointoftax, '%Y-%m-%d')) IS NULL;
|
||||||
-- VMYSQL4.1 SET sql_mode = 'NO_ZERO_DATE';
|
-- VMYSQL4.1 SET sql_mode = 'NO_ZERO_DATE';
|
||||||
|
|||||||
26
htdocs/install/mysql/tables/llx_c_exp_tax_cat.sql
Normal file
26
htdocs/install/mysql/tables/llx_c_exp_tax_cat.sql
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
-- ============================================================================
|
||||||
|
-- Copyright (C) 2012 Mikael Carlavan <mcarlavan@qis-network.com>
|
||||||
|
-- Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
|
||||||
|
-- Copyright (C) 2017 Pierre-Henry Favre <phf@atm-consulting.fr>
|
||||||
|
--
|
||||||
|
-- This program is free software; you can redistribute it and/or modify
|
||||||
|
-- it under the terms of the GNU General Public License as published by
|
||||||
|
-- the Free Software Foundation; either version 2 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 IF NOT EXISTS llx_c_exp_tax_cat (
|
||||||
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
label varchar(48) NOT NULL,
|
||||||
|
entity integer DEFAULT 1 NOT NULL,
|
||||||
|
active integer DEFAULT 1 NOT NULL
|
||||||
|
)ENGINE=innodb DEFAULT CHARSET=utf8;
|
||||||
27
htdocs/install/mysql/tables/llx_c_exp_tax_range.sql
Normal file
27
htdocs/install/mysql/tables/llx_c_exp_tax_range.sql
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
-- ============================================================================
|
||||||
|
-- Copyright (C) 2012 Mikael Carlavan <mcarlavan@qis-network.com>
|
||||||
|
-- Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
|
||||||
|
-- Copyright (C) 2017 Pierre-Henry Favre <phf@atm-consulting.fr>
|
||||||
|
--
|
||||||
|
-- This program is free software; you can redistribute it and/or modify
|
||||||
|
-- it under the terms of the GNU General Public License as published by
|
||||||
|
-- the Free Software Foundation; either version 2 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 IF NOT EXISTS llx_c_exp_tax_range (
|
||||||
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
fk_c_exp_tax_cat integer DEFAULT 1 NOT NULL,
|
||||||
|
range_ik double DEFAULT 0 NOT NULL,
|
||||||
|
entity integer DEFAULT 1 NOT NULL,
|
||||||
|
active integer DEFAULT 1 NOT NULL
|
||||||
|
)ENGINE=innodb DEFAULT CHARSET=utf8;
|
||||||
@@ -21,6 +21,7 @@ CREATE TABLE llx_expensereport_det
|
|||||||
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
fk_expensereport integer NOT NULL,
|
fk_expensereport integer NOT NULL,
|
||||||
fk_c_type_fees integer NOT NULL,
|
fk_c_type_fees integer NOT NULL,
|
||||||
|
fk_c_exp_tax_cat integer,
|
||||||
fk_projet integer,
|
fk_projet integer,
|
||||||
comments text NOT NULL,
|
comments text NOT NULL,
|
||||||
product_type integer DEFAULT -1,
|
product_type integer DEFAULT -1,
|
||||||
@@ -50,5 +51,6 @@ CREATE TABLE llx_expensereport_det
|
|||||||
fk_facture integer DEFAULT 0, -- ID of customer invoice line if expense is rebilled to a customer
|
fk_facture integer DEFAULT 0, -- ID of customer invoice line if expense is rebilled to a customer
|
||||||
fk_code_ventilation integer DEFAULT 0,
|
fk_code_ventilation integer DEFAULT 0,
|
||||||
rang integer DEFAULT 0, -- position of line
|
rang integer DEFAULT 0, -- position of line
|
||||||
import_key varchar(14)
|
import_key varchar(14),
|
||||||
|
rule_warning_message text
|
||||||
) ENGINE=innodb;
|
) ENGINE=innodb;
|
||||||
29
htdocs/install/mysql/tables/llx_expensereport_ik.sql
Normal file
29
htdocs/install/mysql/tables/llx_expensereport_ik.sql
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
-- ============================================================================
|
||||||
|
-- Copyright (C) 2012 Mikael Carlavan <mcarlavan@qis-network.com>
|
||||||
|
-- Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
|
||||||
|
-- Copyright (C) 2017 Pierre-Henry Favre <phf@atm-consulting.fr>
|
||||||
|
--
|
||||||
|
-- This program is free software; you can redistribute it and/or modify
|
||||||
|
-- it under the terms of the GNU General Public License as published by
|
||||||
|
-- the Free Software Foundation; either version 2 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 IF NOT EXISTS llx_expensereport_ik (
|
||||||
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
datec datetime DEFAULT NULL,
|
||||||
|
tms timestamp,
|
||||||
|
fk_c_exp_tax_cat integer DEFAULT 0 NOT NULL,
|
||||||
|
fk_range integer DEFAULT 0 NOT NULL,
|
||||||
|
coef double DEFAULT 0 NOT NULL,
|
||||||
|
offset double DEFAULT 0 NOT NULL
|
||||||
|
)ENGINE=innodb DEFAULT CHARSET=utf8;
|
||||||
34
htdocs/install/mysql/tables/llx_expensereport_rules.sql
Normal file
34
htdocs/install/mysql/tables/llx_expensereport_rules.sql
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
-- ============================================================================
|
||||||
|
-- Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
|
||||||
|
-- Copyright (C) 2017 Pierre-Henry Favre <phf@atm-consulting.fr>
|
||||||
|
--
|
||||||
|
-- This program is free software; you can redistribute it and/or modify
|
||||||
|
-- it under the terms of the GNU General Public License as published by
|
||||||
|
-- the Free Software Foundation; either version 2 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_expensereport_rules (
|
||||||
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
datec datetime DEFAULT NULL,
|
||||||
|
tms timestamp,
|
||||||
|
dates datetime NOT NULL,
|
||||||
|
datee datetime NOT NULL,
|
||||||
|
amount numeric(24,8) NOT NULL,
|
||||||
|
restrictive tinyint NOT NULL,
|
||||||
|
fk_user integer DEFAULT NULL,
|
||||||
|
fk_usergroup integer DEFAULT NULL,
|
||||||
|
fk_c_type_fees integer NOT NULL,
|
||||||
|
code_expense_rules_type varchar(50) NOT NULL,
|
||||||
|
is_for_all tinyint DEFAULT '0',
|
||||||
|
entity integer DEFAULT 1
|
||||||
|
) ENGINE=InnoDB
|
||||||
@@ -85,5 +85,7 @@ create table llx_user
|
|||||||
dateemployment date, -- denormalized value coming from llx_user_employment
|
dateemployment date, -- denormalized value coming from llx_user_employment
|
||||||
weeklyhours double(16,8), -- denormalized value coming from llx_user_employment
|
weeklyhours double(16,8), -- denormalized value coming from llx_user_employment
|
||||||
|
|
||||||
import_key varchar(14) -- import key
|
import_key varchar(14), -- import key
|
||||||
|
default_range integer,
|
||||||
|
default_c_exp_tax_cat integer
|
||||||
)ENGINE=innodb;
|
)ENGINE=innodb;
|
||||||
|
|||||||
@@ -29,5 +29,6 @@ CREATE TABLE llx_website
|
|||||||
fk_user_create integer,
|
fk_user_create integer,
|
||||||
fk_user_modif integer,
|
fk_user_modif integer,
|
||||||
date_creation datetime,
|
date_creation datetime,
|
||||||
tms timestamp
|
tms timestamp,
|
||||||
|
import_key varchar(14) -- import key
|
||||||
) ENGINE=innodb;
|
) ENGINE=innodb;
|
||||||
|
|||||||
@@ -28,9 +28,10 @@ CREATE TABLE llx_website_page
|
|||||||
lang varchar(6),
|
lang varchar(6),
|
||||||
fk_page integer,
|
fk_page integer,
|
||||||
content mediumtext, -- text is not enough in size
|
content mediumtext, -- text is not enough in size
|
||||||
status integer,
|
status integer DEFAULT 1,
|
||||||
fk_user_create integer,
|
fk_user_create integer,
|
||||||
fk_user_modif integer,
|
fk_user_modif integer,
|
||||||
date_creation datetime,
|
date_creation datetime,
|
||||||
tms timestamp
|
tms timestamp,
|
||||||
|
import_key varchar(14) -- import key
|
||||||
) ENGINE=innodb;
|
) ENGINE=innodb;
|
||||||
|
|||||||
@@ -875,6 +875,8 @@ DictionaryUnits=Units
|
|||||||
DictionaryProspectStatus=Prospection status
|
DictionaryProspectStatus=Prospection status
|
||||||
DictionaryHolidayTypes=Types of leaves
|
DictionaryHolidayTypes=Types of leaves
|
||||||
DictionaryOpportunityStatus=Opportunity status for project/lead
|
DictionaryOpportunityStatus=Opportunity status for project/lead
|
||||||
|
DictionaryExpenseTaxCat=Expense report categories
|
||||||
|
DictionaryExpenseTaxRange=Expense report range by category
|
||||||
SetupSaved=Setup saved
|
SetupSaved=Setup saved
|
||||||
SetupNotSaved=Setup not saved
|
SetupNotSaved=Setup not saved
|
||||||
BackToModuleList=Back to modules list
|
BackToModuleList=Back to modules list
|
||||||
@@ -1141,6 +1143,8 @@ RuleForGeneratedPasswords=Rule to generate suggested passwords or validate passw
|
|||||||
DisableForgetPasswordLinkOnLogonPage=Do not show the link "Forget password" on login page
|
DisableForgetPasswordLinkOnLogonPage=Do not show the link "Forget password" on login page
|
||||||
UsersSetup=Users module setup
|
UsersSetup=Users module setup
|
||||||
UserMailRequired=EMail required to create a new user
|
UserMailRequired=EMail required to create a new user
|
||||||
|
DefaultCategoryCar=Default car category
|
||||||
|
DefaultRangeNumber=Default range number
|
||||||
##### HRM setup #####
|
##### HRM setup #####
|
||||||
HRMSetup=HRM module setup
|
HRMSetup=HRM module setup
|
||||||
##### Company setup #####
|
##### Company setup #####
|
||||||
@@ -1609,6 +1613,8 @@ TypePaymentDesc=0:Customer payment type, 1:Supplier payment type, 2:Both custome
|
|||||||
IncludePath=Include path (defined into variable %s)
|
IncludePath=Include path (defined into variable %s)
|
||||||
ExpenseReportsSetup=Setup of module Expense Reports
|
ExpenseReportsSetup=Setup of module Expense Reports
|
||||||
TemplatePDFExpenseReports=Document templates to generate expense report document
|
TemplatePDFExpenseReports=Document templates to generate expense report document
|
||||||
|
ExpenseReportsIkSetup=Setup of module Expense Reports - Milles index
|
||||||
|
ExpenseReportsRulesSetup=Setup of module Expense Reports - Rules
|
||||||
NoModueToManageStockIncrease=No module able to manage automatic stock increase has been activated. Stock increase will be done on manual input only.
|
NoModueToManageStockIncrease=No module able to manage automatic stock increase has been activated. Stock increase will be done on manual input only.
|
||||||
YouMayFindNotificationsFeaturesIntoModuleNotification=You may find options for EMail notifications by enabling and configuring the module "Notification".
|
YouMayFindNotificationsFeaturesIntoModuleNotification=You may find options for EMail notifications by enabling and configuring the module "Notification".
|
||||||
ListOfNotificationsPerUser=List of notifications per user*
|
ListOfNotificationsPerUser=List of notifications per user*
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
# Dolibarr language file - Source file is en_US - banks
|
# Dolibarr language file - Source file is en_US - banks
|
||||||
Bank=Bank
|
Bank=Bank
|
||||||
MenuBankCash=Bank/Cash
|
MenuBankCash=Bank/Cash
|
||||||
|
MenuVariousPayment=Various payments
|
||||||
|
MenuNewVariousPayment=New various payment
|
||||||
BankName=Bank name
|
BankName=Bank name
|
||||||
FinancialAccount=Account
|
FinancialAccount=Account
|
||||||
BankAccount=Bank account
|
BankAccount=Bank account
|
||||||
|
|||||||
@@ -325,3 +325,32 @@ PaperFormatCAP3=Format P3 Canada
|
|||||||
PaperFormatCAP4=Format P4 Canada
|
PaperFormatCAP4=Format P4 Canada
|
||||||
PaperFormatCAP5=Format P5 Canada
|
PaperFormatCAP5=Format P5 Canada
|
||||||
PaperFormatCAP6=Format P6 Canada
|
PaperFormatCAP6=Format P6 Canada
|
||||||
|
#### Expense report categories ####
|
||||||
|
ExpAutoCat=Car
|
||||||
|
ExpCycloCat=Moped
|
||||||
|
ExpMotoCat=Motorbike
|
||||||
|
ExpAuto3CV=3 CV
|
||||||
|
ExpAuto4CV=4 CV
|
||||||
|
ExpAuto5CV=5 CV
|
||||||
|
ExpAuto6CV=6 CV
|
||||||
|
ExpAuto7CV=7 CV
|
||||||
|
ExpAuto8CV=8 CV
|
||||||
|
ExpAuto9CV=9 CV
|
||||||
|
ExpAuto10CV=10 CV
|
||||||
|
ExpAuto11CV=11 CV
|
||||||
|
ExpAuto12CV=12 CV
|
||||||
|
ExpAuto3PCV=3 CV and more
|
||||||
|
ExpAuto4PCV=4 CV and more
|
||||||
|
ExpAuto5PCV=5 CV and more
|
||||||
|
ExpAuto6PCV=6 CV and more
|
||||||
|
ExpAuto7PCV=7 CV and more
|
||||||
|
ExpAuto8PCV=8 CV and more
|
||||||
|
ExpAuto9PCV=9 CV and more
|
||||||
|
ExpAuto10PCV=10 CV and more
|
||||||
|
ExpAuto11PCV=11 CV and more
|
||||||
|
ExpAuto12PCV=12 CV and more
|
||||||
|
ExpAuto13PCV=13 CV and more
|
||||||
|
ExpCyclo=Capacity lower to 50cm3
|
||||||
|
ExpMoto12CV=Motorbike 1 or 2 CV
|
||||||
|
ExpMoto345CV=Motorbike 3, 4 or 5 CV
|
||||||
|
ExpMoto5PCV=Motorbike 5 CV and more
|
||||||
@@ -10,7 +10,7 @@ CurrencyLayerAccount=CurrencyLayer API
|
|||||||
CurrencyLayerAccount_help_to_synchronize=You sould create an account on their website to use this functionnality<br />Get your <b>API key</b><br />If you use a free account you can't change the <b>currency source</b> (USD by default)<br />But if your main currency isn't USD you can use the <b>alternate currency source</b> to force you main currency<br /><br />You are limited at 1000 synchronizations per month
|
CurrencyLayerAccount_help_to_synchronize=You sould create an account on their website to use this functionnality<br />Get your <b>API key</b><br />If you use a free account you can't change the <b>currency source</b> (USD by default)<br />But if your main currency isn't USD you can use the <b>alternate currency source</b> to force you main currency<br /><br />You are limited at 1000 synchronizations per month
|
||||||
multicurrency_appId=API key
|
multicurrency_appId=API key
|
||||||
multicurrency_appCurrencySource=Currency source
|
multicurrency_appCurrencySource=Currency source
|
||||||
multicurrency_alternateCurrencySource= Alternate currency souce
|
multicurrency_alternateCurrencySource=Alternate currency source
|
||||||
CurrenciesUsed=Currencies used
|
CurrenciesUsed=Currencies used
|
||||||
CurrenciesUsed_help_to_add=Add the differents currencies and rates you need to use on you <b>proposals</b>, <b>orders</b>, etc.
|
CurrenciesUsed_help_to_add=Add the differents currencies and rates you need to use on you <b>proposals</b>, <b>orders</b>, etc.
|
||||||
rate=rate
|
rate=rate
|
||||||
|
|||||||
@@ -49,6 +49,28 @@ TF_PEAGE=Toll
|
|||||||
TF_ESSENCE=Fuel
|
TF_ESSENCE=Fuel
|
||||||
TF_HOTEL=Hotel
|
TF_HOTEL=Hotel
|
||||||
TF_TAXI=Taxi
|
TF_TAXI=Taxi
|
||||||
|
EX_KME=Mileage costs
|
||||||
|
EX_FUE=Fuel CV
|
||||||
|
EX_HOT=Hotel
|
||||||
|
EX_PAR=Parking CV
|
||||||
|
EX_TOL=Toll CV
|
||||||
|
EX_TAX=Various Taxes
|
||||||
|
EX_IND=Indemnity transportation subscription
|
||||||
|
EX_SUM=Maintenance supply
|
||||||
|
EX_SUO=Office supplies
|
||||||
|
EX_CAR=Car rental
|
||||||
|
EX_DOC=Documentation
|
||||||
|
EX_CUR=Customers receiving
|
||||||
|
EX_OTR=Other receiving
|
||||||
|
EX_POS=Postage
|
||||||
|
EX_CAM=CV maintenance and repair
|
||||||
|
EX_EMM=Employees meal
|
||||||
|
EX_GUM=Guests meal
|
||||||
|
EX_BRE=Breakfast
|
||||||
|
EX_FUE_VP=Fuel PV
|
||||||
|
EX_TOL_VP=Toll PV
|
||||||
|
EX_PAR_VP=Parking PV
|
||||||
|
EX_CAM_VP=PV maintenance and repair
|
||||||
|
|
||||||
ErrorDoubleDeclaration=You have declared another expense report into a similar date range.
|
ErrorDoubleDeclaration=You have declared another expense report into a similar date range.
|
||||||
AucuneLigne=There is no expense report declared yet
|
AucuneLigne=There is no expense report declared yet
|
||||||
@@ -89,4 +111,44 @@ ExpenseReportPayment=Expense report payment
|
|||||||
ExpenseReportsToApprove=Expense reports to approve
|
ExpenseReportsToApprove=Expense reports to approve
|
||||||
ExpenseReportsToPay=Expense reports to pay
|
ExpenseReportsToPay=Expense reports to pay
|
||||||
CloneExpenseReport=Clone expense report
|
CloneExpenseReport=Clone expense report
|
||||||
ConfirmCloneExpenseReport=Are you sure you want to clone this expense report ?
|
ConfirmCloneExpenseReport=Are you sure you want to clone this expense report ?
|
||||||
|
ExpenseReportsIk=Expense report milles index
|
||||||
|
ExpenseReportsRules=Expense report rules
|
||||||
|
ExpenseReportIkDesc=You can modify the calculation of kilometers expense by category and range who they are previously defined. <b>d</b> is the distance in kilometers
|
||||||
|
ExpenseReportRulesDesc=You can create or update any rules of calculation. This part will be used when user will create a new expense report
|
||||||
|
expenseReportOffset=Offset
|
||||||
|
expenseReportCoef=Coefficient
|
||||||
|
expenseReportTotalForFive=Example with <u>d</u> = 5
|
||||||
|
expenseReportRangeFromTo=from %d to %d
|
||||||
|
expenseReportRangeMoreThan=more than %d
|
||||||
|
expenseReportCoefUndefined=(value not defined)
|
||||||
|
expenseReportCatDisabled=Category disabled - see the c_exp_tax_cat dictionary
|
||||||
|
expenseReportRangeDisabled=Range disabled - see the c_exp_tax_range dictionay
|
||||||
|
expenseReportPrintExample=offset + (d x coef) = %s
|
||||||
|
ExpenseReportApplyTo=Apply to
|
||||||
|
ExpenseReportDomain=Domain to apply
|
||||||
|
ExpenseReportLimitOn=Limit on
|
||||||
|
ExpenseReportDateStart=Date start
|
||||||
|
ExpenseReportDateEnd=Date end
|
||||||
|
ExpenseReportLimitAmount=Limite amount
|
||||||
|
ExpenseReportRestrictive=Restrictive
|
||||||
|
AllExpenseReport=All type of expense report
|
||||||
|
OnExpense=Expense line
|
||||||
|
ExpenseReportRuleSave=Expense report rule saved
|
||||||
|
ExpenseReportRuleErrorOnSave=Error: %s
|
||||||
|
RangeNum=Range %d
|
||||||
|
|
||||||
|
ExpenseReportConstraintViolationError=Constraint violation id [%s]: %s is superior to %s %s
|
||||||
|
byEX_DAY=by day (limitation to %s)
|
||||||
|
byEX_MON=by month (limitation to %s)
|
||||||
|
byEX_YEA=by year (limitation to %s)
|
||||||
|
byEX_EXP=by line (limitation to %s)
|
||||||
|
ExpenseReportConstraintViolationWarning=Constraint violation id [%s]: %s is superior to %s %s
|
||||||
|
nolimitbyEX_DAY=by day (no limitation)
|
||||||
|
nolimitbyEX_MON=by month (no limitation)
|
||||||
|
nolimitbyEX_YEA=by year (no limitation)
|
||||||
|
nolimitbyEX_EXP=by line (no limitation)
|
||||||
|
|
||||||
|
CarCategory=Category of car
|
||||||
|
ExpenseRangeOffset=Offset amount: %s
|
||||||
|
RangeIk=Mileage range
|
||||||
@@ -33,11 +33,14 @@ PreviewSiteServedByWebServer=Preview %s in a new tab.<br><br>The %s will be serv
|
|||||||
PreviewSiteServedByDolibarr=Preview %s in a new tab.<br><br>The %s will be served by Dolibarr server so it does not need any extra web server (like Apache, Nginx, IIS) to be installed.<br>The inconvenient is that URL of pages are not user friendly and start with path of your Dolibarr.<br>URL served by Dolibarr:<br><strong>%s</strong><br><br>To use your own external web server to serve this web site, create a virtual host on your web server that point on directory<br><strong>%s</strong><br>then enter the name of this virtual server and click on the other preview button.
|
PreviewSiteServedByDolibarr=Preview %s in a new tab.<br><br>The %s will be served by Dolibarr server so it does not need any extra web server (like Apache, Nginx, IIS) to be installed.<br>The inconvenient is that URL of pages are not user friendly and start with path of your Dolibarr.<br>URL served by Dolibarr:<br><strong>%s</strong><br><br>To use your own external web server to serve this web site, create a virtual host on your web server that point on directory<br><strong>%s</strong><br>then enter the name of this virtual server and click on the other preview button.
|
||||||
VirtualHostUrlNotDefined=URL of the virtual host served by external web server not defined
|
VirtualHostUrlNotDefined=URL of the virtual host served by external web server not defined
|
||||||
NoPageYet=No pages yet
|
NoPageYet=No pages yet
|
||||||
SyntaxHelp=Help on code syntax
|
SyntaxHelp=Help on specific syntax tips
|
||||||
YouCanEditHtmlSourceckeditor=You can edit HTML source code using the "Source" button in editor.
|
YouCanEditHtmlSourceckeditor=You can edit HTML source code using the "Source" button in editor.
|
||||||
YouCanEditHtmlSource=You can include PHP code into this source using tags <strong><?php ?></strong>. The following global variables are available: $conf, $langs, $db, $mysoc, $user, $website.<br><br>You can also include content of another Page/Container with the following syntax: <strong><?php dolIncludeHtmlContent($websitekey.'/contentaliastoinclude.php'); ?></strong><br><br>To include a link to download a file stored into the documents/medias directory, use syntax:<br><strong><a href="/document.php?modulepart=medias&file=filename.ext"></strong>.
|
YouCanEditHtmlSource=You can include PHP code into this source using tags <strong><?php ?></strong>. The following global variables are available: $conf, $langs, $db, $mysoc, $user, $website.<br><br>You can also include content of another Page/Container with the following syntax: <strong><?php dolIncludeHtmlContent($websitekey.'/contentaliastoinclude.php'); ?></strong><br><br>To include a link to download a file stored into the <strong>documents</strong> directory, use the <strong>document.php</strong> wrapper:<br>Example, for a file into documents/ecm (need to be logged), syntax is:<br><strong><a href="/document.php?modulepart=ecm&file=reldir/filename.ext"></strong>.<br>for a file into documents/media (open access), syntax is:<br><strong><a href="/document.php?modulepart=medias&file=reldir/filename.ext"></strong>.<br><br>To include an image stored into the <strong>documents</strong> directory, use the <strong>viewimage.php</strong> wrapper:<br>Example, for an image into documents/media (open access), syntax is:<br><strong><a href="/viewimage.php?modulepart=medias&file=filename.ext"></strong>.
|
||||||
ClonePage=Clone page/container
|
ClonePage=Clone page/container
|
||||||
CloneSite=Clone site
|
CloneSite=Clone site
|
||||||
ConfirmClonePage=Please enter code/alias of new page and if it is a translation of the cloned page.
|
ConfirmClonePage=Please enter code/alias of new page and if it is a translation of the cloned page.
|
||||||
PageIsANewTranslation=The new page is a translation of the current page ?
|
PageIsANewTranslation=The new page is a translation of the current page ?
|
||||||
LanguageMustNotBeSameThanClonedPage=You clone a page as a translation. The language of the new page must be different than language of source page.
|
LanguageMustNotBeSameThanClonedPage=You clone a page as a translation. The language of the new page must be different than language of source page.
|
||||||
|
ParentPageId=Parent page ID
|
||||||
|
WebsiteId=Website ID
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ $action=GETPOST('action','aZ09');
|
|||||||
$confirm=GETPOST('confirm');
|
$confirm=GETPOST('confirm');
|
||||||
$cancel=GETPOST('cancel','alpha');
|
$cancel=GETPOST('cancel','alpha');
|
||||||
|
|
||||||
|
$projectid = GETPOST('projectid','int');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid = GETPOST('socid','int');
|
$socid = GETPOST('socid','int');
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
@@ -133,7 +135,7 @@ if (empty($reshook))
|
|||||||
$object->rate = $rate;
|
$object->rate = $rate;
|
||||||
$object->note_private = GETPOST('note_private');
|
$object->note_private = GETPOST('note_private');
|
||||||
$object->note_public = GETPOST('note_public');
|
$object->note_public = GETPOST('note_public');
|
||||||
$object->fk_project = GETPOST('fk_project');
|
$object->fk_project = GETPOST('projectid','int');
|
||||||
|
|
||||||
$accountancy_account_capital = GETPOST('accountancy_account_capital');
|
$accountancy_account_capital = GETPOST('accountancy_account_capital');
|
||||||
$accountancy_account_insurance = GETPOST('accountancy_account_insurance');
|
$accountancy_account_insurance = GETPOST('accountancy_account_insurance');
|
||||||
@@ -215,7 +217,7 @@ if (empty($reshook))
|
|||||||
if ($action == 'classin' && $user->rights->loan->write)
|
if ($action == 'classin' && $user->rights->loan->write)
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$result = $object->setProject(GETPOST('projectid'));
|
$result = $object->setProject($projectid);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
@@ -309,7 +311,7 @@ if ($action == 'create')
|
|||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Project").'</td><td>';
|
print '<tr><td>'.$langs->trans("Project").'</td><td>';
|
||||||
|
|
||||||
$numproject=$formproject->select_projects(-1,GETPOST("fk_project"),'fk_project',16,0,1,1);
|
$numproject=$formproject->select_projects(-1, $projectid, 'projectid', 16, 0, 1, 1);
|
||||||
|
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
@@ -443,21 +445,21 @@ if ($id > 0)
|
|||||||
{
|
{
|
||||||
$langs->load("projects");
|
$langs->load("projects");
|
||||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||||
if ($user->rights->commande->creer)
|
if ($user->rights->loan->write)
|
||||||
{
|
{
|
||||||
if ($action != 'classify')
|
if ($action != 'classify')
|
||||||
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||||
if ($action == 'classify') {
|
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->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.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||||
$morehtmlref.='</form>';
|
$morehtmlref.='</form>';
|
||||||
} else {
|
} else {
|
||||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (! empty($object->fk_project)) {
|
if (! empty($object->fk_project)) {
|
||||||
$proj = new Project($db);
|
$proj = new Project($db);
|
||||||
|
|||||||
@@ -89,8 +89,38 @@ if ($object->id)
|
|||||||
|
|
||||||
$morehtmlref='<div class="refidno">';
|
$morehtmlref='<div class="refidno">';
|
||||||
// Ref loan
|
// Ref loan
|
||||||
$morehtmlref.=$form->editfieldkey("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', 0, 1);
|
$morehtmlref.=$form->editfieldkey("Label", 'label', $object->label, $object, 0, 'string', '', 0, 1);
|
||||||
$morehtmlref.=$form->editfieldval("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', null, null, '', 1);
|
$morehtmlref.=$form->editfieldval("Label", 'label', $object->label, $object, 0, 'string', '', null, null, '', 1);
|
||||||
|
// Project
|
||||||
|
if (! empty($conf->projet->enabled)) {
|
||||||
|
$langs->load("projects");
|
||||||
|
$morehtmlref .= '<br>' . $langs->trans('Project') . ' : ';
|
||||||
|
if ($user->rights->loan->write) {
|
||||||
|
//if ($action != 'classify')
|
||||||
|
// $morehtmlref .= '<a 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->socid, $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->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
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>';
|
||||||
|
} else {
|
||||||
|
$morehtmlref .= '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
$morehtmlref.='</div>';
|
$morehtmlref.='</div>';
|
||||||
|
|
||||||
$linkback = '<a href="' . DOL_URL_ROOT . '/loan/index.php">' . $langs->trans("BackToList") . '</a>';
|
$linkback = '<a href="' . DOL_URL_ROOT . '/loan/index.php">' . $langs->trans("BackToList") . '</a>';
|
||||||
|
|||||||
@@ -57,8 +57,38 @@ dol_fiche_head($head, 'info', $langs->trans("Loan"), -1, 'bill');
|
|||||||
|
|
||||||
$morehtmlref='<div class="refidno">';
|
$morehtmlref='<div class="refidno">';
|
||||||
// Ref loan
|
// Ref loan
|
||||||
$morehtmlref.=$form->editfieldkey("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', 0, 1);
|
$morehtmlref.=$form->editfieldkey("Label", 'label', $object->label, $object, 0, 'string', '', 0, 1);
|
||||||
$morehtmlref.=$form->editfieldval("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', null, null, '', 1);
|
$morehtmlref.=$form->editfieldval("Label", 'label', $object->label, $object, 0, 'string', '', null, null, '', 1);
|
||||||
|
// Project
|
||||||
|
if (! empty($conf->projet->enabled)) {
|
||||||
|
$langs->load("projects");
|
||||||
|
$morehtmlref .= '<br>' . $langs->trans('Project') . ' : ';
|
||||||
|
if ($user->rights->loan->write) {
|
||||||
|
//if ($action != 'classify')
|
||||||
|
// $morehtmlref .= '<a 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->socid, $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->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
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>';
|
||||||
|
} else {
|
||||||
|
$morehtmlref .= '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
$morehtmlref.='</div>';
|
$morehtmlref.='</div>';
|
||||||
|
|
||||||
$linkback = '<a href="' . DOL_URL_ROOT . '/loan/index.php">' . $langs->trans("BackToList") . '</a>';
|
$linkback = '<a href="' . DOL_URL_ROOT . '/loan/index.php">' . $langs->trans("BackToList") . '</a>';
|
||||||
|
|||||||
@@ -74,8 +74,38 @@ if ($id > 0)
|
|||||||
|
|
||||||
$morehtmlref='<div class="refidno">';
|
$morehtmlref='<div class="refidno">';
|
||||||
// Ref loan
|
// Ref loan
|
||||||
$morehtmlref.=$form->editfieldkey("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', 0, 1);
|
$morehtmlref.=$form->editfieldkey("Label", 'label', $object->label, $object, 0, 'string', '', 0, 1);
|
||||||
$morehtmlref.=$form->editfieldval("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', null, null, '', 1);
|
$morehtmlref.=$form->editfieldval("Label", 'label', $object->label, $object, 0, 'string', '', null, null, '', 1);
|
||||||
|
// Project
|
||||||
|
if (! empty($conf->projet->enabled)) {
|
||||||
|
$langs->load("projects");
|
||||||
|
$morehtmlref .= '<br>' . $langs->trans('Project') . ' : ';
|
||||||
|
if ($user->rights->loan->write) {
|
||||||
|
//if ($action != 'classify')
|
||||||
|
// $morehtmlref .= '<a 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->socid, $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->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
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>';
|
||||||
|
} else {
|
||||||
|
$morehtmlref .= '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
$morehtmlref.='</div>';
|
$morehtmlref.='</div>';
|
||||||
|
|
||||||
$linkback = '<a href="' . DOL_URL_ROOT . '/loan/index.php">' . $langs->trans("BackToList") . '</a>';
|
$linkback = '<a href="' . DOL_URL_ROOT . '/loan/index.php">' . $langs->trans("BackToList") . '</a>';
|
||||||
|
|||||||
@@ -1199,7 +1199,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
|
|||||||
print '<!-- Includes JS for JQuery -->'."\n";
|
print '<!-- Includes JS for JQuery -->'."\n";
|
||||||
if (defined('JS_JQUERY') && constant('JS_JQUERY')) print '<script type="text/javascript" src="'.JS_JQUERY.'jquery.min.js'.($ext?'?'.$ext:'').'"></script>'."\n";
|
if (defined('JS_JQUERY') && constant('JS_JQUERY')) print '<script type="text/javascript" src="'.JS_JQUERY.'jquery.min.js'.($ext?'?'.$ext:'').'"></script>'."\n";
|
||||||
else print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/js/jquery.min.js'.($ext?'?'.$ext:'').'"></script>'."\n";
|
else print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/js/jquery.min.js'.($ext?'?'.$ext:'').'"></script>'."\n";
|
||||||
if (! empty($conf->global->MAIN_FEATURES_LEVEL))
|
if (! empty($conf->global->MAIN_FEATURES_LEVEL) && ! defined('JS_JQUERY_MIGRATE_DISABLED'))
|
||||||
{
|
{
|
||||||
if (defined('JS_JQUERY_MIGRATE') && constant('JS_JQUERY_MIGRATE')) print '<script type="text/javascript" src="'.JS_JQUERY_MIGRATE.'jquery-migrate.min.js'.($ext?'?'.$ext:'').'"></script>'."\n";
|
if (defined('JS_JQUERY_MIGRATE') && constant('JS_JQUERY_MIGRATE')) print '<script type="text/javascript" src="'.JS_JQUERY_MIGRATE.'jquery-migrate.min.js'.($ext?'?'.$ext:'').'"></script>'."\n";
|
||||||
else print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/js/jquery-migrate.min.js'.($ext?'?'.$ext:'').'"></script>'."\n";
|
else print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/js/jquery-migrate.min.js'.($ext?'?'.$ext:'').'"></script>'."\n";
|
||||||
@@ -2002,7 +2002,7 @@ if (! function_exists("llxFooter"))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Wrapper to manage dropdown
|
// Wrapper to manage dropdown
|
||||||
if ($conf->use_javascript_ajax)
|
if (! empty($conf->use_javascript_ajax) && ! defined('JS_JQUERY_DISABLE_DROPDOWN'))
|
||||||
{
|
{
|
||||||
print "\n<!-- JS CODE TO ENABLE dropdown -->\n";
|
print "\n<!-- JS CODE TO ENABLE dropdown -->\n";
|
||||||
print '<script type="text/javascript">
|
print '<script type="text/javascript">
|
||||||
|
|||||||
@@ -61,8 +61,7 @@ class MyObject extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* 'type' if the field format, 'label' the translation key, 'enabled' is a condition when the filed must be managed,
|
* 'type' if the field format, 'label' the translation key, 'enabled' is a condition when the filed must be managed,
|
||||||
* 'visible' says if field is visible in list (-1 means not shown by default but can be aded into list to be viewed)
|
* 'visible' says if field is visible in list (-1 means not shown by default but can be aded into list to be viewed)
|
||||||
* 'notnull' if not null in database
|
* 'notnull' if not null in database, 'index' if we want an index in database
|
||||||
* 'index' if we want an index in database
|
|
||||||
* 'position' is the sort order of field
|
* 'position' is the sort order of field
|
||||||
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button
|
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button
|
||||||
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
|
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
|
||||||
@@ -71,7 +70,7 @@ class MyObject extends CommonObject
|
|||||||
|
|
||||||
// BEGIN MODULEBUILDER PROPERTIES
|
// BEGIN MODULEBUILDER PROPERTIES
|
||||||
/**
|
/**
|
||||||
* @var array Array with all fields and their property
|
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
|
||||||
*/
|
*/
|
||||||
public $fields=array(
|
public $fields=array(
|
||||||
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>true, 'index'=>true, 'position'=>1, 'comment'=>'Id'),
|
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>true, 'index'=>true, 'position'=>1, 'comment'=>'Id'),
|
||||||
@@ -86,7 +85,6 @@ class MyObject extends CommonObject
|
|||||||
'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>true, 'position'=>500),
|
'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>true, 'position'=>500),
|
||||||
'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
|
'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
|
||||||
//'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValid', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
|
//'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValid', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
|
||||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>true, 'position'=>500),
|
|
||||||
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'index'=>true, 'position'=>1000, 'nullifempty'=>1),
|
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'index'=>true, 'position'=>1000, 'nullifempty'=>1),
|
||||||
);
|
);
|
||||||
// END MODULEBUILDER PROPERTIES
|
// END MODULEBUILDER PROPERTIES
|
||||||
@@ -125,7 +123,11 @@ class MyObject extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function __construct(DoliDB $db)
|
public function __construct(DoliDB $db)
|
||||||
{
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
|
|
||||||
|
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) $fields['rowid']['visible']=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -236,7 +236,7 @@ class modMyModule extends DolibarrModules
|
|||||||
'leftmenu'=>'',
|
'leftmenu'=>'',
|
||||||
'url'=>'/mymodule/mymoduleindex.php',
|
'url'=>'/mymodule/mymoduleindex.php',
|
||||||
'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||||
'position'=>1000,
|
'position'=>1000+$r,
|
||||||
'enabled'=>'$conf->mymodule->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled.
|
'enabled'=>'$conf->mymodule->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled.
|
||||||
'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
||||||
'target'=>'',
|
'target'=>'',
|
||||||
@@ -253,7 +253,7 @@ class modMyModule extends DolibarrModules
|
|||||||
'leftmenu'=>'mymodule',
|
'leftmenu'=>'mymodule',
|
||||||
'url'=>'/mymodule/myobject_list.php',
|
'url'=>'/mymodule/myobject_list.php',
|
||||||
'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||||
'position'=>1100,
|
'position'=>1000+$r,
|
||||||
'enabled'=>'$conf->mymodule->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
|
'enabled'=>'$conf->mymodule->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
|
||||||
'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
||||||
'target'=>'',
|
'target'=>'',
|
||||||
@@ -265,7 +265,7 @@ class modMyModule extends DolibarrModules
|
|||||||
'leftmenu'=>'mymodule',
|
'leftmenu'=>'mymodule',
|
||||||
'url'=>'/mymodule/myobject_page.php?action=create',
|
'url'=>'/mymodule/myobject_page.php?action=create',
|
||||||
'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||||
'position'=>1101,
|
'position'=>1000+$r,
|
||||||
'enabled'=>'$conf->mymodule->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
|
'enabled'=>'$conf->mymodule->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
|
||||||
'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
||||||
'target'=>'',
|
'target'=>'',
|
||||||
@@ -276,23 +276,23 @@ class modMyModule extends DolibarrModules
|
|||||||
// Exports
|
// Exports
|
||||||
$r=1;
|
$r=1;
|
||||||
|
|
||||||
// Example:
|
/* BEGIN MODULEBUILDER EXPORT MYOBJECT */
|
||||||
/* BEGIN MODULEBUILDER EXPORT MYOBJECT
|
/*
|
||||||
|
$langs->load("mymodule@mymodule");
|
||||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||||
$this->export_label[$r]='MyModule'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
$this->export_label[$r]='MyObjectLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||||
$this->export_enabled[$r]='1'; // Condition to show export in list (ie: '$user->id==3'). Set to 1 to always show when module is enabled.
|
$this->export_icon[$r]='myobject@mymodule';
|
||||||
$this->export_icon[$r]='generic:MyModule'; // Put here code of icon then string for translation key of module name
|
$keyforclass = 'MyObject'; $keyforclassfile='/mymobule/class/myobject.class.php'; $keyforelement='myobject';
|
||||||
//$this->export_permission[$r]=array(array("mymodule","level1","level2"));
|
include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
|
||||||
$this->export_fields_array[$r]=array('t.rowid'=>"Id",'t.ref'=>'Ref','t.label'=>'Label','t.datec'=>"DateCreation",'t.tms'=>"DateUpdate");
|
$keyforselect='myobject'; $keyforaliasextra='extra'; $keyforelement='myobject';
|
||||||
$this->export_TypeFields_array[$r]=array('t.rowid'=>'Numeric', 't.ref'=>'Text', 't.label'=>'Label', 't.datec'=>"Date", 't.tms'=>"Date");
|
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||||
// $this->export_entities_array[$r]=array('t.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.price'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.fk_product'=>'product','p.ref'=>'product');
|
//$this->export_dependencies_array[$r]=array('mysubobject'=>'ts.rowid', 't.myfield'=>array('t.myfield2','t.myfield3')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields)
|
||||||
// $this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
|
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||||
// $this->export_sql_start[$r]='SELECT DISTINCT ';
|
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'myobject as t';
|
||||||
// $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'myobject as t';
|
$this->export_sql_end[$r] .=' WHERE 1 = 1';
|
||||||
// $this->export_sql_order[$r] .=' ORDER BY t.ref';
|
$this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('myobject').')';
|
||||||
// $r++;
|
$r++; */
|
||||||
END MODULEBUILDER EXPORT MYOBJECT */
|
/* END MODULEBUILDER EXPORT MYOBJECT */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ $day=GETPOST('reday')?GETPOST('reday'):(GETPOST("day","int")?GETPOST("day","int"
|
|||||||
$day = (int) $day;
|
$day = (int) $day;
|
||||||
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
|
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
|
||||||
|
|
||||||
|
$search_categ=GETPOST("search_categ",'alpha');
|
||||||
$search_usertoprocessid=GETPOST('search_usertoprocessid', 'int');
|
$search_usertoprocessid=GETPOST('search_usertoprocessid', 'int');
|
||||||
$search_task_ref=GETPOST('search_task_ref', 'alpha');
|
$search_task_ref=GETPOST('search_task_ref', 'alpha');
|
||||||
$search_task_label=GETPOST('search_task_label', 'alpha');
|
$search_task_label=GETPOST('search_task_label', 'alpha');
|
||||||
@@ -100,13 +101,14 @@ $object=new Task($db);
|
|||||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$action = '';
|
$action = '';
|
||||||
|
$search_categ='';
|
||||||
$search_usertoprocessid = '';
|
$search_usertoprocessid = '';
|
||||||
$search_task_ref = '';
|
$search_task_ref = '';
|
||||||
$search_task_label = '';
|
$search_task_label = '';
|
||||||
$search_project_ref = '';
|
$search_project_ref = '';
|
||||||
$search_thirdparty = '';
|
$search_thirdparty = '';
|
||||||
}
|
}
|
||||||
if (GETPOST("button_search_x") || GETPOST("button_search.x") || GETPOST("button_search"))
|
if (GETPOST("button_search_x",'alpha') || GETPOST("button_search.x",'alpha') || GETPOST("button_search",'alpha'))
|
||||||
{
|
{
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
@@ -394,15 +396,41 @@ print '</div>';
|
|||||||
print '<div class="clearboth" style="padding-bottom: 8px;"></div>';
|
print '<div class="clearboth" style="padding-bottom: 8px;"></div>';
|
||||||
|
|
||||||
|
|
||||||
|
$moreforfilter='';
|
||||||
|
|
||||||
|
// Filter on categories
|
||||||
|
/*if (! empty($conf->categorie->enabled))
|
||||||
|
{
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
|
||||||
|
$moreforfilter.='<div class="divsearchfield">';
|
||||||
|
$moreforfilter.=$langs->trans('ProjectCategories'). ': ';
|
||||||
|
$moreforfilter.=$formother->select_categories('project', $search_categ, 'search_categ', 1, 1, 'maxwidth300');
|
||||||
|
$moreforfilter.='</div>';
|
||||||
|
}*/
|
||||||
|
|
||||||
|
// If the user can view user other than himself
|
||||||
|
$moreforfilter.='<div class="divsearchfield">';
|
||||||
|
$moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ': ';
|
||||||
|
$includeonly='hierachyme';
|
||||||
|
if (empty($user->rights->user->user->lire)) $includeonly=array($user->id);
|
||||||
|
$moreforfilter.=$form->select_dolusers($search_project_user?$search_project_user:$usertoprocess->id, 'search_usertoprocessid', 0, null, 0, $includeonly, null, 0, 0, 0, '', 0, '', 'maxwidth200');
|
||||||
|
$moreforfilter.='</div>';
|
||||||
|
|
||||||
|
if (! empty($moreforfilter))
|
||||||
|
{
|
||||||
|
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||||
|
print $moreforfilter;
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
print $hookmanager->resPrint;
|
||||||
|
print '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
print '<div class="div-table-responsive">';
|
print '<div class="div-table-responsive">';
|
||||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'" id="tablelines3">'."\n";
|
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'" id="tablelines3">'."\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
print '<td class="liste_titre">';
|
|
||||||
$usersettoshow='hierarchyme';
|
|
||||||
if ($user->rights->projet->all->lire) $usersettoshow='';
|
|
||||||
print $form->select_dolusers($usertoprocess->id, 'search_usertoprocessid', 0, null, 0, $usersettoshow, 0, 0, 0, 1, '', 0, '', 'maxwidth150');
|
|
||||||
print '</td>';
|
|
||||||
print '<td class="liste_titre"><input type="text" size="4" name="search_task_ref" value="'.dol_escape_htmltag($search_task_ref).'"></td>';
|
print '<td class="liste_titre"><input type="text" size="4" name="search_task_ref" value="'.dol_escape_htmltag($search_task_ref).'"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" size="4" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).'"></td>';
|
print '<td class="liste_titre"><input type="text" size="4" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).'"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" size="4" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).'"></td>';
|
print '<td class="liste_titre"><input type="text" size="4" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).'"></td>';
|
||||||
@@ -422,7 +450,6 @@ print '</td>';
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("User").'</td>';
|
|
||||||
print '<td>'.$langs->trans("RefTask").'</td>';
|
print '<td>'.$langs->trans("RefTask").'</td>';
|
||||||
print '<td>'.$langs->trans("LabelTask").'</td>';
|
print '<td>'.$langs->trans("LabelTask").'</td>';
|
||||||
print '<td>'.$langs->trans("ProjectRef").'</td>';
|
print '<td>'.$langs->trans("ProjectRef").'</td>';
|
||||||
@@ -454,7 +481,7 @@ if (count($tasksarray) > 0)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<tr><td colspan="14">'.$langs->trans("NoTasks").'</td></tr>';
|
print '<tr><td colspan="13">'.$langs->trans("NoTasks").'</td></tr>';
|
||||||
}
|
}
|
||||||
print "</table>";
|
print "</table>";
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ $day=GETPOST('reday')?GETPOST('reday','int'):(GETPOST("day")?GETPOST("day","int"
|
|||||||
$day = (int) $day;
|
$day = (int) $day;
|
||||||
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
|
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
|
||||||
|
|
||||||
|
$search_categ=GETPOST("search_categ",'alpha');
|
||||||
$search_usertoprocessid=GETPOST('search_usertoprocessid', 'int');
|
$search_usertoprocessid=GETPOST('search_usertoprocessid', 'int');
|
||||||
$search_task_ref=GETPOST('search_task_ref', 'alpha');
|
$search_task_ref=GETPOST('search_task_ref', 'alpha');
|
||||||
$search_task_label=GETPOST('search_task_label', 'alpha');
|
$search_task_label=GETPOST('search_task_label', 'alpha');
|
||||||
@@ -113,13 +114,14 @@ $object=new Task($db);
|
|||||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$action = '';
|
$action = '';
|
||||||
|
$search_categ='';
|
||||||
$search_usertoprocessid = '';
|
$search_usertoprocessid = '';
|
||||||
$search_task_ref = '';
|
$search_task_ref = '';
|
||||||
$search_task_label = '';
|
$search_task_label = '';
|
||||||
$search_project_ref = '';
|
$search_project_ref = '';
|
||||||
$search_thirdparty = '';
|
$search_thirdparty = '';
|
||||||
}
|
}
|
||||||
if (GETPOST("button_search_x") || GETPOST("button_search.x") || GETPOST("button_search"))
|
if (GETPOST("button_search_x",'alpha') || GETPOST("button_search.x",'alpha') || GETPOST("button_search",'alpha'))
|
||||||
{
|
{
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
@@ -313,6 +315,7 @@ $morewherefilter='';
|
|||||||
if ($search_task_ref) $morewherefilter.=natural_search("t.ref", $search_task_ref);
|
if ($search_task_ref) $morewherefilter.=natural_search("t.ref", $search_task_ref);
|
||||||
if ($search_task_label) $morewherefilter.=natural_search("t.label", $search_task_label);
|
if ($search_task_label) $morewherefilter.=natural_search("t.label", $search_task_label);
|
||||||
if ($search_thirdparty) $morewherefilter.=natural_search("s.nom", $search_thirdparty);
|
if ($search_thirdparty) $morewherefilter.=natural_search("s.nom", $search_thirdparty);
|
||||||
|
|
||||||
$tasksarray=$taskstatic->getTasksArray(0, 0, ($project->id?$project->id:0), $socid, 0, $search_project_ref, $onlyopenedproject, $morewherefilter); // We want to see all task of opened project i am allowed to see, not only mine. Later only mine will be editable later.
|
$tasksarray=$taskstatic->getTasksArray(0, 0, ($project->id?$project->id:0), $socid, 0, $search_project_ref, $onlyopenedproject, $morewherefilter); // We want to see all task of opened project i am allowed to see, not only mine. Later only mine will be editable later.
|
||||||
$projectsrole=$taskstatic->getUserRolesForProjectsOrTasks($usertoprocess, 0, ($project->id?$project->id:0), 0, $onlyopenedproject);
|
$projectsrole=$taskstatic->getUserRolesForProjectsOrTasks($usertoprocess, 0, ($project->id?$project->id:0), 0, $onlyopenedproject);
|
||||||
$tasksrole=$taskstatic->getUserRolesForProjectsOrTasks(0, $usertoprocess, ($project->id?$project->id:0), 0, $onlyopenedproject);
|
$tasksrole=$taskstatic->getUserRolesForProjectsOrTasks(0, $usertoprocess, ($project->id?$project->id:0), 0, $onlyopenedproject);
|
||||||
@@ -387,15 +390,42 @@ print '</div>';
|
|||||||
print '<div class="clearboth" style="padding-bottom: 8px;"></div>';
|
print '<div class="clearboth" style="padding-bottom: 8px;"></div>';
|
||||||
|
|
||||||
|
|
||||||
|
$moreforfilter='';
|
||||||
|
|
||||||
|
// Filter on categories
|
||||||
|
/*
|
||||||
|
if (! empty($conf->categorie->enabled))
|
||||||
|
{
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
|
||||||
|
$moreforfilter.='<div class="divsearchfield">';
|
||||||
|
$moreforfilter.=$langs->trans('ProjectCategories'). ': ';
|
||||||
|
$moreforfilter.=$formother->select_categories('project', $search_categ, 'search_categ', 1, 1, 'maxwidth300');
|
||||||
|
$moreforfilter.='</div>';
|
||||||
|
}*/
|
||||||
|
|
||||||
|
// If the user can view user other than himself
|
||||||
|
$moreforfilter.='<div class="divsearchfield">';
|
||||||
|
$moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ': ';
|
||||||
|
$includeonly='hierachyme';
|
||||||
|
if (empty($user->rights->user->user->lire)) $includeonly=array($user->id);
|
||||||
|
$moreforfilter.=$form->select_dolusers($search_project_user?$search_project_user:$usertoprocess->id, 'search_usertoprocessid', 0, null, 0, $includeonly, null, 0, 0, 0, '', 0, '', 'maxwidth200');
|
||||||
|
$moreforfilter.='</div>';
|
||||||
|
|
||||||
|
if (! empty($moreforfilter))
|
||||||
|
{
|
||||||
|
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||||
|
print $moreforfilter;
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
print $hookmanager->resPrint;
|
||||||
|
print '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
print '<div class="div-table-responsive">';
|
print '<div class="div-table-responsive">';
|
||||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'" id="tablelines3">'."\n";
|
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'" id="tablelines3">'."\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
print '<td class="liste_titre">';
|
|
||||||
$usersettoshow='hierarchyme';
|
|
||||||
if ($user->rights->projet->all->lire) $usersettoshow='';
|
|
||||||
print $form->select_dolusers($usertoprocess->id, 'search_usertoprocessid', 0, null, 0, $usersettoshow, 0, 0, 0, 1, '', 0, '', 'maxwidth150');
|
|
||||||
print '</td>';
|
|
||||||
print '<td class="liste_titre"><input type="text" size="4" name="search_task_ref" value="'.dol_escape_htmltag($search_task_ref).'"></td>';
|
print '<td class="liste_titre"><input type="text" size="4" name="search_task_ref" value="'.dol_escape_htmltag($search_task_ref).'"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" size="4" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).'"></td>';
|
print '<td class="liste_titre"><input type="text" size="4" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).'"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" size="4" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).'"></td>';
|
print '<td class="liste_titre"><input type="text" size="4" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).'"></td>';
|
||||||
@@ -416,7 +446,6 @@ print '</td>';
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("User").'</td>';
|
|
||||||
print '<td>'.$langs->trans("RefTask").'</td>';
|
print '<td>'.$langs->trans("RefTask").'</td>';
|
||||||
print '<td>'.$langs->trans("LabelTask").'</td>';
|
print '<td>'.$langs->trans("LabelTask").'</td>';
|
||||||
print '<td>'.$langs->trans("ProjectRef").'</td>';
|
print '<td>'.$langs->trans("ProjectRef").'</td>';
|
||||||
@@ -453,7 +482,7 @@ if (count($tasksarray) > 0)
|
|||||||
$level=0;
|
$level=0;
|
||||||
projectLinesPerWeek($j, $firstdaytoshow, $usertoprocess, 0, $tasksarray, $level, $projectsrole, $tasksrole, $mine, $restrictviewformytask);
|
projectLinesPerWeek($j, $firstdaytoshow, $usertoprocess, 0, $tasksarray, $level, $projectsrole, $tasksrole, $mine, $restrictviewformytask);
|
||||||
|
|
||||||
$colspan=8;
|
$colspan=7;
|
||||||
if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY)) $colspan++;
|
if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY)) $colspan++;
|
||||||
|
|
||||||
print '<tr class="liste_total">
|
print '<tr class="liste_total">
|
||||||
@@ -470,7 +499,7 @@ if (count($tasksarray) > 0)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<tr><td colspan="16">'.$langs->trans("NoTasks").'</td></tr>';
|
print '<tr><td colspan="15">'.$langs->trans("NoTasks").'</td></tr>';
|
||||||
}
|
}
|
||||||
print "</table>";
|
print "</table>";
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
@@ -336,7 +336,7 @@ $listofreferent=array(
|
|||||||
'table'=>'fichinter',
|
'table'=>'fichinter',
|
||||||
'datefieldname'=>'date_valid',
|
'datefieldname'=>'date_valid',
|
||||||
'disableamount'=>0,
|
'disableamount'=>0,
|
||||||
'margin'=>'minus',
|
'margin'=>'minus',
|
||||||
'urlnew'=>DOL_URL_ROOT.'/fichinter/card.php?action=create&origin=project&originid='.$id.'&socid='.$socid,
|
'urlnew'=>DOL_URL_ROOT.'/fichinter/card.php?action=create&origin=project&originid='.$id.'&socid='.$socid,
|
||||||
'lang'=>'interventions',
|
'lang'=>'interventions',
|
||||||
'buttonnew'=>'AddIntervention',
|
'buttonnew'=>'AddIntervention',
|
||||||
@@ -417,9 +417,9 @@ $listofreferent=array(
|
|||||||
'lang'=>'compta',
|
'lang'=>'compta',
|
||||||
'buttonnew'=>'AddSocialContribution',
|
'buttonnew'=>'AddSocialContribution',
|
||||||
'testnew'=>$user->rights->tax->charges->lire,
|
'testnew'=>$user->rights->tax->charges->lire,
|
||||||
'test'=>$conf->tax->enabled && $user->rights->tax->charges->lire),
|
'test'=>$conf->tax->enabled && $user->rights->tax->charges->lire),
|
||||||
'project_task'=>array(
|
'project_task'=>array(
|
||||||
'name'=>"TaskTimeValorised",
|
'name'=>"TaskTimeSpent",
|
||||||
'title'=>"ListTaskTimeUserProject",
|
'title'=>"ListTaskTimeUserProject",
|
||||||
'class'=>'Task',
|
'class'=>'Task',
|
||||||
'margin'=>'minus',
|
'margin'=>'minus',
|
||||||
@@ -573,7 +573,7 @@ foreach ($listofreferent as $key => $value)
|
|||||||
if ($tablename != 'expensereport_det' && method_exists($element, 'fetch_thirdparty')) $element->fetch_thirdparty();
|
if ($tablename != 'expensereport_det' && method_exists($element, 'fetch_thirdparty')) $element->fetch_thirdparty();
|
||||||
if ($tablename == 'don' || $tablename == 'chargesociales') $total_ht_by_line=$element->amount;
|
if ($tablename == 'don' || $tablename == 'chargesociales') $total_ht_by_line=$element->amount;
|
||||||
elseif ($tablename == 'stock_mouvement') $total_ht_by_line=$element->price*abs($element->qty);
|
elseif ($tablename == 'stock_mouvement') $total_ht_by_line=$element->price*abs($element->qty);
|
||||||
else if($tablename == 'fichinter') $total_ht_by_line=$element->getAmount();
|
else if($tablename == 'fichinter') $total_ht_by_line=$element->getAmount();
|
||||||
elseif ($tablename == 'projet_task')
|
elseif ($tablename == 'projet_task')
|
||||||
{
|
{
|
||||||
if ($idofelementuser)
|
if ($idofelementuser)
|
||||||
@@ -598,7 +598,7 @@ foreach ($listofreferent as $key => $value)
|
|||||||
if ($qualifiedfortotal) $total_ht = $total_ht + $total_ht_by_line;
|
if ($qualifiedfortotal) $total_ht = $total_ht + $total_ht_by_line;
|
||||||
|
|
||||||
if ($tablename == 'don' || $tablename == 'chargesociales') $total_ttc_by_line=$element->amount;
|
if ($tablename == 'don' || $tablename == 'chargesociales') $total_ttc_by_line=$element->amount;
|
||||||
else if($tablename == 'fichinter') $total_ttc_by_line=$element->getAmount();
|
else if($tablename == 'fichinter') $total_ttc_by_line=$element->getAmount();
|
||||||
elseif ($tablename == 'stock_mouvement') $total_ttc_by_line=$element->price*abs($element->qty);
|
elseif ($tablename == 'stock_mouvement') $total_ttc_by_line=$element->price*abs($element->qty);
|
||||||
elseif ($tablename == 'projet_task')
|
elseif ($tablename == 'projet_task')
|
||||||
{
|
{
|
||||||
@@ -629,7 +629,7 @@ foreach ($listofreferent as $key => $value)
|
|||||||
$total_ttc = -$total_ttc;
|
$total_ttc = -$total_ttc;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($classname) {
|
/*switch ($classname) {
|
||||||
case 'FactureFournisseur':
|
case 'FactureFournisseur':
|
||||||
$newclassname = 'SupplierInvoice';
|
$newclassname = 'SupplierInvoice';
|
||||||
break;
|
break;
|
||||||
@@ -653,12 +653,12 @@ foreach ($listofreferent as $key => $value)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$newclassname = $classname;
|
$newclassname = $classname;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
$var = ! $var;
|
$var = ! $var;
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
// Module
|
// Module
|
||||||
print '<td align="left">'.$langs->trans($newclassname).'</td>';
|
print '<td align="left">'.$name.'</td>';
|
||||||
// Nb
|
// Nb
|
||||||
print '<td align="right">'.$i.'</td>';
|
print '<td align="right">'.$i.'</td>';
|
||||||
// Amount HT
|
// Amount HT
|
||||||
@@ -711,7 +711,7 @@ foreach ($listofreferent as $key => $value)
|
|||||||
|
|
||||||
$idtofilterthirdparty=0;
|
$idtofilterthirdparty=0;
|
||||||
$array_of_element_linkable_with_different_thirdparty = array('facture_fourn', 'commande_fournisseur');
|
$array_of_element_linkable_with_different_thirdparty = array('facture_fourn', 'commande_fournisseur');
|
||||||
if (! in_array($tablename, $array_of_element_linkable_with_different_thirdparty))
|
if (! in_array($tablename, $array_of_element_linkable_with_different_thirdparty))
|
||||||
{
|
{
|
||||||
$idtofilterthirdparty=$object->thirdparty->id;
|
$idtofilterthirdparty=$object->thirdparty->id;
|
||||||
if (! empty($conf->global->PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS)) $idtofilterthirdparty.=','.$conf->global->PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS;
|
if (! empty($conf->global->PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS)) $idtofilterthirdparty.=','.$conf->global->PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS;
|
||||||
@@ -854,7 +854,7 @@ foreach ($listofreferent as $key => $value)
|
|||||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $projectid . '&action=unlink&tablename=' . $tablename . '&elementselect=' . $element->id . '">' . img_picto($langs->trans('Unlink'), 'editdelete') . '</a>';
|
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $projectid . '&action=unlink&tablename=' . $tablename . '&elementselect=' . $element->id . '">' . img_picto($langs->trans('Unlink'), 'editdelete') . '</a>';
|
||||||
}
|
}
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<td align="left" class="nowrap">';
|
print '<td align="left" class="nowrap">';
|
||||||
if ($tablename == 'expensereport_det')
|
if ($tablename == 'expensereport_det')
|
||||||
@@ -922,7 +922,7 @@ foreach ($listofreferent as $key => $value)
|
|||||||
print dol_print_date($element->datep,'dayhour');
|
print dol_print_date($element->datep,'dayhour');
|
||||||
if ($element->datef && $element->datef > $element->datep) print " - ".dol_print_date($element->datef,'dayhour');
|
if ($element->datef && $element->datef > $element->datep) print " - ".dol_print_date($element->datef,'dayhour');
|
||||||
}
|
}
|
||||||
else if (in_array($tablename, array('projet_task')))
|
else if (in_array($tablename, array('projet_task')))
|
||||||
{
|
{
|
||||||
$tmpprojtime = $element->getSumOfAmount($elementuser, $dates, $datee); // $element is a task. $elementuser may be empty
|
$tmpprojtime = $element->getSumOfAmount($elementuser, $dates, $datee); // $element is a task. $elementuser may be empty
|
||||||
print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$idofelement.'&withproject=1">';
|
print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$idofelement.'&withproject=1">';
|
||||||
@@ -1018,7 +1018,7 @@ foreach ($listofreferent as $key => $value)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$othermessage=$form->textwithpicto($langs->trans("NotAvailable"), $langs->trans("ModuleSalaryToDefineHourlyRateMustBeEnabled"));
|
$othermessage=$form->textwithpicto($langs->trans("NotAvailable"), $langs->trans("ModuleSalaryToDefineHourlyRateMustBeEnabled"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1074,8 +1074,8 @@ foreach ($listofreferent as $key => $value)
|
|||||||
|
|
||||||
$total_ht_by_third += $total_ht_by_line;
|
$total_ht_by_third += $total_ht_by_line;
|
||||||
$total_ttc_by_third += $total_ttc_by_line;
|
$total_ttc_by_third += $total_ttc_by_line;
|
||||||
|
|
||||||
$total_time = $total_time + $total_time_by_line;
|
$total_time = $total_time + $total_time_by_line;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (canApplySubtotalOn($tablename))
|
if (canApplySubtotalOn($tablename))
|
||||||
@@ -1115,7 +1115,7 @@ foreach ($listofreferent as $key => $value)
|
|||||||
//if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print '<td align="right" width="100">'.$langs->trans("TotalHT").' : '.price($total_ht).'</td>';
|
//if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print '<td align="right" width="100">'.$langs->trans("TotalHT").' : '.price($total_ht).'</td>';
|
||||||
//elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print '<td align="right" width="100">'.$langs->trans("Total").' : '.price($total_ht).'</td>';
|
//elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print '<td align="right" width="100">'.$langs->trans("Total").' : '.price($total_ht).'</td>';
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
if (empty($value['disableamount']))
|
if (empty($value['disableamount']))
|
||||||
{
|
{
|
||||||
if ($tablename != 'projet_task' || ! empty($conf->salaries->enabled)) print ''.$langs->trans("TotalHT").' : '.price($total_ht);
|
if ($tablename != 'projet_task' || ! empty($conf->salaries->enabled)) print ''.$langs->trans("TotalHT").' : '.price($total_ht);
|
||||||
}
|
}
|
||||||
@@ -1123,7 +1123,7 @@ foreach ($listofreferent as $key => $value)
|
|||||||
//if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print '<td align="right" width="100">'.$langs->trans("TotalTTC").' : '.price($total_ttc).'</td>';
|
//if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print '<td align="right" width="100">'.$langs->trans("TotalTTC").' : '.price($total_ttc).'</td>';
|
||||||
//elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print '<td align="right" width="100"></td>';
|
//elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print '<td align="right" width="100"></td>';
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
if (empty($value['disableamount']))
|
if (empty($value['disableamount']))
|
||||||
{
|
{
|
||||||
if ($tablename != 'projet_task' || ! empty($conf->salaries->enabled)) print $langs->trans("TotalTTC").' : '.price($total_ttc);
|
if ($tablename != 'projet_task' || ! empty($conf->salaries->enabled)) print $langs->trans("TotalTTC").' : '.price($total_ttc);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,12 +98,12 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
$param=($mode=='mine'?'&mode=mine':'');
|
$param=($mode=='mine'?'&mode=mine':'');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Project card
|
// Project card
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
$morehtmlref='<div class="refidno">';
|
$morehtmlref='<div class="refidno">';
|
||||||
// Title
|
// Title
|
||||||
$morehtmlref.=$object->title;
|
$morehtmlref.=$object->title;
|
||||||
@@ -113,29 +113,29 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1, 'project');
|
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1, 'project');
|
||||||
}
|
}
|
||||||
$morehtmlref.='</div>';
|
$morehtmlref.='</div>';
|
||||||
|
|
||||||
// Define a complementary filter for search of next/prev ref.
|
// Define a complementary filter for search of next/prev ref.
|
||||||
if (! $user->rights->projet->all->lire)
|
if (! $user->rights->projet->all->lire)
|
||||||
{
|
{
|
||||||
$objectsListId = $object->getProjectsAuthorizedForUser($user,0,0);
|
$objectsListId = $object->getProjectsAuthorizedForUser($user,0,0);
|
||||||
$object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")";
|
$object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")";
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||||
|
|
||||||
|
|
||||||
print '<div class="fichecenter">';
|
print '<div class="fichecenter">';
|
||||||
print '<div class="fichehalfleft">';
|
print '<div class="fichehalfleft">';
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Visibility
|
// Visibility
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
|
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
|
||||||
if ($object->public) print $langs->trans('SharedProject');
|
if ($object->public) print $langs->trans('SharedProject');
|
||||||
else print $langs->trans('PrivateProject');
|
else print $langs->trans('PrivateProject');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Date start - end
|
// Date start - end
|
||||||
print '<tr><td>'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td>';
|
print '<tr><td>'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td>';
|
||||||
$start = dol_print_date($object->date_start,'dayhour');
|
$start = dol_print_date($object->date_start,'dayhour');
|
||||||
@@ -145,45 +145,45 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print ($end?$end:'?');
|
print ($end?$end:'?');
|
||||||
if ($object->hasDelay()) print img_warning("Late");
|
if ($object->hasDelay()) print img_warning("Late");
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Budget
|
// Budget
|
||||||
print '<tr><td>'.$langs->trans("Budget").'</td><td>';
|
print '<tr><td>'.$langs->trans("Budget").'</td><td>';
|
||||||
if (strcmp($object->budget_amount, '')) print price($object->budget_amount,'',$langs,1,0,0,$conf->currency);
|
if (strcmp($object->budget_amount, '')) print price($object->budget_amount,'',$langs,1,0,0,$conf->currency);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
$cols = 2;
|
$cols = 2;
|
||||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '<div class="fichehalfright">';
|
print '<div class="fichehalfright">';
|
||||||
print '<div class="ficheaddleft">';
|
print '<div class="ficheaddleft">';
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Description
|
// Description
|
||||||
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
|
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
|
||||||
print nl2br($object->description);
|
print nl2br($object->description);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Categories
|
// Categories
|
||||||
if($conf->categorie->enabled) {
|
if($conf->categorie->enabled) {
|
||||||
print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td>';
|
print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td>';
|
||||||
print $form->showCategories($object->id,'project',1);
|
print $form->showCategories($object->id,'project',1);
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '<div class="clearboth"></div>';
|
print '<div class="clearboth"></div>';
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -371,6 +371,7 @@ llxHeader("", $title, $help_url);
|
|||||||
$param='';
|
$param='';
|
||||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
|
if ($search_all != '') $param.='&search_all='.$search_all;
|
||||||
if ($search_sday) $param.='&search_sday='.$search_sday;
|
if ($search_sday) $param.='&search_sday='.$search_sday;
|
||||||
if ($search_smonth) $param.='&search_smonth='.$search_smonth;
|
if ($search_smonth) $param.='&search_smonth='.$search_smonth;
|
||||||
if ($search_syear) $param.='&search_syear=' .$search_syear;
|
if ($search_syear) $param.='&search_syear=' .$search_syear;
|
||||||
@@ -378,7 +379,6 @@ if ($search_eday) $param.='&search_eday='.$search_eday;
|
|||||||
if ($search_emonth) $param.='&search_emonth='.$search_emonth;
|
if ($search_emonth) $param.='&search_emonth='.$search_emonth;
|
||||||
if ($search_eyear) $param.='&search_eyear=' .$search_eyear;
|
if ($search_eyear) $param.='&search_eyear=' .$search_eyear;
|
||||||
if ($socid) $param.='&socid='.$socid;
|
if ($socid) $param.='&socid='.$socid;
|
||||||
if ($search_all != '') $param.='&search_all='.$search_all;
|
|
||||||
if ($search_ref != '') $param.='&search_ref='.$search_ref;
|
if ($search_ref != '') $param.='&search_ref='.$search_ref;
|
||||||
if ($search_label != '') $param.='&search_label='.$search_label;
|
if ($search_label != '') $param.='&search_label='.$search_label;
|
||||||
if ($search_societe != '') $param.='&search_societe='.$search_societe;
|
if ($search_societe != '') $param.='&search_societe='.$search_societe;
|
||||||
@@ -451,7 +451,7 @@ if (! empty($conf->categorie->enabled))
|
|||||||
// If the user can view user other than himself
|
// If the user can view user other than himself
|
||||||
$moreforfilter.='<div class="divsearchfield">';
|
$moreforfilter.='<div class="divsearchfield">';
|
||||||
$moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ': ';
|
$moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ': ';
|
||||||
$includeonly='';
|
$includeonly='hierachyme';
|
||||||
if (empty($user->rights->user->user->lire)) $includeonly=array($user->id);
|
if (empty($user->rights->user->user->lire)) $includeonly=array($user->id);
|
||||||
$moreforfilter.=$form->select_dolusers($search_project_user?$search_project_user:'', 'search_project_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth200');
|
$moreforfilter.=$form->select_dolusers($search_project_user?$search_project_user:'', 'search_project_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth200');
|
||||||
$moreforfilter.='</div>';
|
$moreforfilter.='</div>';
|
||||||
|
|||||||
@@ -32,9 +32,6 @@ if (empty($usedolheader))
|
|||||||
<!-- Includes for JQuery (Ajax library) -->
|
<!-- Includes for JQuery (Ajax library) -->
|
||||||
<link rel="stylesheet" type="text/css" href="<?php echo DOL_URL_ROOT ?>/includes/jquery/css/smoothness/jquery-ui.css" />
|
<link rel="stylesheet" type="text/css" href="<?php echo DOL_URL_ROOT ?>/includes/jquery/css/smoothness/jquery-ui.css" />
|
||||||
<!-- <link rel="stylesheet" type="text/css" href="<?php echo DOL_URL_ROOT ?>/includes/jquery/plugins/datatables/media/css/jquery.dataTables.css" /> -->
|
<!-- <link rel="stylesheet" type="text/css" href="<?php echo DOL_URL_ROOT ?>/includes/jquery/plugins/datatables/media/css/jquery.dataTables.css" /> -->
|
||||||
<?php if ($_GET["dol_use_jmobile"] == 1) { ?>
|
|
||||||
<link rel="stylesheet" type="text/css" href="<?php echo DOL_URL_ROOT ?>/includes/jquery/plugins/mobile/jquery.mobile-latest.min.css" />
|
|
||||||
<?php } ?>
|
|
||||||
<link rel="stylesheet" type="text/css" title="default" href="<?php echo DOL_URL_ROOT ?>/theme/eldy/style.css.php<?php echo ($_GET["dol_use_jmobile"] == 1)?'?dol_use_jmobile=1&dol_optimize_smallscreen=1':''; ?>" />
|
<link rel="stylesheet" type="text/css" title="default" href="<?php echo DOL_URL_ROOT ?>/theme/eldy/style.css.php<?php echo ($_GET["dol_use_jmobile"] == 1)?'?dol_use_jmobile=1&dol_optimize_smallscreen=1':''; ?>" />
|
||||||
<!-- Includes JS for JQuery -->
|
<!-- Includes JS for JQuery -->
|
||||||
<script type="text/javascript" src="<?php echo DOL_URL_ROOT ?>/includes/jquery/js/jquery.min.js"></script>
|
<script type="text/javascript" src="<?php echo DOL_URL_ROOT ?>/includes/jquery/js/jquery.min.js"></script>
|
||||||
@@ -43,9 +40,6 @@ if (empty($usedolheader))
|
|||||||
<script type="text/javascript" src="<?php echo DOL_URL_ROOT ?>/includes/jquery/plugins/tablednd/jquery.tablednd.0.6.min.js"></script>
|
<script type="text/javascript" src="<?php echo DOL_URL_ROOT ?>/includes/jquery/plugins/tablednd/jquery.tablednd.0.6.min.js"></script>
|
||||||
<!-- <script type="text/javascript" src="<?php echo DOL_URL_ROOT ?>/includes/jquery/plugins/datatables/media/js/jquery.dataTables.js"></script> -->
|
<!-- <script type="text/javascript" src="<?php echo DOL_URL_ROOT ?>/includes/jquery/plugins/datatables/media/js/jquery.dataTables.js"></script> -->
|
||||||
<script type="text/javascript" src="<?php echo DOL_URL_ROOT ?>/includes/jquery/plugins/select2/select2.min.js?version=4.0.0-beta"></script>
|
<script type="text/javascript" src="<?php echo DOL_URL_ROOT ?>/includes/jquery/plugins/select2/select2.min.js?version=4.0.0-beta"></script>
|
||||||
<?php if ($_GET["dol_use_jmobile"] == 1) { ?>
|
|
||||||
<script type="text/javascript" src="<?php echo DOL_URL_ROOT ?>/includes/jquery/plugins/mobile/jquery.mobile-latest.min.js"></script>
|
|
||||||
<?php } ?>
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body style="padding: 10px;">
|
<body style="padding: 10px;">
|
||||||
@@ -74,7 +68,7 @@ else
|
|||||||
'/includes/pdfmake/vfs_fonts.js'
|
'/includes/pdfmake/vfs_fonts.js'
|
||||||
);
|
);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader('','','','',0,0,$arrayjs,$arraycss);
|
llxHeader('','','','',0,0,$arrayjs,$arraycss);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,7 +86,7 @@ This page is a sample of page using tables. It is designed to make test with<br>
|
|||||||
- tablednd<br>
|
- tablednd<br>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<?php ?>
|
<?php ?>
|
||||||
|
|
||||||
<br><hr><br>Example 0a : Table with div+div+div containg a select that should be overflowed and truncated => Use this to align text or form<br>
|
<br><hr><br>Example 0a : Table with div+div+div containg a select that should be overflowed and truncated => Use this to align text or form<br>
|
||||||
|
|
||||||
@@ -139,7 +133,7 @@ This page is a sample of page using tables. It is designed to make test with<br>
|
|||||||
|
|
||||||
<br><hr><br>Example 1 : Standard table/thead/tbody/tr/th-td (no class pair/impair on td) => Use this if you need the drag and drop for lines or for long result tables<br>
|
<br><hr><br>Example 1 : Standard table/thead/tbody/tr/th-td (no class pair/impair on td) => Use this if you need the drag and drop for lines or for long result tables<br>
|
||||||
|
|
||||||
|
|
||||||
<script type="text/javascript" language="javascript">
|
<script type="text/javascript" language="javascript">
|
||||||
/*jQuery(document).ready(function() {
|
/*jQuery(document).ready(function() {
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
@@ -157,7 +151,7 @@ $(document).ready(function() {
|
|||||||
});*/
|
});*/
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||||
$productspecimen=new Product($db);
|
$productspecimen=new Product($db);
|
||||||
@@ -223,7 +217,7 @@ if (! empty($moreforfilter))
|
|||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<table class="stripe row-border order-column centpercent tagtable liste<?php echo $moreforfilter?" listwithfilterbefore":""; ?>" id="tablelines3">
|
<table class="stripe row-border order-column centpercent tagtable liste<?php echo $moreforfilter?" listwithfilterbefore":""; ?>" id="tablelines3">
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="liste_titre">
|
<tr class="liste_titre">
|
||||||
@@ -243,7 +237,7 @@ if (! empty($moreforfilter))
|
|||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
<br><hr><br>Example 1b : Table using tags: table/thead/tbody/tr/th-td + dataTable => Use this for short result tables<br>
|
<br><hr><br>Example 1b : Table using tags: table/thead/tbody/tr/th-td + dataTable => Use this for short result tables<br>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ if (! file_exists($original_file_osencoded))
|
|||||||
|
|
||||||
// Output page content
|
// Output page content
|
||||||
define('USEDOLIBARRSERVER', 1);
|
define('USEDOLIBARRSERVER', 1);
|
||||||
print '<!-- Page content '.$original_file.' : Html with CSS link and html header + Body that was saved into tpl -->'."\n";
|
print '<!-- Page content '.$original_file.' : Html with CSS link and html header + Body that was saved into tpl dir -->'."\n";
|
||||||
include_once $original_file_osencoded;
|
include_once $original_file_osencoded;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -139,6 +139,8 @@ if (! file_exists($original_file_osencoded))
|
|||||||
|
|
||||||
|
|
||||||
// Output page content
|
// Output page content
|
||||||
|
define('USEDOLIBARRSERVER', 1);
|
||||||
|
print '/* Page content '.$original_file.' : CSS content that was saved into tpl dir */'."\n";
|
||||||
require_once $original_file_osencoded;
|
require_once $original_file_osencoded;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,9 @@ if ($user->societe_id) $socid=$user->societe_id;
|
|||||||
$result = restrictedArea($user,'societe',$socid,'');
|
$result = restrictedArea($user,'societe',$socid,'');
|
||||||
|
|
||||||
$search_all=trim(GETPOST('sall', 'alphanohtml'));
|
$search_all=trim(GETPOST('sall', 'alphanohtml'));
|
||||||
|
$search_cti=preg_replace('/^0+/', '', preg_replace('/[^0-9]/', '', GETPOST('search_cti', 'alphanohtml'))); // Phone number without any special chars
|
||||||
|
|
||||||
|
$search_id=trim(GETPOST("search_id","int"));
|
||||||
$search_nom=trim(GETPOST("search_nom"));
|
$search_nom=trim(GETPOST("search_nom"));
|
||||||
$search_alias=trim(GETPOST("search_alias"));
|
$search_alias=trim(GETPOST("search_alias"));
|
||||||
$search_nom_only=trim(GETPOST("search_nom_only"));
|
$search_nom_only=trim(GETPOST("search_nom_only"));
|
||||||
@@ -78,6 +81,7 @@ $search_type=GETPOST('search_type','alpha');
|
|||||||
$search_level_from = GETPOST("search_level_from","alpha");
|
$search_level_from = GETPOST("search_level_from","alpha");
|
||||||
$search_level_to = GETPOST("search_level_to","alpha");
|
$search_level_to = GETPOST("search_level_to","alpha");
|
||||||
$search_stcomm=GETPOST('search_stcomm','int');
|
$search_stcomm=GETPOST('search_stcomm','int');
|
||||||
|
$search_import_key = GETPOST("search_import_key","alpha");
|
||||||
|
|
||||||
$type=GETPOST('type');
|
$type=GETPOST('type');
|
||||||
$optioncss=GETPOST('optioncss','alpha');
|
$optioncss=GETPOST('optioncss','alpha');
|
||||||
@@ -152,6 +156,7 @@ $checkedprofid6=0;
|
|||||||
$checkprospectlevel=(in_array($contextpage, array('prospectlist')) ? 1 : 0);
|
$checkprospectlevel=(in_array($contextpage, array('prospectlist')) ? 1 : 0);
|
||||||
$checkstcomm=(in_array($contextpage, array('prospectlist')) ? 1 : 0);
|
$checkstcomm=(in_array($contextpage, array('prospectlist')) ? 1 : 0);
|
||||||
$arrayfields=array(
|
$arrayfields=array(
|
||||||
|
's.rowid'=>array('label'=>"TechnicalID", 'checked'=>($conf->global->MAIN_SHOW_TECHNICAL_ID?1:0), 'enabled'=>($conf->global->MAIN_SHOW_TECHNICAL_ID?1:0)),
|
||||||
's.nom'=>array('label'=>"ThirdPartyName", 'checked'=>1),
|
's.nom'=>array('label'=>"ThirdPartyName", 'checked'=>1),
|
||||||
's.name_alias'=>array('label'=>"AliasNameShort", 'checked'=>1),
|
's.name_alias'=>array('label'=>"AliasNameShort", 'checked'=>1),
|
||||||
's.barcode'=>array('label'=>"Gencod", 'checked'=>1, 'enabled'=>(! empty($conf->barcode->enabled))),
|
's.barcode'=>array('label'=>"Gencod", 'checked'=>1, 'enabled'=>(! empty($conf->barcode->enabled))),
|
||||||
@@ -179,6 +184,7 @@ $arrayfields=array(
|
|||||||
's.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
|
's.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
|
||||||
's.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
|
's.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
|
||||||
's.status'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
|
's.status'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
|
||||||
|
's.import_key'=>array('label'=>"ImportId", 'checked'=>0, 'position'=>1100),
|
||||||
);
|
);
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||||
@@ -211,6 +217,7 @@ if (empty($reshook))
|
|||||||
// Did we click on purge search criteria ?
|
// Did we click on purge search criteria ?
|
||||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
|
$search_id='';
|
||||||
$search_nom='';
|
$search_nom='';
|
||||||
$search_alias='';
|
$search_alias='';
|
||||||
$search_categ=0;
|
$search_categ=0;
|
||||||
@@ -239,6 +246,7 @@ if (empty($reshook))
|
|||||||
$search_stcomm='';
|
$search_stcomm='';
|
||||||
$search_level_from='';
|
$search_level_from='';
|
||||||
$search_level_to='';
|
$search_level_to='';
|
||||||
|
$search_import_key='';
|
||||||
$toselect='';
|
$toselect='';
|
||||||
$search_array_options=array();
|
$search_array_options=array();
|
||||||
}
|
}
|
||||||
@@ -401,42 +409,47 @@ if ($search_sale || (!$user->rights->societe->client->voir && !$socid)) $sql.= "
|
|||||||
$sql.= " WHERE s.fk_stcomm = st.id";
|
$sql.= " WHERE s.fk_stcomm = st.id";
|
||||||
$sql.= " AND s.entity IN (".getEntity('societe').")";
|
$sql.= " AND s.entity IN (".getEntity('societe').")";
|
||||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||||
if ($search_sale) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
if ($search_sale) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
||||||
if (! $user->rights->fournisseur->lire) $sql.=" AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible
|
if (! $user->rights->fournisseur->lire) $sql.=" AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible
|
||||||
if ($search_sale) $sql.= " AND sc.fk_user = ".$db->escape($search_sale);
|
if ($search_sale) $sql.= " AND sc.fk_user = ".$db->escape($search_sale);
|
||||||
if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$db->escape($search_categ);
|
if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$db->escape($search_categ);
|
||||||
if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL";
|
if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL";
|
||||||
if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all);
|
|
||||||
if ($search_nom) $sql.= natural_search("s.nom",$search_nom);
|
if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all);
|
||||||
if ($search_alias) $sql.= natural_search("s.name_alias",$search_alias);
|
if (strlen($search_cti)) $sql.= natural_search('s.phone', $search_cti);
|
||||||
if ($search_nom_only) $sql.= natural_search("s.nom",$search_nom_only);
|
|
||||||
|
if ($search_id > 0) $sql.= natural_search("s.rowid",$search_id,1);
|
||||||
|
if ($search_nom) $sql.= natural_search("s.nom",$search_nom);
|
||||||
|
if ($search_alias) $sql.= natural_search("s.name_alias",$search_alias);
|
||||||
|
if ($search_nom_only) $sql.= natural_search("s.nom",$search_nom_only);
|
||||||
if ($search_customer_code) $sql.= natural_search("s.code_client",$search_customer_code);
|
if ($search_customer_code) $sql.= natural_search("s.code_client",$search_customer_code);
|
||||||
if ($search_supplier_code) $sql.= natural_search("s.code_fournisseur",$search_supplier_code);
|
if ($search_supplier_code) $sql.= natural_search("s.code_fournisseur",$search_supplier_code);
|
||||||
if ($search_account_customer_code) $sql.= natural_search("s.code_compta",$search_account_customer_code);
|
if ($search_account_customer_code) $sql.= natural_search("s.code_compta",$search_account_customer_code);
|
||||||
if ($search_account_supplier_code) $sql.= natural_search("s.code_compta_fournisseur",$search_account_supplier_code);
|
if ($search_account_supplier_code) $sql.= natural_search("s.code_compta_fournisseur",$search_account_supplier_code);
|
||||||
if ($search_town) $sql.= natural_search("s.town",$search_town);
|
if ($search_town) $sql.= natural_search("s.town",$search_town);
|
||||||
if ($search_zip) $sql.= natural_search("s.zip",$search_zip);
|
if (strlen($search_zip)) $sql.= natural_search("s.zip",$search_zip);
|
||||||
if ($search_state) $sql.= natural_search("state.nom",$search_state);
|
if ($search_state) $sql.= natural_search("state.nom",$search_state);
|
||||||
if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
|
if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
|
||||||
if ($search_email) $sql.= natural_search("s.email",$search_email);
|
if ($search_email) $sql.= natural_search("s.email",$search_email);
|
||||||
if ($search_phone) $sql.= natural_search("s.phone",$search_phone);
|
if (strlen($search_phone)) $sql.= natural_search("s.phone", $search_phone);
|
||||||
if ($search_url) $sql.= natural_search("s.url",$search_url);
|
if ($search_url) $sql.= natural_search("s.url",$search_url);
|
||||||
if ($search_idprof1) $sql.= natural_search("s.siren",$search_idprof1);
|
if (strlen($search_idprof1)) $sql.= natural_search("s.siren",$search_idprof1);
|
||||||
if ($search_idprof2) $sql.= natural_search("s.siret",$search_idprof2);
|
if (strlen($search_idprof2)) $sql.= natural_search("s.siret",$search_idprof2);
|
||||||
if ($search_idprof3) $sql.= natural_search("s.ape",$search_idprof3);
|
if (strlen($search_idprof3)) $sql.= natural_search("s.ape",$search_idprof3);
|
||||||
if ($search_idprof4) $sql.= natural_search("s.idprof4",$search_idprof4);
|
if (strlen($search_idprof4)) $sql.= natural_search("s.idprof4",$search_idprof4);
|
||||||
if ($search_idprof5) $sql.= natural_search("s.idprof5",$search_idprof5);
|
if (strlen($search_idprof5)) $sql.= natural_search("s.idprof5",$search_idprof5);
|
||||||
if ($search_idprof6) $sql.= natural_search("s.idprof6",$search_idprof6);
|
if (strlen($search_idprof6)) $sql.= natural_search("s.idprof6",$search_idprof6);
|
||||||
// Filter on type of thirdparty
|
// Filter on type of thirdparty
|
||||||
if ($search_type > 0 && in_array($search_type,array('1,3','2,3'))) $sql .= " AND s.client IN (".$db->escape($search_type).")";
|
if ($search_type > 0 && in_array($search_type,array('1,3','2,3'))) $sql .= " AND s.client IN (".$db->escape($search_type).")";
|
||||||
if ($search_type > 0 && in_array($search_type,array('4'))) $sql .= " AND s.fournisseur = 1";
|
if ($search_type > 0 && in_array($search_type,array('4'))) $sql .= " AND s.fournisseur = 1";
|
||||||
if ($search_type == '0') $sql .= " AND s.client = 0 AND s.fournisseur = 0";
|
if ($search_type == '0') $sql .= " AND s.client = 0 AND s.fournisseur = 0";
|
||||||
if ($search_status!='' && $search_status >= 0) $sql .= " AND s.status = ".$db->escape($search_status);
|
if ($search_status!='' && $search_status >= 0) $sql .= " AND s.status = ".$db->escape($search_status);
|
||||||
if (!empty($conf->barcode->enabled) && $search_barcode) $sql.= " AND s.barcode LIKE '%".$db->escape($search_barcode)."%'";
|
if (!empty($conf->barcode->enabled) && $search_barcode) $sql.= natural_search("s.barcode", $search_barcode);
|
||||||
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
|
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
|
||||||
if ($search_levels) $sql .= " AND s.fk_prospectlevel IN (".$search_levels.')';
|
if ($search_levels) $sql .= " AND s.fk_prospectlevel IN (".$search_levels.')';
|
||||||
if ($search_stcomm != '' && $search_stcomm != -2) $sql.= natural_search("s.fk_stcomm",$search_stcomm,2);
|
if ($search_stcomm != '' && $search_stcomm != -2) $sql.= natural_search("s.fk_stcomm",$search_stcomm,2);
|
||||||
|
if ($search_import_key) $sql.= natural_search("s.import_key",$search_import_key);
|
||||||
// Add where from extra fields
|
// Add where from extra fields
|
||||||
foreach ($search_array_options as $key => $val)
|
foreach ($search_array_options as $key => $val)
|
||||||
{
|
{
|
||||||
@@ -478,7 +491,7 @@ $num = $db->num_rows($resql);
|
|||||||
|
|
||||||
$arrayofselected=is_array($toselect)?$toselect:array();
|
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||||
|
|
||||||
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && $action != 'list')
|
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && ($search_all != '' || $search_cti != '') && $action != 'list')
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
$id = $obj->rowid;
|
$id = $obj->rowid;
|
||||||
@@ -496,6 +509,7 @@ if ($search_all != '') $param = "&sall=".urlencode($search_all);
|
|||||||
if ($sall != '') $param .= "&sall=".urlencode($sall);
|
if ($sall != '') $param .= "&sall=".urlencode($sall);
|
||||||
if ($search_categ > 0) $param.='&search_categ='.urlencode($search_categ);
|
if ($search_categ > 0) $param.='&search_categ='.urlencode($search_categ);
|
||||||
if ($search_sale > 0) $param.='&search_sale='.urlencode($search_sale);
|
if ($search_sale > 0) $param.='&search_sale='.urlencode($search_sale);
|
||||||
|
if ($search_id > 0) $param.= "&search_id=".urlencode($search_id);
|
||||||
if ($search_nom != '') $param.= "&search_nom=".urlencode($search_nom);
|
if ($search_nom != '') $param.= "&search_nom=".urlencode($search_nom);
|
||||||
if ($search_alias != '') $param.= "&search_alias=".urlencode($search_alias);
|
if ($search_alias != '') $param.= "&search_alias=".urlencode($search_alias);
|
||||||
if ($search_town != '') $param.= "&search_town=".urlencode($search_town);
|
if ($search_town != '') $param.= "&search_town=".urlencode($search_town);
|
||||||
@@ -520,9 +534,10 @@ if ($search_country != '') $param.='&search_country='.urlencode($search_country)
|
|||||||
if ($search_type_thirdparty != '') $param.='&search_type_thirdparty='.urlencode($search_type_thirdparty);
|
if ($search_type_thirdparty != '') $param.='&search_type_thirdparty='.urlencode($search_type_thirdparty);
|
||||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||||
if ($search_status != '') $param.='&search_status='.urlencode($search_status);
|
if ($search_status != '') $param.='&search_status='.urlencode($search_status);
|
||||||
if ($search_stcomm != '') $param.='&search_stcomm='.$search_stcomm;
|
if ($search_stcomm != '') $param.='&search_stcomm='.urlencode($search_stcomm);
|
||||||
if ($search_level_from != '') $param.='&search_level_from='.$search_level_from;
|
if ($search_level_from != '') $param.='&search_level_from='.urlencode($search_level_from);
|
||||||
if ($search_level_to != '') $param.='&search_level_to='.$search_level_to;
|
if ($search_level_to != '') $param.='&search_level_to='.urlencode($search_level_to);
|
||||||
|
if ($search_import_key != '') $param.='&search_import_key='.urlencode($search_import_key);
|
||||||
if ($type != '') $param.='&type='.urlencode($type);
|
if ($type != '') $param.='&type='.urlencode($type);
|
||||||
// Add $param from extra fields
|
// Add $param from extra fields
|
||||||
foreach ($search_array_options as $key => $val)
|
foreach ($search_array_options as $key => $val)
|
||||||
@@ -631,6 +646,12 @@ print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"")
|
|||||||
|
|
||||||
// Fields title search
|
// Fields title search
|
||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
|
if (! empty($arrayfields['s.rowid']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre">';
|
||||||
|
print '<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dol_escape_htmltag($search_id).'">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
if (! empty($arrayfields['s.nom']['checked']))
|
if (! empty($arrayfields['s.nom']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
@@ -879,10 +900,16 @@ if (! empty($arrayfields['s.tms']['checked']))
|
|||||||
// Status
|
// Status
|
||||||
if (! empty($arrayfields['s.status']['checked']))
|
if (! empty($arrayfields['s.status']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre maxwidthonsmartphone" align="center">';
|
print '<td class="liste_titre maxwidthonsmartphone center">';
|
||||||
print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')), $search_status, 1);
|
print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')), $search_status, 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
if (! empty($arrayfields['s.import_key']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre center">';
|
||||||
|
print '<input class="flat searchstring" type="text" name="search_import_key" size="3" value="'.dol_escape_htmltag($search_import_key).'">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
// Action column
|
// Action column
|
||||||
print '<td class="liste_titre" align="right">';
|
print '<td class="liste_titre" align="right">';
|
||||||
$searchpicto=$form->showFilterButtons();
|
$searchpicto=$form->showFilterButtons();
|
||||||
@@ -892,6 +919,7 @@ print '</td>';
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
|
if (! empty($arrayfields['s.rowid']['checked'])) print_liste_field_titre($arrayfields['s.rowid']['label'], $_SERVER["PHP_SELF"],"s.rowid","",$param,"",$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder);
|
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['s.name_alias']['checked'])) print_liste_field_titre($arrayfields['s.name_alias']['label'], $_SERVER["PHP_SELF"],"s.name_alias","",$param,"",$sortfield,$sortorder);
|
if (! empty($arrayfields['s.name_alias']['checked'])) print_liste_field_titre($arrayfields['s.name_alias']['label'], $_SERVER["PHP_SELF"],"s.name_alias","",$param,"",$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['s.barcode']['checked'])) print_liste_field_titre($arrayfields['s.barcode']['label'], $_SERVER["PHP_SELF"], "s.barcode",$param,'','',$sortfield,$sortorder);
|
if (! empty($arrayfields['s.barcode']['checked'])) print_liste_field_titre($arrayfields['s.barcode']['label'], $_SERVER["PHP_SELF"], "s.barcode",$param,'','',$sortfield,$sortorder);
|
||||||
@@ -937,6 +965,7 @@ print $hookmanager->resPrint;
|
|||||||
if (! empty($arrayfields['s.datec']['checked'])) print_liste_field_titre($arrayfields['s.datec']['label'],$_SERVER["PHP_SELF"],"s.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
if (! empty($arrayfields['s.datec']['checked'])) print_liste_field_titre($arrayfields['s.datec']['label'],$_SERVER["PHP_SELF"],"s.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['s.tms']['checked'])) print_liste_field_titre($arrayfields['s.tms']['label'],$_SERVER["PHP_SELF"],"s.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
if (! empty($arrayfields['s.tms']['checked'])) print_liste_field_titre($arrayfields['s.tms']['label'],$_SERVER["PHP_SELF"],"s.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['s.status']['checked'])) print_liste_field_titre($arrayfields['s.status']['label'],$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder);
|
if (! empty($arrayfields['s.status']['checked'])) print_liste_field_titre($arrayfields['s.status']['label'],$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder);
|
||||||
|
if (! empty($arrayfields['s.import_key']['checked'])) print_liste_field_titre($arrayfields['s.import_key']['label'],$_SERVER["PHP_SELF"],"s.import_key","",$param,'align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
|
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
@@ -962,6 +991,13 @@ while ($i < min($num, $limit))
|
|||||||
$companystatic->fk_prospectlevel=$obj->fk_prospectlevel;
|
$companystatic->fk_prospectlevel=$obj->fk_prospectlevel;
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
|
if (! empty($arrayfields['s.rowid']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="tdoverflowmax50">';
|
||||||
|
print $obj->rowid;
|
||||||
|
print "</td>\n";
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
if (! empty($arrayfields['s.nom']['checked']))
|
if (! empty($arrayfields['s.nom']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="tdoverflowmax200">';
|
print '<td class="tdoverflowmax200">';
|
||||||
@@ -1186,6 +1222,13 @@ while ($i < min($num, $limit))
|
|||||||
print '<td align="center" class="nowrap">'.$companystatic->getLibStatut(3).'</td>';
|
print '<td align="center" class="nowrap">'.$companystatic->getLibStatut(3).'</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
|
if (! empty($arrayfields['s.import_key']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="tdoverflowmax100">';
|
||||||
|
print $obj->import_key;
|
||||||
|
print "</td>\n";
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
// Action column
|
// Action column
|
||||||
print '<td class="nowrap" align="center">';
|
print '<td class="nowrap" align="center">';
|
||||||
|
|||||||
BIN
htdocs/theme/eldy/img/object_website.png
Normal file
BIN
htdocs/theme/eldy/img/object_website.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 366 B |
@@ -2188,6 +2188,11 @@ span.butAction, span.butActionDelete {
|
|||||||
border: 1px solid #bbb;
|
border: 1px solid #bbb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.butActionTransparent {
|
||||||
|
color: #222 ! important;
|
||||||
|
background-color: transparent ! important;
|
||||||
|
}
|
||||||
|
|
||||||
<?php if (! empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED) && (! $user->admin)) { ?>
|
<?php if (! empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED) && (! $user->admin)) { ?>
|
||||||
.butActionRefused {
|
.butActionRefused {
|
||||||
display: none;
|
display: none;
|
||||||
@@ -2656,7 +2661,6 @@ div.liste_titre_bydiv, .liste_titre div.tagtr, tr.liste_titre, tr.liste_titre_se
|
|||||||
}
|
}
|
||||||
tr.liste_titre th, tr.liste_titre td, th.liste_titre
|
tr.liste_titre th, tr.liste_titre td, th.liste_titre
|
||||||
{
|
{
|
||||||
/* border-bottom: 1px solid #<?php echo ($colorbacktitle1 == '255,255,255'?'BBBBBB':'ddd'); ?>; */
|
|
||||||
border-bottom: 1px solid #888;
|
border-bottom: 1px solid #888;
|
||||||
}
|
}
|
||||||
tr.liste_titre:first-child th, tr:first-child th.liste_titre {
|
tr.liste_titre:first-child th, tr:first-child th.liste_titre {
|
||||||
@@ -2782,6 +2786,13 @@ div.tabBar .noborder {
|
|||||||
border-bottom: 1px solid #ddd;
|
border-bottom: 1px solid #ddd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ul.noborder li:nth-child(even):not(.liste_titre) {
|
||||||
|
background-color: rgb(<?php echo $colorbacklinepair2; ?>) !important;
|
||||||
|
background-color: rgb(<?php echo $colorbacklinepair2; ?>) !important;
|
||||||
|
background-color: rgb(<?php echo $colorbacklinepair2; ?>) !important;
|
||||||
|
background-color: rgb(<?php echo $colorbacklinepair2; ?>) !important;
|
||||||
|
background-color: rgb(<?php echo $colorbacklinepair2; ?>) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2808,7 +2819,7 @@ div.tabBar .noborder {
|
|||||||
}
|
}
|
||||||
.boxstats {
|
.boxstats {
|
||||||
padding: 3px;
|
padding: 3px;
|
||||||
width: 105px;
|
width: 103px;
|
||||||
}
|
}
|
||||||
.boxstats130 {
|
.boxstats130 {
|
||||||
width: 160px;
|
width: 160px;
|
||||||
@@ -3431,6 +3442,15 @@ table.cal_event td.cal_event_right { padding: 4px 4px !important; }
|
|||||||
cursor:pointer;
|
cursor:pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ============================================================================== */
|
||||||
|
/* Gantt
|
||||||
|
/* ============================================================================== */
|
||||||
|
|
||||||
|
td.gtaskname {
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ============================================================================== */
|
/* ============================================================================== */
|
||||||
/* jQuery - jeditable */
|
/* jQuery - jeditable */
|
||||||
|
|||||||
BIN
htdocs/theme/md/img/object_website.png
Normal file
BIN
htdocs/theme/md/img/object_website.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 305 B |
@@ -2161,7 +2161,6 @@ span.butAction, span.butActionDelete {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Prepare for bootstrap look */
|
|
||||||
.button, .butAction, .butActionDelete, .butActionRefused {
|
.button, .butAction, .butActionDelete, .butActionRefused {
|
||||||
border-color: #c5c5c5;
|
border-color: #c5c5c5;
|
||||||
border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25);
|
border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25);
|
||||||
@@ -2257,7 +2256,10 @@ a.butAction:hover, a.butActionDelete:hover {
|
|||||||
opacity: 0.9;
|
opacity: 0.9;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* End bootstrap */
|
.butActionTransparent {
|
||||||
|
color: #222 ! important;
|
||||||
|
background-color: transparent ! important;
|
||||||
|
}
|
||||||
|
|
||||||
<?php if (! empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)) { ?>
|
<?php if (! empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)) { ?>
|
||||||
.butActionRefused {
|
.butActionRefused {
|
||||||
@@ -2626,6 +2628,15 @@ div.pagination li.paginationafterarrows {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
ul.noborder li:nth-child(odd):not(.liste_titre) {
|
||||||
|
background-color: rgb(<?php echo $colorbacklinepair2; ?>) !important;
|
||||||
|
background-color: rgb(<?php echo $colorbacklinepair2; ?>) !important;
|
||||||
|
background-color: rgb(<?php echo $colorbacklinepair2; ?>) !important;
|
||||||
|
background-color: rgb(<?php echo $colorbacklinepair2; ?>) !important;
|
||||||
|
background-color: rgb(<?php echo $colorbacklinepair2; ?>) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Set the color for hover lines */
|
/* Set the color for hover lines */
|
||||||
.oddeven:hover, .evenodd:hover, .impair:hover, .pair:hover
|
.oddeven:hover, .evenodd:hover, .impair:hover, .pair:hover
|
||||||
{
|
{
|
||||||
@@ -2726,19 +2737,19 @@ tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, tabl
|
|||||||
{
|
{
|
||||||
height: 26px !important;
|
height: 26px !important;
|
||||||
}
|
}
|
||||||
div.liste_titre, tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, table.dataTable thead tr
|
div.liste_titre_bydiv, .liste_titre div.tagtr, tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, table.dataTable thead tr
|
||||||
{
|
{
|
||||||
background: rgb(<?php echo $colorbacktitle1; ?>);
|
background: rgb(<?php echo $colorbacktitle1; ?>);
|
||||||
font-weight: <?php echo $useboldtitle?'bold':'normal'; ?>;
|
font-weight: <?php echo $useboldtitle?'bold':'normal'; ?>;
|
||||||
|
border-bottom: 1px solid #FDFFFF;
|
||||||
|
|
||||||
color: rgb(<?php echo $colortexttitle; ?>);
|
color: rgb(<?php echo $colortexttitle; ?>);
|
||||||
font-family: <?php print $fontlist ?>;
|
font-family: <?php print $fontlist ?>;
|
||||||
border-bottom: 1px solid #FDFFFF;
|
|
||||||
text-align: <?php echo $left; ?>;
|
text-align: <?php echo $left; ?>;
|
||||||
}
|
}
|
||||||
tr.liste_titre th, tr.liste_titre td, th.liste_titre, form.liste_titre div, div.liste_titre
|
tr.liste_titre th, tr.liste_titre td, th.liste_titre
|
||||||
{
|
{
|
||||||
border-bottom: 1px solid #<?php echo ($colorbacktitle1 == '255,255,255'?'BBBBBB':'FDFFFF'); ?>;
|
border-bottom: 1px solid #aaa;
|
||||||
}
|
}
|
||||||
/* TODO Once title line is moved under title search, make border bottom of all th black and force to whit when it's first tr */
|
/* TODO Once title line is moved under title search, make border bottom of all th black and force to whit when it's first tr */
|
||||||
tr:first-child th.liste_titre {
|
tr:first-child th.liste_titre {
|
||||||
@@ -2892,7 +2903,7 @@ div .tdtop {
|
|||||||
}
|
}
|
||||||
.boxstats {
|
.boxstats {
|
||||||
padding: 3px;
|
padding: 3px;
|
||||||
width: 105px;
|
width: 100px;
|
||||||
}
|
}
|
||||||
.boxstats130 {
|
.boxstats130 {
|
||||||
width: 135px;
|
width: 135px;
|
||||||
@@ -3514,6 +3525,17 @@ table.cal_event td.cal_event_right { padding: 4px 4px !important; }
|
|||||||
cursor:pointer;
|
cursor:pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================================== */
|
||||||
|
/* Gantt
|
||||||
|
/* ============================================================================== */
|
||||||
|
|
||||||
|
td.gtaskname {
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ============================================================================== */
|
/* ============================================================================== */
|
||||||
/* jQuery - jeditable */
|
/* jQuery - jeditable */
|
||||||
/* ============================================================================== */
|
/* ============================================================================== */
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ if (! empty($conf->ldap->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/l
|
|||||||
if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||||
if (! empty($conf->multicompany->enabled)) dol_include_once('/multicompany/class/actions_multicompany.class.php');
|
if (! empty($conf->multicompany->enabled)) dol_include_once('/multicompany/class/actions_multicompany.class.php');
|
||||||
if (! empty($conf->categorie->enabled)) require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
if (! empty($conf->categorie->enabled)) require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||||
|
if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport_ik.class.php';
|
||||||
|
|
||||||
$id = GETPOST('id','int');
|
$id = GETPOST('id','int');
|
||||||
$action = GETPOST('action','alpha');
|
$action = GETPOST('action','alpha');
|
||||||
@@ -367,6 +367,9 @@ if (empty($reshook)) {
|
|||||||
$dateemployment = dol_mktime(0, 0, 0, GETPOST('dateemploymentmonth'), GETPOST('dateemploymentday'), GETPOST('dateemploymentyear'));
|
$dateemployment = dol_mktime(0, 0, 0, GETPOST('dateemploymentmonth'), GETPOST('dateemploymentday'), GETPOST('dateemploymentyear'));
|
||||||
$object->dateemployment = $dateemployment;
|
$object->dateemployment = $dateemployment;
|
||||||
|
|
||||||
|
$object->default_range = GETPOST('default_range');
|
||||||
|
$object->default_c_exp_tax_cat = GETPOST('default_c_exp_tax_cat');
|
||||||
|
|
||||||
if (! empty($conf->multicompany->enabled))
|
if (! empty($conf->multicompany->enabled))
|
||||||
{
|
{
|
||||||
if (! empty($_POST["superadmin"]))
|
if (! empty($_POST["superadmin"]))
|
||||||
@@ -1108,7 +1111,21 @@ if ($action == 'create' || $action == 'adduserldap')
|
|||||||
null, '90%' );
|
null, '90%' );
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($conf->global->MAIN_USE_EXPENSE_IK))
|
||||||
|
{
|
||||||
|
print '<tr><td>'.$langs->trans("DefaultCategoryCar").'</td>';
|
||||||
|
print '<td>';
|
||||||
|
print $form->selectExpenseCategories($object->default_c_exp_tax_cat, 'default_c_exp_tax_cat', 1);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '<tr><td>'.$langs->trans("DefaultRangeNumber").'</td>';
|
||||||
|
print '<td>';
|
||||||
|
$maxRangeNum = ExpenseReportIk::getMaxRangeNumber($object->default_c_exp_tax_cat);
|
||||||
|
print $form->selectarray('default_range', range(0, $maxRangeNum), $object->default_range);
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
$parameters=array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"');
|
$parameters=array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"');
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$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
|
||||||
@@ -1126,7 +1143,7 @@ if ($action == 'create' || $action == 'adduserldap')
|
|||||||
$doleditor=new DolEditor('note','','',120,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_3,'90%');
|
$doleditor=new DolEditor('note','','',120,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_3,'90%');
|
||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
|
|
||||||
// Signature
|
// Signature
|
||||||
print '<tr><td class="tdtop">'.$langs->trans("Signature").'</td>';
|
print '<tr><td class="tdtop">'.$langs->trans("Signature").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
@@ -1498,6 +1515,19 @@ else
|
|||||||
print '<td>'.dol_print_date($object->datepreviouslogin,"dayhour").'</td>';
|
print '<td>'.dol_print_date($object->datepreviouslogin,"dayhour").'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
if (!empty($conf->global->MAIN_USE_EXPENSE_IK))
|
||||||
|
{
|
||||||
|
print '<tr><td>'.$langs->trans("DefaultCategoryCar").'</td>';
|
||||||
|
print '<td class="fk_c_exp_tax_cat">';
|
||||||
|
print dol_getIdFromCode($db, $object->default_c_exp_tax_cat, 'c_exp_tax_cat', 'rowid', 'label');
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '<tr><td>'.$langs->trans("DefaultRangeNumber").'</td>';
|
||||||
|
print '<td>';
|
||||||
|
print $object->default_range;
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||||
|
|
||||||
@@ -2392,6 +2422,20 @@ else
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($conf->global->MAIN_USE_EXPENSE_IK))
|
||||||
|
{
|
||||||
|
print '<tr><td>'.$langs->trans("DefaultCategoryCar").'</td>';
|
||||||
|
print '<td>';
|
||||||
|
print $form->selectExpenseCategories($object->default_c_exp_tax_cat, 'default_c_exp_tax_cat', 1);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '<tr><td>'.$langs->trans("DefaultRangeNumber").'</td>';
|
||||||
|
print '<td>';
|
||||||
|
$maxRangeNum = ExpenseReportIk::getMaxRangeNumber($object->default_c_exp_tax_cat);
|
||||||
|
print $form->selectarray('default_range', range(0, $maxRangeNum), $object->default_range);
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
$parameters=array('colspan' => ' colspan="2"');
|
$parameters=array('colspan' => ' colspan="2"');
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$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
|
||||||
|
|||||||
@@ -130,7 +130,8 @@ class User extends CommonObject
|
|||||||
|
|
||||||
public $dateemployment; // Define date of employment by company
|
public $dateemployment; // Define date of employment by company
|
||||||
|
|
||||||
|
public $default_c_exp_tax_cat;
|
||||||
|
public $default_range;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor de la classe
|
* Constructor de la classe
|
||||||
@@ -199,6 +200,7 @@ class User extends CommonObject
|
|||||||
$sql.= " u.color,";
|
$sql.= " u.color,";
|
||||||
$sql.= " u.dateemployment,";
|
$sql.= " u.dateemployment,";
|
||||||
$sql.= " u.ref_int, u.ref_ext,";
|
$sql.= " u.ref_int, u.ref_ext,";
|
||||||
|
$sql.= " u.default_range, u.default_c_exp_tax_cat,";
|
||||||
$sql.= " c.code as country_code, c.label as country,";
|
$sql.= " c.code as country_code, c.label as country,";
|
||||||
$sql.= " d.code_departement as state_code, d.nom as state";
|
$sql.= " d.code_departement as state_code, d.nom as state";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||||
@@ -310,6 +312,9 @@ class User extends CommonObject
|
|||||||
$this->contactid = $obj->fk_socpeople;
|
$this->contactid = $obj->fk_socpeople;
|
||||||
$this->fk_member = $obj->fk_member;
|
$this->fk_member = $obj->fk_member;
|
||||||
$this->fk_user = $obj->fk_user;
|
$this->fk_user = $obj->fk_user;
|
||||||
|
|
||||||
|
$this->default_range = $obj->default_range;
|
||||||
|
$this->default_c_exp_tax_cat = $obj->default_c_exp_tax_cat;
|
||||||
|
|
||||||
// Protection when module multicompany was set, admin was set to first entity and then, the module was disabled,
|
// Protection when module multicompany was set, admin was set to first entity and then, the module was disabled,
|
||||||
// in such case, this admin user must be admin for ALL entities.
|
// in such case, this admin user must be admin for ALL entities.
|
||||||
@@ -1320,7 +1325,7 @@ class User extends CommonObject
|
|||||||
$this->accountancy_code = trim($this->accountancy_code);
|
$this->accountancy_code = trim($this->accountancy_code);
|
||||||
$this->color = empty($this->color)?'':$this->color;
|
$this->color = empty($this->color)?'':$this->color;
|
||||||
$this->dateemployment = empty($this->dateemployment)?'':$this->dateemployment;
|
$this->dateemployment = empty($this->dateemployment)?'':$this->dateemployment;
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (! empty($conf->global->USER_MAIL_REQUIRED) && ! isValidEMail($this->email))
|
if (! empty($conf->global->USER_MAIL_REQUIRED) && ! isValidEMail($this->email))
|
||||||
{
|
{
|
||||||
@@ -1371,6 +1376,9 @@ class User extends CommonObject
|
|||||||
if (isset($this->salaryextra) || $this->salaryextra != '') $sql.= ", salaryextra= ".($this->salaryextra != ''?"'".$this->db->escape($this->salaryextra)."'":"null");
|
if (isset($this->salaryextra) || $this->salaryextra != '') $sql.= ", salaryextra= ".($this->salaryextra != ''?"'".$this->db->escape($this->salaryextra)."'":"null");
|
||||||
$sql.= ", weeklyhours= ".($this->weeklyhours != ''?"'".$this->db->escape($this->weeklyhours)."'":"null");
|
$sql.= ", weeklyhours= ".($this->weeklyhours != ''?"'".$this->db->escape($this->weeklyhours)."'":"null");
|
||||||
$sql.= ", entity = '".$this->db->escape($this->entity)."'";
|
$sql.= ", entity = '".$this->db->escape($this->entity)."'";
|
||||||
|
$sql.= ", default_range = ".($this->default_range > 0 ? $this->default_range : 'null');
|
||||||
|
$sql.= ", default_c_exp_tax_cat = ".($this->default_c_exp_tax_cat > 0 ? $this->default_c_exp_tax_cat : 'null');
|
||||||
|
|
||||||
$sql.= " WHERE rowid = ".$this->id;
|
$sql.= " WHERE rowid = ".$this->id;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||||
|
|||||||
@@ -58,8 +58,30 @@ class WebsitePage extends CommonObject
|
|||||||
public $date_creation;
|
public $date_creation;
|
||||||
public $date_modification;
|
public $date_modification;
|
||||||
|
|
||||||
|
// BEGIN MODULEBUILDER PROPERTIES
|
||||||
/**
|
/**
|
||||||
*/
|
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
|
||||||
|
*/
|
||||||
|
public $fields=array(
|
||||||
|
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>true, 'index'=>true, 'position'=>1, 'comment'=>'Id'),
|
||||||
|
'pageurl' =>array('type'=>'varchar(16)', 'label'=>'WEBSITE_PAGENAME', 'enabled'=>1, 'visible'=>1, 'notnull'=>true, 'index'=>true, 'position'=>10, 'searchall'=>1, 'comment'=>'Alias of page'),
|
||||||
|
'title' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1),
|
||||||
|
'description' =>array('type'=>'varchar(255)', 'label'=>'Description', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1),
|
||||||
|
'keywords' =>array('type'=>'varchar(255)', 'label'=>'Keywords', 'enabled'=>1, 'visible'=>1, 'position'=>45, 'searchall'=>0),
|
||||||
|
'content' =>array('type'=>'mediumtext', 'label'=>'Content', 'enabled'=>1, 'visible'=>1, 'position'=>45, 'searchall'=>0),
|
||||||
|
'lang' =>array('type'=>'varchar(6)', 'label'=>'Lang', 'enabled'=>1, 'visible'=>1, 'position'=>45, 'searchall'=>0),
|
||||||
|
//'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'index'=>true, 'position'=>1000),
|
||||||
|
'fk_website' =>array('type'=>'integer', 'label'=>'WebsiteId', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'searchall'=>0),
|
||||||
|
'fk_page' =>array('type'=>'integer', 'label'=>'ParentPageId', 'enabled'=>1, 'visible'=>1, 'position'=>45, 'searchall'=>0),
|
||||||
|
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>true, 'position'=>500),
|
||||||
|
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>true, 'position'=>500),
|
||||||
|
//'date_valid' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
|
||||||
|
//'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>true, 'position'=>500),
|
||||||
|
//'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
|
||||||
|
//'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValid', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
|
||||||
|
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'index'=>true, 'position'=>1000, 'nullifempty'=>1),
|
||||||
|
);
|
||||||
|
// END MODULEBUILDER PROPERTIES
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -142,7 +164,7 @@ class WebsitePage extends CommonObject
|
|||||||
$sql .= ' '.(! isset($this->lang)?'NULL':"'".$this->db->escape($this->lang)."'").',';
|
$sql .= ' '.(! isset($this->lang)?'NULL':"'".$this->db->escape($this->lang)."'").',';
|
||||||
$sql .= ' '.(empty($this->fk_page)?'NULL':$this->db->escape($this->fk_page)).',';
|
$sql .= ' '.(empty($this->fk_page)?'NULL':$this->db->escape($this->fk_page)).',';
|
||||||
$sql .= ' '.(! isset($this->status)?'NULL':$this->status).',';
|
$sql .= ' '.(! isset($this->status)?'NULL':$this->status).',';
|
||||||
$sql .= ' '.(! isset($this->date_creation) || dol_strlen($this->date_creation)==0?'NULL':"'".$this->db->idate($this->date_creation)."'").',';
|
$sql .= ' '.(! isset($this->date_creation) || dol_strlen($this->date_creation)==0?"'".$this->db->idate($now)."'":"'".$this->db->idate($this->date_creation)."'").',';
|
||||||
$sql .= ' '.(! isset($this->date_modification) || dol_strlen($this->date_modification)==0?'NULL':"'".$this->db->idate($this->date_modification)."'");
|
$sql .= ' '.(! isset($this->date_modification) || dol_strlen($this->date_modification)==0?'NULL':"'".$this->db->idate($this->date_modification)."'");
|
||||||
$sql .= ')';
|
$sql .= ')';
|
||||||
|
|
||||||
|
|||||||
@@ -300,7 +300,7 @@ if ($action == 'updatecss')
|
|||||||
|
|
||||||
$csscontent.= "<?php // BEGIN PHP\n";
|
$csscontent.= "<?php // BEGIN PHP\n";
|
||||||
$csscontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
|
$csscontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
|
||||||
$csscontent.= "if (! defined('USEDOLIBARRSERVER')) { require_once './master.inc.php'; } // Not already loaded"."\n";
|
$csscontent.= "if (! defined('USEDOLIBARRSERVER')) { require_once dirname(__FILE__).'/master.inc.php'; } // Not already loaded"."\n"; // For the css, we need to set path of master using the dirname of css file.
|
||||||
$csscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
|
$csscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
|
||||||
$csscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
|
$csscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
|
||||||
$csscontent.= "ob_start();\n";
|
$csscontent.= "ob_start();\n";
|
||||||
@@ -520,7 +520,7 @@ if ($action == 'updatemeta')
|
|||||||
$aliascontent = '<?php'."\n";
|
$aliascontent = '<?php'."\n";
|
||||||
$aliascontent.= "// File generated to wrap the alias page - DO NOT MODIFY - It is just a copy of database page content\n";
|
$aliascontent.= "// File generated to wrap the alias page - DO NOT MODIFY - It is just a copy of database page content\n";
|
||||||
$aliascontent.= 'global $dolibarr_main_data_root;'."\n";
|
$aliascontent.= 'global $dolibarr_main_data_root;'."\n";
|
||||||
$aliascontent.= 'if (empty($dolibarr_main_data_root)) require \'./page'.$objectpage->id.'.tpl.php\';';
|
$aliascontent.= 'if (empty($dolibarr_main_data_root)) require \'./page'.$objectpage->id.'.tpl.php\'; ';
|
||||||
$aliascontent.= 'else require $dolibarr_main_data_root.\'/websites/\'.$website->ref.\'/page'.$objectpage->id.'.tpl.php\';'."\n";
|
$aliascontent.= 'else require $dolibarr_main_data_root.\'/websites/\'.$website->ref.\'/page'.$objectpage->id.'.tpl.php\';'."\n";
|
||||||
$aliascontent.= '?>'."\n";
|
$aliascontent.= '?>'."\n";
|
||||||
$result = file_put_contents($filealias, $aliascontent);
|
$result = file_put_contents($filealias, $aliascontent);
|
||||||
@@ -529,52 +529,8 @@ if ($action == 'updatemeta')
|
|||||||
|
|
||||||
if (! $result) setEventMessages('Failed to write file '.$filealias, null, 'errors');
|
if (! $result) setEventMessages('Failed to write file '.$filealias, null, 'errors');
|
||||||
|
|
||||||
|
// Save page of content
|
||||||
// Now create the .tpl file (duplicate code with actions updatesource or updatecontent but we need this to save new header)
|
$result=dolSavePageContent($filetpl, $object, $objectpage);
|
||||||
dol_syslog("We regenerate the tpl page filetpl=".$filetpl);
|
|
||||||
|
|
||||||
dol_delete_file($filetpl);
|
|
||||||
|
|
||||||
// TODO Same code than into updatesource updatecontent
|
|
||||||
$tplcontent ='';
|
|
||||||
$tplcontent.= "<?php // BEGIN PHP\n";
|
|
||||||
$tplcontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
|
|
||||||
$tplcontent.= "if (! defined('USEDOLIBARRSERVER')) { require_once './master.inc.php'; } // Not already loaded"."\n";
|
|
||||||
$tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
|
|
||||||
$tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
|
|
||||||
$tplcontent.= "ob_start();\n";
|
|
||||||
$tplcontent.= "// END PHP ?>\n";
|
|
||||||
$tplcontent.= '<html>'."\n";
|
|
||||||
$tplcontent.= '<header>'."\n";
|
|
||||||
$tplcontent.= '<title>'.dol_string_nohtmltag($objectpage->title, 0, 'UTF-8').'</title>'."\n";
|
|
||||||
$tplcontent.= '<meta charset="UTF-8">'."\n";
|
|
||||||
$tplcontent.= '<meta http-equiv="content-type" content="text/html; charset=utf-8" />'."\n";
|
|
||||||
$tplcontent.= '<meta name="robots" content="index, follow" />'."\n";
|
|
||||||
$tplcontent.= '<meta name="viewport" content="width=device-width, initial-scale=0.8">'."\n";
|
|
||||||
$tplcontent.= '<link rel="canonical" href="'.$objectpage->pageurl.'">'."\n";
|
|
||||||
$tplcontent.= '<meta name="keywords" content="'.join(', ', explode(',',$objectpage->keywords)).'" />'."\n";
|
|
||||||
$tplcontent.= '<meta name="title" content="'.dol_string_nohtmltag($objectpage->title, 0, 'UTF-8').'" />'."\n";
|
|
||||||
$tplcontent.= '<meta name="description" content="'.dol_string_nohtmltag($objectpage->description, 0, 'UTF-8').'" />'."\n";
|
|
||||||
$tplcontent.= '<meta name="generator" content="'.DOL_APPLICATION_TITLE.' '.DOL_VERSION.'" />'."\n";
|
|
||||||
$tplcontent.= '<!-- Include link to CSS file -->'."\n";
|
|
||||||
$tplcontent.= '<link rel="stylesheet" href="styles.css.php?websiteid='.$object->id.'" type="text/css" />'."\n";
|
|
||||||
$tplcontent.= '<!-- Include common HTML header file -->'."\n";
|
|
||||||
$tplcontent.= '<?php print file_get_contents(DOL_DATA_ROOT."/websites/'.$object->ref.'/htmlheader.html"); ?>'."\n";
|
|
||||||
$tplcontent.= '</header>'."\n";
|
|
||||||
|
|
||||||
$tplcontent.= '<!-- File generated by Dolibarr website module editor -->'."\n";
|
|
||||||
$tplcontent.= '<body id="bodywebsite" class="bodywebsite">'."\n";
|
|
||||||
$tplcontent.= $objectpage->content."\n";
|
|
||||||
$tplcontent.= '</body>'."\n";
|
|
||||||
|
|
||||||
$tplcontent.= '<?php // BEGIN PHP'."\n";
|
|
||||||
$tplcontent.= '$tmp = ob_get_contents(); ob_end_clean(); dolWebsiteOutput($tmp);'."\n";
|
|
||||||
$tplcontent.= "// END PHP ?>"."\n";
|
|
||||||
|
|
||||||
//var_dump($filetpl);exit;
|
|
||||||
$result = file_put_contents($filetpl, $tplcontent);
|
|
||||||
if (! empty($conf->global->MAIN_UMASK))
|
|
||||||
@chmod($filetpl, octdec($conf->global->MAIN_UMASK));
|
|
||||||
|
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
@@ -582,7 +538,12 @@ if ($action == 'updatemeta')
|
|||||||
//header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website.'&pageid='.$pageid);
|
//header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website.'&pageid='.$pageid);
|
||||||
//exit;
|
//exit;
|
||||||
}
|
}
|
||||||
else setEventMessages('Failed to write file '.$filetpl, null, 'errors');
|
else
|
||||||
|
{
|
||||||
|
setEventMessages('Failed to write file '.$filetpl, null, 'errors');
|
||||||
|
//header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website.'&pageid='.$pageid);
|
||||||
|
//exit;
|
||||||
|
}
|
||||||
|
|
||||||
$action='preview';
|
$action='preview';
|
||||||
}
|
}
|
||||||
@@ -674,7 +635,7 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf
|
|||||||
$objectpage->content = GETPOST('PAGE_CONTENT');
|
$objectpage->content = GETPOST('PAGE_CONTENT');
|
||||||
|
|
||||||
// Clean data. We remove all the head section.
|
// Clean data. We remove all the head section.
|
||||||
$objectpage->content = preg_replace('/<head.*<\/head>/s', '', $objectpage->content);
|
$objectpage->content = preg_replace('/<head>.*<\/head>/s', '', $objectpage->content);
|
||||||
/* $objectpage->content = preg_replace('/<base\s+href=[\'"][^\'"]+[\'"]\s/?>/s', '', $objectpage->content); */
|
/* $objectpage->content = preg_replace('/<base\s+href=[\'"][^\'"]+[\'"]\s/?>/s', '', $objectpage->content); */
|
||||||
|
|
||||||
$res = $objectpage->update($user);
|
$res = $objectpage->update($user);
|
||||||
@@ -730,48 +691,8 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf
|
|||||||
if (! $result) setEventMessages('Failed to write file '.$filealias, null, 'errors');
|
if (! $result) setEventMessages('Failed to write file '.$filealias, null, 'errors');
|
||||||
|
|
||||||
|
|
||||||
// Now create the .tpl file with code to be able to make dynamic changes
|
// Save page content
|
||||||
dol_delete_file($filetpl);
|
$result=dolSavePageContent($filetpl, $object, $objectpage);
|
||||||
|
|
||||||
// TODO Same code than into updatemeta
|
|
||||||
$tplcontent ='';
|
|
||||||
$tplcontent.= "<?php // BEGIN PHP\n";
|
|
||||||
$tplcontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
|
|
||||||
$tplcontent.= "if (! defined('USEDOLIBARRSERVER')) { require_once './master.inc.php'; } // Not already loaded"."\n";
|
|
||||||
$tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
|
|
||||||
$tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
|
|
||||||
$tplcontent.= "ob_start();\n";
|
|
||||||
$tplcontent.= "// END PHP ?>\n";
|
|
||||||
$tplcontent.= '<html>'."\n";
|
|
||||||
$tplcontent.= '<header>'."\n";
|
|
||||||
$tplcontent.= '<title>'.dol_string_nohtmltag($objectpage->title, 0, 'UTF-8').'</title>'."\n";
|
|
||||||
$tplcontent.= '<meta charset="UTF-8">'."\n";
|
|
||||||
$tplcontent.= '<meta http-equiv="content-type" content="text/html; charset=utf-8" />'."\n";
|
|
||||||
$tplcontent.= '<meta name="robots" content="index, follow" />'."\n";
|
|
||||||
$tplcontent.= '<meta name="viewport" content="width=device-width, initial-scale=0.8">'."\n";
|
|
||||||
$tplcontent.= '<meta name="keywords" content="'.join(', ', explode(',',$objectpage->keywords)).'" />'."\n";
|
|
||||||
$tplcontent.= '<meta name="title" content="'.dol_string_nohtmltag($objectpage->title, 0, 'UTF-8').'" />'."\n";
|
|
||||||
$tplcontent.= '<meta name="description" content="'.dol_string_nohtmltag($objectpage->description, 0, 'UTF-8').'" />'."\n";
|
|
||||||
$tplcontent.= '<meta name="generator" content="'.DOL_APPLICATION_TITLE.' '.DOL_VERSION.'" />'."\n";
|
|
||||||
$tplcontent.= '<!-- Include link to CSS file -->'."\n";
|
|
||||||
$tplcontent.= '<link rel="stylesheet" href="styles.css.php?websiteid='.$object->id.'" type="text/css" />'."\n";
|
|
||||||
$tplcontent.= '<!-- Include common HTML header file -->'."\n";
|
|
||||||
$tplcontent.= '<?php print file_get_contents(DOL_DATA_ROOT."/websites/'.$object->ref.'/htmlheader.html"); ?>'."\n";
|
|
||||||
$tplcontent.= '</header>'."\n";
|
|
||||||
|
|
||||||
$tplcontent.= '<!-- File generated by Dolibarr website module editor -->'."\n";
|
|
||||||
$tplcontent.= '<body id="bodywebsite" class="bodywebsite">'."\n";
|
|
||||||
$tplcontent.= $objectpage->content."\n";
|
|
||||||
$tplcontent.= '</body>'."\n";
|
|
||||||
|
|
||||||
$tplcontent.= '<?php // BEGIN PHP'."\n";
|
|
||||||
$tplcontent.= '$tmp = ob_get_contents(); ob_end_clean(); dolWebsiteOutput($tmp);'."\n";
|
|
||||||
$tplcontent.= "// END PHP ?>"."\n";
|
|
||||||
|
|
||||||
//var_dump($filetpl);exit;
|
|
||||||
$result = file_put_contents($filetpl, $tplcontent);
|
|
||||||
if (! empty($conf->global->MAIN_UMASK))
|
|
||||||
@chmod($filetpl, octdec($conf->global->MAIN_UMASK));
|
|
||||||
|
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
@@ -1162,19 +1083,19 @@ if ($action == 'editcss')
|
|||||||
|
|
||||||
$csscontent = @file_get_contents($filecss);
|
$csscontent = @file_get_contents($filecss);
|
||||||
// Clean the php css file to remove php code and get only css part
|
// Clean the php css file to remove php code and get only css part
|
||||||
$csscontent = preg_replace('/<\?php \/\/ BEGIN PHP.*END PHP \?>\n*/ims', '', $csscontent);
|
$csscontent = preg_replace('/<\?php \/\/ BEGIN PHP[^\?]*END PHP \?>\n*/ims', '', $csscontent);
|
||||||
$csscontent.= GETPOST('WEBSITE_CSS_INLINE');
|
$csscontent.= GETPOST('WEBSITE_CSS_INLINE');
|
||||||
if (! trim($csscontent)) $csscontent='/* CSS content (all pages) */'."\n".'body.bodywebsite { margin: 0; }';
|
if (! trim($csscontent)) $csscontent='/* CSS content (all pages) */'."\n".'body.bodywebsite { margin: 0; }';
|
||||||
|
|
||||||
$htmlheader = @file_get_contents($filehtmlheader);
|
$htmlheader = @file_get_contents($filehtmlheader);
|
||||||
// Clean the php htmlheader file to remove php code and get only html part
|
// Clean the php htmlheader file to remove php code and get only html part
|
||||||
$htmlheader = preg_replace('/<\?php \/\/ BEGIN PHP.*END PHP \?>\n*/ims', '', $htmlheader);
|
$htmlheader = preg_replace('/<\?php \/\/ BEGIN PHP[^\?]*END PHP \?>\n*/ims', '', $htmlheader);
|
||||||
if (! trim($htmlheader)) $htmlheader='<html>'."\n".'<!-- HTML header content (all pages) -->'."\n".'</html>';
|
if (! trim($htmlheader)) $htmlheader='<html>'."\n".'<!-- HTML header content (all pages) -->'."\n".'</html>';
|
||||||
else $htmlheader='<html>'."\n".$htmlheader."\n".'</html>';
|
else $htmlheader='<html>'."\n".$htmlheader."\n".'</html>';
|
||||||
|
|
||||||
$robotcontent = @file_get_contents($filerobot);
|
$robotcontent = @file_get_contents($filerobot);
|
||||||
// Clean the php htmlheader file to remove php code and get only html part
|
// Clean the php htmlheader file to remove php code and get only html part
|
||||||
$robotcontent = preg_replace('/<\?php \/\/ BEGIN PHP.*END PHP \?>\n*/ims', '', $robotcontent);
|
$robotcontent = preg_replace('/<\?php \/\/ BEGIN PHP[^\?]*END PHP \?>\n*/ims', '', $robotcontent);
|
||||||
if (! trim($robotcontent))
|
if (! trim($robotcontent))
|
||||||
{
|
{
|
||||||
$robotcontent.="# Robot file. Generated with ".DOL_APPLICATION_TITLE."\n";
|
$robotcontent.="# Robot file. Generated with ".DOL_APPLICATION_TITLE."\n";
|
||||||
@@ -1185,7 +1106,7 @@ if ($action == 'editcss')
|
|||||||
|
|
||||||
$htaccesscontent = @file_get_contents($filehtaccess);
|
$htaccesscontent = @file_get_contents($filehtaccess);
|
||||||
// Clean the php htmlheader file to remove php code and get only html part
|
// Clean the php htmlheader file to remove php code and get only html part
|
||||||
$htaccesscontent = preg_replace('/<\?php \/\/ BEGIN PHP.*END PHP \?>\n*/ims', '', $htaccesscontent);
|
$htaccesscontent = preg_replace('/<\?php \/\/ BEGIN PHP[^\?]*END PHP \?>\n*/ims', '', $htaccesscontent);
|
||||||
if (! trim($htaccesscontent))
|
if (! trim($htaccesscontent))
|
||||||
{
|
{
|
||||||
$htaccesscontent.="# Order allow,deny\n";
|
$htaccesscontent.="# Order allow,deny\n";
|
||||||
@@ -1383,31 +1304,24 @@ if ($action == 'preview' || $action == 'createpagefromclone')
|
|||||||
{
|
{
|
||||||
// Ouput page under the Dolibarr top menu
|
// Ouput page under the Dolibarr top menu
|
||||||
$objectpage->fetch($pageid);
|
$objectpage->fetch($pageid);
|
||||||
|
$csscontent = @file_get_contents($filecss);
|
||||||
|
|
||||||
$out = '<!-- Page content '.$filetpl.' : Div with (CSS + Page content from database) -->'."\n";
|
$out = '<!-- Page content '.$filetpl.' : Div with (CSS + Page content from database) -->'."\n";
|
||||||
|
|
||||||
$out.='<div id="websitecontentundertopmenu" class="websitecontentundertopmenu">'."\n";
|
$out.='<div id="websitecontentundertopmenu" class="websitecontentundertopmenu">'."\n";
|
||||||
|
|
||||||
$csscontent = @file_get_contents($filecss);
|
// REPLACEMENT OF LINKS When page called by website editor
|
||||||
|
|
||||||
$out.='<style scoped>'."\n"; // "scoped" means "apply to parent element only". Not yet supported by browsers
|
$out.='<style scoped>'."\n"; // "scoped" means "apply to parent element only". Not yet supported by browsers
|
||||||
$out.=$csscontent;
|
$out.=dolWebsiteReplacementOfLinks($csscontent);
|
||||||
$out.='</style>'."\n";
|
$out.='</style>'."\n";
|
||||||
|
|
||||||
$out.='<div id="bodywebsite" class="bodywebsite">'."\n";
|
$out.='<div id="bodywebsite" class="bodywebsite">'."\n";
|
||||||
|
|
||||||
// Replace php code. Note $objectpage->content come from database and does not contains body tags.
|
$out.=dolWebsiteReplacementOfLinks($objectpage->content)."\n";
|
||||||
$content = preg_replace('/<\?php[^\?]+\?>\n*/ims', '<span style="background: #ddd; border: 1px solid #ccc; border-radius: 4px;">...php...</span>', $objectpage->content);
|
|
||||||
|
|
||||||
// Replace relative link / with dolibarr URL
|
|
||||||
$content = preg_replace('/(href=")\/\"/', '\1'.DOL_URL_ROOT.'/websites/index.php?website='.$object->ref.'&pageid='.$object->fk_default_home.'"', $content, -1, $nbrep);
|
|
||||||
// Replace relative link /xxx.php with dolibarr URL
|
|
||||||
$content = preg_replace('/(href=")\/?([^\"]*)(\.php\")/', '\1'.DOL_URL_ROOT.'/websites/index.php?website='.$object->ref.'&pageref=\2"', $content, -1, $nbrep);
|
|
||||||
|
|
||||||
|
|
||||||
$out.=$content."\n";
|
|
||||||
|
|
||||||
$out.='</div>';
|
$out.='</div>';
|
||||||
|
|
||||||
$out.='</div>';
|
$out.='</div>';
|
||||||
|
|
||||||
$out.= "\n".'<!-- End page content '.$filetpl.' -->'."\n\n";
|
$out.= "\n".'<!-- End page content '.$filetpl.' -->'."\n\n";
|
||||||
@@ -1447,3 +1361,88 @@ if ($action == 'preview' || $action == 'createpagefromclone')
|
|||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save content of a page on disk
|
||||||
|
*
|
||||||
|
* @param string $content Content to replace
|
||||||
|
* @return boolean True if OK
|
||||||
|
*/
|
||||||
|
function dolWebsiteReplacementOfLinks($content)
|
||||||
|
{
|
||||||
|
// Replace php code. Note $objectpage->content come from database and does not contains body tags.
|
||||||
|
$content = preg_replace('/<\?php[^\?]+\?>\n*/ims', '<span style="background: #ddd; border: 1px solid #ccc; border-radius: 4px;">...php...</span>', $content);
|
||||||
|
|
||||||
|
// Replace relative link / with dolibarr URL
|
||||||
|
$content = preg_replace('/(href=")\/\"/', '\1'.DOL_URL_ROOT.'/websites/index.php?website='.$object->ref.'&pageid='.$object->fk_default_home.'"', $content, -1, $nbrep);
|
||||||
|
// Replace relative link /xxx.php with dolibarr URL
|
||||||
|
$content = preg_replace('/(href=")\/?([^\"]*)(\.php\")/', '\1'.DOL_URL_ROOT.'/websites/index.php?website='.$object->ref.'&pageref=\2"', $content, -1, $nbrep);
|
||||||
|
|
||||||
|
$content = preg_replace('/url\((["\']?)medias\//', 'url(\1'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
|
||||||
|
|
||||||
|
return $content;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save content of a page on disk
|
||||||
|
*
|
||||||
|
* @param string $filetpl Full path of filename to generate
|
||||||
|
* @param Website $object Object website
|
||||||
|
* @param WebsitePage $objectpage Object websitepage
|
||||||
|
* @return boolean True if OK
|
||||||
|
*/
|
||||||
|
function dolSavePageContent($filetpl, $object, $objectpage)
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
// Now create the .tpl file (duplicate code with actions updatesource or updatecontent but we need this to save new header)
|
||||||
|
dol_syslog("We regenerate the tpl page filetpl=".$filetpl);
|
||||||
|
|
||||||
|
dol_delete_file($filetpl);
|
||||||
|
|
||||||
|
$shortlangcode = '';
|
||||||
|
if ($objectpage->lang) $shortlangcode=preg_replace('/[_-].*$/', '', $objectpage->lang); // en_US or en-US -> en
|
||||||
|
|
||||||
|
$tplcontent ='';
|
||||||
|
$tplcontent.= "<?php // BEGIN PHP\n";
|
||||||
|
$tplcontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
|
||||||
|
$tplcontent.= "if (! defined('USEDOLIBARRSERVER')) { require_once './master.inc.php'; } // Not already loaded"."\n";
|
||||||
|
$tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
|
||||||
|
$tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
|
||||||
|
$tplcontent.= "ob_start();\n";
|
||||||
|
$tplcontent.= "// END PHP ?>\n";
|
||||||
|
$tplcontent.= '<html'.($shortlangcode ? ' lang="'.$shortlangcode.'"':'').'>'."\n";
|
||||||
|
$tplcontent.= '<head>'."\n";
|
||||||
|
$tplcontent.= '<title>'.dol_string_nohtmltag($objectpage->title, 0, 'UTF-8').'</title>'."\n";
|
||||||
|
$tplcontent.= '<meta charset="UTF-8">'."\n";
|
||||||
|
$tplcontent.= '<meta http-equiv="content-type" content="text/html; charset=utf-8" />'."\n";
|
||||||
|
$tplcontent.= '<meta name="robots" content="index, follow" />'."\n";
|
||||||
|
$tplcontent.= '<meta name="viewport" content="width=device-width, initial-scale=0.8">'."\n";
|
||||||
|
$tplcontent.= '<meta name="keywords" content="'.join(', ', explode(',',$objectpage->keywords)).'" />'."\n";
|
||||||
|
$tplcontent.= '<meta name="title" content="'.dol_string_nohtmltag($objectpage->title, 0, 'UTF-8').'" />'."\n";
|
||||||
|
$tplcontent.= '<meta name="description" content="'.dol_string_nohtmltag($objectpage->description, 0, 'UTF-8').'" />'."\n";
|
||||||
|
$tplcontent.= '<meta name="generator" content="'.DOL_APPLICATION_TITLE.' '.DOL_VERSION.'" />'."\n";
|
||||||
|
$tplcontent.= '<!-- Include link to CSS file -->'."\n";
|
||||||
|
$tplcontent.= '<link rel="stylesheet" href="styles.css.php?websiteid='.$object->id.'" type="text/css" />'."\n";
|
||||||
|
$tplcontent.= '<!-- Include common HTML header file -->'."\n";
|
||||||
|
$tplcontent.= '<?php print file_get_contents(DOL_DATA_ROOT."/websites/'.$object->ref.'/htmlheader.html"); ?>'."\n";
|
||||||
|
$tplcontent.= '</head>'."\n";
|
||||||
|
|
||||||
|
$tplcontent.= '<!-- File generated by Dolibarr website module editor -->'."\n";
|
||||||
|
$tplcontent.= '<body id="bodywebsite" class="bodywebsite">'."\n";
|
||||||
|
$tplcontent.= $objectpage->content."\n";
|
||||||
|
$tplcontent.= '</body>'."\n";
|
||||||
|
|
||||||
|
$tplcontent.= '<?php // BEGIN PHP'."\n";
|
||||||
|
$tplcontent.= '$tmp = ob_get_contents(); ob_end_clean(); dolWebsiteOutput($tmp);'."\n";
|
||||||
|
$tplcontent.= "// END PHP ?>"."\n";
|
||||||
|
|
||||||
|
//var_dump($filetpl);exit;
|
||||||
|
$result = file_put_contents($filetpl, $tplcontent);
|
||||||
|
if (! empty($conf->global->MAIN_UMASK))
|
||||||
|
@chmod($filetpl, octdec($conf->global->MAIN_UMASK));
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|||||||
@@ -155,6 +155,25 @@ class CodingPhpTest extends PHPUnit_Framework_TestCase
|
|||||||
print 'Check php file '.$file['fullname']."\n";
|
print 'Check php file '.$file['fullname']."\n";
|
||||||
$filecontent=file_get_contents($file['fullname']);
|
$filecontent=file_get_contents($file['fullname']);
|
||||||
|
|
||||||
|
|
||||||
|
$ok=true;
|
||||||
|
$matches=array();
|
||||||
|
// Check string ='".$this->xxx with xxx that is not 'escape'. It means we forget a db->escape when forging sql request.
|
||||||
|
preg_match_all('/(..)\s*\.\s*\$this->db->idate\(/', $filecontent, $matches, PREG_SET_ORDER);
|
||||||
|
foreach($matches as $key => $val)
|
||||||
|
{
|
||||||
|
if ($val[1] != '\'"' && $val[1] != '\'\'')
|
||||||
|
{
|
||||||
|
$ok=false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//if ($reg[0] != 'db') $ok=false;
|
||||||
|
}
|
||||||
|
//print __METHOD__." Result for checking we don't have non escaped string in sql requests for file ".$file."\n";
|
||||||
|
$this->assertTrue($ok, 'Found a $this->db->idate to forge a sql request without quotes around this date field '.$file['fullname'].' :: '.$val[0]);
|
||||||
|
//exit;
|
||||||
|
|
||||||
|
|
||||||
$ok=true;
|
$ok=true;
|
||||||
$matches=array();
|
$matches=array();
|
||||||
// Check string ='".$this->xxx with xxx that is not 'escape'. It means we forget a db->escape when forging sql request.
|
// Check string ='".$this->xxx with xxx that is not 'escape'. It means we forget a db->escape when forging sql request.
|
||||||
@@ -172,6 +191,7 @@ class CodingPhpTest extends PHPUnit_Framework_TestCase
|
|||||||
$this->assertTrue($ok, 'Found non escaped string in building of a sql request '.$file['fullname'].' ('.$val[0].'). Bad.');
|
$this->assertTrue($ok, 'Found non escaped string in building of a sql request '.$file['fullname'].' ('.$val[0].'). Bad.');
|
||||||
//exit;
|
//exit;
|
||||||
|
|
||||||
|
|
||||||
// Test that output of $_SERVER\[\'QUERY_STRING\'\] is escaped.
|
// Test that output of $_SERVER\[\'QUERY_STRING\'\] is escaped.
|
||||||
$ok=true;
|
$ok=true;
|
||||||
$matches=array();
|
$matches=array();
|
||||||
|
|||||||
Reference in New Issue
Block a user