Merge pull request #7586 from Dolibarr/scrutinizer-patch-1
Scrutinizer Auto-Fixes
This commit is contained in:
commit
762879b95b
File diff suppressed because it is too large
Load Diff
@ -128,8 +128,8 @@ complete_dictionary_with_modules($taborder,$tabname,$tablib,$tabsql,$tabsqlsort,
|
|||||||
|
|
||||||
// Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact")
|
// Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact")
|
||||||
$elementList = array();
|
$elementList = array();
|
||||||
// Must match ids defined into eldy.lib.php
|
// Must match ids defined into eldy.lib.php
|
||||||
$sourceList = array(
|
$sourceList = array(
|
||||||
'1' => $langs->trans('AccountingJournalType1'),
|
'1' => $langs->trans('AccountingJournalType1'),
|
||||||
'2' => $langs->trans('AccountingJournalType2'),
|
'2' => $langs->trans('AccountingJournalType2'),
|
||||||
'3' => $langs->trans('AccountingJournalType3'),
|
'3' => $langs->trans('AccountingJournalType3'),
|
||||||
@ -144,214 +144,214 @@ $elementList = array();
|
|||||||
|
|
||||||
if (GETPOST('button_removefilter') || GETPOST('button_removefilter.x') || GETPOST('button_removefilter_x'))
|
if (GETPOST('button_removefilter') || GETPOST('button_removefilter.x') || GETPOST('button_removefilter_x'))
|
||||||
{
|
{
|
||||||
$search_country_id = '';
|
$search_country_id = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions add or modify an entry into a dictionary
|
// Actions add or modify an entry into a dictionary
|
||||||
if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||||
{
|
{
|
||||||
$listfield=explode(',', str_replace(' ', '',$tabfield[$id]));
|
$listfield=explode(',', str_replace(' ', '',$tabfield[$id]));
|
||||||
$listfieldinsert=explode(',',$tabfieldinsert[$id]);
|
$listfieldinsert=explode(',',$tabfieldinsert[$id]);
|
||||||
$listfieldmodify=explode(',',$tabfieldinsert[$id]);
|
$listfieldmodify=explode(',',$tabfieldinsert[$id]);
|
||||||
$listfieldvalue=explode(',',$tabfieldvalue[$id]);
|
$listfieldvalue=explode(',',$tabfieldvalue[$id]);
|
||||||
|
|
||||||
// Check that all fields are filled
|
// Check that all fields are filled
|
||||||
$ok=1;
|
$ok=1;
|
||||||
foreach ($listfield as $f => $value)
|
foreach ($listfield as $f => $value)
|
||||||
{
|
{
|
||||||
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label';
|
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label';
|
||||||
if ($fieldnamekey == 'code') $fieldnamekey = 'Code';
|
if ($fieldnamekey == 'code') $fieldnamekey = 'Code';
|
||||||
if ($fieldnamekey == 'nature') $fieldnamekey = 'Nature';
|
if ($fieldnamekey == 'nature') $fieldnamekey = 'Nature';
|
||||||
}
|
}
|
||||||
// Other checks
|
// Other checks
|
||||||
if (isset($_POST["code"]))
|
if (isset($_POST["code"]))
|
||||||
{
|
{
|
||||||
if ($_POST["code"]=='0')
|
if ($_POST["code"]=='0')
|
||||||
{
|
{
|
||||||
$ok=0;
|
$ok=0;
|
||||||
setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors');
|
setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors');
|
||||||
}
|
}
|
||||||
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
|
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
|
||||||
{
|
{
|
||||||
$ok = 0;
|
$ok = 0;
|
||||||
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br>';
|
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br>';
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean some parameters
|
// Clean some parameters
|
||||||
if ($_POST["accountancy_code"] <= 0) $_POST["accountancy_code"]=''; // If empty, we force to null
|
if ($_POST["accountancy_code"] <= 0) $_POST["accountancy_code"]=''; // If empty, we force to null
|
||||||
if ($_POST["accountancy_code_sell"] <= 0) $_POST["accountancy_code_sell"]=''; // If empty, we force to null
|
if ($_POST["accountancy_code_sell"] <= 0) $_POST["accountancy_code_sell"]=''; // If empty, we force to null
|
||||||
if ($_POST["accountancy_code_buy"] <= 0) $_POST["accountancy_code_buy"]=''; // If empty, we force to null
|
if ($_POST["accountancy_code_buy"] <= 0) $_POST["accountancy_code_buy"]=''; // If empty, we force to null
|
||||||
|
|
||||||
// Si verif ok et action add, on ajoute la ligne
|
// Si verif ok et action add, on ajoute la ligne
|
||||||
if ($ok && GETPOST('actionadd'))
|
if ($ok && GETPOST('actionadd'))
|
||||||
{
|
{
|
||||||
if ($tabrowid[$id])
|
if ($tabrowid[$id])
|
||||||
{
|
{
|
||||||
// Recupere id libre pour insertion
|
// Recupere id libre pour insertion
|
||||||
$newid=0;
|
$newid=0;
|
||||||
$sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id];
|
$sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id];
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
$newid=($obj->newid + 1);
|
$newid=($obj->newid + 1);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add new entry
|
// Add new entry
|
||||||
$sql = "INSERT INTO ".$tabname[$id]." (";
|
$sql = "INSERT INTO ".$tabname[$id]." (";
|
||||||
// List of fields
|
// List of fields
|
||||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
|
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
|
||||||
$sql.= $tabrowid[$id].",";
|
$sql.= $tabrowid[$id].",";
|
||||||
$sql.= $tabfieldinsert[$id];
|
$sql.= $tabfieldinsert[$id];
|
||||||
$sql.=",active)";
|
$sql.=",active)";
|
||||||
$sql.= " VALUES(";
|
$sql.= " VALUES(";
|
||||||
|
|
||||||
// List of values
|
// List of values
|
||||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
|
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
|
||||||
$sql.= $newid.",";
|
$sql.= $newid.",";
|
||||||
$i=0;
|
$i=0;
|
||||||
foreach ($listfieldinsert as $f => $value)
|
foreach ($listfieldinsert as $f => $value)
|
||||||
{
|
{
|
||||||
if ($value == 'entity') {
|
if ($value == 'entity') {
|
||||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||||
}
|
}
|
||||||
if ($i) $sql.=",";
|
if ($i) $sql.=",";
|
||||||
if ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = ''
|
if ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = ''
|
||||||
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$sql.=",1)";
|
$sql.=",1)";
|
||||||
|
|
||||||
dol_syslog("actionadd", LOG_DEBUG);
|
dol_syslog("actionadd", LOG_DEBUG);
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result) // Add is ok
|
if ($result) // Add is ok
|
||||||
{
|
{
|
||||||
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
|
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
|
||||||
$_POST=array('id'=>$id); // Clean $_POST array, we keep only
|
$_POST=array('id'=>$id); // Clean $_POST array, we keep only
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||||
setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors');
|
setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si verif ok et action modify, on modifie la ligne
|
// Si verif ok et action modify, on modifie la ligne
|
||||||
if ($ok && GETPOST('actionmodify'))
|
if ($ok && GETPOST('actionmodify'))
|
||||||
{
|
{
|
||||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||||
else { $rowidcol="rowid"; }
|
else { $rowidcol="rowid"; }
|
||||||
|
|
||||||
// Modify entry
|
// Modify entry
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET ";
|
$sql = "UPDATE ".$tabname[$id]." SET ";
|
||||||
// Modifie valeur des champs
|
// Modifie valeur des champs
|
||||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldmodify))
|
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldmodify))
|
||||||
{
|
{
|
||||||
$sql.= $tabrowid[$id]."=";
|
$sql.= $tabrowid[$id]."=";
|
||||||
$sql.= "'".$db->escape($rowid)."', ";
|
$sql.= "'".$db->escape($rowid)."', ";
|
||||||
}
|
}
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($listfieldmodify as $field)
|
foreach ($listfieldmodify as $field)
|
||||||
{
|
{
|
||||||
if ($field == 'price' || preg_match('/^amount/i',$field) || $field == 'taux') {
|
if ($field == 'price' || preg_match('/^amount/i',$field) || $field == 'taux') {
|
||||||
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU');
|
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU');
|
||||||
}
|
}
|
||||||
else if ($field == 'entity') {
|
else if ($field == 'entity') {
|
||||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||||
}
|
}
|
||||||
if ($i) $sql.=",";
|
if ($i) $sql.=",";
|
||||||
$sql.= $field."=";
|
$sql.= $field."=";
|
||||||
if ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = ''
|
if ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = ''
|
||||||
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$sql.= " WHERE ".$rowidcol." = '".$rowid."'";
|
$sql.= " WHERE ".$rowidcol." = '".$rowid."'";
|
||||||
|
|
||||||
dol_syslog("actionmodify", LOG_DEBUG);
|
dol_syslog("actionmodify", LOG_DEBUG);
|
||||||
//print $sql;
|
//print $sql;
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if (! $resql)
|
if (! $resql)
|
||||||
{
|
{
|
||||||
setEventMessages($db->error(), null, 'errors');
|
setEventMessages($db->error(), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
|
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GETPOST('actioncancel'))
|
if (GETPOST('actioncancel'))
|
||||||
{
|
{
|
||||||
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
|
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
||||||
{
|
{
|
||||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||||
else { $rowidcol="rowid"; }
|
else { $rowidcol="rowid"; }
|
||||||
|
|
||||||
$sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'";
|
||||||
|
|
||||||
dol_syslog("delete", LOG_DEBUG);
|
dol_syslog("delete", LOG_DEBUG);
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if (! $result)
|
if (! $result)
|
||||||
{
|
{
|
||||||
if ($db->errno() == 'DB_ERROR_CHILD_EXISTS')
|
if ($db->errno() == 'DB_ERROR_CHILD_EXISTS')
|
||||||
{
|
{
|
||||||
setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors');
|
setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// activate
|
// activate
|
||||||
if ($action == $acts[0])
|
if ($action == $acts[0])
|
||||||
{
|
{
|
||||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||||
else { $rowidcol="rowid"; }
|
else { $rowidcol="rowid"; }
|
||||||
|
|
||||||
if ($rowid) {
|
if ($rowid) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'";
|
||||||
}
|
}
|
||||||
elseif ($code) {
|
elseif ($code) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".$code."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".$code."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if (!$result)
|
if (!$result)
|
||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// disable
|
// disable
|
||||||
if ($action == $acts[1])
|
if ($action == $acts[1])
|
||||||
{
|
{
|
||||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||||
else { $rowidcol="rowid"; }
|
else { $rowidcol="rowid"; }
|
||||||
|
|
||||||
if ($rowid) {
|
if ($rowid) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'";
|
||||||
}
|
}
|
||||||
elseif ($code) {
|
elseif ($code) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".$code."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".$code."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if (!$result)
|
if (!$result)
|
||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -368,8 +368,8 @@ $titre=$langs->trans("DictionarySetup");
|
|||||||
$linkback='';
|
$linkback='';
|
||||||
if ($id)
|
if ($id)
|
||||||
{
|
{
|
||||||
$titre.=' - '.$langs->trans($tablib[$id]);
|
$titre.=' - '.$langs->trans($tablib[$id]);
|
||||||
$titlepicto='title_accountancy';
|
$titlepicto='title_accountancy';
|
||||||
}
|
}
|
||||||
|
|
||||||
print load_fiche_titre($titre,$linkback,$titlepicto);
|
print load_fiche_titre($titre,$linkback,$titlepicto);
|
||||||
@ -378,7 +378,7 @@ print load_fiche_titre($titre,$linkback,$titlepicto);
|
|||||||
// Confirmation de la suppression de la ligne
|
// Confirmation de la suppression de la ligne
|
||||||
if ($action == 'delete')
|
if ($action == 'delete')
|
||||||
{
|
{
|
||||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1);
|
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1);
|
||||||
}
|
}
|
||||||
//var_dump($elementList);
|
//var_dump($elementList);
|
||||||
|
|
||||||
@ -387,315 +387,315 @@ if ($action == 'delete')
|
|||||||
*/
|
*/
|
||||||
if ($id)
|
if ($id)
|
||||||
{
|
{
|
||||||
// Complete requete recherche valeurs avec critere de tri
|
// Complete requete recherche valeurs avec critere de tri
|
||||||
$sql=$tabsql[$id];
|
$sql=$tabsql[$id];
|
||||||
|
|
||||||
if ($search_country_id > 0)
|
if ($search_country_id > 0)
|
||||||
{
|
{
|
||||||
if (preg_match('/ WHERE /',$sql)) $sql.= " AND ";
|
if (preg_match('/ WHERE /',$sql)) $sql.= " AND ";
|
||||||
else $sql.=" WHERE ";
|
else $sql.=" WHERE ";
|
||||||
$sql.= " c.rowid = ".$search_country_id;
|
$sql.= " c.rowid = ".$search_country_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sortfield)
|
if ($sortfield)
|
||||||
{
|
{
|
||||||
// If sort order is "country", we use country_code instead
|
// If sort order is "country", we use country_code instead
|
||||||
if ($sortfield == 'country') $sortfield='country_code';
|
if ($sortfield == 'country') $sortfield='country_code';
|
||||||
$sql.= " ORDER BY ".$sortfield;
|
$sql.= " ORDER BY ".$sortfield;
|
||||||
if ($sortorder)
|
if ($sortorder)
|
||||||
{
|
{
|
||||||
$sql.=" ".strtoupper($sortorder);
|
$sql.=" ".strtoupper($sortorder);
|
||||||
}
|
}
|
||||||
$sql.=", ";
|
$sql.=", ";
|
||||||
// Clear the required sort criteria for the tabsqlsort to be able to force it with selected value
|
// Clear the required sort criteria for the tabsqlsort to be able to force it with selected value
|
||||||
$tabsqlsort[$id]=preg_replace('/([a-z]+\.)?'.$sortfield.' '.$sortorder.',/i','',$tabsqlsort[$id]);
|
$tabsqlsort[$id]=preg_replace('/([a-z]+\.)?'.$sortfield.' '.$sortorder.',/i','',$tabsqlsort[$id]);
|
||||||
$tabsqlsort[$id]=preg_replace('/([a-z]+\.)?'.$sortfield.',/i','',$tabsqlsort[$id]);
|
$tabsqlsort[$id]=preg_replace('/([a-z]+\.)?'.$sortfield.',/i','',$tabsqlsort[$id]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$sql.=" ORDER BY ";
|
$sql.=" ORDER BY ";
|
||||||
}
|
}
|
||||||
$sql.=$tabsqlsort[$id];
|
$sql.=$tabsqlsort[$id];
|
||||||
$sql.=$db->plimit($listlimit+1,$offset);
|
$sql.=$db->plimit($listlimit+1,$offset);
|
||||||
//print $sql;
|
//print $sql;
|
||||||
|
|
||||||
$fieldlist=explode(',',$tabfield[$id]);
|
$fieldlist=explode(',',$tabfield[$id]);
|
||||||
|
|
||||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
|
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
|
||||||
|
|
||||||
print '<div class="div-table-responsive">';
|
print '<div class="div-table-responsive">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
// Form to add a new line
|
// Form to add a new line
|
||||||
if ($tabname[$id])
|
if ($tabname[$id])
|
||||||
{
|
{
|
||||||
$alabelisused=0;
|
$alabelisused=0;
|
||||||
$var=false;
|
$var=false;
|
||||||
|
|
||||||
$fieldlist=explode(',',$tabfield[$id]);
|
$fieldlist=explode(',',$tabfield[$id]);
|
||||||
|
|
||||||
// Line for title
|
// Line for title
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
foreach ($fieldlist as $field => $value)
|
foreach ($fieldlist as $field => $value)
|
||||||
{
|
{
|
||||||
// Determine le nom du champ par rapport aux noms possibles
|
// Determine le nom du champ par rapport aux noms possibles
|
||||||
// dans les dictionnaires de donnees
|
// dans les dictionnaires de donnees
|
||||||
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
|
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
|
||||||
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
||||||
$align="left";
|
$align="left";
|
||||||
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
|
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
|
||||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label')
|
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label')
|
||||||
{
|
{
|
||||||
$valuetoshow=$langs->trans("Label");
|
$valuetoshow=$langs->trans("Label");
|
||||||
}
|
}
|
||||||
if ($fieldlist[$field]=='nature') { $valuetoshow=$langs->trans("Nature"); }
|
if ($fieldlist[$field]=='nature') { $valuetoshow=$langs->trans("Nature"); }
|
||||||
|
|
||||||
if ($valuetoshow != '')
|
if ($valuetoshow != '')
|
||||||
{
|
{
|
||||||
print '<td align="'.$align.'">';
|
print '<td align="'.$align.'">';
|
||||||
if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i',$tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1,$valuetoshow).'</a>';
|
if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i',$tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1,$valuetoshow).'</a>';
|
||||||
else if (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow,$tabhelp[$id][$value]);
|
else if (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow,$tabhelp[$id][$value]);
|
||||||
else print $valuetoshow;
|
else print $valuetoshow;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
|
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td style="min-width: 26px;"></td>';
|
print '<td style="min-width: 26px;"></td>';
|
||||||
print '<td style="min-width: 26px;"></td>';
|
print '<td style="min-width: 26px;"></td>';
|
||||||
print '<td style="min-width: 26px;"></td>';
|
print '<td style="min-width: 26px;"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Line to enter new values
|
// Line to enter new values
|
||||||
print '<tr class="oddeven nodrag nodrap nohover">';
|
print '<tr class="oddeven nodrag nodrap nohover">';
|
||||||
|
|
||||||
$obj = new stdClass();
|
$obj = new stdClass();
|
||||||
// If data was already input, we define them in obj to populate input fields.
|
// If data was already input, we define them in obj to populate input fields.
|
||||||
if (GETPOST('actionadd'))
|
if (GETPOST('actionadd'))
|
||||||
{
|
{
|
||||||
foreach ($fieldlist as $key=>$val)
|
foreach ($fieldlist as $key=>$val)
|
||||||
{
|
{
|
||||||
if (GETPOST($val) != '')
|
if (GETPOST($val) != '')
|
||||||
$obj->$val=GETPOST($val);
|
$obj->$val=GETPOST($val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$tmpaction = 'create';
|
$tmpaction = 'create';
|
||||||
$parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
$parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||||
$reshook=$hookmanager->executeHooks('createDictionaryFieldlist',$parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('createDictionaryFieldlist',$parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||||
|
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
fieldListJournal($fieldlist,$obj,$tabname[$id],'add');
|
fieldListJournal($fieldlist,$obj,$tabname[$id],'add');
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<td colspan="4" align="right">';
|
print '<td colspan="4" align="right">';
|
||||||
print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';
|
print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
print '<tr><td colspan="7"> </td></tr>'; // Keep to have a line with enough height
|
print '<tr><td colspan="7"> </td></tr>'; // Keep to have a line with enough height
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// List of available record in database
|
// List of available record in database
|
||||||
dol_syslog("htdocs/admin/dict", LOG_DEBUG);
|
dol_syslog("htdocs/admin/dict", 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;
|
||||||
$var=true;
|
$var=true;
|
||||||
|
|
||||||
$param = '&id='.$id;
|
$param = '&id='.$id;
|
||||||
if ($search_country_id > 0) $param.= '&search_country_id='.$search_country_id;
|
if ($search_country_id > 0) $param.= '&search_country_id='.$search_country_id;
|
||||||
$paramwithsearch = $param;
|
$paramwithsearch = $param;
|
||||||
if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder;
|
if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder;
|
||||||
if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield;
|
if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield;
|
||||||
if (GETPOST('from')) $paramwithsearch.= '&from='.GETPOST('from','alpha');
|
if (GETPOST('from')) $paramwithsearch.= '&from='.GETPOST('from','alpha');
|
||||||
|
|
||||||
// There is several pages
|
// There is several pages
|
||||||
if ($num > $listlimit)
|
if ($num > $listlimit)
|
||||||
{
|
{
|
||||||
print '<tr class="none"><td align="right" colspan="'.(3+count($fieldlist)).'">';
|
print '<tr class="none"><td align="right" colspan="'.(3+count($fieldlist)).'">';
|
||||||
print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page+1).'</span></li>');
|
print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page+1).'</span></li>');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Title line with search boxes
|
// Title line with search boxes
|
||||||
print '<tr class="liste_titre_filter liste_titre_add">';
|
print '<tr class="liste_titre_filter liste_titre_add">';
|
||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre"></td>';
|
||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre"></td>';
|
||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre"></td>';
|
||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre"></td>';
|
||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre"></td>';
|
||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre"></td>';
|
||||||
print '<td class="liste_titre" align="center">';
|
print '<td class="liste_titre" align="center">';
|
||||||
if ($filterfound)
|
if ($filterfound)
|
||||||
{
|
{
|
||||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||||
print $searchpicto;
|
print $searchpicto;
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Title of lines
|
// Title of lines
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
foreach ($fieldlist as $field => $value)
|
foreach ($fieldlist as $field => $value)
|
||||||
{
|
{
|
||||||
// Determine le nom du champ par rapport aux noms possibles
|
// Determine le nom du champ par rapport aux noms possibles
|
||||||
// dans les dictionnaires de donnees
|
// dans les dictionnaires de donnees
|
||||||
$showfield=1; // By defaut
|
$showfield=1; // By defaut
|
||||||
$align="left";
|
$align="left";
|
||||||
$sortable=1;
|
$sortable=1;
|
||||||
$valuetoshow='';
|
$valuetoshow='';
|
||||||
/*
|
/*
|
||||||
$tmparray=getLabelOfField($fieldlist[$field]);
|
$tmparray=getLabelOfField($fieldlist[$field]);
|
||||||
$showfield=$tmp['showfield'];
|
$showfield=$tmp['showfield'];
|
||||||
$valuetoshow=$tmp['valuetoshow'];
|
$valuetoshow=$tmp['valuetoshow'];
|
||||||
$align=$tmp['align'];
|
$align=$tmp['align'];
|
||||||
$sortable=$tmp['sortable'];
|
$sortable=$tmp['sortable'];
|
||||||
*/
|
*/
|
||||||
$valuetoshow=ucfirst($fieldlist[$field]); // By defaut
|
$valuetoshow=ucfirst($fieldlist[$field]); // By defaut
|
||||||
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
||||||
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
|
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
|
||||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); }
|
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); }
|
||||||
if ($fieldlist[$field]=='nature') { $valuetoshow=$langs->trans("Nature"); }
|
if ($fieldlist[$field]=='nature') { $valuetoshow=$langs->trans("Nature"); }
|
||||||
|
|
||||||
// Affiche nom du champ
|
// Affiche nom du champ
|
||||||
if ($showfield)
|
if ($showfield)
|
||||||
{
|
{
|
||||||
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder);
|
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, 'align="center"', $sortfield, $sortorder);
|
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, 'align="center"', $sortfield, $sortorder);
|
||||||
print getTitleFieldOfList('');
|
print getTitleFieldOfList('');
|
||||||
print getTitleFieldOfList('');
|
print getTitleFieldOfList('');
|
||||||
print getTitleFieldOfList('');
|
print getTitleFieldOfList('');
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
if ($num)
|
if ($num)
|
||||||
{
|
{
|
||||||
// Lines with values
|
// Lines with values
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
//print_r($obj);
|
//print_r($obj);
|
||||||
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
|
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
|
||||||
if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code)))
|
if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code)))
|
||||||
{
|
{
|
||||||
$tmpaction='edit';
|
$tmpaction='edit';
|
||||||
$parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
$parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||||
$reshook=$hookmanager->executeHooks('editDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('editDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||||
|
|
||||||
// Show fields
|
// Show fields
|
||||||
if (empty($reshook)) fieldListJournal($fieldlist,$obj,$tabname[$id],'edit');
|
if (empty($reshook)) fieldListJournal($fieldlist,$obj,$tabname[$id],'edit');
|
||||||
|
|
||||||
print '<td align="center" colspan="4">';
|
print '<td align="center" colspan="4">';
|
||||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||||
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
||||||
print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
||||||
print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">';
|
print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">';
|
||||||
print '<div name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"></div>';
|
print '<div name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"></div>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$tmpaction = 'view';
|
$tmpaction = 'view';
|
||||||
$parameters=array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
$parameters=array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||||
$reshook=$hookmanager->executeHooks('viewDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('viewDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||||
|
|
||||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||||
|
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
foreach ($fieldlist as $field => $value)
|
foreach ($fieldlist as $field => $value)
|
||||||
{
|
{
|
||||||
|
|
||||||
$showfield=1;
|
$showfield=1;
|
||||||
$align="left";
|
$align="left";
|
||||||
$valuetoshow=$obj->{$fieldlist[$field]};
|
$valuetoshow=$obj->{$fieldlist[$field]};
|
||||||
if ($valuetoshow=='all') {
|
if ($valuetoshow=='all') {
|
||||||
$valuetoshow=$langs->trans('All');
|
$valuetoshow=$langs->trans('All');
|
||||||
}
|
}
|
||||||
else if ($fieldlist[$field]=='nature' && $tabname[$id]==MAIN_DB_PREFIX.'accounting_journal') {
|
else if ($fieldlist[$field]=='nature' && $tabname[$id]==MAIN_DB_PREFIX.'accounting_journal') {
|
||||||
$langs->load("accountancy");
|
$langs->load("accountancy");
|
||||||
$key=$langs->trans("AccountingJournalType".strtoupper($obj->nature));
|
$key=$langs->trans("AccountingJournalType".strtoupper($obj->nature));
|
||||||
$valuetoshow=($obj->nature && $key != "AccountingJournalType".strtoupper($obj->nature)?$key:$obj->{$fieldlist[$field]});
|
$valuetoshow=($obj->nature && $key != "AccountingJournalType".strtoupper($obj->nature)?$key:$obj->{$fieldlist[$field]});
|
||||||
}
|
}
|
||||||
|
|
||||||
$class='tddict';
|
$class='tddict';
|
||||||
// Show value for field
|
// Show value for field
|
||||||
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
|
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Can an entry be erased or disabled ?
|
// Can an entry be erased or disabled ?
|
||||||
$iserasable=1;$canbedisabled=1;$canbemodified=1; // true by default
|
$iserasable=1;$canbedisabled=1;$canbemodified=1; // true by default
|
||||||
if (isset($obj->code) && $id != 10)
|
if (isset($obj->code) && $id != 10)
|
||||||
{
|
{
|
||||||
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) { $iserasable = 0; $canbedisabled = 0; }
|
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) { $iserasable = 0; $canbedisabled = 0; }
|
||||||
else if ($obj->code == 'RECEP') { $iserasable = 0; $canbedisabled = 0; }
|
else if ($obj->code == 'RECEP') { $iserasable = 0; $canbedisabled = 0; }
|
||||||
else if ($obj->code == 'EF0') { $iserasable = 0; $canbedisabled = 0; }
|
else if ($obj->code == 'EF0') { $iserasable = 0; $canbedisabled = 0; }
|
||||||
}
|
}
|
||||||
|
|
||||||
$canbemodified=$iserasable;
|
$canbemodified=$iserasable;
|
||||||
|
|
||||||
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'');
|
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'');
|
||||||
if ($param) $url .= '&'.$param;
|
if ($param) $url .= '&'.$param;
|
||||||
$url.='&';
|
$url.='&';
|
||||||
|
|
||||||
// Active
|
// Active
|
||||||
print '<td align="center" class="nowrap">';
|
print '<td align="center" class="nowrap">';
|
||||||
if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
|
if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO'))) print $langs->trans("AlwaysActive");
|
if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO'))) print $langs->trans("AlwaysActive");
|
||||||
else if (isset($obj->type) && in_array($obj->type, array('systemauto')) && empty($obj->active)) print $langs->trans("Deprecated");
|
else if (isset($obj->type) && in_array($obj->type, array('systemauto')) && empty($obj->active)) print $langs->trans("Deprecated");
|
||||||
else if (isset($obj->type) && in_array($obj->type, array('system')) && ! empty($obj->active) && $obj->code != 'AC_OTH') print $langs->trans("UsedOnlyWithTypeOption");
|
else if (isset($obj->type) && in_array($obj->type, array('system')) && ! empty($obj->active) && $obj->code != 'AC_OTH') print $langs->trans("UsedOnlyWithTypeOption");
|
||||||
else print $langs->trans("AlwaysActive");
|
else print $langs->trans("AlwaysActive");
|
||||||
}
|
}
|
||||||
print "</td>";
|
print "</td>";
|
||||||
|
|
||||||
// Modify link
|
// Modify link
|
||||||
if ($canbemodified) print '<td align="center"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>';
|
if ($canbemodified) print '<td align="center"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>';
|
||||||
else print '<td> </td>';
|
else print '<td> </td>';
|
||||||
|
|
||||||
// Delete link
|
// Delete link
|
||||||
if ($iserasable)
|
if ($iserasable)
|
||||||
{
|
{
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
if ($user->admin) print '<a href="'.$url.'action=delete">'.img_delete().'</a>';
|
if ($user->admin) print '<a href="'.$url.'action=delete">'.img_delete().'</a>';
|
||||||
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
|
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
else print '<td> </td>';
|
else print '<td> </td>';
|
||||||
|
|
||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -57,19 +57,19 @@ if (! defined("MAIN_MOTD")) define("MAIN_MOTD","");
|
|||||||
|
|
||||||
if (GETPOST('cancel','alpha'))
|
if (GETPOST('cancel','alpha'))
|
||||||
{
|
{
|
||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'removebackgroundlogin' && ! empty($conf->global->MAIN_LOGIN_BACKGROUND))
|
if ($action == 'removebackgroundlogin' && ! empty($conf->global->MAIN_LOGIN_BACKGROUND))
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
$logofile=$conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND;
|
$logofile=$conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND;
|
||||||
dol_delete_file($logofile);
|
dol_delete_file($logofile);
|
||||||
dolibarr_del_const($db, "MAIN_LOGIN_BACKGROUND",$conf->entity);
|
dolibarr_del_const($db, "MAIN_LOGIN_BACKGROUND",$conf->entity);
|
||||||
$mysoc->logo='';
|
$mysoc->logo='';
|
||||||
|
|
||||||
/*$logosmallfile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small;
|
/*$logosmallfile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small;
|
||||||
dol_delete_file($logosmallfile);
|
dol_delete_file($logosmallfile);
|
||||||
dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$conf->entity);
|
dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$conf->entity);
|
||||||
$mysoc->logo_small='';
|
$mysoc->logo_small='';
|
||||||
@ -89,7 +89,7 @@ if ($action == 'update')
|
|||||||
|
|
||||||
$val=GETPOST('THEME_TOPMENU_DISABLE_IMAGE');
|
$val=GETPOST('THEME_TOPMENU_DISABLE_IMAGE');
|
||||||
if (! $val) dolibarr_del_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', $conf->entity);
|
if (! $val) dolibarr_del_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', $conf->entity);
|
||||||
else dolibarr_set_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', GETPOST('THEME_TOPMENU_DISABLE_IMAGE'),'chaine',0,'',$conf->entity);
|
else dolibarr_set_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', GETPOST('THEME_TOPMENU_DISABLE_IMAGE'),'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_BACKBODY'),array()))));
|
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_BACKBODY'),array()))));
|
||||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_BACKBODY', $conf->entity);
|
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_BACKBODY', $conf->entity);
|
||||||
@ -103,44 +103,44 @@ if ($action == 'update')
|
|||||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_VERMENU_BACK1', $conf->entity);
|
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_VERMENU_BACK1', $conf->entity);
|
||||||
else dolibarr_set_const($db, 'THEME_ELDY_VERMENU_BACK1', $val,'chaine',0,'',$conf->entity);
|
else dolibarr_set_const($db, 'THEME_ELDY_VERMENU_BACK1', $val,'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'),array()))));
|
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'),array()))));
|
||||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_BACKTITLE1', $conf->entity);
|
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_BACKTITLE1', $conf->entity);
|
||||||
else dolibarr_set_const($db, 'THEME_ELDY_BACKTITLE1', $val,'chaine',0,'',$conf->entity);
|
else dolibarr_set_const($db, 'THEME_ELDY_BACKTITLE1', $val,'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'),array()))));
|
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'),array()))));
|
||||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR1', $conf->entity);
|
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR1', $conf->entity);
|
||||||
else dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR1', $val,'chaine',0,'',$conf->entity);
|
else dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR1', $val,'chaine',0,'',$conf->entity);
|
||||||
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'),array()))));
|
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'),array()))));
|
||||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR2', $conf->entity);
|
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR2', $conf->entity);
|
||||||
else dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR2', $val,'chaine',0,'',$conf->entity);
|
else dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR2', $val,'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'),array()))));
|
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'),array()))));
|
||||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_LINEPAIR1', $conf->entity);
|
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_LINEPAIR1', $conf->entity);
|
||||||
else dolibarr_set_const($db, 'THEME_ELDY_LINEPAIR1', $val,'chaine',0,'',$conf->entity);
|
else dolibarr_set_const($db, 'THEME_ELDY_LINEPAIR1', $val,'chaine',0,'',$conf->entity);
|
||||||
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'),array()))));
|
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'),array()))));
|
||||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_LINEPAIR2', $conf->entity);
|
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_LINEPAIR2', $conf->entity);
|
||||||
else dolibarr_set_const($db, 'THEME_ELDY_LINEPAIR2', $val,'chaine',0,'',$conf->entity);
|
else dolibarr_set_const($db, 'THEME_ELDY_LINEPAIR2', $val,'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLENOTAB'),array()))));
|
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLENOTAB'),array()))));
|
||||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLENOTAB', $conf->entity);
|
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLENOTAB', $conf->entity);
|
||||||
else dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLENOTAB', $val,'chaine',0,'',$conf->entity);
|
else dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLENOTAB', $val,'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
if (GETPOST('THEME_ELDY_USE_HOVER') == '') dolibarr_set_const($db, "THEME_ELDY_USE_HOVER", '0', 'chaine', 0, '', $conf->entity); // If empty, we set to '0' ('000000' is for black)
|
if (GETPOST('THEME_ELDY_USE_HOVER') == '') dolibarr_set_const($db, "THEME_ELDY_USE_HOVER", '0', 'chaine', 0, '', $conf->entity); // If empty, we set to '0' ('000000' is for black)
|
||||||
else dolibarr_set_const($db, "THEME_ELDY_USE_HOVER", $_POST["THEME_ELDY_USE_HOVER"], 'chaine', 0, '', $conf->entity);
|
else dolibarr_set_const($db, "THEME_ELDY_USE_HOVER", $_POST["THEME_ELDY_USE_HOVER"], 'chaine', 0, '', $conf->entity);
|
||||||
|
|
||||||
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_TEXTLINK'),array()))));
|
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_TEXTLINK'),array()))));
|
||||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TEXTLINK', $conf->entity);
|
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TEXTLINK', $conf->entity);
|
||||||
else dolibarr_set_const($db, 'THEME_ELDY_TEXTLINK', $val,'chaine',0,'',$conf->entity);
|
else dolibarr_set_const($db, 'THEME_ELDY_TEXTLINK', $val,'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", $_POST["main_size_liste_limit"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", $_POST["main_size_liste_limit"],'chaine',0,'',$conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_SIZE_SHORTLIST_LIMIT", $_POST["main_size_shortliste_limit"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_SIZE_SHORTLIST_LIMIT", $_POST["main_size_shortliste_limit"],'chaine',0,'',$conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_DISABLE_JAVASCRIPT", $_POST["main_disable_javascript"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_DISABLE_JAVASCRIPT", $_POST["main_disable_javascript"],'chaine',0,'',$conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_BUTTON_HIDE_UNAUTHORIZED", $_POST["MAIN_BUTTON_HIDE_UNAUTHORIZED"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_BUTTON_HIDE_UNAUTHORIZED", $_POST["MAIN_BUTTON_HIDE_UNAUTHORIZED"],'chaine',0,'',$conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_START_WEEK", $_POST["MAIN_START_WEEK"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_START_WEEK", $_POST["MAIN_START_WEEK"],'chaine',0,'',$conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_DAYS", $_POST["MAIN_DEFAULT_WORKING_DAYS"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_DAYS", $_POST["MAIN_DEFAULT_WORKING_DAYS"],'chaine',0,'',$conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", $_POST["MAIN_DEFAULT_WORKING_HOURS"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", $_POST["MAIN_DEFAULT_WORKING_HOURS"],'chaine',0,'',$conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_SHOW_LOGO", $_POST["MAIN_SHOW_LOGO"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_SHOW_LOGO", $_POST["MAIN_SHOW_LOGO"],'chaine',0,'',$conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", $_POST["MAIN_FIRSTNAME_NAME_POSITION"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", $_POST["MAIN_FIRSTNAME_NAME_POSITION"],'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
dolibarr_set_const($db, "MAIN_HELPCENTER_DISABLELINK", $_POST["MAIN_HELPCENTER_DISABLELINK"],'chaine',0,'',0); // Param for all entities
|
dolibarr_set_const($db, "MAIN_HELPCENTER_DISABLELINK", $_POST["MAIN_HELPCENTER_DISABLELINK"],'chaine',0,'',0); // Param for all entities
|
||||||
dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr($_POST["main_motd"]),'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr($_POST["main_motd"]),'chaine',0,'',$conf->entity);
|
||||||
@ -151,43 +151,43 @@ if ($action == 'update')
|
|||||||
$varforimage='imagebackground'; $dirforimage=$conf->mycompany->dir_output.'/logos/';
|
$varforimage='imagebackground'; $dirforimage=$conf->mycompany->dir_output.'/logos/';
|
||||||
if ($_FILES[$varforimage]["tmp_name"])
|
if ($_FILES[$varforimage]["tmp_name"])
|
||||||
{
|
{
|
||||||
if (preg_match('/([^\\/:]+)$/i',$_FILES[$varforimage]["name"],$reg))
|
if (preg_match('/([^\\/:]+)$/i',$_FILES[$varforimage]["name"],$reg))
|
||||||
{
|
{
|
||||||
$original_file=$reg[1];
|
$original_file=$reg[1];
|
||||||
|
|
||||||
$isimage=image_format_supported($original_file);
|
$isimage=image_format_supported($original_file);
|
||||||
if ($isimage >= 0)
|
if ($isimage >= 0)
|
||||||
{
|
{
|
||||||
dol_syslog("Move file ".$_FILES[$varforimage]["tmp_name"]." to ".$dirforimage.$original_file);
|
dol_syslog("Move file ".$_FILES[$varforimage]["tmp_name"]." to ".$dirforimage.$original_file);
|
||||||
if (! is_dir($dirforimage))
|
if (! is_dir($dirforimage))
|
||||||
{
|
{
|
||||||
dol_mkdir($dirforimage);
|
dol_mkdir($dirforimage);
|
||||||
}
|
}
|
||||||
$result=dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"],$dirforimage.$original_file,1,0,$_FILES[$varforimage]['error']);
|
$result=dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"],$dirforimage.$original_file,1,0,$_FILES[$varforimage]['error']);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
dolibarr_set_const($db, "MAIN_LOGIN_BACKGROUND",$original_file,'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_LOGIN_BACKGROUND",$original_file,'chaine',0,'',$conf->entity);
|
||||||
}
|
}
|
||||||
else if (preg_match('/^ErrorFileIsInfectedWithAVirus/',$result))
|
else if (preg_match('/^ErrorFileIsInfectedWithAVirus/',$result))
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$tmparray=explode(':',$result);
|
$tmparray=explode(':',$result);
|
||||||
setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus',$tmparray[1]), null, 'errors');
|
setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus',$tmparray[1]), null, 'errors');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors');
|
setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
|
setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -218,59 +218,59 @@ print "<br>\n";
|
|||||||
|
|
||||||
if ($action == 'edit') // Edit
|
if ($action == 'edit') // Edit
|
||||||
{
|
{
|
||||||
//WYSIWYG Editor
|
//WYSIWYG Editor
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
|
|
||||||
print '<form enctype="multipart/form-data" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
print '<form enctype="multipart/form-data" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="update">';
|
print '<input type="hidden" name="action" value="update">';
|
||||||
|
|
||||||
clearstatcache();
|
clearstatcache();
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<table summary="edit" class="noborder" width="100%">';
|
print '<table summary="edit" class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td>'.$langs->trans("Language").'</td><td></td>';
|
print '<tr class="liste_titre"><td>'.$langs->trans("Language").'</td><td></td>';
|
||||||
print '<td width="20"> </td>';
|
print '<td width="20"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Default language
|
// Default language
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("DefaultLanguage").'</td><td>';
|
print '<tr><td class="titlefield">'.$langs->trans("DefaultLanguage").'</td><td>';
|
||||||
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'MAIN_LANG_DEFAULT', 1, 0, 0, 0, 0, 'minwidth300');
|
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'MAIN_LANG_DEFAULT', 1, 0, 0, 0, 0, 'minwidth300');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td width="20"> </td>';
|
print '<td width="20"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Multilingual GUI
|
// Multilingual GUI
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("EnableMultilangInterface").'</td><td>';
|
print '<tr><td class="titlefield">'.$langs->trans("EnableMultilangInterface").'</td><td>';
|
||||||
print $form->selectyesno('MAIN_MULTILANGS',$conf->global->MAIN_MULTILANGS,1);
|
print $form->selectyesno('MAIN_MULTILANGS',$conf->global->MAIN_MULTILANGS,1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td width="20"> </td>';
|
print '<td width="20"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '</table><br>'."\n";
|
print '</table><br>'."\n";
|
||||||
|
|
||||||
// Themes and themes options
|
// Themes and themes options
|
||||||
show_theme(null,1);
|
show_theme(null,1);
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
// Other
|
// Other
|
||||||
print '<table summary="edit" class="noborder" width="100%">';
|
print '<table summary="edit" class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td>';
|
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td>';
|
||||||
print '<td width="20"> </td>';
|
print '<td width="20"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Max size of lists
|
// Max size of lists
|
||||||
print '<tr><td>'.$langs->trans("DefaultMaxSizeList").'</td><td><input class="flat" name="main_size_liste_limit" size="4" value="' . $conf->global->MAIN_SIZE_LISTE_LIMIT . '"></td>';
|
print '<tr><td>'.$langs->trans("DefaultMaxSizeList").'</td><td><input class="flat" name="main_size_liste_limit" size="4" value="' . $conf->global->MAIN_SIZE_LISTE_LIMIT . '"></td>';
|
||||||
print '<td width="20"> </td>';
|
print '<td width="20"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Max size of short lists on customer card
|
// Max size of short lists on customer card
|
||||||
print '<tr><td>'.$langs->trans("DefaultMaxSizeShortList").'</td><td><input class="flat" name="main_size_shortliste_limit" size="4" value="' . $conf->global->MAIN_SIZE_SHORTLIST_LIMIT . '"></td>';
|
print '<tr><td>'.$langs->trans("DefaultMaxSizeShortList").'</td><td><input class="flat" name="main_size_shortliste_limit" size="4" value="' . $conf->global->MAIN_SIZE_SHORTLIST_LIMIT . '"></td>';
|
||||||
print '<td width="20"> </td>';
|
print '<td width="20"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// show input border
|
// show input border
|
||||||
/*
|
/*
|
||||||
print '<tr><td>'.$langs->trans("showInputBorder").'</td><td>';
|
print '<tr><td>'.$langs->trans("showInputBorder").'</td><td>';
|
||||||
print $form->selectyesno('main_showInputBorder',isset($conf->global->THEME_ELDY_SHOW_BORDER_INPUT)?$conf->global->THEME_ELDY_SHOW_BORDER_INPUT:0,1);
|
print $form->selectyesno('main_showInputBorder',isset($conf->global->THEME_ELDY_SHOW_BORDER_INPUT)?$conf->global->THEME_ELDY_SHOW_BORDER_INPUT:0,1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -279,38 +279,38 @@ if ($action == 'edit') // Edit
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Disable javascript and ajax
|
// Disable javascript and ajax
|
||||||
print '<tr><td>'.$langs->trans("DisableJavascript").'</td><td>';
|
print '<tr><td>'.$langs->trans("DisableJavascript").'</td><td>';
|
||||||
print $form->selectyesno('main_disable_javascript',isset($conf->global->MAIN_DISABLE_JAVASCRIPT)?$conf->global->MAIN_DISABLE_JAVASCRIPT:0,1);
|
print $form->selectyesno('main_disable_javascript',isset($conf->global->MAIN_DISABLE_JAVASCRIPT)?$conf->global->MAIN_DISABLE_JAVASCRIPT:0,1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td width="20"> </td>';
|
print '<td width="20"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// First day for weeks
|
// First day for weeks
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("WeekStartOnDay").'</td><td>';
|
print '<tr><td class="titlefield">'.$langs->trans("WeekStartOnDay").'</td><td>';
|
||||||
print $formother->select_dayofweek((isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:'1'),'MAIN_START_WEEK',0);
|
print $formother->select_dayofweek((isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:'1'),'MAIN_START_WEEK',0);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td width="20"> </td>';
|
print '<td width="20"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// DefaultWorkingDays
|
// DefaultWorkingDays
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("DefaultWorkingDays").'</td><td>';
|
print '<tr><td class="titlefield">'.$langs->trans("DefaultWorkingDays").'</td><td>';
|
||||||
print '<input type="text" name="MAIN_DEFAULT_WORKING_DAYS" size="5" value="'.(isset($conf->global->MAIN_DEFAULT_WORKING_DAYS)?$conf->global->MAIN_DEFAULT_WORKING_DAYS:'1-5').'">';
|
print '<input type="text" name="MAIN_DEFAULT_WORKING_DAYS" size="5" value="'.(isset($conf->global->MAIN_DEFAULT_WORKING_DAYS)?$conf->global->MAIN_DEFAULT_WORKING_DAYS:'1-5').'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td width="20"> </td>';
|
print '<td width="20"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// DefaultWorkingHours
|
// DefaultWorkingHours
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("DefaultWorkingHours").'</td><td>';
|
print '<tr><td class="titlefield">'.$langs->trans("DefaultWorkingHours").'</td><td>';
|
||||||
print '<input type="text" name="MAIN_DEFAULT_WORKING_HOURS" size="5" value="'.(isset($conf->global->MAIN_DEFAULT_WORKING_HOURS)?$conf->global->MAIN_DEFAULT_WORKING_HOURS:'9-18').'">';
|
print '<input type="text" name="MAIN_DEFAULT_WORKING_HOURS" size="5" value="'.(isset($conf->global->MAIN_DEFAULT_WORKING_HOURS)?$conf->global->MAIN_DEFAULT_WORKING_HOURS:'9-18').'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td width="20"> </td>';
|
print '<td width="20"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Firstname/Name
|
// Firstname/Name
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("FirstnameNamePosition").'</td><td>';
|
print '<tr><td class="titlefield">'.$langs->trans("FirstnameNamePosition").'</td><td>';
|
||||||
$array=array(0=>$langs->trans("Firstname").' '.$langs->trans("Lastname"),1=>$langs->trans("Lastname").' '.$langs->trans("Firstname"));
|
$array=array(0=>$langs->trans("Firstname").' '.$langs->trans("Lastname"),1=>$langs->trans("Lastname").' '.$langs->trans("Firstname"));
|
||||||
print $form->selectarray('MAIN_FIRSTNAME_NAME_POSITION',$array,(isset($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?$conf->global->MAIN_FIRSTNAME_NAME_POSITION:0));
|
print $form->selectarray('MAIN_FIRSTNAME_NAME_POSITION',$array,(isset($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?$conf->global->MAIN_FIRSTNAME_NAME_POSITION:0));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td width="20"> </td>';
|
print '<td width="20"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
@ -346,27 +346,27 @@ if ($action == 'edit') // Edit
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Hide wiki link on login page
|
// Hide wiki link on login page
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("DisableLinkToHelp",img_picto('',DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/helpdoc.png','',1)).'</td><td>';
|
print '<tr><td class="titlefield">'.$langs->trans("DisableLinkToHelp",img_picto('',DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/helpdoc.png','',1)).'</td><td>';
|
||||||
print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK)?$conf->global->MAIN_HELP_DISABLELINK:0,1);
|
print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK)?$conf->global->MAIN_HELP_DISABLELINK:0,1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td width="20"> </td>';
|
print '<td width="20"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Message of the day on home page
|
// Message of the day on home page
|
||||||
$substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount'));
|
$substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount'));
|
||||||
complete_substitutions_array($substitutionarray, $langs);
|
complete_substitutions_array($substitutionarray, $langs);
|
||||||
|
|
||||||
print '<tr><td class="titlefield">';
|
print '<tr><td class="titlefield">';
|
||||||
$texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
$texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||||
foreach($substitutionarray as $key => $val)
|
foreach($substitutionarray as $key => $val)
|
||||||
{
|
{
|
||||||
$texthelp.=$key.'<br>';
|
$texthelp.=$key.'<br>';
|
||||||
}
|
}
|
||||||
print $form->textwithpicto($langs->trans("MessageOfDay"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessageofday');
|
print $form->textwithpicto($langs->trans("MessageOfDay"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessageofday');
|
||||||
|
|
||||||
print '</td><td colspan="2">';
|
print '</td><td colspan="2">';
|
||||||
|
|
||||||
$doleditor = new DolEditor('main_motd', (isset($conf->global->MAIN_MOTD)?$conf->global->MAIN_MOTD:''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
|
$doleditor = new DolEditor('main_motd', (isset($conf->global->MAIN_MOTD)?$conf->global->MAIN_MOTD:''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
|
||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
|
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
@ -383,12 +383,12 @@ if ($action == 'edit') // Edit
|
|||||||
|
|
||||||
// Message on login page
|
// Message on login page
|
||||||
$substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount','user'));
|
$substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount','user'));
|
||||||
complete_substitutions_array($substitutionarray, $langs);
|
complete_substitutions_array($substitutionarray, $langs);
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
$texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
$texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||||
foreach($substitutionarray as $key => $val)
|
foreach($substitutionarray as $key => $val)
|
||||||
{
|
{
|
||||||
$texthelp.=$key.'<br>';
|
$texthelp.=$key.'<br>';
|
||||||
}
|
}
|
||||||
print $form->textwithpicto($langs->trans("MessageLogin"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessagelogin');
|
print $form->textwithpicto($langs->trans("MessageLogin"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessagelogin');
|
||||||
print '</td><td colspan="2">';
|
print '</td><td colspan="2">';
|
||||||
@ -405,16 +405,16 @@ if ($action == 'edit') // Edit
|
|||||||
|
|
||||||
// Background
|
// Background
|
||||||
print '<tr><td><label for="imagebackground">'.$langs->trans("BackgroundImageLogin").' (png,jpg)</label></td><td colspan="2">';
|
print '<tr><td><label for="imagebackground">'.$langs->trans("BackgroundImageLogin").' (png,jpg)</label></td><td colspan="2">';
|
||||||
print '<div class="centpercent inline-block">';
|
print '<div class="centpercent inline-block">';
|
||||||
print '<input type="file" class="flat class=minwidth200" name="imagebackground" id="imagebackground">';
|
print '<input type="file" class="flat class=minwidth200" name="imagebackground" id="imagebackground">';
|
||||||
if (! empty($conf->global->MAIN_LOGIN_BACKGROUND)) {
|
if (! empty($conf->global->MAIN_LOGIN_BACKGROUND)) {
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=removebackgroundlogin">'.img_delete($langs->trans("Delete")).'</a>';
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=removebackgroundlogin">'.img_delete($langs->trans("Delete")).'</a>';
|
||||||
if (file_exists($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND)) {
|
if (file_exists($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND)) {
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<img class="paddingleft valignmiddle" width="100px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('/'.$conf->global->MAIN_LOGIN_BACKGROUND).'">';
|
print '<img class="paddingleft valignmiddle" width="100px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('/'.$conf->global->MAIN_LOGIN_BACKGROUND).'">';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print '<img class="paddingleft valignmiddle" width="100" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
|
print '<img class="paddingleft valignmiddle" width="100" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
|
||||||
}
|
}
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@ -422,31 +422,31 @@ if ($action == 'edit') // Edit
|
|||||||
print '</table>'."\n";
|
print '</table>'."\n";
|
||||||
|
|
||||||
|
|
||||||
print '<br><div class="center">';
|
print '<br><div class="center">';
|
||||||
print '<input class="button" type="submit" name="submit" value="'.$langs->trans("Save").'">';
|
print '<input class="button" type="submit" name="submit" value="'.$langs->trans("Save").'">';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
|
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
else // Show
|
else // Show
|
||||||
{
|
{
|
||||||
// Language
|
// Language
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td>'.$langs->trans("Language").'</td><td></td><td> </td></tr>';
|
print '<tr class="liste_titre"><td>'.$langs->trans("Language").'</td><td></td><td> </td></tr>';
|
||||||
|
|
||||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DefaultLanguage").'</td><td>';
|
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DefaultLanguage").'</td><td>';
|
||||||
$s=picto_from_langcode($conf->global->MAIN_LANG_DEFAULT);
|
$s=picto_from_langcode($conf->global->MAIN_LANG_DEFAULT);
|
||||||
print ($s?$s.' ':'');
|
print ($s?$s.' ':'');
|
||||||
print ($conf->global->MAIN_LANG_DEFAULT=='auto'?$langs->trans("AutoDetectLang"):$langs->trans("Language_".$conf->global->MAIN_LANG_DEFAULT));
|
print ($conf->global->MAIN_LANG_DEFAULT=='auto'?$langs->trans("AutoDetectLang"):$langs->trans("Language_".$conf->global->MAIN_LANG_DEFAULT));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td width="20">';
|
print '<td width="20">';
|
||||||
if ($user->admin && $conf->global->MAIN_LANG_DEFAULT!='auto') print info_admin($langs->trans("SubmitTranslation".($conf->global->MAIN_LANG_DEFAULT=='en_US'?'ENUS':''),$conf->global->MAIN_LANG_DEFAULT),1);
|
if ($user->admin && $conf->global->MAIN_LANG_DEFAULT!='auto') print info_admin($langs->trans("SubmitTranslation".($conf->global->MAIN_LANG_DEFAULT=='en_US'?'ENUS':''),$conf->global->MAIN_LANG_DEFAULT),1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("EnableMultilangInterface").'</td><td>' . yn($conf->global->MAIN_MULTILANGS) . '</td>';
|
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("EnableMultilangInterface").'</td><td>' . yn($conf->global->MAIN_MULTILANGS) . '</td>';
|
||||||
print '<td width="20"> </td>';
|
print '<td width="20"> </td>';
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
@ -454,19 +454,19 @@ else // Show
|
|||||||
|
|
||||||
|
|
||||||
// Themes
|
// Themes
|
||||||
show_theme(null,0);
|
show_theme(null,0);
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
|
||||||
// Other
|
// Other
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameters").'</td><td colspan="2">'.$langs->trans("Value").'</td></tr>';
|
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameters").'</td><td colspan="2">'.$langs->trans("Value").'</td></tr>';
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>'.$langs->trans("DefaultMaxSizeList").'</td><td>' . $conf->global->MAIN_SIZE_LISTE_LIMIT . '</td>';
|
print '<tr class="oddeven"><td>'.$langs->trans("DefaultMaxSizeList").'</td><td>' . $conf->global->MAIN_SIZE_LISTE_LIMIT . '</td>';
|
||||||
print '<td width="20"> </td>';
|
print '<td width="20"> </td>';
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>'.$langs->trans("DefaultMaxSizeShortList").'</td><td>' . $conf->global->MAIN_SIZE_SHORTLIST_LIMIT . '</td>';
|
print '<tr class="oddeven"><td>'.$langs->trans("DefaultMaxSizeShortList").'</td><td>' . $conf->global->MAIN_SIZE_SHORTLIST_LIMIT . '</td>';
|
||||||
print '<td width="20"> </td>';
|
print '<td width="20"> </td>';
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
@ -477,38 +477,38 @@ else // Show
|
|||||||
print "</tr>";
|
print "</tr>";
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Disable javascript/ajax
|
// Disable javascript/ajax
|
||||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DisableJavascript").'</td><td>';
|
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DisableJavascript").'</td><td>';
|
||||||
print yn($conf->global->MAIN_DISABLE_JAVASCRIPT)."</td>";
|
print yn($conf->global->MAIN_DISABLE_JAVASCRIPT)."</td>";
|
||||||
print '<td width="20"> </td>';
|
print '<td width="20"> </td>';
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
// First day for weeks
|
// First day for weeks
|
||||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("WeekStartOnDay").'</td><td>';
|
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("WeekStartOnDay").'</td><td>';
|
||||||
print $langs->trans("Day".(isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:'1'));
|
print $langs->trans("Day".(isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:'1'));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td width="20"> </td>';
|
print '<td width="20"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// DefaultWorkingDays
|
// DefaultWorkingDays
|
||||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DefaultWorkingDays").'</td><td>';
|
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DefaultWorkingDays").'</td><td>';
|
||||||
print isset($conf->global->MAIN_DEFAULT_WORKING_DAYS)?$conf->global->MAIN_DEFAULT_WORKING_DAYS:'1-5';
|
print isset($conf->global->MAIN_DEFAULT_WORKING_DAYS)?$conf->global->MAIN_DEFAULT_WORKING_DAYS:'1-5';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td width="20"> </td>';
|
print '<td width="20"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// DefaultWorkingHours
|
// DefaultWorkingHours
|
||||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DefaultWorkingHours").'</td><td>';
|
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DefaultWorkingHours").'</td><td>';
|
||||||
print isset($conf->global->MAIN_DEFAULT_WORKING_HOURS)?$conf->global->MAIN_DEFAULT_WORKING_HOURS:'9-18';
|
print isset($conf->global->MAIN_DEFAULT_WORKING_HOURS)?$conf->global->MAIN_DEFAULT_WORKING_HOURS:'9-18';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td width="20"> </td>';
|
print '<td width="20"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Firstname / Name position
|
// Firstname / Name position
|
||||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("FirstnameNamePosition").'</td><td>';
|
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("FirstnameNamePosition").'</td><td>';
|
||||||
if (empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)) { print $langs->trans("Firstname").' '.$langs->trans("Lastname"); }
|
if (empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)) { print $langs->trans("Firstname").' '.$langs->trans("Lastname"); }
|
||||||
else { print $langs->trans("Lastname").' '.$langs->trans("Firstname"); }
|
else { print $langs->trans("Lastname").' '.$langs->trans("Firstname"); }
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td width="20"> </td>';
|
print '<td width="20"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
@ -517,8 +517,8 @@ else // Show
|
|||||||
print yn((isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)?$conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED:0),1);
|
print yn((isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)?$conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED:0),1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Show logo
|
// Show logo
|
||||||
print '<tr class="oddeven"><td>'.$langs->trans("EnableShowLogo").'</td><td>' . yn($conf->global->MAIN_SHOW_LOGO) . '</td>';
|
print '<tr class="oddeven"><td>'.$langs->trans("EnableShowLogo").'</td><td>' . yn($conf->global->MAIN_SHOW_LOGO) . '</td>';
|
||||||
print '<td width="20"> </td>';
|
print '<td width="20"> </td>';
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
@ -531,62 +531,62 @@ else // Show
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Show bugtrack link
|
// Show bugtrack link
|
||||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).'</td><td>';
|
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).'</td><td>';
|
||||||
print yn($conf->global->MAIN_BUGTRACK_ENABLELINK)."</td>";
|
print yn($conf->global->MAIN_BUGTRACK_ENABLELINK)."</td>";
|
||||||
print '<td width="20"> </td>';
|
print '<td width="20"> </td>';
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
// Link to wiki help
|
// Link to wiki help
|
||||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DisableLinkToHelp",img_picto('',DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/helpdoc.png','',1)).'</td><td colspan="2">';
|
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DisableLinkToHelp",img_picto('',DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/helpdoc.png','',1)).'</td><td colspan="2">';
|
||||||
print yn((isset($conf->global->MAIN_HELP_DISABLELINK)?$conf->global->MAIN_HELP_DISABLELINK:0),1);
|
print yn((isset($conf->global->MAIN_HELP_DISABLELINK)?$conf->global->MAIN_HELP_DISABLELINK:0),1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Message of the day
|
// Message of the day
|
||||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("MessageOfDay").'</td><td colspan="2">';
|
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("MessageOfDay").'</td><td colspan="2">';
|
||||||
if (isset($conf->global->MAIN_MOTD)) print dol_htmlcleanlastbr($conf->global->MAIN_MOTD);
|
if (isset($conf->global->MAIN_MOTD)) print dol_htmlcleanlastbr($conf->global->MAIN_MOTD);
|
||||||
else print ' ';
|
else print ' ';
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
print '</table>'."\n";
|
print '</table>'."\n";
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
// Login page
|
// Login page
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td>'.$langs->trans("LoginPage").'</td><td></td><td> </td></tr>';
|
print '<tr class="liste_titre"><td>'.$langs->trans("LoginPage").'</td><td></td><td> </td></tr>';
|
||||||
|
|
||||||
// Message login
|
// Message login
|
||||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("MessageLogin").'</td><td colspan="2">';
|
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("MessageLogin").'</td><td colspan="2">';
|
||||||
if (isset($conf->global->MAIN_HOME)) print dol_htmlcleanlastbr($conf->global->MAIN_HOME);
|
if (isset($conf->global->MAIN_HOME)) print dol_htmlcleanlastbr($conf->global->MAIN_HOME);
|
||||||
else print ' ';
|
else print ' ';
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
// Link to help center
|
// Link to help center
|
||||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DisableLinkToHelpCenter").'</td><td colspan="2">';
|
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DisableLinkToHelpCenter").'</td><td colspan="2">';
|
||||||
print yn((isset($conf->global->MAIN_HELPCENTER_DISABLELINK)?$conf->global->MAIN_HELPCENTER_DISABLELINK:0),1);
|
print yn((isset($conf->global->MAIN_HELPCENTER_DISABLELINK)?$conf->global->MAIN_HELPCENTER_DISABLELINK:0),1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Background login
|
// Background login
|
||||||
print '<tr class="oddeven"><td>'.$langs->trans("BackgroundImageLogin").'</td><td colspan="2">';
|
print '<tr class="oddeven"><td>'.$langs->trans("BackgroundImageLogin").'</td><td colspan="2">';
|
||||||
print '<div class="centpercent inline-block">';
|
print '<div class="centpercent inline-block">';
|
||||||
print $conf->global->MAIN_LOGIN_BACKGROUND;
|
print $conf->global->MAIN_LOGIN_BACKGROUND;
|
||||||
if ($conf->global->MAIN_LOGIN_BACKGROUND && is_file($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND))
|
if ($conf->global->MAIN_LOGIN_BACKGROUND && is_file($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND))
|
||||||
{
|
{
|
||||||
print '<img class="img_logo paddingleft valignmiddle" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode($conf->global->MAIN_LOGIN_BACKGROUND).'">';
|
print '<img class="img_logo paddingleft valignmiddle" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode($conf->global->MAIN_LOGIN_BACKGROUND).'">';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<img class="img_logo paddingleft valignmiddle" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
|
print '<img class="img_logo paddingleft valignmiddle" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
|
||||||
}
|
}
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>'."\n";
|
print '</table>'."\n";
|
||||||
|
|
||||||
print '<div class="tabsAction tabsActionNoBottom">';
|
print '<div class="tabsAction tabsActionNoBottom">';
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -66,7 +66,7 @@ if ($action == 'setvalue' && $user->admin)
|
|||||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_PHONE',GETPOST("fieldphone"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_PHONE',GETPOST("fieldphone"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_PHONE_PERSO',GETPOST("fieldphoneperso"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_PHONE_PERSO',GETPOST("fieldphoneperso"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_MOBILE',GETPOST("fieldmobile"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_MOBILE',GETPOST("fieldmobile"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_SKYPE',GETPOST("fieldskype"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_SKYPE',GETPOST("fieldskype"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_FAX',GETPOST("fieldfax"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_FAX',GETPOST("fieldfax"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_COMPANY',GETPOST("fieldcompany"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_COMPANY',GETPOST("fieldcompany"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_ADDRESS',GETPOST("fieldaddress"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_ADDRESS',GETPOST("fieldaddress"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
@ -85,22 +85,22 @@ if ($action == 'setvalue' && $user->admin)
|
|||||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE', GETPOST("fieldlastsubscriptiondate"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE', GETPOST("fieldlastsubscriptiondate"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT', GETPOST("fieldlastsubscriptionamount"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT', GETPOST("fieldlastsubscriptionamount"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
|
|
||||||
// This one must be after the others
|
// This one must be after the others
|
||||||
$valkey='';
|
$valkey='';
|
||||||
$key=GETPOST("key");
|
$key=GETPOST("key");
|
||||||
if ($key) $valkey=$conf->global->$key;
|
if ($key) $valkey=$conf->global->$key;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_KEY_MEMBERS',$valkey,'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_KEY_MEMBERS',$valkey,'chaine',0,'',$conf->entity)) $error++;
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -63,7 +63,7 @@ if ($action == 'setvalue' && $user->admin)
|
|||||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_MAIL',GETPOST("fieldmail"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_FIELD_MAIL',GETPOST("fieldmail"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_PHONE',GETPOST("fieldphone"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_FIELD_PHONE',GETPOST("fieldphone"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_MOBILE',GETPOST("fieldmobile"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_FIELD_MOBILE',GETPOST("fieldmobile"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_SKYPE',GETPOST("fieldskype"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_FIELD_SKYPE',GETPOST("fieldskype"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_FAX',GETPOST("fieldfax"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_FIELD_FAX',GETPOST("fieldfax"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_COMPANY',GETPOST("fieldcompany"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_FIELD_COMPANY',GETPOST("fieldcompany"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_ADDRESS',GETPOST("fieldaddress"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_FIELD_ADDRESS',GETPOST("fieldaddress"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
@ -74,22 +74,22 @@ if ($action == 'setvalue' && $user->admin)
|
|||||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_SID',GETPOST("fieldsid"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_FIELD_SID',GETPOST("fieldsid"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_TITLE',GETPOST("fieldtitle"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_FIELD_TITLE',GETPOST("fieldtitle"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
|
|
||||||
// This one must be after the others
|
// This one must be after the others
|
||||||
$valkey='';
|
$valkey='';
|
||||||
$key=GETPOST("key");
|
$key=GETPOST("key");
|
||||||
if ($key) $valkey=$conf->global->$key;
|
if ($key) $valkey=$conf->global->$key;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_KEY_USERS',$valkey,'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_KEY_USERS',$valkey,'chaine',0,'',$conf->entity)) $error++;
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -430,7 +430,7 @@ if (function_exists("ldap_connect"))
|
|||||||
{
|
{
|
||||||
$required_fields = array(
|
$required_fields = array(
|
||||||
$conf->global->LDAP_KEY_USERS,
|
$conf->global->LDAP_KEY_USERS,
|
||||||
$conf->global->LDAP_FIELD_FULLNAME,
|
$conf->global->LDAP_FIELD_FULLNAME,
|
||||||
$conf->global->LDAP_FIELD_NAME,
|
$conf->global->LDAP_FIELD_NAME,
|
||||||
$conf->global->LDAP_FIELD_FIRSTNAME,
|
$conf->global->LDAP_FIELD_FIRSTNAME,
|
||||||
$conf->global->LDAP_FIELD_LOGIN,
|
$conf->global->LDAP_FIELD_LOGIN,
|
||||||
@ -439,7 +439,7 @@ if (function_exists("ldap_connect"))
|
|||||||
$conf->global->LDAP_FIELD_PASSWORD_CRYPTED,
|
$conf->global->LDAP_FIELD_PASSWORD_CRYPTED,
|
||||||
$conf->global->LDAP_FIELD_PHONE,
|
$conf->global->LDAP_FIELD_PHONE,
|
||||||
$conf->global->LDAP_FIELD_FAX,
|
$conf->global->LDAP_FIELD_FAX,
|
||||||
$conf->global->LDAP_FIELD_SKYPE,
|
$conf->global->LDAP_FIELD_SKYPE,
|
||||||
$conf->global->LDAP_FIELD_MOBILE,
|
$conf->global->LDAP_FIELD_MOBILE,
|
||||||
$conf->global->LDAP_FIELD_MAIL,
|
$conf->global->LDAP_FIELD_MAIL,
|
||||||
$conf->global->LDAP_FIELD_TITLE,
|
$conf->global->LDAP_FIELD_TITLE,
|
||||||
@ -447,35 +447,35 @@ if (function_exists("ldap_connect"))
|
|||||||
$conf->global->LDAP_FIELD_SID
|
$conf->global->LDAP_FIELD_SID
|
||||||
);
|
);
|
||||||
|
|
||||||
// Remove from required_fields all entries not configured in LDAP (empty) and duplicated
|
// Remove from required_fields all entries not configured in LDAP (empty) and duplicated
|
||||||
$required_fields=array_unique(array_values(array_filter($required_fields, "dol_validElement")));
|
$required_fields=array_unique(array_values(array_filter($required_fields, "dol_validElement")));
|
||||||
|
|
||||||
// Get from LDAP database an array of results
|
// Get from LDAP database an array of results
|
||||||
$ldapusers = $ldap->getRecords('*', $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, $required_fields, 1);
|
$ldapusers = $ldap->getRecords('*', $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, $required_fields, 1);
|
||||||
//$ldapusers = $ldap->getRecords('*', $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, '', 1);
|
//$ldapusers = $ldap->getRecords('*', $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, '', 1);
|
||||||
|
|
||||||
if (is_array($ldapusers))
|
if (is_array($ldapusers))
|
||||||
{
|
{
|
||||||
$liste=array();
|
$liste=array();
|
||||||
foreach ($ldapusers as $key => $ldapuser)
|
foreach ($ldapusers as $key => $ldapuser)
|
||||||
{
|
{
|
||||||
// Define the label string for this user
|
// Define the label string for this user
|
||||||
$label='';
|
$label='';
|
||||||
foreach ($required_fields as $value)
|
foreach ($required_fields as $value)
|
||||||
{
|
{
|
||||||
if ($value)
|
if ($value)
|
||||||
{
|
{
|
||||||
$label.=$value."=".$ldapuser[$value]." ";
|
$label.=$value."=".$ldapuser[$value]." ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$liste[$key] = $label;
|
$liste[$key] = $label;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessages($ldap->error, $ldap->errors, 'errors');
|
setEventMessages($ldap->error, $ldap->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
print "LDAP search for user:<br>\n";
|
print "LDAP search for user:<br>\n";
|
||||||
|
|||||||
@ -87,94 +87,94 @@ class Documents extends DolibarrApi
|
|||||||
|
|
||||||
if (preg_match('/\.\./',$original_file) || preg_match('/[<>|]/',$original_file))
|
if (preg_match('/\.\./',$original_file) || preg_match('/[<>|]/',$original_file))
|
||||||
{
|
{
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
if (!$accessallowed) {
|
||||||
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
if (!$accessallowed) {
|
|
||||||
throw new RestException(401);
|
|
||||||
}
|
|
||||||
|
|
||||||
// --- Generates the document
|
// --- Generates the document
|
||||||
if ($regeneratedoc)
|
if ($regeneratedoc)
|
||||||
{
|
{
|
||||||
$hidedetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 0 : 1;
|
$hidedetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 0 : 1;
|
||||||
$hidedesc = empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 0 : 1;
|
$hidedesc = empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 0 : 1;
|
||||||
$hideref = empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 0 : 1;
|
$hideref = empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 0 : 1;
|
||||||
|
|
||||||
if ($module_part == 'facture' || $module_part == 'invoice')
|
if ($module_part == 'facture' || $module_part == 'invoice')
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||||
$this->invoice = new Facture($this->db);
|
$this->invoice = new Facture($this->db);
|
||||||
$result = $this->invoice->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
|
$result = $this->invoice->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
|
||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Invoice not found');
|
throw new RestException(404, 'Invoice not found');
|
||||||
}
|
}
|
||||||
$result = $this->invoice->generateDocument($this->invoice->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$result = $this->invoice->generateDocument($this->invoice->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
if( $result <= 0 ) {
|
if( $result <= 0 ) {
|
||||||
throw new RestException(500, 'Error generating document');
|
throw new RestException(500, 'Error generating document');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$filename = basename($original_file);
|
$filename = basename($original_file);
|
||||||
$original_file_osencoded=dol_osencode($original_file); // New file name encoded in OS encoding charset
|
$original_file_osencoded=dol_osencode($original_file); // New file name encoded in OS encoding charset
|
||||||
|
|
||||||
if (! file_exists($original_file_osencoded))
|
if (! file_exists($original_file_osencoded))
|
||||||
{
|
{
|
||||||
throw new RestException(404, 'File not found');
|
throw new RestException(404, 'File not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
$file_content=file_get_contents($original_file_osencoded);
|
$file_content=file_get_contents($original_file_osencoded);
|
||||||
return array('filename'=>$filename, 'content'=>base64_encode($file_content), 'encoding'=>'MIME base64 (base64_encode php function, http://php.net/manual/en/function.base64-encode.php)' );
|
return array('filename'=>$filename, 'content'=>base64_encode($file_content), 'encoding'=>'MIME base64 (base64_encode php function, http://php.net/manual/en/function.base64-encode.php)' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a document.
|
* Return a document.
|
||||||
*
|
*
|
||||||
* @param int $id ID of document
|
* @param int $id ID of document
|
||||||
* @return array Array with data of file
|
* @return array Array with data of file
|
||||||
*
|
*
|
||||||
* @throws RestException
|
* @throws RestException
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
public function get($id) {
|
public function get($id) {
|
||||||
return array('note'=>'xxx');
|
return array('note'=>'xxx');
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Push a file.
|
* Push a file.
|
||||||
* Test sample 1: { "filename": "mynewfile.txt", "modulepart": "facture", "ref": "FA1701-001", "subdir": "", "filecontent": "content text", "fileencoding": "", "overwriteifexists": "0" }.
|
* Test sample 1: { "filename": "mynewfile.txt", "modulepart": "facture", "ref": "FA1701-001", "subdir": "", "filecontent": "content text", "fileencoding": "", "overwriteifexists": "0" }.
|
||||||
* Test sample 2: { "filename": "mynewfile.txt", "modulepart": "medias", "ref": "", "subdir": "mysubdir1/mysubdir2", "filecontent": "content text", "fileencoding": "", "overwriteifexists": "0" }.
|
* Test sample 2: { "filename": "mynewfile.txt", "modulepart": "medias", "ref": "", "subdir": "mysubdir1/mysubdir2", "filecontent": "content text", "fileencoding": "", "overwriteifexists": "0" }.
|
||||||
*
|
*
|
||||||
* @param string $filename Name of file to create ('FA1705-0123')
|
* @param string $filename Name of file to create ('FA1705-0123')
|
||||||
* @param string $modulepart Name of module or area concerned by file upload ('facture', ...)
|
* @param string $modulepart Name of module or area concerned by file upload ('facture', ...)
|
||||||
* @param string $ref Reference of object (This will define subdir automatically and store submited file into it)
|
* @param string $ref Reference of object (This will define subdir automatically and store submited file into it)
|
||||||
* @param string $subdir Subdirectory (Only if ref not provided)
|
* @param string $subdir Subdirectory (Only if ref not provided)
|
||||||
* @param string $filecontent File content (string with file content. An empty file will be created if this parameter is not provided)
|
* @param string $filecontent File content (string with file content. An empty file will be created if this parameter is not provided)
|
||||||
* @param string $fileencoding File encoding (''=no encoding, 'base64'=Base 64)
|
* @param string $fileencoding File encoding (''=no encoding, 'base64'=Base 64)
|
||||||
* @param int $overwriteifexists Overwrite file if exists (1 by default)
|
* @param int $overwriteifexists Overwrite file if exists (1 by default)
|
||||||
* @return bool State of copy
|
* @return bool State of copy
|
||||||
* @throws RestException
|
* @throws RestException
|
||||||
*/
|
*/
|
||||||
public function post($filename, $modulepart, $ref='', $subdir='', $filecontent='', $fileencoding='', $overwriteifexists=0)
|
public function post($filename, $modulepart, $ref='', $subdir='', $filecontent='', $fileencoding='', $overwriteifexists=0)
|
||||||
{
|
{
|
||||||
global $db, $conf;
|
global $db, $conf;
|
||||||
|
|
||||||
/*var_dump($modulepart);
|
/*var_dump($modulepart);
|
||||||
var_dump($filename);
|
var_dump($filename);
|
||||||
var_dump($filecontent);
|
var_dump($filecontent);
|
||||||
exit;*/
|
exit;*/
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||||
|
|
||||||
if (!DolibarrApiAccess::$user->rights->ecm->upload) {
|
if (!DolibarrApiAccess::$user->rights->ecm->upload) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
|
|
||||||
$newfilecontent = '';
|
$newfilecontent = '';
|
||||||
if (empty($fileencoding)) $newfilecontent = $filecontent;
|
if (empty($fileencoding)) $newfilecontent = $filecontent;
|
||||||
if ($fileencoding == 'base64') $newfilecontent = base64_decode($filecontent);
|
if ($fileencoding == 'base64') $newfilecontent = base64_decode($filecontent);
|
||||||
|
|
||||||
$original_file = dol_sanitizeFileName($filename);
|
$original_file = dol_sanitizeFileName($filename);
|
||||||
|
|
||||||
|
|||||||
@ -231,8 +231,8 @@ if (empty($reshook))
|
|||||||
|
|
||||||
// Validation
|
// Validation
|
||||||
else if ($action == 'confirm_validate' && $confirm == 'yes' &&
|
else if ($action == 'confirm_validate' && $confirm == 'yes' &&
|
||||||
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->creer))
|
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->creer))
|
||||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->propal_advance->validate)))
|
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->propal_advance->validate)))
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
$result = $object->valid($user);
|
$result = $object->valid($user);
|
||||||
@ -294,15 +294,15 @@ if (empty($reshook))
|
|||||||
$result = $object->set_ref_client($user, GETPOST('ref_client'));
|
$result = $object->set_ref_client($user, GETPOST('ref_client'));
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set incoterm
|
// Set incoterm
|
||||||
elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled))
|
elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled))
|
||||||
{
|
{
|
||||||
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
|
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create proposal
|
// Create proposal
|
||||||
else if ($action == 'add' && $user->rights->propal->creer)
|
else if ($action == 'add' && $user->rights->propal->creer)
|
||||||
@ -346,11 +346,11 @@ if (empty($reshook))
|
|||||||
$object->availability_id = GETPOST('availability_id');
|
$object->availability_id = GETPOST('availability_id');
|
||||||
$object->demand_reason_id = GETPOST('demand_reason_id');
|
$object->demand_reason_id = GETPOST('demand_reason_id');
|
||||||
$object->fk_delivery_address = GETPOST('fk_address');
|
$object->fk_delivery_address = GETPOST('fk_address');
|
||||||
$object->shipping_method_id = GETPOST('shipping_method_id', 'int');
|
$object->shipping_method_id = GETPOST('shipping_method_id', 'int');
|
||||||
$object->duree_validite = $duration;
|
$object->duree_validite = $duration;
|
||||||
$object->cond_reglement_id = GETPOST('cond_reglement_id');
|
$object->cond_reglement_id = GETPOST('cond_reglement_id');
|
||||||
$object->mode_reglement_id = GETPOST('mode_reglement_id');
|
$object->mode_reglement_id = GETPOST('mode_reglement_id');
|
||||||
$object->fk_account = GETPOST('fk_account', 'int');
|
$object->fk_account = GETPOST('fk_account', 'int');
|
||||||
$object->remise_percent = GETPOST('remise_percent');
|
$object->remise_percent = GETPOST('remise_percent');
|
||||||
$object->remise_absolue = GETPOST('remise_absolue');
|
$object->remise_absolue = GETPOST('remise_absolue');
|
||||||
$object->socid = GETPOST('socid');
|
$object->socid = GETPOST('socid');
|
||||||
@ -377,11 +377,11 @@ if (empty($reshook))
|
|||||||
$object->availability_id = GETPOST('availability_id');
|
$object->availability_id = GETPOST('availability_id');
|
||||||
$object->demand_reason_id = GETPOST('demand_reason_id');
|
$object->demand_reason_id = GETPOST('demand_reason_id');
|
||||||
$object->fk_delivery_address = GETPOST('fk_address');
|
$object->fk_delivery_address = GETPOST('fk_address');
|
||||||
$object->shipping_method_id = GETPOST('shipping_method_id', 'int');
|
$object->shipping_method_id = GETPOST('shipping_method_id', 'int');
|
||||||
$object->duree_validite = GETPOST('duree_validite');
|
$object->duree_validite = GETPOST('duree_validite');
|
||||||
$object->cond_reglement_id = GETPOST('cond_reglement_id');
|
$object->cond_reglement_id = GETPOST('cond_reglement_id');
|
||||||
$object->mode_reglement_id = GETPOST('mode_reglement_id');
|
$object->mode_reglement_id = GETPOST('mode_reglement_id');
|
||||||
$object->fk_account = GETPOST('fk_account', 'int');
|
$object->fk_account = GETPOST('fk_account', 'int');
|
||||||
$object->contactid = GETPOST('contactid');
|
$object->contactid = GETPOST('contactid');
|
||||||
$object->fk_project = GETPOST('projectid');
|
$object->fk_project = GETPOST('projectid');
|
||||||
$object->modelpdf = GETPOST('model');
|
$object->modelpdf = GETPOST('model');
|
||||||
@ -527,7 +527,7 @@ if (empty($reshook))
|
|||||||
// Hooks
|
// Hooks
|
||||||
$parameters = array('objFrom' => $srcobject);
|
$parameters = array('objFrom' => $srcobject);
|
||||||
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
|
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
|
||||||
// modified by hook
|
// modified by hook
|
||||||
if ($reshook < 0)
|
if ($reshook < 0)
|
||||||
$error ++;
|
$error ++;
|
||||||
} else {
|
} else {
|
||||||
@ -561,23 +561,23 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
|
|
||||||
// Define output language
|
// Define output language
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||||
{
|
{
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
$newlang = '';
|
$newlang = '';
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||||
if (! empty($newlang)) {
|
if (! empty($newlang)) {
|
||||||
$outputlangs = new Translate("", $conf);
|
$outputlangs = new Translate("", $conf);
|
||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
$model=$object->modelpdf;
|
$model=$object->modelpdf;
|
||||||
|
|
||||||
$ret = $object->fetch($id); // Reload to get new records
|
$ret = $object->fetch($id); // Reload to get new records
|
||||||
$result=$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$result=$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
if ($result < 0) dol_print_error($db,$result);
|
if ($result < 0) dol_print_error($db,$result);
|
||||||
}
|
}
|
||||||
|
|
||||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id);
|
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id);
|
||||||
exit();
|
exit();
|
||||||
@ -647,7 +647,7 @@ if (empty($reshook))
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||||
|
|
||||||
// Actions to send emails
|
// Actions to send emails
|
||||||
$actiontypecode='AC_OTH_AUTO';
|
$actiontypecode='AC_OTH_AUTO';
|
||||||
$trigger_name='PROPAL_SENTBYMAIL';
|
$trigger_name='PROPAL_SENTBYMAIL';
|
||||||
$autocopy='MAIN_MAIL_AUTOCOPY_PROPOSAL_TO';
|
$autocopy='MAIN_MAIL_AUTOCOPY_PROPOSAL_TO';
|
||||||
$trackid='pro'.$object->id;
|
$trackid='pro'.$object->id;
|
||||||
@ -756,7 +756,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
// $tva_tx can be 'x.x (XXX)'
|
// $tva_tx can be 'x.x (XXX)'
|
||||||
|
|
||||||
// Ecrase $pu par celui du produit
|
// Ecrase $pu par celui du produit
|
||||||
// Ecrase $desc par celui du produit
|
// Ecrase $desc par celui du produit
|
||||||
@ -781,7 +781,7 @@ if (empty($reshook))
|
|||||||
// On defini prix unitaire
|
// On defini prix unitaire
|
||||||
if (! empty($conf->global->PRODUIT_MULTIPRICES) && $object->thirdparty->price_level)
|
if (! empty($conf->global->PRODUIT_MULTIPRICES) && $object->thirdparty->price_level)
|
||||||
{
|
{
|
||||||
$pu_ht = $prod->multiprices[$object->thirdparty->price_level];
|
$pu_ht = $prod->multiprices[$object->thirdparty->price_level];
|
||||||
$pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level];
|
$pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level];
|
||||||
$price_min = $prod->multiprices_min[$object->thirdparty->price_level];
|
$price_min = $prod->multiprices_min[$object->thirdparty->price_level];
|
||||||
$price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level];
|
$price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level];
|
||||||
@ -801,7 +801,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter);
|
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
// If there is some prices specific to the customer
|
// If there is some prices specific to the customer
|
||||||
if (count($prodcustprice->lines) > 0) {
|
if (count($prodcustprice->lines) > 0) {
|
||||||
$pu_ht = price($prodcustprice->lines[0]->price);
|
$pu_ht = price($prodcustprice->lines[0]->price);
|
||||||
$pu_ttc = price($prodcustprice->lines[0]->price_ttc);
|
$pu_ttc = price($prodcustprice->lines[0]->price_ttc);
|
||||||
@ -949,18 +949,18 @@ if (empty($reshook))
|
|||||||
unset($_POST['idprod']);
|
unset($_POST['idprod']);
|
||||||
unset($_POST['units']);
|
unset($_POST['units']);
|
||||||
|
|
||||||
unset($_POST['date_starthour']);
|
unset($_POST['date_starthour']);
|
||||||
unset($_POST['date_startmin']);
|
unset($_POST['date_startmin']);
|
||||||
unset($_POST['date_startsec']);
|
unset($_POST['date_startsec']);
|
||||||
unset($_POST['date_startday']);
|
unset($_POST['date_startday']);
|
||||||
unset($_POST['date_startmonth']);
|
unset($_POST['date_startmonth']);
|
||||||
unset($_POST['date_startyear']);
|
unset($_POST['date_startyear']);
|
||||||
unset($_POST['date_endhour']);
|
unset($_POST['date_endhour']);
|
||||||
unset($_POST['date_endmin']);
|
unset($_POST['date_endmin']);
|
||||||
unset($_POST['date_endsec']);
|
unset($_POST['date_endsec']);
|
||||||
unset($_POST['date_endday']);
|
unset($_POST['date_endday']);
|
||||||
unset($_POST['date_endmonth']);
|
unset($_POST['date_endmonth']);
|
||||||
unset($_POST['date_endyear']);
|
unset($_POST['date_endyear']);
|
||||||
} else {
|
} else {
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
|
|
||||||
@ -1159,12 +1159,12 @@ if (empty($reshook))
|
|||||||
|
|
||||||
// bank account
|
// bank account
|
||||||
else if ($action == 'setbankaccount' && $user->rights->propal->creer) {
|
else if ($action == 'setbankaccount' && $user->rights->propal->creer) {
|
||||||
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
|
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// shipping method
|
// shipping method
|
||||||
else if ($action == 'setshippingmethod' && $user->rights->propal->creer) {
|
else if ($action == 'setshippingmethod' && $user->rights->propal->creer) {
|
||||||
$result=$object->setShippingMethod(GETPOST('shipping_method_id', 'int'));
|
$result=$object->setShippingMethod(GETPOST('shipping_method_id', 'int'));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'update_extras') {
|
else if ($action == 'update_extras') {
|
||||||
@ -1225,10 +1225,10 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions to build doc
|
// Actions to build doc
|
||||||
$upload_dir = $conf->propal->dir_output;
|
$upload_dir = $conf->propal->dir_output;
|
||||||
$permissioncreate=$user->rights->propal->creer;
|
$permissioncreate=$user->rights->propal->creer;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1252,7 +1252,7 @@ $now = dol_now();
|
|||||||
// Add new proposal
|
// Add new proposal
|
||||||
if ($action == 'create')
|
if ($action == 'create')
|
||||||
{
|
{
|
||||||
$currency_code = $conf->currency;
|
$currency_code = $conf->currency;
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("NewProp"));
|
print load_fiche_titre($langs->trans("NewProp"));
|
||||||
|
|
||||||
@ -1317,14 +1317,14 @@ if ($action == 'create')
|
|||||||
|
|
||||||
if (!empty($conf->multicurrency->enabled))
|
if (!empty($conf->multicurrency->enabled))
|
||||||
{
|
{
|
||||||
if (!empty($objectsrc->multicurrency_code)) $currency_code = $objectsrc->multicurrency_code;
|
if (!empty($objectsrc->multicurrency_code)) $currency_code = $objectsrc->multicurrency_code;
|
||||||
if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx;
|
if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code;
|
if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
$object = new Propal($db);
|
$object = new Propal($db);
|
||||||
@ -1359,9 +1359,9 @@ if ($action == 'create')
|
|||||||
print $soc->getNomUrl(1);
|
print $soc->getNomUrl(1);
|
||||||
print '<input type="hidden" name="socid" value="' . $soc->id . '">';
|
print '<input type="hidden" name="socid" value="' . $soc->id . '">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD) && ! empty($soc->shipping_method_id)) {
|
if (! empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD) && ! empty($soc->shipping_method_id)) {
|
||||||
$shipping_method_id = $soc->shipping_method_id;
|
$shipping_method_id = $soc->shipping_method_id;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300');
|
print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300');
|
||||||
@ -1427,12 +1427,12 @@ if ($action == 'create')
|
|||||||
$form->select_types_paiements($soc->mode_reglement_id, 'mode_reglement_id');
|
$form->select_types_paiements($soc->mode_reglement_id, 'mode_reglement_id');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Bank Account
|
// Bank Account
|
||||||
if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && ! empty($conf->banque->enabled)) {
|
if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && ! empty($conf->banque->enabled)) {
|
||||||
print '<tr><td>' . $langs->trans('BankAccount') . '</td><td>';
|
print '<tr><td>' . $langs->trans('BankAccount') . '</td><td>';
|
||||||
$form->select_comptes($fk_account, 'fk_account', 0, '', 1);
|
$form->select_comptes($fk_account, 'fk_account', 0, '', 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// What trigger creation
|
// What trigger creation
|
||||||
print '<tr><td>' . $langs->trans('Source') . '</td><td>';
|
print '<tr><td>' . $langs->trans('Source') . '</td><td>';
|
||||||
@ -1444,12 +1444,12 @@ if ($action == 'create')
|
|||||||
$form->selectAvailabilityDelay('', 'availability_id', '', 1);
|
$form->selectAvailabilityDelay('', 'availability_id', '', 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Shipping Method
|
// Shipping Method
|
||||||
if (! empty($conf->expedition->enabled)) {
|
if (! empty($conf->expedition->enabled)) {
|
||||||
print '<tr><td>' . $langs->trans('SendingMethod') . '</td><td>';
|
print '<tr><td>' . $langs->trans('SendingMethod') . '</td><td>';
|
||||||
print $form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1);
|
print $form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delivery date (or manufacturing)
|
// Delivery date (or manufacturing)
|
||||||
print '<tr><td>' . $langs->trans("DeliveryDate") . '</td>';
|
print '<tr><td>' . $langs->trans("DeliveryDate") . '</td>';
|
||||||
@ -1485,8 +1485,8 @@ if ($action == 'create')
|
|||||||
{
|
{
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), $soc->libelle_incoterms, 1).'</label></td>';
|
print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), $soc->libelle_incoterms, 1).'</label></td>';
|
||||||
print '<td class="maxwidthonsmartphone">';
|
print '<td class="maxwidthonsmartphone">';
|
||||||
print $form->select_incoterms((!empty($soc->fk_incoterms) ? $soc->fk_incoterms : ''), (!empty($soc->location_incoterms)?$soc->location_incoterms:''));
|
print $form->select_incoterms((!empty($soc->fk_incoterms) ? $soc->fk_incoterms : ''), (!empty($soc->location_incoterms)?$soc->location_incoterms:''));
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1503,8 +1503,8 @@ if ($action == 'create')
|
|||||||
{
|
{
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>'.fieldLabel('Currency','multicurrency_code').'</td>';
|
print '<td>'.fieldLabel('Currency','multicurrency_code').'</td>';
|
||||||
print '<td class="maxwidthonsmartphone">';
|
print '<td class="maxwidthonsmartphone">';
|
||||||
print $form->selectMultiCurrency($currency_code, 'multicurrency_code', 0);
|
print $form->selectMultiCurrency($currency_code, 'multicurrency_code', 0);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1522,7 +1522,7 @@ if ($action == 'create')
|
|||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td class="tdtop">' . $langs->trans('NotePrivate') . '</td>';
|
print '<td class="tdtop">' . $langs->trans('NotePrivate') . '</td>';
|
||||||
print '<td valign="top">';
|
print '<td valign="top">';
|
||||||
$note_private = $object->getDefaultCreateValueFor('note_private', ((! empty($origin) && ! empty($originid) && is_object($objectsrc))?$objectsrc->note_private:null));
|
$note_private = $object->getDefaultCreateValueFor('note_private', ((! empty($origin) && ! empty($originid) && is_object($objectsrc))?$objectsrc->note_private:null));
|
||||||
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
|
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
|
||||||
print $doleditor->Create(1);
|
print $doleditor->Create(1);
|
||||||
// print '<textarea name="note_private" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_private.'.</textarea>
|
// print '<textarea name="note_private" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_private.'.</textarea>
|
||||||
@ -1587,7 +1587,7 @@ if ($action == 'create')
|
|||||||
|
|
||||||
if (! empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE))
|
if (! empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE))
|
||||||
{
|
{
|
||||||
print '<br><table>';
|
print '<br><table>';
|
||||||
|
|
||||||
// For backward compatibility
|
// For backward compatibility
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
@ -1690,13 +1690,13 @@ if ($action == 'create')
|
|||||||
//array('type' => 'other','name' => 'note_private', 'label' => $langs->trans("Note"),'value' => '<textarea cols="30" rows="' . ROWS_3 . '" wrap="soft" name="note_private" id="note_private">'.$object->note_private.'</textarea>'));
|
//array('type' => 'other','name' => 'note_private', 'label' => $langs->trans("Note"),'value' => '<textarea cols="30" rows="' . ROWS_3 . '" wrap="soft" name="note_private" id="note_private">'.$object->note_private.'</textarea>'));
|
||||||
array('type' => 'text', 'name' => 'note_private', 'label' => $langs->trans("Note"),'value' => $object->note_private));
|
array('type' => 'text', 'name' => 'note_private', 'label' => $langs->trans("Note"),'value' => $object->note_private));
|
||||||
|
|
||||||
if (! empty($conf->notification->enabled)) {
|
if (! empty($conf->notification->enabled)) {
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
|
||||||
$notify = new Notify($db);
|
$notify = new Notify($db);
|
||||||
$formquestion = array_merge($formquestion, array(
|
$formquestion = array_merge($formquestion, array(
|
||||||
array('type' => 'onecolumn', 'value' => $notify->confirmMessage('PROPAL_CLOSE_SIGNED', $object->socid, $object)),
|
array('type' => 'onecolumn', 'value' => $notify->confirmMessage('PROPAL_CLOSE_SIGNED', $object->socid, $object)),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('SetAcceptedRefused'), $text, 'setstatut', $formquestion, '', 1, 250);
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('SetAcceptedRefused'), $text, 'setstatut', $formquestion, '', 1, 250);
|
||||||
|
|
||||||
@ -1765,50 +1765,50 @@ if ($action == 'create')
|
|||||||
// Ref customer
|
// Ref customer
|
||||||
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->propal->creer, 'string', '', 0, 1);
|
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->propal->creer, 'string', '', 0, 1);
|
||||||
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->propal->creer, 'string', '', null, null, '', 1);
|
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->propal->creer, 'string', '', null, null, '', 1);
|
||||||
// Thirdparty
|
// Thirdparty
|
||||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||||
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' (<a href="'.DOL_URL_ROOT.'/comm/propal/list.php?socid='.$object->thirdparty->id.'">'.$langs->trans("OtherProposals").'</a>)';
|
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' (<a href="'.DOL_URL_ROOT.'/comm/propal/list.php?socid='.$object->thirdparty->id.'">'.$langs->trans("OtherProposals").'</a>)';
|
||||||
// Project
|
// Project
|
||||||
if (! empty($conf->projet->enabled))
|
if (! empty($conf->projet->enabled))
|
||||||
{
|
{
|
||||||
$langs->load("projects");
|
$langs->load("projects");
|
||||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||||
if ($user->rights->propal->creer)
|
if ($user->rights->propal->creer)
|
||||||
{
|
{
|
||||||
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);
|
||||||
$proj->fetch($object->fk_project);
|
$proj->fetch($object->fk_project);
|
||||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||||
$morehtmlref.=$proj->ref;
|
$morehtmlref.=$proj->ref;
|
||||||
$morehtmlref.='</a>';
|
$morehtmlref.='</a>';
|
||||||
} else {
|
} else {
|
||||||
$morehtmlref.='';
|
$morehtmlref.='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$morehtmlref.='</div>';
|
$morehtmlref.='</div>';
|
||||||
|
|
||||||
|
|
||||||
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%">';
|
||||||
|
|
||||||
@ -1941,24 +1941,24 @@ if ($action == 'create')
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Shipping Method
|
// Shipping Method
|
||||||
if (! empty($conf->expedition->enabled)) {
|
if (! empty($conf->expedition->enabled)) {
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||||
print $langs->trans('SendingMethod');
|
print $langs->trans('SendingMethod');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if ($action != 'editshippingmethod' && $user->rights->propal->creer)
|
if ($action != 'editshippingmethod' && $user->rights->propal->creer)
|
||||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editshippingmethod&id='.$object->id.'">'.img_edit($langs->trans('SetShippingMode'),1).'</a></td>';
|
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editshippingmethod&id='.$object->id.'">'.img_edit($langs->trans('SetShippingMode'),1).'</a></td>';
|
||||||
print '</tr></table>';
|
print '</tr></table>';
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
if ($action == 'editshippingmethod') {
|
if ($action == 'editshippingmethod') {
|
||||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1);
|
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1);
|
||||||
} else {
|
} else {
|
||||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'none');
|
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'none');
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Origin of demand
|
// Origin of demand
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
@ -2054,36 +2054,36 @@ if ($action == 'create')
|
|||||||
|
|
||||||
if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && ! empty($conf->banque->enabled))
|
if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && ! empty($conf->banque->enabled))
|
||||||
{
|
{
|
||||||
// Bank Account
|
// Bank Account
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||||
print $langs->trans('BankAccount');
|
print $langs->trans('BankAccount');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if ($action != 'editbankaccount' && $user->rights->propal->creer)
|
if ($action != 'editbankaccount' && $user->rights->propal->creer)
|
||||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
|
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
|
||||||
print '</tr></table>';
|
print '</tr></table>';
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
if ($action == 'editbankaccount') {
|
if ($action == 'editbankaccount') {
|
||||||
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
|
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
|
||||||
} else {
|
} else {
|
||||||
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
|
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Incoterms
|
// Incoterms
|
||||||
if (!empty($conf->incoterm->enabled))
|
if (!empty($conf->incoterm->enabled))
|
||||||
{
|
{
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||||
print $langs->trans('IncotermLabel');
|
print $langs->trans('IncotermLabel');
|
||||||
print '<td><td align="right">';
|
print '<td><td align="right">';
|
||||||
if ($user->rights->propal->creer) print '<a href="'.DOL_URL_ROOT.'/comm/propal/card.php?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
|
if ($user->rights->propal->creer) print '<a href="'.DOL_URL_ROOT.'/comm/propal/card.php?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
|
||||||
else print ' ';
|
else print ' ';
|
||||||
print '</td></tr></table>';
|
print '</td></tr></table>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if ($action != 'editincoterm')
|
if ($action != 'editincoterm')
|
||||||
{
|
{
|
||||||
print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1);
|
print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1);
|
||||||
@ -2092,7 +2092,7 @@ if ($action == 'create')
|
|||||||
{
|
{
|
||||||
print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?id='.$object->id);
|
print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?id='.$object->id);
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
@ -2105,25 +2105,25 @@ if ($action == 'create')
|
|||||||
print '<div class="ficheaddleft">';
|
print '<div class="ficheaddleft">';
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
print '<table class="border centpercent">';
|
print '<table class="border centpercent">';
|
||||||
|
|
||||||
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency))
|
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency))
|
||||||
{
|
{
|
||||||
// Multicurrency Amount HT
|
// Multicurrency Amount HT
|
||||||
print '<tr><td class="titlefieldmiddle">' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '</td>';
|
print '<tr><td class="titlefieldmiddle">' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '</td>';
|
||||||
print '<td class="nowrap">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
print '<td class="nowrap">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Multicurrency Amount VAT
|
// Multicurrency Amount VAT
|
||||||
print '<tr><td>' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '</td>';
|
print '<tr><td>' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '</td>';
|
||||||
print '<td class="nowrap">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
print '<td class="nowrap">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Multicurrency Amount TTC
|
// Multicurrency Amount TTC
|
||||||
print '<tr><td>' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '</td>';
|
print '<tr><td>' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '</td>';
|
||||||
print '<td class="nowrap">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
print '<td class="nowrap">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Amount HT
|
// Amount HT
|
||||||
print '<tr><td class="titlefieldmiddle">' . $langs->trans('AmountHT') . '</td>';
|
print '<tr><td class="titlefieldmiddle">' . $langs->trans('AmountHT') . '</td>';
|
||||||
@ -2138,15 +2138,15 @@ if ($action == 'create')
|
|||||||
// Amount Local Taxes
|
// Amount Local Taxes
|
||||||
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) // Localtax1
|
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) // Localtax1
|
||||||
{
|
{
|
||||||
print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>';
|
print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>';
|
||||||
print '<td class="nowrap">' . price($object->total_localtax1, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>';
|
print '<td class="nowrap">' . price($object->total_localtax1, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) // Localtax2
|
if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) // Localtax2
|
||||||
{
|
{
|
||||||
print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>';
|
print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>';
|
||||||
print '<td class="nowrap">' . price($object->total_localtax2, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>';
|
print '<td class="nowrap">' . price($object->total_localtax2, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Amount TTC
|
// Amount TTC
|
||||||
@ -2162,7 +2162,7 @@ if ($action == 'create')
|
|||||||
// Margin Infos
|
// Margin Infos
|
||||||
if (! empty($conf->margin->enabled))
|
if (! empty($conf->margin->enabled))
|
||||||
{
|
{
|
||||||
$formmargin->displayMarginInfos($object);
|
$formmargin->displayMarginInfos($object);
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
@ -2201,7 +2201,7 @@ if ($action == 'create')
|
|||||||
include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
|
include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<div class="div-table-responsive">';
|
print '<div class="div-table-responsive">';
|
||||||
print '<table id="tablelines" class="noborder noshadow" width="100%">';
|
print '<table id="tablelines" class="noborder noshadow" width="100%">';
|
||||||
|
|
||||||
if (! empty($object->lines))
|
if (! empty($object->lines))
|
||||||
@ -2223,7 +2223,7 @@ if ($action == 'create')
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print "</form>\n";
|
print "</form>\n";
|
||||||
|
|
||||||
@ -2237,7 +2237,7 @@ if ($action == 'create')
|
|||||||
|
|
||||||
$parameters = array();
|
$parameters = array();
|
||||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
|
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
|
||||||
// modified by hook
|
// modified by hook
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
if ($action != 'editline')
|
if ($action != 'editline')
|
||||||
@ -2245,12 +2245,12 @@ if ($action == 'create')
|
|||||||
// Validate
|
// Validate
|
||||||
if ($object->statut == Propal::STATUS_DRAFT && $object->total_ttc >= 0 && count($object->lines) > 0)
|
if ($object->statut == Propal::STATUS_DRAFT && $object->total_ttc >= 0 && count($object->lines) > 0)
|
||||||
{
|
{
|
||||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->creer))
|
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->creer))
|
||||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->propal_advance->validate)))
|
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->propal_advance->validate)))
|
||||||
{
|
{
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=validate">' . $langs->trans('Validate') . '</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=validate">' . $langs->trans('Validate') . '</a></div>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#">' . $langs->trans('Validate') . '</a></div>';
|
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#">' . $langs->trans('Validate') . '</a></div>';
|
||||||
}
|
}
|
||||||
// Create event
|
// Create event
|
||||||
|
|||||||
@ -30,225 +30,225 @@ require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
|||||||
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'
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var propal $propal {@type propal}
|
* @var propal $propal {@type propal}
|
||||||
*/
|
*/
|
||||||
public $propal;
|
public $propal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
global $db, $conf;
|
global $db, $conf;
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
$this->propal = new Propal($this->db);
|
$this->propal = new Propal($this->db);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get properties of a commercial proposal object
|
* Get properties of a commercial proposal object
|
||||||
*
|
|
||||||
* Return an array with commercial proposal informations
|
|
||||||
*
|
|
||||||
* @param int $id ID of commercial proposal
|
|
||||||
* @return array|mixed data without useless information
|
|
||||||
*
|
*
|
||||||
* @throws RestException
|
* Return an array with commercial proposal informations
|
||||||
*/
|
*
|
||||||
function get($id)
|
* @param int $id ID of commercial proposal
|
||||||
{
|
* @return array|mixed data without useless information
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
*/
|
||||||
|
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
|
||||||
* @param int $page Page number
|
* @param int $page Page number
|
||||||
* @param string $thirdparty_ids Thirdparty ids to filter commercial proposal of. Example: '1' or '1,2,3' {@pattern /^[0-9,]*$/i}
|
* @param string $thirdparty_ids Thirdparty ids to filter commercial proposal of. Example: '1' or '1,2,3' {@pattern /^[0-9,]*$/i}
|
||||||
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')"
|
* @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
|
* @return array Array of order objects
|
||||||
*/
|
*/
|
||||||
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;
|
||||||
|
|
||||||
$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').')';
|
||||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc";
|
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $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
|
||||||
// Insert sale filter
|
// Insert sale filter
|
||||||
if ($search_sale > 0)
|
if ($search_sale > 0)
|
||||||
{
|
{
|
||||||
$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))
|
||||||
{
|
{
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||||
}
|
}
|
||||||
$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)
|
||||||
{
|
{
|
||||||
$page = 0;
|
$page = 0;
|
||||||
}
|
}
|
||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
|
|
||||||
$sql.= $db->plimit($limit + 1, $offset);
|
$sql.= $db->plimit($limit + 1, $offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
|
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
$min = min($num, ($limit <= 0 ? $num : $limit));
|
$min = min($num, ($limit <= 0 ? $num : $limit));
|
||||||
while ($i < $min)
|
while ($i < $min)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
$propal_static = new Propal($db);
|
$propal_static = new Propal($db);
|
||||||
if($propal_static->fetch($obj->rowid)) {
|
if($propal_static->fetch($obj->rowid)) {
|
||||||
$obj_ret[] = $this->_cleanObjectDatas($propal_static);
|
$obj_ret[] = $this->_cleanObjectDatas($propal_static);
|
||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new RestException(503, 'Error when retrieve propal list : '.$db->lasterror());
|
throw new RestException(503, 'Error when retrieve propal list : '.$db->lasterror());
|
||||||
}
|
}
|
||||||
if( ! count($obj_ret)) {
|
if( ! count($obj_ret)) {
|
||||||
throw new RestException(404, 'No order found');
|
throw new RestException(404, 'No order found');
|
||||||
}
|
}
|
||||||
return $obj_ret;
|
return $obj_ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create commercial proposal object
|
* Create commercial proposal object
|
||||||
*
|
*
|
||||||
* @param array $request_data Request data
|
* @param array $request_data Request data
|
||||||
* @return int ID of propal
|
* @return int ID of propal
|
||||||
*/
|
*/
|
||||||
function post($request_data = NULL)
|
function post($request_data = NULL)
|
||||||
{
|
{
|
||||||
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||||
throw new RestException(401, "Insuffisant rights");
|
throw new RestException(401, "Insuffisant rights");
|
||||||
}
|
}
|
||||||
// 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->propal->$field = $value;
|
$this->propal->$field = $value;
|
||||||
}
|
}
|
||||||
/*if (isset($request_data["lines"])) {
|
/*if (isset($request_data["lines"])) {
|
||||||
$lines = array();
|
$lines = array();
|
||||||
foreach ($request_data["lines"] as $line) {
|
foreach ($request_data["lines"] as $line) {
|
||||||
array_push($lines, (object) $line);
|
array_push($lines, (object) $line);
|
||||||
}
|
}
|
||||||
$this->propal->lines = $lines;
|
$this->propal->lines = $lines;
|
||||||
}*/
|
}*/
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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);
|
||||||
}
|
}
|
||||||
$this->propal->getLinesArray();
|
$this->propal->getLinesArray();
|
||||||
$result = array();
|
$result = array();
|
||||||
foreach ($this->propal->lines as $line) {
|
foreach ($this->propal->lines as $line) {
|
||||||
array_push($result,$this->_cleanObjectDatas($line));
|
array_push($result,$this->_cleanObjectDatas($line));
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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))
|
||||||
{
|
{
|
||||||
@ -257,288 +257,288 @@ class Proposals extends DolibarrApi
|
|||||||
|
|
||||||
$request_data = (object) $request_data;
|
$request_data = (object) $request_data;
|
||||||
|
|
||||||
$updateRes = $this->propal->addline(
|
$updateRes = $this->propal->addline(
|
||||||
$request_data->desc,
|
$request_data->desc,
|
||||||
$request_data->subprice,
|
$request_data->subprice,
|
||||||
$request_data->qty,
|
$request_data->qty,
|
||||||
$request_data->tva_tx,
|
$request_data->tva_tx,
|
||||||
$request_data->localtax1_tx,
|
$request_data->localtax1_tx,
|
||||||
$request_data->localtax2_tx,
|
$request_data->localtax2_tx,
|
||||||
$request_data->fk_product,
|
$request_data->fk_product,
|
||||||
$request_data->remise_percent,
|
$request_data->remise_percent,
|
||||||
'HT',
|
'HT',
|
||||||
0,
|
0,
|
||||||
$request_data->info_bits,
|
$request_data->info_bits,
|
||||||
$request_data->product_type,
|
$request_data->product_type,
|
||||||
$request_data->rang,
|
$request_data->rang,
|
||||||
$request_data->special_code,
|
$request_data->special_code,
|
||||||
$fk_parent_line,
|
$fk_parent_line,
|
||||||
$request_data->fk_fournprice,
|
$request_data->fk_fournprice,
|
||||||
$request_data->pa_ht,
|
$request_data->pa_ht,
|
||||||
$request_data->label,
|
$request_data->label,
|
||||||
$request_data->date_start,
|
$request_data->date_start,
|
||||||
$request_data->date_end,
|
$request_data->date_end,
|
||||||
$request_data->array_options,
|
$request_data->array_options,
|
||||||
$request_data->fk_unit,
|
$request_data->fk_unit,
|
||||||
$this->element,
|
$this->element,
|
||||||
$request_data->id,
|
$request_data->id,
|
||||||
$request_data->multicurrency_subprice,
|
$request_data->multicurrency_subprice,
|
||||||
$request_data->fk_remise_except
|
$request_data->fk_remise_except
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($updateRes > 0) {
|
if ($updateRes > 0) {
|
||||||
return $this->get($id)->line->rowid;
|
return $this->get($id)->line->rowid;
|
||||||
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update a line of given commercial proposal
|
* Update a line of given commercial proposal
|
||||||
*
|
*
|
||||||
* @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 <= 0) {
|
if($result <= 0) {
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
$request_data = (object) $request_data;
|
$request_data = (object) $request_data;
|
||||||
|
|
||||||
$propalline = new PropaleLigne($this->db);
|
$propalline = new PropaleLigne($this->db);
|
||||||
$result = $propalline->fetch($lineid);
|
$result = $propalline->fetch($lineid);
|
||||||
if ($result <= 0) {
|
if ($result <= 0) {
|
||||||
throw new RestException(404, 'Proposal line not found');
|
throw new RestException(404, 'Proposal line not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
$updateRes = $this->propal->updateline(
|
$updateRes = $this->propal->updateline(
|
||||||
$lineid,
|
$lineid,
|
||||||
isset($request_data->subprice)?$request_data->subprice:$propalline->subprice,
|
isset($request_data->subprice)?$request_data->subprice:$propalline->subprice,
|
||||||
isset($request_data->qty)?$request_data->qty:$propalline->qty,
|
isset($request_data->qty)?$request_data->qty:$propalline->qty,
|
||||||
isset($request_data->remise_percent)?$request_data->remise_percent:$propalline->remise_percent,
|
isset($request_data->remise_percent)?$request_data->remise_percent:$propalline->remise_percent,
|
||||||
isset($request_data->tva_tx)?$request_data->tva_tx:$propalline->tva_tx,
|
isset($request_data->tva_tx)?$request_data->tva_tx:$propalline->tva_tx,
|
||||||
isset($request_data->localtax1_tx)?$request_data->localtax1_tx:$propalline->localtax1_tx,
|
isset($request_data->localtax1_tx)?$request_data->localtax1_tx:$propalline->localtax1_tx,
|
||||||
isset($request_data->localtax2_tx)?$request_data->localtax2_tx:$propalline->localtax2_tx,
|
isset($request_data->localtax2_tx)?$request_data->localtax2_tx:$propalline->localtax2_tx,
|
||||||
isset($request_data->desc)?$request_data->desc:$propalline->desc,
|
isset($request_data->desc)?$request_data->desc:$propalline->desc,
|
||||||
'HT',
|
'HT',
|
||||||
isset($request_data->info_bits)?$request_data->info_bits:$propalline->info_bits,
|
isset($request_data->info_bits)?$request_data->info_bits:$propalline->info_bits,
|
||||||
isset($request_data->special_code)?$request_data->special_code:$propalline->special_code,
|
isset($request_data->special_code)?$request_data->special_code:$propalline->special_code,
|
||||||
isset($request_data->fk_parent_line)?$request_data->fk_parent_line:$propalline->fk_parent_line,
|
isset($request_data->fk_parent_line)?$request_data->fk_parent_line:$propalline->fk_parent_line,
|
||||||
0,
|
0,
|
||||||
isset($request_data->fk_fournprice)?$request_data->fk_fournprice:$propalline->fk_fournprice,
|
isset($request_data->fk_fournprice)?$request_data->fk_fournprice:$propalline->fk_fournprice,
|
||||||
isset($request_data->pa_ht)?$request_data->pa_ht:$propalline->pa_ht,
|
isset($request_data->pa_ht)?$request_data->pa_ht:$propalline->pa_ht,
|
||||||
isset($request_data->label)?$request_data->label:$propalline->label,
|
isset($request_data->label)?$request_data->label:$propalline->label,
|
||||||
isset($request_data->product_type)?$request_data->product_type:$propalline->product_type,
|
isset($request_data->product_type)?$request_data->product_type:$propalline->product_type,
|
||||||
isset($request_data->date_start)?$request_data->date_start:$propalline->date_start,
|
isset($request_data->date_start)?$request_data->date_start:$propalline->date_start,
|
||||||
isset($request_data->date_end)?$request_data->date_end:$propalline->date_end,
|
isset($request_data->date_end)?$request_data->date_end:$propalline->date_end,
|
||||||
isset($request_data->array_options)?$request_data->array_options:$propalline->array_options,
|
isset($request_data->array_options)?$request_data->array_options:$propalline->array_options,
|
||||||
isset($request_data->fk_unit)?$request_data->fk_unit:$propalline->fk_unit,
|
isset($request_data->fk_unit)?$request_data->fk_unit:$propalline->fk_unit,
|
||||||
isset($request_data->multicurrency_subprice)?$request_data->multicurrency_subprice:$propalline->subprice
|
isset($request_data->multicurrency_subprice)?$request_data->multicurrency_subprice:$propalline->subprice
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($updateRes > 0) {
|
if ($updateRes > 0) {
|
||||||
$result = $this->get($id);
|
$result = $this->get($id);
|
||||||
unset($result->line);
|
unset($result->line);
|
||||||
return $this->_cleanObjectDatas($result);
|
return $this->_cleanObjectDatas($result);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a line of given commercial proposal
|
* Delete a line of given commercial proposal
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @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);
|
||||||
}
|
}
|
||||||
$request_data = (object) $request_data;
|
$request_data = (object) $request_data;
|
||||||
$updateRes = $this->propal->deleteline($lineid);
|
$updateRes = $this->propal->deleteline($lineid);
|
||||||
if ($updateRes == 1) {
|
if ($updateRes == 1) {
|
||||||
return $this->get($id);
|
return $this->get($id);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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);
|
||||||
}
|
}
|
||||||
foreach($request_data as $field => $value) {
|
foreach($request_data as $field => $value) {
|
||||||
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)
|
||||||
{
|
{
|
||||||
if(! DolibarrApiAccess::$user->rights->propal->supprimer) {
|
if(! DolibarrApiAccess::$user->rights->propal->supprimer) {
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
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."
|
||||||
* Workaround: send this in the body
|
* Workaround: send this in the body
|
||||||
* {
|
* {
|
||||||
* "notrigger": 0
|
* "notrigger": 0
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
function validate($id, $notrigger=0)
|
function validate($id, $notrigger=0)
|
||||||
{
|
{
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
$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');
|
||||||
}
|
}
|
||||||
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 (Ref='.$this->propal->ref.')'
|
'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 (Proposals::$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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean sensible object datas
|
* Clean sensible object datas
|
||||||
*
|
*
|
||||||
* @param object $object Object to clean
|
* @param object $object Object to clean
|
||||||
* @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->name);
|
unset($object->name);
|
||||||
unset($object->lastname);
|
unset($object->lastname);
|
||||||
unset($object->firstname);
|
unset($object->firstname);
|
||||||
unset($object->civility_id);
|
unset($object->civility_id);
|
||||||
unset($object->address);
|
unset($object->address);
|
||||||
|
|
||||||
return $object;
|
return $object;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -72,204 +72,204 @@ if ($cancel) $action='';
|
|||||||
|
|
||||||
if ($action == 'add')
|
if ($action == 'add')
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
// Create account
|
// Create account
|
||||||
$object = new Account($db);
|
$object = new Account($db);
|
||||||
|
|
||||||
$object->ref = dol_sanitizeFileName(trim($_POST["ref"]));
|
$object->ref = dol_sanitizeFileName(trim($_POST["ref"]));
|
||||||
$object->label = trim($_POST["label"]);
|
$object->label = trim($_POST["label"]);
|
||||||
$object->courant = $_POST["type"];
|
$object->courant = $_POST["type"];
|
||||||
$object->clos = $_POST["clos"];
|
$object->clos = $_POST["clos"];
|
||||||
$object->rappro = (isset($_POST["norappro"]) && $_POST["norappro"])?0:1;
|
$object->rappro = (isset($_POST["norappro"]) && $_POST["norappro"])?0:1;
|
||||||
$object->url = $_POST["url"];
|
$object->url = $_POST["url"];
|
||||||
|
|
||||||
$object->bank = trim($_POST["bank"]);
|
$object->bank = trim($_POST["bank"]);
|
||||||
$object->code_banque = trim($_POST["code_banque"]);
|
$object->code_banque = trim($_POST["code_banque"]);
|
||||||
$object->code_guichet = trim($_POST["code_guichet"]);
|
$object->code_guichet = trim($_POST["code_guichet"]);
|
||||||
$object->number = trim($_POST["number"]);
|
$object->number = trim($_POST["number"]);
|
||||||
$object->cle_rib = trim($_POST["cle_rib"]);
|
$object->cle_rib = trim($_POST["cle_rib"]);
|
||||||
$object->bic = trim($_POST["bic"]);
|
$object->bic = trim($_POST["bic"]);
|
||||||
$object->iban = trim($_POST["iban"]);
|
$object->iban = trim($_POST["iban"]);
|
||||||
$object->domiciliation = trim($_POST["domiciliation"]);
|
$object->domiciliation = trim($_POST["domiciliation"]);
|
||||||
|
|
||||||
$object->proprio = trim($_POST["proprio"]);
|
$object->proprio = trim($_POST["proprio"]);
|
||||||
$object->owner_address = trim($_POST["owner_address"]);
|
$object->owner_address = trim($_POST["owner_address"]);
|
||||||
|
|
||||||
$account_number = GETPOST('account_number','alpha');
|
$account_number = GETPOST('account_number','alpha');
|
||||||
if ($account_number <= 0) { $object->account_number = ''; } else { $object->account_number = $account_number; }
|
if ($account_number <= 0) { $object->account_number = ''; } else { $object->account_number = $account_number; }
|
||||||
$fk_accountancy_journal = GETPOST('fk_accountancy_journal','int');
|
$fk_accountancy_journal = GETPOST('fk_accountancy_journal','int');
|
||||||
if ($fk_accountancy_journal <= 0) { $object->fk_accountancy_journal = ''; } else { $object->fk_accountancy_journal = $fk_accountancy_journal; }
|
if ($fk_accountancy_journal <= 0) { $object->fk_accountancy_journal = ''; } else { $object->fk_accountancy_journal = $fk_accountancy_journal; }
|
||||||
|
|
||||||
$object->solde = $_POST["solde"];
|
$object->solde = $_POST["solde"];
|
||||||
$object->date_solde = dol_mktime(12,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]);
|
$object->date_solde = dol_mktime(12,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]);
|
||||||
|
|
||||||
$object->currency_code = trim($_POST["account_currency_code"]);
|
$object->currency_code = trim($_POST["account_currency_code"]);
|
||||||
|
|
||||||
$object->state_id = $_POST["account_state_id"];
|
$object->state_id = $_POST["account_state_id"];
|
||||||
$object->country_id = $_POST["account_country_id"];
|
$object->country_id = $_POST["account_country_id"];
|
||||||
|
|
||||||
$object->min_allowed = GETPOST("account_min_allowed",'int');
|
$object->min_allowed = GETPOST("account_min_allowed",'int');
|
||||||
$object->min_desired = GETPOST("account_min_desired",'int');
|
$object->min_desired = GETPOST("account_min_desired",'int');
|
||||||
$object->comment = trim(GETPOST("account_comment"));
|
$object->comment = trim(GETPOST("account_comment"));
|
||||||
|
|
||||||
$object->fk_user_author = $user->id;
|
$object->fk_user_author = $user->id;
|
||||||
|
|
||||||
if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($object->account_number))
|
if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($object->account_number))
|
||||||
{
|
{
|
||||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("AccountancyCode")), null, 'errors');
|
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("AccountancyCode")), null, 'errors');
|
||||||
$action='create'; // Force chargement page en mode creation
|
$action='create'; // Force chargement page en mode creation
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
if (empty($object->ref))
|
if (empty($object->ref))
|
||||||
{
|
{
|
||||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")), null, 'errors');
|
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")), null, 'errors');
|
||||||
$action='create'; // Force chargement page en mode creation
|
$action='create'; // Force chargement page en mode creation
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
if (empty($object->label))
|
if (empty($object->label))
|
||||||
{
|
{
|
||||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("LabelBankCashAccount")), null, 'errors');
|
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("LabelBankCashAccount")), null, 'errors');
|
||||||
$action='create'; // Force chargement page en mode creation
|
$action='create'; // Force chargement page en mode creation
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$id = $object->create($user);
|
$id = $object->create($user);
|
||||||
if ($id > 0)
|
if ($id > 0)
|
||||||
{
|
{
|
||||||
// Category association
|
// Category association
|
||||||
$categories = GETPOST('categories', 'array');
|
$categories = GETPOST('categories', 'array');
|
||||||
$object->setCategories($categories);
|
$object->setCategories($categories);
|
||||||
|
|
||||||
$_GET["id"]=$id; // Force chargement page en mode visu
|
$_GET["id"]=$id; // Force chargement page en mode visu
|
||||||
|
|
||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
|
||||||
$action='create'; // Force chargement page en mode creation
|
$action='create'; // Force chargement page en mode creation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'update')
|
if ($action == 'update')
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
// Update account
|
// Update account
|
||||||
$object = new Account($db);
|
$object = new Account($db);
|
||||||
$object->fetch(GETPOST("id"));
|
$object->fetch(GETPOST("id"));
|
||||||
|
|
||||||
$object->ref = dol_string_nospecial(trim($_POST["ref"]));
|
$object->ref = dol_string_nospecial(trim($_POST["ref"]));
|
||||||
$object->label = trim($_POST["label"]);
|
$object->label = trim($_POST["label"]);
|
||||||
$object->courant = $_POST["type"];
|
$object->courant = $_POST["type"];
|
||||||
$object->clos = $_POST["clos"];
|
$object->clos = $_POST["clos"];
|
||||||
$object->rappro = (isset($_POST["norappro"]) && $_POST["norappro"])?0:1;
|
$object->rappro = (isset($_POST["norappro"]) && $_POST["norappro"])?0:1;
|
||||||
$object->url = trim($_POST["url"]);
|
$object->url = trim($_POST["url"]);
|
||||||
|
|
||||||
$object->bank = trim($_POST["bank"]);
|
$object->bank = trim($_POST["bank"]);
|
||||||
$object->code_banque = trim($_POST["code_banque"]);
|
$object->code_banque = trim($_POST["code_banque"]);
|
||||||
$object->code_guichet = trim($_POST["code_guichet"]);
|
$object->code_guichet = trim($_POST["code_guichet"]);
|
||||||
$object->number = trim($_POST["number"]);
|
$object->number = trim($_POST["number"]);
|
||||||
$object->cle_rib = trim($_POST["cle_rib"]);
|
$object->cle_rib = trim($_POST["cle_rib"]);
|
||||||
$object->bic = trim($_POST["bic"]);
|
$object->bic = trim($_POST["bic"]);
|
||||||
$object->iban = trim($_POST["iban"]);
|
$object->iban = trim($_POST["iban"]);
|
||||||
$object->domiciliation = trim($_POST["domiciliation"]);
|
$object->domiciliation = trim($_POST["domiciliation"]);
|
||||||
|
|
||||||
$object->proprio = trim($_POST["proprio"]);
|
$object->proprio = trim($_POST["proprio"]);
|
||||||
$object->owner_address = trim($_POST["owner_address"]);
|
$object->owner_address = trim($_POST["owner_address"]);
|
||||||
|
|
||||||
$account_number = GETPOST('account_number', 'int');
|
$account_number = GETPOST('account_number', 'int');
|
||||||
if ($account_number <= 0) { $object->account_number = ''; } else { $object->account_number = $account_number; }
|
if ($account_number <= 0) { $object->account_number = ''; } else { $object->account_number = $account_number; }
|
||||||
$fk_accountancy_journal = GETPOST('fk_accountancy_journal','int');
|
$fk_accountancy_journal = GETPOST('fk_accountancy_journal','int');
|
||||||
if ($fk_accountancy_journal <= 0) { $object->fk_accountancy_journal = ''; } else { $object->fk_accountancy_journal = $fk_accountancy_journal; }
|
if ($fk_accountancy_journal <= 0) { $object->fk_accountancy_journal = ''; } else { $object->fk_accountancy_journal = $fk_accountancy_journal; }
|
||||||
|
|
||||||
$object->currency_code = trim($_POST["account_currency_code"]);
|
$object->currency_code = trim($_POST["account_currency_code"]);
|
||||||
|
|
||||||
$object->state_id = $_POST["account_state_id"];
|
$object->state_id = $_POST["account_state_id"];
|
||||||
$object->country_id = $_POST["account_country_id"];
|
$object->country_id = $_POST["account_country_id"];
|
||||||
|
|
||||||
$object->min_allowed = GETPOST("account_min_allowed",'int');
|
$object->min_allowed = GETPOST("account_min_allowed",'int');
|
||||||
$object->min_desired = GETPOST("account_min_desired",'int');
|
$object->min_desired = GETPOST("account_min_desired",'int');
|
||||||
$object->comment = trim(GETPOST("account_comment"));
|
$object->comment = trim(GETPOST("account_comment"));
|
||||||
|
|
||||||
if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($object->account_number))
|
if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($object->account_number))
|
||||||
{
|
{
|
||||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("AccountancyCode")), null, 'error');
|
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("AccountancyCode")), null, 'error');
|
||||||
$action='edit'; // Force chargement page en mode creation
|
$action='edit'; // Force chargement page en mode creation
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
if (empty($object->ref))
|
if (empty($object->ref))
|
||||||
{
|
{
|
||||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")), null, 'errors');
|
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")), null, 'errors');
|
||||||
$action='edit'; // Force chargement page en mode creation
|
$action='edit'; // Force chargement page en mode creation
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
if (empty($object->label))
|
if (empty($object->label))
|
||||||
{
|
{
|
||||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("LabelBankCashAccount")), null, 'errors');
|
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("LabelBankCashAccount")), null, 'errors');
|
||||||
$action='edit'; // Force chargement page en mode creation
|
$action='edit'; // Force chargement page en mode creation
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$result = $object->update($user);
|
$result = $object->update($user);
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
// Category association
|
// Category association
|
||||||
$categories = GETPOST('categories', 'array');
|
$categories = GETPOST('categories', 'array');
|
||||||
$object->setCategories($categories);
|
$object->setCategories($categories);
|
||||||
|
|
||||||
$_GET["id"]=$_POST["id"]; // Force chargement page en mode visu
|
$_GET["id"]=$_POST["id"]; // Force chargement page en mode visu
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$action='edit'; // Force chargement page edition
|
$action='edit'; // Force chargement page edition
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights->banque->configurer)
|
if ($action == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights->banque->configurer)
|
||||||
{
|
{
|
||||||
// Delete
|
// Delete
|
||||||
$object = new Account($db);
|
$object = new Account($db);
|
||||||
$object->fetch(GETPOST("id","int"));
|
$object->fetch(GETPOST("id","int"));
|
||||||
$result = $object->delete($user);
|
$result = $object->delete($user);
|
||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
|
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
|
||||||
header("Location: ".DOL_URL_ROOT."/compta/bank/list.php");
|
header("Location: ".DOL_URL_ROOT."/compta/bank/list.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessages($account->error, $account->errors, 'errors');
|
setEventMessages($account->error, $account->errors, 'errors');
|
||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -297,10 +297,10 @@ if ($action == 'create')
|
|||||||
|
|
||||||
print load_fiche_titre($langs->trans("NewFinancialAccount"), '', 'title_bank.png');
|
print load_fiche_titre($langs->trans("NewFinancialAccount"), '', 'title_bank.png');
|
||||||
|
|
||||||
if ($conf->use_javascript_ajax)
|
if ($conf->use_javascript_ajax)
|
||||||
{
|
{
|
||||||
print "\n".'<script type="text/javascript" language="javascript">';
|
print "\n".'<script type="text/javascript" language="javascript">';
|
||||||
print 'jQuery(document).ready(function () {
|
print 'jQuery(document).ready(function () {
|
||||||
jQuery("#selecttype").change(function() {
|
jQuery("#selecttype").change(function() {
|
||||||
document.formsoc.action.value="create";
|
document.formsoc.action.value="create";
|
||||||
document.formsoc.submit();
|
document.formsoc.submit();
|
||||||
@ -310,8 +310,8 @@ if ($action == 'create')
|
|||||||
document.formsoc.submit();
|
document.formsoc.submit();
|
||||||
});
|
});
|
||||||
})';
|
})';
|
||||||
print '</script>'."\n";
|
print '</script>'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<form action="'.$_SERVER["PHP_SELF"].'" name="formsoc" method="post">';
|
print '<form action="'.$_SERVER["PHP_SELF"].'" name="formsoc" method="post">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
@ -347,12 +347,12 @@ if ($action == 'create')
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Status
|
// Status
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $form->selectarray("clos", $object->status,(GETPOST("clos",'int')!=''?GETPOST("clos",'int'):$object->clos));
|
print $form->selectarray("clos", $object->status,(GETPOST("clos",'int')!=''?GETPOST("clos",'int'):$object->clos));
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Country
|
// Country
|
||||||
$selectedcode='';
|
$selectedcode='';
|
||||||
if (isset($_POST["account_country_id"]))
|
if (isset($_POST["account_country_id"]))
|
||||||
{
|
{
|
||||||
@ -383,24 +383,24 @@ if ($action == 'create')
|
|||||||
print '<tr><td>'.$langs->trans("Web").'</td>';
|
print '<tr><td>'.$langs->trans("Web").'</td>';
|
||||||
print '<td><input class="minwidth300" type="text" class="flat" name="url" value="'.GETPOST("url").'"></td></tr>';
|
print '<td><input class="minwidth300" type="text" class="flat" name="url" value="'.GETPOST("url").'"></td></tr>';
|
||||||
|
|
||||||
// Tags-Categories
|
// Tags-Categories
|
||||||
if ($conf->categorie->enabled)
|
if ($conf->categorie->enabled)
|
||||||
{
|
{
|
||||||
print '<tr><td class="tdtop">'.$langs->trans("Categories").'</td><td>';
|
print '<tr><td class="tdtop">'.$langs->trans("Categories").'</td><td>';
|
||||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1);
|
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1);
|
||||||
$c = new Categorie($db);
|
$c = new Categorie($db);
|
||||||
$cats = $c->containing($object->id,Categorie::TYPE_ACCOUNT);
|
$cats = $c->containing($object->id,Categorie::TYPE_ACCOUNT);
|
||||||
foreach($cats as $cat) {
|
foreach($cats as $cat) {
|
||||||
$arrayselected[] = $cat->id;
|
$arrayselected[] = $cat->id;
|
||||||
}
|
}
|
||||||
print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%');
|
print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%');
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Comment
|
// Comment
|
||||||
print '<tr><td class="tdtop">'.$langs->trans("Comment").'</td>';
|
print '<tr><td class="tdtop">'.$langs->trans("Comment").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
// Editor wysiwyg
|
// Editor wysiwyg
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
$doleditor=new DolEditor('account_comment',(GETPOST("account_comment")?GETPOST("account_comment"):$object->comment),'',90,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_4,'90%');
|
$doleditor=new DolEditor('account_comment',(GETPOST("account_comment")?GETPOST("account_comment"):$object->comment),'',90,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_4,'90%');
|
||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
@ -409,7 +409,7 @@ if ($action == 'create')
|
|||||||
// Other attributes
|
// Other attributes
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$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
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
||||||
{
|
{
|
||||||
print $object->showOptionals($extrafields,'edit',$parameters);
|
print $object->showOptionals($extrafields,'edit',$parameters);
|
||||||
@ -504,7 +504,7 @@ if ($action == 'create')
|
|||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
// Accountancy code
|
// Accountancy code
|
||||||
$fieldrequired='';
|
$fieldrequired='';
|
||||||
if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) $fieldrequired='fieldrequired ';
|
if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) $fieldrequired='fieldrequired ';
|
||||||
|
|
||||||
if (! empty($conf->accounting->enabled))
|
if (! empty($conf->accounting->enabled))
|
||||||
{
|
{
|
||||||
@ -523,7 +523,7 @@ if ($action == 'create')
|
|||||||
if (! empty($conf->accounting->enabled))
|
if (! empty($conf->accounting->enabled))
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>';
|
print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $formaccounting->select_journal($object->fk_accountancy_journal, 'fk_accountancy_journal', 4, 1, 0, 0);
|
print $formaccounting->select_journal($object->fk_accountancy_journal, 'fk_accountancy_journal', 4, 1, 0, 0);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
@ -547,7 +547,7 @@ if ($action == 'create')
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (($_GET["id"] || $_GET["ref"]) && $action != 'edit')
|
if (($_GET["id"] || $_GET["ref"]) && $action != 'edit')
|
||||||
{
|
{
|
||||||
$object = new Account($db);
|
$object = new Account($db);
|
||||||
if ($_GET["id"])
|
if ($_GET["id"])
|
||||||
@ -605,7 +605,7 @@ else
|
|||||||
print '<td>';
|
print '<td>';
|
||||||
$conciliate=$object->canBeConciliated();
|
$conciliate=$object->canBeConciliated();
|
||||||
if ($conciliate == -2) print $langs->trans("No").' ('.$langs->trans("CashAccount").')';
|
if ($conciliate == -2) print $langs->trans("No").' ('.$langs->trans("CashAccount").')';
|
||||||
else if ($conciliate == -3) print $langs->trans("No").' ('.$langs->trans("Closed").')';
|
else if ($conciliate == -3) print $langs->trans("No").' ('.$langs->trans("Closed").')';
|
||||||
else print ($object->rappro==1 ? $langs->trans("Yes") : ($langs->trans("No").' ('.$langs->trans("ConciliationDisabled").')'));
|
else print ($object->rappro==1 ? $langs->trans("Yes") : ($langs->trans("No").' ('.$langs->trans("ConciliationDisabled").')'));
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
@ -624,15 +624,15 @@ else
|
|||||||
|
|
||||||
print $accountingaccount->getNomUrl(0,1,1,'',1);
|
print $accountingaccount->getNomUrl(0,1,1,'',1);
|
||||||
} else {
|
} else {
|
||||||
print $object->account_number;
|
print $object->account_number;
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Accountancy journal
|
// Accountancy journal
|
||||||
if (! empty($conf->accounting->enabled))
|
if (! empty($conf->accounting->enabled))
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>';
|
print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
|
|
||||||
$accountingjournal = new AccountingJournal($db);
|
$accountingjournal = new AccountingJournal($db);
|
||||||
$accountingjournal->fetch($object->fk_accountancy_journal);
|
$accountingjournal->fetch($object->fk_accountancy_journal);
|
||||||
@ -655,12 +655,12 @@ else
|
|||||||
|
|
||||||
print '<table class="border centpercent">';
|
print '<table class="border centpercent">';
|
||||||
|
|
||||||
// Categories
|
// Categories
|
||||||
if ($conf->categorie->enabled) {
|
if ($conf->categorie->enabled) {
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("Categories").'</td><td>';
|
print '<tr><td class="titlefield">'.$langs->trans("Categories").'</td><td>';
|
||||||
print $form->showCategories($object->id,'bank_account',1);
|
print $form->showCategories($object->id,'bank_account',1);
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr><td class="tdtop titlefield">'.$langs->trans("Comment").'</td>';
|
print '<tr><td class="tdtop titlefield">'.$langs->trans("Comment").'</td>';
|
||||||
print '<td>'.dol_htmlentitiesbr($object->comment).'</td></tr>';
|
print '<td>'.dol_htmlentitiesbr($object->comment).'</td></tr>';
|
||||||
@ -669,11 +669,11 @@ else
|
|||||||
|
|
||||||
if ($object->type == Account::TYPE_SAVINGS || $object->type == Account::TYPE_CURRENT)
|
if ($object->type == Account::TYPE_SAVINGS || $object->type == Account::TYPE_CURRENT)
|
||||||
{
|
{
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
print '<table class="border centpercent">';
|
print '<table class="border centpercent">';
|
||||||
|
|
||||||
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("BankName").'</td>';
|
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("BankName").'</td>';
|
||||||
print '<td>'.$object->bank.'</td></tr>';
|
print '<td>'.$object->bank.'</td></tr>';
|
||||||
@ -764,23 +764,23 @@ else
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* Edition */
|
/* Edition */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
if (GETPOST('id','int') && $action == 'edit' && $user->rights->banque->configurer)
|
if (GETPOST('id','int') && $action == 'edit' && $user->rights->banque->configurer)
|
||||||
{
|
{
|
||||||
$object = new Account($db);
|
$object = new Account($db);
|
||||||
$object->fetch(GETPOST('id','int'));
|
$object->fetch(GETPOST('id','int'));
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("EditFinancialAccount"), '', 'title_bank.png');
|
print load_fiche_titre($langs->trans("EditFinancialAccount"), '', 'title_bank.png');
|
||||||
|
|
||||||
if ($conf->use_javascript_ajax)
|
if ($conf->use_javascript_ajax)
|
||||||
{
|
{
|
||||||
print "\n".'<script type="text/javascript" language="javascript">';
|
print "\n".'<script type="text/javascript" language="javascript">';
|
||||||
print 'jQuery(document).ready(function () {
|
print 'jQuery(document).ready(function () {
|
||||||
jQuery("#selecttype").change(function() {
|
jQuery("#selecttype").change(function() {
|
||||||
document.formsoc.action.value="edit";
|
document.formsoc.action.value="edit";
|
||||||
document.formsoc.submit();
|
document.formsoc.submit();
|
||||||
@ -793,33 +793,33 @@ else
|
|||||||
document.formsoc.submit();
|
document.formsoc.submit();
|
||||||
});
|
});
|
||||||
})';
|
})';
|
||||||
print '</script>'."\n";
|
print '</script>'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post" name="formsoc">';
|
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post" name="formsoc">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="update">';
|
print '<input type="hidden" name="action" value="update">';
|
||||||
print '<input type="hidden" name="id" value="'.$_REQUEST["id"].'">'."\n\n";
|
print '<input type="hidden" name="id" value="'.$_REQUEST["id"].'">'."\n\n";
|
||||||
|
|
||||||
dol_fiche_head('');
|
dol_fiche_head('');
|
||||||
|
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Ref").'</td>';
|
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Ref").'</td>';
|
||||||
print '<td><input size="8" type="text" class="flat" name="ref" value="'.(isset($_POST["ref"])?GETPOST("ref"):$object->ref).'"></td></tr>';
|
print '<td><input size="8" type="text" class="flat" name="ref" value="'.(isset($_POST["ref"])?GETPOST("ref"):$object->ref).'"></td></tr>';
|
||||||
|
|
||||||
// Label
|
// Label
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td>';
|
||||||
print '<td><input type="text" class="flat minwidth300" name="label" value="'.(isset($_POST["label"])?GETPOST("label"):$object->label).'"></td></tr>';
|
print '<td><input type="text" class="flat minwidth300" name="label" value="'.(isset($_POST["label"])?GETPOST("label"):$object->label).'"></td></tr>';
|
||||||
|
|
||||||
// Type
|
// Type
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>';
|
||||||
print '<td class="maxwidth200onsmartphone">';
|
print '<td class="maxwidth200onsmartphone">';
|
||||||
$formbank->selectTypeOfBankAccount((isset($_POST["type"])?$_POST["type"]:$object->type),"type");
|
$formbank->selectTypeOfBankAccount((isset($_POST["type"])?$_POST["type"]:$object->type),"type");
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Currency
|
// Currency
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("Currency");
|
print '<tr><td class="fieldrequired">'.$langs->trans("Currency");
|
||||||
@ -834,10 +834,10 @@ else
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Status
|
// Status
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
|
||||||
print '<td class="maxwidth200onsmartphone">';
|
print '<td class="maxwidth200onsmartphone">';
|
||||||
print $form->selectarray("clos", $object->status, (isset($_POST["clos"])?$_POST["clos"]:$object->clos));
|
print $form->selectarray("clos", $object->status, (isset($_POST["clos"])?$_POST["clos"]:$object->clos));
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Country
|
// Country
|
||||||
$object->country_id=$object->country_id?$object->country_id:$mysoc->country_id;
|
$object->country_id=$object->country_id?$object->country_id:$mysoc->country_id;
|
||||||
@ -865,15 +865,15 @@ else
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Conciliable
|
// Conciliable
|
||||||
print '<tr><td>'.$langs->trans("Conciliable").'</td>';
|
print '<tr><td>'.$langs->trans("Conciliable").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$conciliate=$object->canBeConciliated();
|
$conciliate=$object->canBeConciliated();
|
||||||
if ($conciliate == -2) print $langs->trans("No").' ('.$langs->trans("CashAccount").')';
|
if ($conciliate == -2) print $langs->trans("No").' ('.$langs->trans("CashAccount").')';
|
||||||
else if ($conciliate == -3) print $langs->trans("No").' ('.$langs->trans("Closed").')';
|
else if ($conciliate == -3) print $langs->trans("No").' ('.$langs->trans("Closed").')';
|
||||||
else print '<input type="checkbox" class="flat" name="norappro"'.(($conciliate > 0)?'':' checked="checked"').'"> '.$langs->trans("DisableConciliation");
|
else print '<input type="checkbox" class="flat" name="norappro"'.(($conciliate > 0)?'':' checked="checked"').'"> '.$langs->trans("DisableConciliation");
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Balance
|
// Balance
|
||||||
print '<tr><td>'.$langs->trans("BalanceMinimalAllowed").'</td>';
|
print '<tr><td>'.$langs->trans("BalanceMinimalAllowed").'</td>';
|
||||||
print '<td><input size="12" type="text" class="flat" name="account_min_allowed" value="'.(isset($_POST["account_min_allowed"])?GETPOST("account_min_allowed"):$object->min_allowed).'"></td></tr>';
|
print '<td><input size="12" type="text" class="flat" name="account_min_allowed" value="'.(isset($_POST["account_min_allowed"])?GETPOST("account_min_allowed"):$object->min_allowed).'"></td></tr>';
|
||||||
|
|
||||||
@ -881,28 +881,28 @@ else
|
|||||||
print '<td ><input size="12" type="text" class="flat" name="account_min_desired" value="'.(isset($_POST["account_min_desired"])?GETPOST("account_min_desired"):$object->min_desired).'"></td></tr>';
|
print '<td ><input size="12" type="text" class="flat" name="account_min_desired" value="'.(isset($_POST["account_min_desired"])?GETPOST("account_min_desired"):$object->min_desired).'"></td></tr>';
|
||||||
|
|
||||||
// Web
|
// Web
|
||||||
print '<tr><td>'.$langs->trans("Web").'</td>';
|
print '<tr><td>'.$langs->trans("Web").'</td>';
|
||||||
print '<td><input class="maxwidth200onsmartphone" type="text" class="flat" name="url" value="'.(isset($_POST["url"])?GETPOST("url"):$object->url).'">';
|
print '<td><input class="maxwidth200onsmartphone" type="text" class="flat" name="url" value="'.(isset($_POST["url"])?GETPOST("url"):$object->url).'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Tags-Categories
|
// Tags-Categories
|
||||||
if ($conf->categorie->enabled)
|
if ($conf->categorie->enabled)
|
||||||
{
|
{
|
||||||
print '<tr><td class="tdtop">'.$langs->trans("Categories").'</td><td>';
|
print '<tr><td class="tdtop">'.$langs->trans("Categories").'</td><td>';
|
||||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1);
|
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1);
|
||||||
$c = new Categorie($db);
|
$c = new Categorie($db);
|
||||||
$cats = $c->containing($object->id,Categorie::TYPE_ACCOUNT);
|
$cats = $c->containing($object->id,Categorie::TYPE_ACCOUNT);
|
||||||
foreach($cats as $cat) {
|
foreach($cats as $cat) {
|
||||||
$arrayselected[] = $cat->id;
|
$arrayselected[] = $cat->id;
|
||||||
}
|
}
|
||||||
print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%');
|
print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%');
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Comment
|
// Comment
|
||||||
print '<tr><td class="tdtop">'.$langs->trans("Comment").'</td>';
|
print '<tr><td class="tdtop">'.$langs->trans("Comment").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
// Editor wysiwyg
|
// Editor wysiwyg
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
$doleditor=new DolEditor('account_comment',(GETPOST("account_comment")?GETPOST("account_comment"):$object->comment),'',90,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_4,'95%');
|
$doleditor=new DolEditor('account_comment',(GETPOST("account_comment")?GETPOST("account_comment"):$object->comment),'',90,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_4,'95%');
|
||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
@ -911,7 +911,7 @@ else
|
|||||||
// Other attributes
|
// Other attributes
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$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
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
||||||
{
|
{
|
||||||
print $object->showOptionals($extrafields,'edit');
|
print $object->showOptionals($extrafields,'edit');
|
||||||
@ -929,15 +929,15 @@ else
|
|||||||
$tdextra = ' class="titlefieldcreate"';
|
$tdextra = ' class="titlefieldcreate"';
|
||||||
|
|
||||||
if (!empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) {
|
if (!empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) {
|
||||||
$tdextra = ' class="fieldrequired titlefieldcreate"';
|
$tdextra = ' class="fieldrequired titlefieldcreate"';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr class="liste_titre_add"><td'.$tdextra.'>'.$langs->trans("AccountancyCode").'</td>';
|
print '<tr class="liste_titre_add"><td'.$tdextra.'>'.$langs->trans("AccountancyCode").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if (!empty($conf->accounting->enabled)) {
|
if (!empty($conf->accounting->enabled)) {
|
||||||
print $formaccounting->select_account($object->account_number, 'account_number', 1, '', 1, 1);
|
print $formaccounting->select_account($object->account_number, 'account_number', 1, '', 1, 1);
|
||||||
} else {
|
} else {
|
||||||
print '<input type="text" name="account_number" value="'.(GETPOST("account_number") ? GETPOST("account_number") : $object->account_number).'">';
|
print '<input type="text" name="account_number" value="'.(GETPOST("account_number") ? GETPOST("account_number") : $object->account_number).'">';
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
@ -954,9 +954,9 @@ else
|
|||||||
|
|
||||||
if ($_POST["type"] == Account::TYPE_SAVINGS || $_POST["type"] == Account::TYPE_CURRENT)
|
if ($_POST["type"] == Account::TYPE_SAVINGS || $_POST["type"] == Account::TYPE_CURRENT)
|
||||||
{
|
{
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
//print '<div class="underbanner clearboth"></div>';
|
//print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
|
|||||||
@ -63,50 +63,50 @@ if ($action == 'confirm_paid' && $user->rights->tax->charges->creer && $confirm
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'reopen' && $user->rights->tax->charges->creer) {
|
if ($action == 'reopen' && $user->rights->tax->charges->creer) {
|
||||||
$result = $object->fetch($id);
|
$result = $object->fetch($id);
|
||||||
if ($object->paye)
|
if ($object->paye)
|
||||||
{
|
{
|
||||||
$result = $object->set_unpaid($user);
|
$result = $object->set_unpaid($user);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id);
|
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id);
|
||||||
exit();
|
exit();
|
||||||
} else {
|
} else {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Link to a project
|
// Link to a project
|
||||||
if ($action == 'classin' && $user->rights->tax->charges->creer)
|
if ($action == 'classin' && $user->rights->tax->charges->creer)
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->setProject(GETPOST('projectid'));
|
$object->setProject(GETPOST('projectid'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'setlib' && $user->rights->tax->charges->creer)
|
if ($action == 'setlib' && $user->rights->tax->charges->creer)
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$result = $object->setValueFrom('libelle', GETPOST('lib'), '', '', 'text', '', $user, 'TAX_MODIFY');
|
$result = $object->setValueFrom('libelle', GETPOST('lib'), '', '', 'text', '', $user, 'TAX_MODIFY');
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
// payment mode
|
// payment mode
|
||||||
if ($action == 'setmode' && $user->rights->tax->charges->creer) {
|
if ($action == 'setmode' && $user->rights->tax->charges->creer) {
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
|
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
// bank account
|
// bank account
|
||||||
if ($action == 'setbankaccount' && $user->rights->tax->charges->creer) {
|
if ($action == 'setbankaccount' && $user->rights->tax->charges->creer) {
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
|
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete social contribution
|
// Delete social contribution
|
||||||
@ -131,8 +131,8 @@ if ($action == 'add' && $user->rights->tax->charges->creer)
|
|||||||
{
|
{
|
||||||
$dateech=dol_mktime(GETPOST('echhour'),GETPOST('echmin'),GETPOST('echsec'),GETPOST('echmonth'),GETPOST('echday'),GETPOST('echyear'));
|
$dateech=dol_mktime(GETPOST('echhour'),GETPOST('echmin'),GETPOST('echsec'),GETPOST('echmonth'),GETPOST('echday'),GETPOST('echyear'));
|
||||||
$dateperiod=dol_mktime(GETPOST('periodhour'),GETPOST('periodmin'),GETPOST('periodsec'),GETPOST('periodmonth'),GETPOST('periodday'),GETPOST('periodyear'));
|
$dateperiod=dol_mktime(GETPOST('periodhour'),GETPOST('periodmin'),GETPOST('periodsec'),GETPOST('periodmonth'),GETPOST('periodday'),GETPOST('periodyear'));
|
||||||
$amount=price2num(GETPOST('amount'));
|
$amount=price2num(GETPOST('amount'));
|
||||||
$actioncode=GETPOST('actioncode');
|
$actioncode=GETPOST('actioncode');
|
||||||
|
|
||||||
if (! $dateech)
|
if (! $dateech)
|
||||||
{
|
{
|
||||||
@ -166,8 +166,8 @@ if ($action == 'add' && $user->rights->tax->charges->creer)
|
|||||||
$object->date_ech = $dateech;
|
$object->date_ech = $dateech;
|
||||||
$object->periode = $dateperiod;
|
$object->periode = $dateperiod;
|
||||||
$object->amount = $amount;
|
$object->amount = $amount;
|
||||||
$object->mode_reglement_id = GETPOST('mode_reglement_id');
|
$object->mode_reglement_id = GETPOST('mode_reglement_id');
|
||||||
$object->fk_account = GETPOST('fk_account', 'int');
|
$object->fk_account = GETPOST('fk_account', 'int');
|
||||||
$object->fk_project = GETPOST('fk_project');
|
$object->fk_project = GETPOST('fk_project');
|
||||||
|
|
||||||
$id=$object->create($user);
|
$id=$object->create($user);
|
||||||
@ -182,43 +182,43 @@ if ($action == 'add' && $user->rights->tax->charges->creer)
|
|||||||
|
|
||||||
if ($action == 'update' && ! $_POST["cancel"] && $user->rights->tax->charges->creer)
|
if ($action == 'update' && ! $_POST["cancel"] && $user->rights->tax->charges->creer)
|
||||||
{
|
{
|
||||||
$dateech=dol_mktime(GETPOST('echhour'),GETPOST('echmin'),GETPOST('echsec'),GETPOST('echmonth'),GETPOST('echday'),GETPOST('echyear'));
|
$dateech=dol_mktime(GETPOST('echhour'),GETPOST('echmin'),GETPOST('echsec'),GETPOST('echmonth'),GETPOST('echday'),GETPOST('echyear'));
|
||||||
$dateperiod=dol_mktime(GETPOST('periodhour'),GETPOST('periodmin'),GETPOST('periodsec'),GETPOST('periodmonth'),GETPOST('periodday'),GETPOST('periodyear'));
|
$dateperiod=dol_mktime(GETPOST('periodhour'),GETPOST('periodmin'),GETPOST('periodsec'),GETPOST('periodmonth'),GETPOST('periodday'),GETPOST('periodyear'));
|
||||||
$amount=price2num(GETPOST('amount'));
|
$amount=price2num(GETPOST('amount'));
|
||||||
|
|
||||||
if (! $dateech)
|
if (! $dateech)
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateDue")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateDue")), null, 'errors');
|
||||||
$action = 'edit';
|
$action = 'edit';
|
||||||
}
|
}
|
||||||
elseif (! $dateperiod)
|
elseif (! $dateperiod)
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Period")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Period")), null, 'errors');
|
||||||
$action = 'edit';
|
$action = 'edit';
|
||||||
}
|
}
|
||||||
elseif (empty($amount))
|
elseif (empty($amount))
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")), null, 'errors');
|
||||||
$action = 'edit';
|
$action = 'edit';
|
||||||
}
|
}
|
||||||
elseif (! is_numeric($amount))
|
elseif (! is_numeric($amount))
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("ErrorFieldMustBeANumeric",$langs->transnoentities("Amount")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldMustBeANumeric",$langs->transnoentities("Amount")), null, 'errors');
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$result=$object->fetch($id);
|
$result=$object->fetch($id);
|
||||||
|
|
||||||
$object->date_ech = $dateech;
|
$object->date_ech = $dateech;
|
||||||
$object->periode = $dateperiod;
|
$object->periode = $dateperiod;
|
||||||
$object->amount = price2num($amount);
|
$object->amount = price2num($amount);
|
||||||
|
|
||||||
$result=$object->update($user);
|
$result=$object->update($user);
|
||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,51 +293,51 @@ if ($action == 'create')
|
|||||||
{
|
{
|
||||||
print load_fiche_titre($langs->trans("NewSocialContribution"));
|
print load_fiche_titre($langs->trans("NewSocialContribution"));
|
||||||
|
|
||||||
$var=false;
|
$var=false;
|
||||||
|
|
||||||
print '<form name="charge" method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
print '<form name="charge" method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="add">';
|
print '<input type="hidden" name="action" value="add">';
|
||||||
|
|
||||||
dol_fiche_head();
|
dol_fiche_head();
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Label
|
// Label
|
||||||
print "<tr>";
|
print "<tr>";
|
||||||
print '<td class="titlefieldcreate fieldrequired">';
|
print '<td class="titlefieldcreate fieldrequired">';
|
||||||
print $langs->trans("Label");
|
print $langs->trans("Label");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td><input type="text" size="34" name="label" class="flat" value="'.dol_escape_htmltag(GETPOST('label','alpha')).'" autofocus></td>';
|
print '<td><input type="text" size="34" name="label" class="flat" value="'.dol_escape_htmltag(GETPOST('label','alpha')).'" autofocus></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
|
|
||||||
// Type
|
// Type
|
||||||
print '<td class="fieldrequired">';
|
print '<td class="fieldrequired">';
|
||||||
print $langs->trans("Type");
|
print $langs->trans("Type");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$formsocialcontrib->select_type_socialcontrib(GETPOST("actioncode",'alpha')?GETPOST("actioncode",'alpha'):'','actioncode',1);
|
$formsocialcontrib->select_type_socialcontrib(GETPOST("actioncode",'alpha')?GETPOST("actioncode",'alpha'):'','actioncode',1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Date end period
|
// Date end period
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td class="fieldrequired">';
|
print '<td class="fieldrequired">';
|
||||||
print $langs->trans("PeriodEndDate");
|
print $langs->trans("PeriodEndDate");
|
||||||
print '</td>';
|
|
||||||
print '<td>';
|
|
||||||
print $form->select_date(! empty($dateperiod)?$dateperiod:'-1', 'period', 0, 0, 0, 'charge', 1);
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '<td>';
|
||||||
|
print $form->select_date(! empty($dateperiod)?$dateperiod:'-1', 'period', 0, 0, 0, 'charge', 1);
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
// Amount
|
// Amount
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td class="fieldrequired">';
|
print '<td class="fieldrequired">';
|
||||||
print $langs->trans("Amount");
|
print $langs->trans("Amount");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td><input type="text" size="6" name="amount" class="flat" value="'.dol_escape_htmltag(GETPOST('amount','alpha')).'"></td>';
|
print '<td><input type="text" size="6" name="amount" class="flat" value="'.dol_escape_htmltag(GETPOST('amount','alpha')).'"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Project
|
// Project
|
||||||
if (! empty($conf->projet->enabled))
|
if (! empty($conf->projet->enabled))
|
||||||
@ -354,30 +354,30 @@ if ($action == 'create')
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Payment Mode
|
// Payment Mode
|
||||||
print '<tr><td>' . $langs->trans('PaymentMode') . '</td><td colspan="2">';
|
print '<tr><td>' . $langs->trans('PaymentMode') . '</td><td colspan="2">';
|
||||||
$form->select_types_paiements($mode_reglement_id, 'mode_reglement_id');
|
$form->select_types_paiements($mode_reglement_id, 'mode_reglement_id');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Bank Account
|
// Bank Account
|
||||||
if (! empty($conf->banque->enabled))
|
if (! empty($conf->banque->enabled))
|
||||||
{
|
{
|
||||||
print '<tr><td>' . $langs->trans('BankAccount') . '</td><td colspan="2">';
|
print '<tr><td>' . $langs->trans('BankAccount') . '</td><td colspan="2">';
|
||||||
$form->select_comptes($fk_account, 'fk_account', 0, '', 1);
|
$form->select_comptes($fk_account, 'fk_account', 0, '', 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Date due
|
// Date due
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td class="fieldrequired">';
|
print '<td class="fieldrequired">';
|
||||||
print $langs->trans("DateDue");
|
print $langs->trans("DateDue");
|
||||||
print '</td>';
|
|
||||||
print '<td>';
|
|
||||||
print $form->select_date(! empty($dateech)?$dateech:'-1', 'ech', 0, 0, 0, 'charge', 1);
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "</tr>\n";
|
print '<td>';
|
||||||
|
print $form->select_date(! empty($dateech)?$dateech:'-1', 'ech', 0, 0, 0, 'charge', 1);
|
||||||
|
print '</td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
@ -387,7 +387,7 @@ if ($action == 'create')
|
|||||||
print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
|
print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/* *************************************************************************** */
|
/* *************************************************************************** */
|
||||||
@ -398,7 +398,7 @@ if ($action == 'create')
|
|||||||
if ($id > 0)
|
if ($id > 0)
|
||||||
{
|
{
|
||||||
$object = new ChargeSociales($db);
|
$object = new ChargeSociales($db);
|
||||||
$result=$object->fetch($id);
|
$result=$object->fetch($id);
|
||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
@ -414,7 +414,7 @@ if ($id > 0)
|
|||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('CloneTax'),$langs->trans('ConfirmCloneTax',$object->ref),'confirm_clone',$formclone,'yes');
|
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('CloneTax'),$langs->trans('ConfirmCloneTax',$object->ref),'confirm_clone',$formclone,'yes');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Confirmation de la suppression de la charge
|
// Confirmation de la suppression de la charge
|
||||||
@ -445,34 +445,34 @@ if ($id > 0)
|
|||||||
// Project
|
// Project
|
||||||
if (! empty($conf->projet->enabled))
|
if (! empty($conf->projet->enabled))
|
||||||
{
|
{
|
||||||
$langs->load("projects");
|
$langs->load("projects");
|
||||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||||
if ($user->rights->tax->charges->creer)
|
if ($user->rights->tax->charges->creer)
|
||||||
{
|
{
|
||||||
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(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
$morehtmlref.=$formproject->select_projects(0, $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);
|
||||||
$proj->fetch($object->fk_project);
|
$proj->fetch($object->fk_project);
|
||||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||||
$morehtmlref.=$proj->ref;
|
$morehtmlref.=$proj->ref;
|
||||||
$morehtmlref.='</a>';
|
$morehtmlref.='</a>';
|
||||||
} else {
|
} else {
|
||||||
$morehtmlref.='';
|
$morehtmlref.='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$morehtmlref.='</div>';
|
$morehtmlref.='</div>';
|
||||||
|
|
||||||
@ -492,7 +492,7 @@ if ($id > 0)
|
|||||||
print '<tr><td class="titlefield">'.$langs->trans("Type")."</td><td>".$object->type_libelle."</td>";
|
print '<tr><td class="titlefield">'.$langs->trans("Type")."</td><td>".$object->type_libelle."</td>";
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
// Period end date
|
// Period end date
|
||||||
print "<tr><td>".$langs->trans("PeriodEndDate")."</td>";
|
print "<tr><td>".$langs->trans("PeriodEndDate")."</td>";
|
||||||
print "<td>";
|
print "<td>";
|
||||||
if ($action == 'edit')
|
if ($action == 'edit')
|
||||||
@ -517,51 +517,51 @@ if ($id > 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Amount
|
// Amount
|
||||||
if ($action == 'edit')
|
if ($action == 'edit')
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("AmountTTC")."</td><td>";
|
print '<tr><td>'.$langs->trans("AmountTTC")."</td><td>";
|
||||||
print '<input type="text" name="amount" size="12" class="flat" value="'.$object->amount.'">';
|
print '<input type="text" name="amount" size="12" class="flat" value="'.$object->amount.'">';
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print '<tr><td>'.$langs->trans("AmountTTC").'</td><td>'.price($object->amount,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
|
print '<tr><td>'.$langs->trans("AmountTTC").'</td><td>'.price($object->amount,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mode of payment
|
// Mode of payment
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
print $langs->trans('PaymentMode');
|
print $langs->trans('PaymentMode');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if ($action != 'editmode')
|
if ($action != 'editmode')
|
||||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmode&id=' . $object->id . '">' . img_edit($langs->trans('SetMode'), 1) . '</a></td>';
|
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmode&id=' . $object->id . '">' . img_edit($langs->trans('SetMode'), 1) . '</a></td>';
|
||||||
print '</tr></table>';
|
print '</tr></table>';
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
if ($action == 'editmode') {
|
if ($action == 'editmode') {
|
||||||
$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id');
|
$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id');
|
||||||
} else {
|
} else {
|
||||||
$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'none');
|
$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'none');
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Bank Account
|
// Bank Account
|
||||||
if (! empty($conf->banque->enabled))
|
if (! empty($conf->banque->enabled))
|
||||||
{
|
{
|
||||||
print '<tr><td class="nowrap">';
|
print '<tr><td class="nowrap">';
|
||||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||||
print $langs->trans('BankAccount');
|
print $langs->trans('BankAccount');
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if ($action != 'editbankaccount' && $user->rights->tax->charges->creer)
|
if ($action != 'editbankaccount' && $user->rights->tax->charges->creer)
|
||||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
|
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
|
||||||
print '</tr></table>';
|
print '</tr></table>';
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
if ($action == 'editbankaccount') {
|
if ($action == 'editbankaccount') {
|
||||||
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
|
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
|
||||||
} else {
|
} else {
|
||||||
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
|
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
@ -588,59 +588,59 @@ if ($id > 0)
|
|||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$totalpaye = 0;
|
$totalpaye = 0;
|
||||||
|
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
$i = 0; $total = 0;
|
$i = 0; $total = 0;
|
||||||
print '<table class="noborder paymenttable">';
|
print '<table class="noborder paymenttable">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("RefPayment").'</td>';
|
print '<td>'.$langs->trans("RefPayment").'</td>';
|
||||||
print '<td>'.$langs->trans("Date").'</td>';
|
print '<td>'.$langs->trans("Date").'</td>';
|
||||||
print '<td>'.$langs->trans("Type").'</td>';
|
print '<td>'.$langs->trans("Type").'</td>';
|
||||||
print '<td align="right">'.$langs->trans("Amount").'</td>';
|
print '<td align="right">'.$langs->trans("Amount").'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$var=true;
|
$var=true;
|
||||||
if ($num > 0)
|
if ($num > 0)
|
||||||
{
|
{
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
|
|
||||||
print "<tr ".$bc[$var]."><td>";
|
print "<tr ".$bc[$var]."><td>";
|
||||||
print '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$objp->rowid.'">'.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.'</a></td>';
|
print '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$objp->rowid.'">'.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.'</a></td>';
|
||||||
print '<td>'.dol_print_date($db->jdate($objp->dp),'day')."</td>\n";
|
print '<td>'.dol_print_date($db->jdate($objp->dp),'day')."</td>\n";
|
||||||
$labeltype=$langs->trans("PaymentType".$objp->type_code)!=("PaymentType".$objp->type_code)?$langs->trans("PaymentType".$objp->type_code):$objp->paiement_type;
|
$labeltype=$langs->trans("PaymentType".$objp->type_code)!=("PaymentType".$objp->type_code)?$langs->trans("PaymentType".$objp->type_code):$objp->paiement_type;
|
||||||
print "<td>".$labeltype.' '.$objp->num_paiement."</td>\n";
|
print "<td>".$labeltype.' '.$objp->num_paiement."</td>\n";
|
||||||
print '<td align="right">'.price($objp->amount)."</td>\n";
|
print '<td align="right">'.price($objp->amount)."</td>\n";
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
$totalpaye += $objp->amount;
|
$totalpaye += $objp->amount;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
print '<tr class="oddeven"><td colspan="'.$nbcols.'" class="opacitymedium">'.$langs->trans("None").'</td><td></td><td></td><td></td></tr>';
|
print '<tr class="oddeven"><td colspan="'.$nbcols.'" class="opacitymedium">'.$langs->trans("None").'</td><td></td><td></td><td></td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
//if ($object->status == ChargeSociales::STATUS_DRAFT)
|
//if ($object->status == ChargeSociales::STATUS_DRAFT)
|
||||||
//{
|
//{
|
||||||
print "<tr><td colspan=\"3\" align=\"right\">".$langs->trans("AlreadyPaid")." :</td><td align=\"right\">".price($totalpaye)."</td></tr>\n";
|
print "<tr><td colspan=\"3\" align=\"right\">".$langs->trans("AlreadyPaid")." :</td><td align=\"right\">".price($totalpaye)."</td></tr>\n";
|
||||||
print "<tr><td colspan=\"3\" align=\"right\">".$langs->trans("AmountExpected")." :</td><td align=\"right\">".price($object->amount)."</td></tr>\n";
|
print "<tr><td colspan=\"3\" align=\"right\">".$langs->trans("AmountExpected")." :</td><td align=\"right\">".price($object->amount)."</td></tr>\n";
|
||||||
|
|
||||||
$resteapayer = $object->amount - $totalpaye;
|
$resteapayer = $object->amount - $totalpaye;
|
||||||
$cssforamountpaymentcomplete = 'amountpaymentcomplete';
|
$cssforamountpaymentcomplete = 'amountpaymentcomplete';
|
||||||
|
|
||||||
print "<tr><td colspan=\"3\" align=\"right\">".$langs->trans("RemainderToPay")." :</td>";
|
print "<tr><td colspan=\"3\" align=\"right\">".$langs->trans("RemainderToPay")." :</td>";
|
||||||
print '<td align="right"'.($resteapayer?' class="amountremaintopay"':(' class="'.$cssforamountpaymentcomplete.'"')).'>'.price($resteapayer)."</td></tr>\n";
|
print '<td align="right"'.($resteapayer?' class="amountremaintopay"':(' class="'.$cssforamountpaymentcomplete.'"')).'>'.price($resteapayer)."</td></tr>\n";
|
||||||
//}
|
//}
|
||||||
print "</table>";
|
print "</table>";
|
||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -92,8 +92,8 @@ class Ldap
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The internal LDAP connection handle
|
* The internal LDAP connection handle
|
||||||
*/
|
*/
|
||||||
var $connection;
|
var $connection;
|
||||||
/**
|
/**
|
||||||
* Result of any connections etc.
|
* Result of any connections etc.
|
||||||
@ -749,7 +749,7 @@ class Ldap
|
|||||||
|
|
||||||
// Attribute methods -----------------------------------------------------
|
// Attribute methods -----------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a LDAP attribute in entry
|
* Add a LDAP attribute in entry
|
||||||
* Ldap object connect and bind must have been done
|
* Ldap object connect and bind must have been done
|
||||||
*
|
*
|
||||||
@ -801,7 +801,7 @@ class Ldap
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update a LDAP attribute in entry
|
* Update a LDAP attribute in entry
|
||||||
* Ldap object connect and bind must have been done
|
* Ldap object connect and bind must have been done
|
||||||
*
|
*
|
||||||
@ -853,7 +853,7 @@ class Ldap
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a LDAP attribute in entry
|
* Delete a LDAP attribute in entry
|
||||||
* Ldap object connect and bind must have been done
|
* Ldap object connect and bind must have been done
|
||||||
*
|
*
|
||||||
@ -905,7 +905,7 @@ class Ldap
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array containing attributes and values for first record
|
* Returns an array containing attributes and values for first record
|
||||||
*
|
*
|
||||||
* @param string $dn DN entry key
|
* @param string $dn DN entry key
|
||||||
@ -1262,7 +1262,7 @@ class Ldap
|
|||||||
$i=0;
|
$i=0;
|
||||||
while ($i <= 2)
|
while ($i <= 2)
|
||||||
{
|
{
|
||||||
dol_syslog(get_class($this)."::fetch search with searchDN=".$searchDN." filter=".$filter);
|
dol_syslog(get_class($this)."::fetch search with searchDN=".$searchDN." filter=".$filter);
|
||||||
$this->result = @ldap_search($this->connection, $searchDN, $filter);
|
$this->result = @ldap_search($this->connection, $searchDN, $filter);
|
||||||
if ($this->result)
|
if ($this->result)
|
||||||
{
|
{
|
||||||
@ -1273,9 +1273,9 @@ class Ldap
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error = ldap_errno($this->connection)." ".ldap_error($this->connection);
|
$this->error = ldap_errno($this->connection)." ".ldap_error($this->connection);
|
||||||
dol_syslog(get_class($this)."::fetch search fails");
|
dol_syslog(get_class($this)."::fetch search fails");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $result)
|
if (! $result)
|
||||||
@ -1324,7 +1324,7 @@ class Ldap
|
|||||||
$this->domainFQDN = $domain;
|
$this->domainFQDN = $domain;
|
||||||
|
|
||||||
// Set ldapUserDn (each user can have a different dn)
|
// Set ldapUserDn (each user can have a different dn)
|
||||||
//var_dump($result[0]);exit;
|
//var_dump($result[0]);exit;
|
||||||
$this->ldapUserDN=$result[0]['dn'];
|
$this->ldapUserDN=$result[0]['dn'];
|
||||||
|
|
||||||
ldap_free_result($this->result);
|
ldap_free_result($this->result);
|
||||||
@ -1350,11 +1350,11 @@ class Ldap
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UserAccountControl Flgs to more human understandable form...
|
* UserAccountControl Flgs to more human understandable form...
|
||||||
*
|
*
|
||||||
* @param string $uacf UACF
|
* @param string $uacf UACF
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function parseUACF($uacf)
|
function parseUACF($uacf)
|
||||||
{
|
{
|
||||||
//All flags array
|
//All flags array
|
||||||
@ -1396,11 +1396,11 @@ class Ldap
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SamAccountType value to text
|
* SamAccountType value to text
|
||||||
*
|
*
|
||||||
* @param string $samtype SamType
|
* @param string $samtype SamType
|
||||||
* @return string Sam string
|
* @return string Sam string
|
||||||
*/
|
*/
|
||||||
function parseSAT($samtype)
|
function parseSAT($samtype)
|
||||||
{
|
{
|
||||||
$stypes = array(
|
$stypes = array(
|
||||||
@ -1443,7 +1443,7 @@ class Ldap
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a string into output/memory charset
|
* Convert a string into output/memory charset
|
||||||
*
|
*
|
||||||
* @param string $str String to convert
|
* @param string $str String to convert
|
||||||
* @param string $pagecodefrom Page code of src string
|
* @param string $pagecodefrom Page code of src string
|
||||||
* @return string Converted string
|
* @return string Converted string
|
||||||
@ -1458,7 +1458,7 @@ class Ldap
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a string from output/memory charset
|
* Convert a string from output/memory charset
|
||||||
*
|
*
|
||||||
* @param string $str String to convert
|
* @param string $str String to convert
|
||||||
* @param string $pagecodeto Page code for result string
|
* @param string $pagecodeto Page code for result string
|
||||||
* @return string Converted string
|
* @return string Converted string
|
||||||
|
|||||||
@ -30,56 +30,56 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/CMailFile.class.php';
|
|||||||
*/
|
*/
|
||||||
class Notify
|
class Notify
|
||||||
{
|
{
|
||||||
var $id;
|
var $id;
|
||||||
var $db;
|
var $db;
|
||||||
var $error;
|
var $error;
|
||||||
var $errors=array();
|
var $errors=array();
|
||||||
|
|
||||||
var $author;
|
var $author;
|
||||||
var $ref;
|
var $ref;
|
||||||
var $date;
|
var $date;
|
||||||
var $duree;
|
var $duree;
|
||||||
var $note;
|
var $note;
|
||||||
var $fk_project;
|
var $fk_project;
|
||||||
|
|
||||||
// Les codes actions sont definis dans la table llx_notify_def
|
// Les codes actions sont definis dans la table llx_notify_def
|
||||||
|
|
||||||
// codes actions supported are
|
// codes actions supported are
|
||||||
public $arrayofnotifsupported = array(
|
public $arrayofnotifsupported = array(
|
||||||
'BILL_VALIDATE',
|
'BILL_VALIDATE',
|
||||||
'BILL_PAYED',
|
'BILL_PAYED',
|
||||||
'ORDER_VALIDATE',
|
'ORDER_VALIDATE',
|
||||||
'PROPAL_VALIDATE',
|
'PROPAL_VALIDATE',
|
||||||
'PROPAL_CLOSE_SIGNED',
|
'PROPAL_CLOSE_SIGNED',
|
||||||
'FICHINTER_VALIDATE',
|
'FICHINTER_VALIDATE',
|
||||||
'FICHINTER_ADD_CONTACT',
|
'FICHINTER_ADD_CONTACT',
|
||||||
'ORDER_SUPPLIER_VALIDATE',
|
'ORDER_SUPPLIER_VALIDATE',
|
||||||
'ORDER_SUPPLIER_APPROVE',
|
'ORDER_SUPPLIER_APPROVE',
|
||||||
'ORDER_SUPPLIER_REFUSE',
|
'ORDER_SUPPLIER_REFUSE',
|
||||||
'SHIPPING_VALIDATE'
|
'SHIPPING_VALIDATE'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param DoliDB $db Database handler
|
* @param DoliDB $db Database handler
|
||||||
*/
|
*/
|
||||||
function __construct($db)
|
function __construct($db)
|
||||||
{
|
{
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return message that say how many notification (and to which email) will occurs on requested event.
|
* Return message that say how many notification (and to which email) will occurs on requested event.
|
||||||
* This is to show confirmation messages before event is recorded.
|
* This is to show confirmation messages before event is recorded.
|
||||||
*
|
*
|
||||||
* @param string $action Id of action in llx_c_action_trigger
|
* @param string $action Id of action in llx_c_action_trigger
|
||||||
* @param int $socid Id of third party
|
* @param int $socid Id of third party
|
||||||
* @param Object $object Object the notification is about
|
* @param Object $object Object the notification is about
|
||||||
* @return string Message
|
* @return string Message
|
||||||
*/
|
*/
|
||||||
function confirmMessage($action,$socid,$object)
|
function confirmMessage($action,$socid,$object)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
@ -96,175 +96,175 @@ class Notify
|
|||||||
|
|
||||||
if (is_array($listofnotiftodo))
|
if (is_array($listofnotiftodo))
|
||||||
{
|
{
|
||||||
$i=0;
|
$i=0;
|
||||||
foreach ($listofnotiftodo as $key => $val)
|
foreach ($listofnotiftodo as $key => $val)
|
||||||
{
|
{
|
||||||
if ($i) $texte.=', ';
|
if ($i) $texte.=', ';
|
||||||
else $texte.=' (';
|
else $texte.=' (';
|
||||||
if ($val['isemailvalid']) $texte.=$val['email'];
|
if ($val['isemailvalid']) $texte.=$val['email'];
|
||||||
else $texte.=$val['emaildesc'];
|
else $texte.=$val['emaildesc'];
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
if ($i) $texte.=')';
|
if ($i) $texte.=')';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $texte;
|
return $texte;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return number of notifications activated for action code (and third party)
|
* Return number of notifications activated for action code (and third party)
|
||||||
*
|
*
|
||||||
* @param string $notifcode Code of action in llx_c_action_trigger (new usage) or Id of action in llx_c_action_trigger (old usage)
|
* @param string $notifcode Code of action in llx_c_action_trigger (new usage) or Id of action in llx_c_action_trigger (old usage)
|
||||||
* @param int $socid Id of third party or 0 for all thirdparties or -1 for no thirdparties
|
* @param int $socid Id of third party or 0 for all thirdparties or -1 for no thirdparties
|
||||||
* @param Object $object Object the notification is about (need it to check threshold value of some notifications)
|
* @param Object $object Object the notification is about (need it to check threshold value of some notifications)
|
||||||
* @param int $userid Id of user or 0 for all users or -1 for no users
|
* @param int $userid Id of user or 0 for all users or -1 for no users
|
||||||
* @param array $scope Scope where to search
|
* @param array $scope Scope where to search
|
||||||
* @return array|int <0 if KO, array of notifications to send if OK
|
* @return array|int <0 if KO, array of notifications to send if OK
|
||||||
*/
|
*/
|
||||||
function getNotificationsArray($notifcode, $socid=0, $object=null, $userid=0, $scope=array('thirdparty', 'user', 'global'))
|
function getNotificationsArray($notifcode, $socid=0, $object=null, $userid=0, $scope=array('thirdparty', 'user', 'global'))
|
||||||
{
|
{
|
||||||
global $conf, $user;
|
global $conf, $user;
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
$resarray=array();
|
$resarray=array();
|
||||||
|
|
||||||
$valueforthreshold = 0;
|
$valueforthreshold = 0;
|
||||||
if (is_object($object)) $valueforthreshold = $object->total_ht;
|
if (is_object($object)) $valueforthreshold = $object->total_ht;
|
||||||
|
|
||||||
if (! $error)
|
|
||||||
{
|
|
||||||
if ($socid >= 0 && in_array('thirdparty', $scope))
|
|
||||||
{
|
|
||||||
$sql = "SELECT a.code, c.email, c.rowid";
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n,";
|
|
||||||
$sql.= " ".MAIN_DB_PREFIX."socpeople as c,";
|
|
||||||
$sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a,";
|
|
||||||
$sql.= " ".MAIN_DB_PREFIX."societe as s";
|
|
||||||
$sql.= " WHERE n.fk_contact = c.rowid";
|
|
||||||
$sql.= " AND a.rowid = n.fk_action";
|
|
||||||
$sql.= " AND n.fk_soc = s.rowid";
|
|
||||||
if ($notifcode)
|
|
||||||
{
|
|
||||||
if (is_numeric($notifcode)) $sql.= " AND n.fk_action = ".$notifcode; // Old usage
|
|
||||||
else $sql.= " AND a.code = '".$notifcode."'"; // New usage
|
|
||||||
}
|
|
||||||
$sql.= " AND s.entity IN (".getEntity('societe').")";
|
|
||||||
if ($socid > 0) $sql.= " AND s.rowid = ".$socid;
|
|
||||||
|
|
||||||
dol_syslog(__METHOD__." ".$notifcode.", ".$socid."", LOG_DEBUG);
|
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
|
||||||
if ($resql)
|
|
||||||
{
|
|
||||||
$num = $this->db->num_rows($resql);
|
|
||||||
$i=0;
|
|
||||||
while ($i < $num)
|
|
||||||
{
|
|
||||||
$obj = $this->db->fetch_object($resql);
|
|
||||||
if ($obj)
|
|
||||||
{
|
|
||||||
$newval2=trim($obj->email);
|
|
||||||
$isvalid=isValidEmail($newval2);
|
|
||||||
if (empty($resarray[$newval2])) $resarray[$newval2] = array('type'=> 'tocontact', 'code'=>trim($obj->code), 'emaildesc'=>'Contact id '.$obj->rowid, 'email'=>$newval2, 'contactid'=>$obj->rowid, 'isemailvalid'=>$isvalid);
|
|
||||||
}
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$error++;
|
|
||||||
$this->error=$this->db->lasterror();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $error)
|
|
||||||
{
|
|
||||||
if ($userid >= 0 && in_array('user', $scope))
|
|
||||||
{
|
|
||||||
$sql = "SELECT a.code, c.email, c.rowid";
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n,";
|
|
||||||
$sql.= " ".MAIN_DB_PREFIX."user as c,";
|
|
||||||
$sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a";
|
|
||||||
$sql.= " WHERE n.fk_user = c.rowid";
|
|
||||||
$sql.= " AND a.rowid = n.fk_action";
|
|
||||||
if ($notifcode)
|
|
||||||
{
|
|
||||||
if (is_numeric($notifcode)) $sql.= " AND n.fk_action = ".$notifcode; // Old usage
|
|
||||||
else $sql.= " AND a.code = '".$notifcode."'"; // New usage
|
|
||||||
}
|
|
||||||
$sql.= " AND c.entity IN (".getEntity('user').")";
|
|
||||||
if ($userid > 0) $sql.= " AND c.rowid = ".$userid;
|
|
||||||
|
|
||||||
dol_syslog(__METHOD__." ".$notifcode.", ".$socid."", LOG_DEBUG);
|
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
|
||||||
if ($resql)
|
|
||||||
{
|
|
||||||
$num = $this->db->num_rows($resql);
|
|
||||||
$i=0;
|
|
||||||
while ($i < $num)
|
|
||||||
{
|
|
||||||
$obj = $this->db->fetch_object($resql);
|
|
||||||
if ($obj)
|
|
||||||
{
|
|
||||||
$newval2=trim($obj->email);
|
|
||||||
$isvalid=isValidEmail($newval2);
|
|
||||||
if (empty($resarray[$newval2])) $resarray[$newval2] = array('type'=> 'touser', 'code'=>trim($obj->code), 'emaildesc'=>'User id '.$obj->rowid, 'email'=>$newval2, 'userid'=>$obj->rowid, 'isemailvalid'=>$isvalid);
|
|
||||||
}
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$error++;
|
|
||||||
$this->error=$this->db->lasterror();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
if (in_array('global', $scope))
|
if ($socid >= 0 && in_array('thirdparty', $scope))
|
||||||
{
|
{
|
||||||
// List of notifications enabled for fixed email
|
$sql = "SELECT a.code, c.email, c.rowid";
|
||||||
foreach($conf->global as $key => $val)
|
$sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n,";
|
||||||
{
|
$sql.= " ".MAIN_DB_PREFIX."socpeople as c,";
|
||||||
if ($notifcode)
|
$sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a,";
|
||||||
{
|
$sql.= " ".MAIN_DB_PREFIX."societe as s";
|
||||||
if ($val == '' || ! preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifcode.'_THRESHOLD_HIGHER_(.*)$/', $key, $reg)) continue;
|
$sql.= " WHERE n.fk_contact = c.rowid";
|
||||||
}
|
$sql.= " AND a.rowid = n.fk_action";
|
||||||
else
|
$sql.= " AND n.fk_soc = s.rowid";
|
||||||
{
|
if ($notifcode)
|
||||||
if ($val == '' || ! preg_match('/^NOTIFICATION_FIXEDEMAIL_.*_THRESHOLD_HIGHER_(.*)$/', $key, $reg)) continue;
|
{
|
||||||
}
|
if (is_numeric($notifcode)) $sql.= " AND n.fk_action = ".$notifcode; // Old usage
|
||||||
|
else $sql.= " AND a.code = '".$notifcode."'"; // New usage
|
||||||
|
}
|
||||||
|
$sql.= " AND s.entity IN (".getEntity('societe').")";
|
||||||
|
if ($socid > 0) $sql.= " AND s.rowid = ".$socid;
|
||||||
|
|
||||||
$threshold = (float) $reg[1];
|
dol_syslog(__METHOD__." ".$notifcode.", ".$socid."", LOG_DEBUG);
|
||||||
if ($valueforthreshold < $threshold) continue;
|
|
||||||
|
|
||||||
$tmpemail=explode(',',$val);
|
$resql = $this->db->query($sql);
|
||||||
foreach($tmpemail as $key2 => $val2)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$newval2=trim($val2);
|
$num = $this->db->num_rows($resql);
|
||||||
if ($newval2 == '__SUPERVISOREMAIL__')
|
$i=0;
|
||||||
{
|
while ($i < $num)
|
||||||
if ($user->fk_user > 0)
|
{
|
||||||
{
|
$obj = $this->db->fetch_object($resql);
|
||||||
$tmpuser=new User($this->db);
|
if ($obj)
|
||||||
$tmpuser->fetch($user->fk_user);
|
{
|
||||||
if ($tmpuser->email) $newval2=trim($tmpuser->email);
|
$newval2=trim($obj->email);
|
||||||
else $newval2='';
|
$isvalid=isValidEmail($newval2);
|
||||||
}
|
if (empty($resarray[$newval2])) $resarray[$newval2] = array('type'=> 'tocontact', 'code'=>trim($obj->code), 'emaildesc'=>'Contact id '.$obj->rowid, 'email'=>$newval2, 'contactid'=>$obj->rowid, 'isemailvalid'=>$isvalid);
|
||||||
else $newval2='';
|
}
|
||||||
}
|
$i++;
|
||||||
if ($newval2)
|
}
|
||||||
{
|
}
|
||||||
$isvalid=isValidEmail($newval2, 0);
|
else
|
||||||
if (empty($resarray[$newval2])) $resarray[$newval2]=array('type'=> 'tofixedemail', 'code'=>trim($key), 'emaildesc'=>trim($val2), 'email'=>$newval2, 'isemailvalid'=>$isvalid);
|
{
|
||||||
}
|
$error++;
|
||||||
}
|
$this->error=$this->db->lasterror();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
if ($userid >= 0 && in_array('user', $scope))
|
||||||
|
{
|
||||||
|
$sql = "SELECT a.code, c.email, c.rowid";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n,";
|
||||||
|
$sql.= " ".MAIN_DB_PREFIX."user as c,";
|
||||||
|
$sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a";
|
||||||
|
$sql.= " WHERE n.fk_user = c.rowid";
|
||||||
|
$sql.= " AND a.rowid = n.fk_action";
|
||||||
|
if ($notifcode)
|
||||||
|
{
|
||||||
|
if (is_numeric($notifcode)) $sql.= " AND n.fk_action = ".$notifcode; // Old usage
|
||||||
|
else $sql.= " AND a.code = '".$notifcode."'"; // New usage
|
||||||
|
}
|
||||||
|
$sql.= " AND c.entity IN (".getEntity('user').")";
|
||||||
|
if ($userid > 0) $sql.= " AND c.rowid = ".$userid;
|
||||||
|
|
||||||
|
dol_syslog(__METHOD__." ".$notifcode.", ".$socid."", LOG_DEBUG);
|
||||||
|
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$num = $this->db->num_rows($resql);
|
||||||
|
$i=0;
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
if ($obj)
|
||||||
|
{
|
||||||
|
$newval2=trim($obj->email);
|
||||||
|
$isvalid=isValidEmail($newval2);
|
||||||
|
if (empty($resarray[$newval2])) $resarray[$newval2] = array('type'=> 'touser', 'code'=>trim($obj->code), 'emaildesc'=>'User id '.$obj->rowid, 'email'=>$newval2, 'userid'=>$obj->rowid, 'isemailvalid'=>$isvalid);
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$this->error=$this->db->lasterror();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
if (in_array('global', $scope))
|
||||||
|
{
|
||||||
|
// List of notifications enabled for fixed email
|
||||||
|
foreach($conf->global as $key => $val)
|
||||||
|
{
|
||||||
|
if ($notifcode)
|
||||||
|
{
|
||||||
|
if ($val == '' || ! preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifcode.'_THRESHOLD_HIGHER_(.*)$/', $key, $reg)) continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($val == '' || ! preg_match('/^NOTIFICATION_FIXEDEMAIL_.*_THRESHOLD_HIGHER_(.*)$/', $key, $reg)) continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$threshold = (float) $reg[1];
|
||||||
|
if ($valueforthreshold < $threshold) continue;
|
||||||
|
|
||||||
|
$tmpemail=explode(',',$val);
|
||||||
|
foreach($tmpemail as $key2 => $val2)
|
||||||
|
{
|
||||||
|
$newval2=trim($val2);
|
||||||
|
if ($newval2 == '__SUPERVISOREMAIL__')
|
||||||
|
{
|
||||||
|
if ($user->fk_user > 0)
|
||||||
|
{
|
||||||
|
$tmpuser=new User($this->db);
|
||||||
|
$tmpuser->fetch($user->fk_user);
|
||||||
|
if ($tmpuser->email) $newval2=trim($tmpuser->email);
|
||||||
|
else $newval2='';
|
||||||
|
}
|
||||||
|
else $newval2='';
|
||||||
|
}
|
||||||
|
if ($newval2)
|
||||||
|
{
|
||||||
|
$isvalid=isValidEmail($newval2, 0);
|
||||||
|
if (empty($resarray[$newval2])) $resarray[$newval2]=array('type'=> 'tofixedemail', 'code'=>trim($key), 'emaildesc'=>trim($val2), 'email'=>$newval2, 'isemailvalid'=>$isvalid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($error) return -1;
|
if ($error) return -1;
|
||||||
@ -273,47 +273,47 @@ class Notify
|
|||||||
return $resarray;
|
return $resarray;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if notification are active for couple action/company.
|
* Check if notification are active for couple action/company.
|
||||||
* If yes, send mail and save trace into llx_notify.
|
* If yes, send mail and save trace into llx_notify.
|
||||||
*
|
*
|
||||||
* @param string $notifcode Code of action in llx_c_action_trigger (new usage) or Id of action in llx_c_action_trigger (old usage)
|
* @param string $notifcode Code of action in llx_c_action_trigger (new usage) or Id of action in llx_c_action_trigger (old usage)
|
||||||
* @param Object $object Object the notification deals on
|
* @param Object $object Object the notification deals on
|
||||||
* @return int <0 if KO, or number of changes if OK
|
* @return int <0 if KO, or number of changes if OK
|
||||||
*/
|
*/
|
||||||
function send($notifcode, $object)
|
function send($notifcode, $object)
|
||||||
{
|
{
|
||||||
global $user,$conf,$langs,$mysoc;
|
global $user,$conf,$langs,$mysoc;
|
||||||
global $hookmanager;
|
global $hookmanager;
|
||||||
global $dolibarr_main_url_root;
|
global $dolibarr_main_url_root;
|
||||||
|
|
||||||
if (! in_array($notifcode, $this->arrayofnotifsupported)) return 0;
|
if (! in_array($notifcode, $this->arrayofnotifsupported)) return 0;
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
if (! is_object($hookmanager))
|
if (! is_object($hookmanager))
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||||
$hookmanager=new HookManager($this->db);
|
$hookmanager=new HookManager($this->db);
|
||||||
}
|
}
|
||||||
$hookmanager->initHooks(array('notification'));
|
$hookmanager->initHooks(array('notification'));
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::send notifcode=".$notifcode.", object=".$object->id);
|
dol_syslog(get_class($this)."::send notifcode=".$notifcode.", object=".$object->id);
|
||||||
|
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
|
|
||||||
// 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
|
||||||
|
|
||||||
// Define some vars
|
// Define some vars
|
||||||
$application = 'Dolibarr';
|
$application = 'Dolibarr';
|
||||||
if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $application = $conf->global->MAIN_APPLICATION_TITLE;
|
if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $application = $conf->global->MAIN_APPLICATION_TITLE;
|
||||||
$replyto = $conf->notification->email_from;
|
$replyto = $conf->notification->email_from;
|
||||||
$filename = basename($file);
|
$filename = basename($file);
|
||||||
$mimefile = dol_mimetype($file);
|
$mimefile = dol_mimetype($file);
|
||||||
$object_type = '';
|
$object_type = '';
|
||||||
$link = '';
|
$link = '';
|
||||||
$num = 0;
|
$num = 0;
|
||||||
|
|
||||||
$oldref=(empty($object->oldref)?$object->ref:$object->oldref);
|
$oldref=(empty($object->oldref)?$object->ref:$object->oldref);
|
||||||
@ -322,56 +322,56 @@ class Notify
|
|||||||
// Check notification per third party
|
// Check notification per third party
|
||||||
$sql = "SELECT 'tocontactid' as type_target, c.email, c.rowid as cid, c.lastname, c.firstname, c.default_lang,";
|
$sql = "SELECT 'tocontactid' as type_target, c.email, c.rowid as cid, c.lastname, c.firstname, c.default_lang,";
|
||||||
$sql.= " a.rowid as adid, a.label, a.code, n.rowid, n.type";
|
$sql.= " a.rowid as adid, a.label, a.code, n.rowid, n.type";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c,";
|
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c,";
|
||||||
$sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a,";
|
$sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a,";
|
||||||
$sql.= " ".MAIN_DB_PREFIX."notify_def as n,";
|
$sql.= " ".MAIN_DB_PREFIX."notify_def as n,";
|
||||||
$sql.= " ".MAIN_DB_PREFIX."societe as s";
|
$sql.= " ".MAIN_DB_PREFIX."societe as s";
|
||||||
$sql.= " WHERE n.fk_contact = c.rowid AND a.rowid = n.fk_action";
|
$sql.= " WHERE n.fk_contact = c.rowid AND a.rowid = n.fk_action";
|
||||||
$sql.= " AND n.fk_soc = s.rowid";
|
$sql.= " AND n.fk_soc = s.rowid";
|
||||||
if (is_numeric($notifcode)) $sql.= " AND n.fk_action = ".$notifcode; // Old usage
|
if (is_numeric($notifcode)) $sql.= " AND n.fk_action = ".$notifcode; // Old usage
|
||||||
else $sql.= " AND a.code = '".$notifcode."'"; // New usage
|
else $sql.= " AND a.code = '".$notifcode."'"; // New usage
|
||||||
$sql .= " AND s.rowid = ".$object->socid;
|
$sql .= " AND s.rowid = ".$object->socid;
|
||||||
|
|
||||||
// Check notification per user
|
// Check notification per user
|
||||||
$sql.= "\nUNION\n";
|
$sql.= "\nUNION\n";
|
||||||
|
|
||||||
$sql.= "SELECT 'touserid' as type_target, c.email, c.rowid as cid, c.lastname, c.firstname, c.lang as default_lang,";
|
$sql.= "SELECT 'touserid' as type_target, c.email, c.rowid as cid, c.lastname, c.firstname, c.lang as default_lang,";
|
||||||
$sql.= " a.rowid as adid, a.label, a.code, n.rowid, n.type";
|
$sql.= " a.rowid as adid, a.label, a.code, n.rowid, n.type";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as c,";
|
$sql.= " FROM ".MAIN_DB_PREFIX."user as c,";
|
||||||
$sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a,";
|
$sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a,";
|
||||||
$sql.= " ".MAIN_DB_PREFIX."notify_def as n";
|
$sql.= " ".MAIN_DB_PREFIX."notify_def as n";
|
||||||
$sql.= " WHERE n.fk_user = c.rowid AND a.rowid = n.fk_action";
|
$sql.= " WHERE n.fk_user = c.rowid AND a.rowid = n.fk_action";
|
||||||
if (is_numeric($notifcode)) $sql.= " AND n.fk_action = ".$notifcode; // Old usage
|
if (is_numeric($notifcode)) $sql.= " AND n.fk_action = ".$notifcode; // Old usage
|
||||||
else $sql.= " AND a.code = '".$notifcode."'"; // New usage
|
else $sql.= " AND a.code = '".$notifcode."'"; // New usage
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$num = $this->db->num_rows($result);
|
$num = $this->db->num_rows($result);
|
||||||
|
|
||||||
if ($num > 0)
|
if ($num > 0)
|
||||||
{
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ($i < $num && ! $error) // For each notification couple defined (third party/actioncode)
|
while ($i < $num && ! $error) // For each notification couple defined (third party/actioncode)
|
||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($result);
|
$obj = $this->db->fetch_object($result);
|
||||||
|
|
||||||
$sendto = dolGetFirstLastname($obj->firstname,$obj->lastname) . " <".$obj->email.">";
|
$sendto = dolGetFirstLastname($obj->firstname,$obj->lastname) . " <".$obj->email.">";
|
||||||
$notifcodedefid = $obj->adid;
|
$notifcodedefid = $obj->adid;
|
||||||
|
|
||||||
if (dol_strlen($obj->email))
|
if (dol_strlen($obj->email))
|
||||||
{
|
{
|
||||||
// Set output language
|
// Set output language
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
if ($obj->default_lang && $obj->default_lang != $langs->defaultlang)
|
if ($obj->default_lang && $obj->default_lang != $langs->defaultlang)
|
||||||
{
|
{
|
||||||
$outputlangs = new Translate('', $conf);
|
$outputlangs = new Translate('', $conf);
|
||||||
$outputlangs->setDefaultLang($obj->default_lang);
|
$outputlangs->setDefaultLang($obj->default_lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
$subject = '['.$mysoc->name.'] '.$outputlangs->transnoentitiesnoconv("DolibarrNotification");
|
$subject = '['.$mysoc->name.'] '.$outputlangs->transnoentitiesnoconv("DolibarrNotification");
|
||||||
|
|
||||||
switch ($notifcode) {
|
switch ($notifcode) {
|
||||||
case 'BILL_VALIDATE':
|
case 'BILL_VALIDATE':
|
||||||
$link='/compta/facture/card.php?facid='.$object->id;
|
$link='/compta/facture/card.php?facid='.$object->id;
|
||||||
$dir_output = $conf->facture->dir_output;
|
$dir_output = $conf->facture->dir_output;
|
||||||
@ -396,12 +396,12 @@ class Notify
|
|||||||
$object_type = 'propal';
|
$object_type = 'propal';
|
||||||
$mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated",$newref);
|
$mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated",$newref);
|
||||||
break;
|
break;
|
||||||
case 'PROPAL_CLOSE_SIGNED':
|
case 'PROPAL_CLOSE_SIGNED':
|
||||||
$link='/comm/propal/card.php?id='.$object->id;
|
$link='/comm/propal/card.php?id='.$object->id;
|
||||||
$dir_output = $conf->propal->dir_output;
|
$dir_output = $conf->propal->dir_output;
|
||||||
$object_type = 'propal';
|
$object_type = 'propal';
|
||||||
$mesg = $langs->transnoentitiesnoconv("EMailTextProposalClosedSigned",$newref);
|
$mesg = $langs->transnoentitiesnoconv("EMailTextProposalClosedSigned",$newref);
|
||||||
break;
|
break;
|
||||||
case 'FICHINTER_ADD_CONTACT':
|
case 'FICHINTER_ADD_CONTACT':
|
||||||
$link='/fichinter/card.php?id='.$object->id;
|
$link='/fichinter/card.php?id='.$object->id;
|
||||||
$dir_output = $conf->facture->dir_output;
|
$dir_output = $conf->facture->dir_output;
|
||||||
@ -444,7 +444,7 @@ class Notify
|
|||||||
$mesg = $langs->transnoentitiesnoconv("EMailTextExpeditionValidated",$newref);
|
$mesg = $langs->transnoentitiesnoconv("EMailTextExpeditionValidated",$newref);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$ref = dol_sanitizeFileName($newref);
|
$ref = dol_sanitizeFileName($newref);
|
||||||
$pdf_path = $dir_output."/".$ref."/".$ref.".pdf";
|
$pdf_path = $dir_output."/".$ref."/".$ref.".pdf";
|
||||||
if (! dol_is_file($pdf_path))
|
if (! dol_is_file($pdf_path))
|
||||||
{
|
{
|
||||||
@ -456,104 +456,104 @@ class Notify
|
|||||||
$filepdf = $pdf_path;
|
$filepdf = $pdf_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
$message = $outputlangs->transnoentities("YouReceiveMailBecauseOfNotification",$application,$mysoc->name)."\n";
|
$message = $outputlangs->transnoentities("YouReceiveMailBecauseOfNotification",$application,$mysoc->name)."\n";
|
||||||
$message.= $outputlangs->transnoentities("YouReceiveMailBecauseOfNotification2",$application,$mysoc->name)."\n";
|
$message.= $outputlangs->transnoentities("YouReceiveMailBecauseOfNotification2",$application,$mysoc->name)."\n";
|
||||||
$message.= "\n";
|
$message.= "\n";
|
||||||
$message.= $mesg;
|
$message.= $mesg;
|
||||||
if ($link) $message=dol_concatdesc($message,$urlwithroot.$link);
|
if ($link) $message=dol_concatdesc($message,$urlwithroot.$link);
|
||||||
|
|
||||||
$parameters=array('notifcode'=>$notifcode, 'sendto'=>$sendto, 'replyto'=>$replyto, 'file'=>$file, 'mimefile'=>$mimefile, 'filename'=>$filename);
|
$parameters=array('notifcode'=>$notifcode, 'sendto'=>$sendto, 'replyto'=>$replyto, 'file'=>$file, 'mimefile'=>$mimefile, 'filename'=>$filename);
|
||||||
$reshook=$hookmanager->executeHooks('formatNotificationMessage',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('formatNotificationMessage',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
if (! empty($hookmanager->resArray['subject'])) $subject.=$hookmanager->resArray['subject'];
|
if (! empty($hookmanager->resArray['subject'])) $subject.=$hookmanager->resArray['subject'];
|
||||||
if (! empty($hookmanager->resArray['message'])) $message.=$hookmanager->resArray['message'];
|
if (! empty($hookmanager->resArray['message'])) $message.=$hookmanager->resArray['message'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$mailfile = new CMailFile(
|
$mailfile = new CMailFile(
|
||||||
$subject,
|
$subject,
|
||||||
$sendto,
|
$sendto,
|
||||||
$replyto,
|
$replyto,
|
||||||
$message,
|
$message,
|
||||||
array($file),
|
array($file),
|
||||||
array($mimefile),
|
array($mimefile),
|
||||||
array($filename[count($filename)-1]),
|
array($filename[count($filename)-1]),
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
0,
|
0,
|
||||||
-1
|
-1
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($mailfile->sendfile())
|
if ($mailfile->sendfile())
|
||||||
{
|
{
|
||||||
if ($obj->type_target == 'touserid') {
|
if ($obj->type_target == 'touserid') {
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_user, type, objet_type, type_target, objet_id, email)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_user, type, objet_type, type_target, objet_id, email)";
|
||||||
$sql.= " VALUES ('".$this->db->idate(dol_now())."', ".$notifcodedefid.", ".($object->socid?$object->socid:'null').", ".$obj->cid.", '".$obj->type."', '".$object_type."', '".$obj->type_target."', ".$object->id.", '".$this->db->escape($obj->email)."')";
|
$sql.= " VALUES ('".$this->db->idate(dol_now())."', ".$notifcodedefid.", ".($object->socid?$object->socid:'null').", ".$obj->cid.", '".$obj->type."', '".$object_type."', '".$obj->type_target."', ".$object->id.", '".$this->db->escape($obj->email)."')";
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, type, objet_type, type_target, objet_id, email)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, type, objet_type, type_target, objet_id, email)";
|
||||||
$sql.= " VALUES ('".$this->db->idate(dol_now())."', ".$notifcodedefid.", ".($object->socid?$object->socid:'null').", ".$obj->cid.", '".$obj->type."', '".$object_type."', '".$obj->type_target."', ".$object->id.", '".$this->db->escape($obj->email)."')";
|
$sql.= " VALUES ('".$this->db->idate(dol_now())."', ".$notifcodedefid.", ".($object->socid?$object->socid:'null').", ".$obj->cid.", '".$obj->type."', '".$object_type."', '".$obj->type_target."', ".$object->id.", '".$this->db->escape($obj->email)."')";
|
||||||
|
|
||||||
}
|
}
|
||||||
if (! $this->db->query($sql))
|
if (! $this->db->query($sql))
|
||||||
{
|
{
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$this->errors[]=$mailfile->error;
|
$this->errors[]=$mailfile->error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_syslog("No notification sent for ".$sendto." because email is empty");
|
dol_syslog("No notification sent for ".$sendto." because email is empty");
|
||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_syslog("No notification to thirdparty sent, nothing into notification setup for the thirdparty socid = ".$object->socid);
|
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
dol_syslog("No notification to thirdparty sent, nothing into notification setup for the thirdparty socid = ".$object->socid);
|
||||||
$error++;
|
}
|
||||||
$this->errors[]=$this->db->lasterror();
|
}
|
||||||
dol_syslog("Failed to get list of notification to send ".$this->db->lasterror(), LOG_ERR);
|
else
|
||||||
return -1;
|
{
|
||||||
}
|
$error++;
|
||||||
|
$this->errors[]=$this->db->lasterror();
|
||||||
|
dol_syslog("Failed to get list of notification to send ".$this->db->lasterror(), LOG_ERR);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
// Check notification using fixed email
|
// Check notification using fixed email
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
foreach($conf->global as $key => $val)
|
foreach($conf->global as $key => $val)
|
||||||
{
|
{
|
||||||
if ($val == '' || ! preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifcode.'_THRESHOLD_HIGHER_(.*)$/', $key, $reg)) continue;
|
if ($val == '' || ! preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifcode.'_THRESHOLD_HIGHER_(.*)$/', $key, $reg)) continue;
|
||||||
|
|
||||||
$threshold = (float) $reg[1];
|
$threshold = (float) $reg[1];
|
||||||
if (!empty($object->total_ht) && $object->total_ht <= $threshold)
|
if (!empty($object->total_ht) && $object->total_ht <= $threshold)
|
||||||
{
|
{
|
||||||
dol_syslog("A notification is requested for notifcode = ".$notifcode." but amount = ".$object->total_ht." so lower than threshold = ".$threshold.". We discard this notification");
|
dol_syslog("A notification is requested for notifcode = ".$notifcode." but amount = ".$object->total_ht." so lower than threshold = ".$threshold.". We discard this notification");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$param='NOTIFICATION_FIXEDEMAIL_'.$notifcode.'_THRESHOLD_HIGHER_'.$reg[1];
|
$param='NOTIFICATION_FIXEDEMAIL_'.$notifcode.'_THRESHOLD_HIGHER_'.$reg[1];
|
||||||
|
|
||||||
$sendto = $conf->global->$param;
|
$sendto = $conf->global->$param;
|
||||||
$notifcodedefid = dol_getIdFromCode($this->db, $notifcode, 'c_action_trigger', 'code', 'rowid');
|
$notifcodedefid = dol_getIdFromCode($this->db, $notifcode, 'c_action_trigger', 'code', 'rowid');
|
||||||
if ($notifcodedefid <= 0) dol_print_error($this->db, 'Failed to get id from code');
|
if ($notifcodedefid <= 0) dol_print_error($this->db, 'Failed to get id from code');
|
||||||
|
|
||||||
$object_type = '';
|
$object_type = '';
|
||||||
$link = '';
|
$link = '';
|
||||||
$num++;
|
$num++;
|
||||||
|
|
||||||
$subject = '['.$mysoc->name.'] '.$langs->transnoentitiesnoconv("DolibarrNotification");
|
$subject = '['.$mysoc->name.'] '.$langs->transnoentitiesnoconv("DolibarrNotification");
|
||||||
|
|
||||||
switch ($notifcode) {
|
switch ($notifcode) {
|
||||||
case 'BILL_VALIDATE':
|
case 'BILL_VALIDATE':
|
||||||
$link='/compta/facture/card.php?facid='.$object->id;
|
$link='/compta/facture/card.php?facid='.$object->id;
|
||||||
$dir_output = $conf->facture->dir_output;
|
$dir_output = $conf->facture->dir_output;
|
||||||
@ -578,32 +578,32 @@ class Notify
|
|||||||
$object_type = 'propal';
|
$object_type = 'propal';
|
||||||
$mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated",$newref);
|
$mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated",$newref);
|
||||||
break;
|
break;
|
||||||
case 'PROPAL_CLOSE_SIGNED':
|
case 'PROPAL_CLOSE_SIGNED':
|
||||||
$link='/comm/propal/card.php?id='.$object->id;
|
$link='/comm/propal/card.php?id='.$object->id;
|
||||||
$dir_output = $conf->propal->dir_output;
|
$dir_output = $conf->propal->dir_output;
|
||||||
$object_type = 'propal';
|
$object_type = 'propal';
|
||||||
$mesg = $langs->transnoentitiesnoconv("EMailTextProposalClosedSigned",$newref);
|
$mesg = $langs->transnoentitiesnoconv("EMailTextProposalClosedSigned",$newref);
|
||||||
break;
|
break;
|
||||||
case 'FICHINTER_ADD_CONTACT':
|
case 'FICHINTER_ADD_CONTACT':
|
||||||
$link='/fichinter/card.php?id='.$object->id;
|
$link='/fichinter/card.php?id='.$object->id;
|
||||||
$dir_output = $conf->facture->dir_output;
|
$dir_output = $conf->facture->dir_output;
|
||||||
$object_type = 'ficheinter';
|
$object_type = 'ficheinter';
|
||||||
$mesg = $langs->transnoentitiesnoconv("EMailTextInterventionAddedContact",$newref);
|
$mesg = $langs->transnoentitiesnoconv("EMailTextInterventionAddedContact",$newref);
|
||||||
break;
|
break;
|
||||||
case 'FICHINTER_VALIDATE':
|
case 'FICHINTER_VALIDATE':
|
||||||
$link='/fichinter/card.php?id='.$object->id;
|
$link='/fichinter/card.php?id='.$object->id;
|
||||||
$dir_output = $conf->facture->dir_output;
|
$dir_output = $conf->facture->dir_output;
|
||||||
$object_type = 'ficheinter';
|
$object_type = 'ficheinter';
|
||||||
$mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated",$newref);
|
$mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated",$newref);
|
||||||
break;
|
break;
|
||||||
case 'ORDER_SUPPLIER_VALIDATE':
|
case 'ORDER_SUPPLIER_VALIDATE':
|
||||||
$link='/fourn/commande/card.php?id='.$object->id;
|
$link='/fourn/commande/card.php?id='.$object->id;
|
||||||
$dir_output = $conf->fournisseur->commande->dir_output;
|
$dir_output = $conf->fournisseur->commande->dir_output;
|
||||||
$object_type = 'order_supplier';
|
$object_type = 'order_supplier';
|
||||||
$mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
|
$mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
|
||||||
$mesg.= $langs->transnoentitiesnoconv("EMailTextOrderValidatedBy",$newref,$user->getFullName($langs));
|
$mesg.= $langs->transnoentitiesnoconv("EMailTextOrderValidatedBy",$newref,$user->getFullName($langs));
|
||||||
$mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
|
$mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
|
||||||
break;
|
break;
|
||||||
case 'ORDER_SUPPLIER_APPROVE':
|
case 'ORDER_SUPPLIER_APPROVE':
|
||||||
$link='/fourn/commande/card.php?id='.$object->id;
|
$link='/fourn/commande/card.php?id='.$object->id;
|
||||||
$dir_output = $conf->fournisseur->commande->dir_output;
|
$dir_output = $conf->fournisseur->commande->dir_output;
|
||||||
@ -646,73 +646,73 @@ class Notify
|
|||||||
$filepdf = $pdf_path;
|
$filepdf = $pdf_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
$message = $langs->transnoentities("YouReceiveMailBecauseOfNotification",$application,$mysoc->name)."\n";
|
$message = $langs->transnoentities("YouReceiveMailBecauseOfNotification",$application,$mysoc->name)."\n";
|
||||||
$message.= $langs->transnoentities("YouReceiveMailBecauseOfNotification2",$application,$mysoc->name)."\n";
|
$message.= $langs->transnoentities("YouReceiveMailBecauseOfNotification2",$application,$mysoc->name)."\n";
|
||||||
$message.= "\n";
|
$message.= "\n";
|
||||||
$message.= $mesg;
|
$message.= $mesg;
|
||||||
if ($link) $message=dol_concatdesc($message,$urlwithroot.$link);
|
if ($link) $message=dol_concatdesc($message,$urlwithroot.$link);
|
||||||
|
|
||||||
// Replace keyword __SUPERVISOREMAIL__
|
// Replace keyword __SUPERVISOREMAIL__
|
||||||
if (preg_match('/__SUPERVISOREMAIL__/', $sendto))
|
if (preg_match('/__SUPERVISOREMAIL__/', $sendto))
|
||||||
{
|
{
|
||||||
$newval='';
|
$newval='';
|
||||||
if ($user->fk_user > 0)
|
if ($user->fk_user > 0)
|
||||||
{
|
{
|
||||||
$supervisoruser=new User($this->db);
|
$supervisoruser=new User($this->db);
|
||||||
$supervisoruser->fetch($user->fk_user);
|
$supervisoruser->fetch($user->fk_user);
|
||||||
if ($supervisoruser->email) $newval=trim(dolGetFirstLastname($supervisoruser->firstname, $supervisoruser->lastname).' <'.$supervisoruser->email.'>');
|
if ($supervisoruser->email) $newval=trim(dolGetFirstLastname($supervisoruser->firstname, $supervisoruser->lastname).' <'.$supervisoruser->email.'>');
|
||||||
}
|
}
|
||||||
dol_syslog("Replace the __SUPERVISOREMAIL__ key into recipient email string with ".$newval);
|
dol_syslog("Replace the __SUPERVISOREMAIL__ key into recipient email string with ".$newval);
|
||||||
$sendto = preg_replace('/__SUPERVISOREMAIL__/', $newval, $sendto);
|
$sendto = preg_replace('/__SUPERVISOREMAIL__/', $newval, $sendto);
|
||||||
$sendto = preg_replace('/^[\s,]+/','',$sendto); // Clean start of string
|
$sendto = preg_replace('/^[\s,]+/','',$sendto); // Clean start of string
|
||||||
$sendto = preg_replace('/[\s,]+$/','',$sendto); // Clean end of string
|
$sendto = preg_replace('/[\s,]+$/','',$sendto); // Clean end of string
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sendto)
|
if ($sendto)
|
||||||
{
|
{
|
||||||
$parameters=array('notifcode'=>$notifcode, 'sendto'=>$sendto, 'replyto'=>$replyto, 'file'=>$file, 'mimefile'=>$mimefile, 'filename'=>$filename);
|
$parameters=array('notifcode'=>$notifcode, 'sendto'=>$sendto, 'replyto'=>$replyto, 'file'=>$file, 'mimefile'=>$mimefile, 'filename'=>$filename);
|
||||||
$reshook=$hookmanager->executeHooks('formatNotificationMessage',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('formatNotificationMessage',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
if (! empty($hookmanager->resArray['subject'])) $subject.=$hookmanager->resArray['subject'];
|
if (! empty($hookmanager->resArray['subject'])) $subject.=$hookmanager->resArray['subject'];
|
||||||
if (! empty($hookmanager->resArray['message'])) $message.=$hookmanager->resArray['message'];
|
if (! empty($hookmanager->resArray['message'])) $message.=$hookmanager->resArray['message'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$mailfile = new CMailFile(
|
$mailfile = new CMailFile(
|
||||||
$subject,
|
$subject,
|
||||||
$sendto,
|
$sendto,
|
||||||
$replyto,
|
$replyto,
|
||||||
$message,
|
$message,
|
||||||
array($file),
|
array($file),
|
||||||
array($mimefile),
|
array($mimefile),
|
||||||
array($filename[count($filename)-1]),
|
array($filename[count($filename)-1]),
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
0,
|
0,
|
||||||
-1
|
-1
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($mailfile->sendfile())
|
if ($mailfile->sendfile())
|
||||||
{
|
{
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, type, type_target, objet_type, objet_id, email)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, type, type_target, objet_type, objet_id, email)";
|
||||||
$sql.= " VALUES ('".$this->db->idate(dol_now())."', ".$notifcodedefid.", ".($object->socid?$object->socid:'null').", null, 'email', 'tofixedemail', '".$object_type."', ".$object->id.", '".$this->db->escape($conf->global->$param)."')";
|
$sql.= " VALUES ('".$this->db->idate(dol_now())."', ".$notifcodedefid.", ".($object->socid?$object->socid:'null').", null, 'email', 'tofixedemail', '".$object_type."', ".$object->id.", '".$this->db->escape($conf->global->$param)."')";
|
||||||
if (! $this->db->query($sql))
|
if (! $this->db->query($sql))
|
||||||
{
|
{
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$this->errors[]=$mailfile->error;
|
$this->errors[]=$mailfile->error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error) return $num;
|
if (! $error) return $num;
|
||||||
else return -1 * $error;
|
else return -1 * $error;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -44,7 +44,7 @@ function project_prepare_head($object)
|
|||||||
$head[$h][2] = 'project';
|
$head[$h][2] = 'project';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
$nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
|
$nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/projet/contact.php?id='.$object->id;
|
$head[$h][0] = DOL_URL_ROOT.'/projet/contact.php?id='.$object->id;
|
||||||
$head[$h][1] = $langs->trans("ProjectContact");
|
$head[$h][1] = $langs->trans("ProjectContact");
|
||||||
if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
|
if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
|
||||||
@ -69,22 +69,22 @@ function project_prepare_head($object)
|
|||||||
|
|
||||||
|
|
||||||
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||||
{
|
{
|
||||||
$nbNote = 0;
|
$nbNote = 0;
|
||||||
if(!empty($object->note_private)) $nbNote++;
|
if(!empty($object->note_private)) $nbNote++;
|
||||||
if(!empty($object->note_public)) $nbNote++;
|
if(!empty($object->note_public)) $nbNote++;
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/projet/note.php?id='.$object->id;
|
$head[$h][0] = DOL_URL_ROOT.'/projet/note.php?id='.$object->id;
|
||||||
$head[$h][1] = $langs->trans('Notes');
|
$head[$h][1] = $langs->trans('Notes');
|
||||||
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||||
$head[$h][2] = 'notes';
|
$head[$h][2] = 'notes';
|
||||||
$h++;
|
$h++;
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||||
$upload_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
$upload_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
|
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
|
||||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/projet/document.php?id='.$object->id;
|
$head[$h][0] = DOL_URL_ROOT.'/projet/document.php?id='.$object->id;
|
||||||
$head[$h][1] = $langs->trans('Documents');
|
$head[$h][1] = $langs->trans('Documents');
|
||||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||||
@ -123,12 +123,12 @@ function project_prepare_head($object)
|
|||||||
}
|
}
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/projet/info.php?id='.$object->id;
|
$head[$h][0] = DOL_URL_ROOT.'/projet/info.php?id='.$object->id;
|
||||||
$head[$h][1].= $langs->trans("Events");
|
$head[$h][1].= $langs->trans("Events");
|
||||||
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
|
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
|
||||||
{
|
{
|
||||||
$head[$h][1].= '/';
|
$head[$h][1].= '/';
|
||||||
$head[$h][1].= $langs->trans("Agenda");
|
$head[$h][1].= $langs->trans("Agenda");
|
||||||
}
|
}
|
||||||
$head[$h][2] = 'agenda';
|
$head[$h][2] = 'agenda';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
@ -171,8 +171,8 @@ function task_prepare_head($object)
|
|||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
if ($obj) $nbTimeSpent=1;
|
if ($obj) $nbTimeSpent=1;
|
||||||
}
|
}
|
||||||
else dol_print_error($db);
|
else dol_print_error($db);
|
||||||
|
|
||||||
@ -189,23 +189,23 @@ function task_prepare_head($object)
|
|||||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'task');
|
complete_head_from_modules($conf,$langs,$object,$head,$h,'task');
|
||||||
|
|
||||||
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||||
{
|
{
|
||||||
$nbNote = 0;
|
$nbNote = 0;
|
||||||
if(!empty($object->note_private)) $nbNote++;
|
if(!empty($object->note_private)) $nbNote++;
|
||||||
if(!empty($object->note_public)) $nbNote++;
|
if(!empty($object->note_public)) $nbNote++;
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/note.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':'');
|
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/note.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':'');
|
||||||
$head[$h][1] = $langs->trans('Notes');
|
$head[$h][1] = $langs->trans('Notes');
|
||||||
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||||
$head[$h][2] = 'task_notes';
|
$head[$h][2] = 'task_notes';
|
||||||
$h++;
|
$h++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/document.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':'');
|
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/document.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':'');
|
||||||
$filesdir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->project->ref) . '/' .dol_sanitizeFileName($object->ref);
|
$filesdir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->project->ref) . '/' .dol_sanitizeFileName($object->ref);
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||||
$nbFiles = count(dol_dir_list($filesdir,'files',0,'','(\.meta|_preview.*\.png)$'));
|
$nbFiles = count(dol_dir_list($filesdir,'files',0,'','(\.meta|_preview.*\.png)$'));
|
||||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||||
$head[$h][1] = $langs->trans('Documents');
|
$head[$h][1] = $langs->trans('Documents');
|
||||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||||
$head[$h][2] = 'task_document';
|
$head[$h][2] = 'task_document';
|
||||||
@ -467,11 +467,11 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
|||||||
// Date end
|
// Date end
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
$taskstatic->projectstatus = $lines[$i]->projectstatus;
|
$taskstatic->projectstatus = $lines[$i]->projectstatus;
|
||||||
$taskstatic->progress = $lines[$i]->progress;
|
$taskstatic->progress = $lines[$i]->progress;
|
||||||
$taskstatic->fk_statut = $lines[$i]->status;
|
$taskstatic->fk_statut = $lines[$i]->status;
|
||||||
$taskstatic->datee = $lines[$i]->date_end;
|
$taskstatic->datee = $lines[$i]->date_end;
|
||||||
print dol_print_date($lines[$i]->date_end,'dayhour');
|
print dol_print_date($lines[$i]->date_end,'dayhour');
|
||||||
if ($taskstatic->hasDelay()) print img_warning($langs->trans("Late"));
|
if ($taskstatic->hasDelay()) print img_warning($langs->trans("Late"));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
$plannedworkloadoutputformat='allhourmin';
|
$plannedworkloadoutputformat='allhourmin';
|
||||||
@ -531,9 +531,9 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
|||||||
|
|
||||||
if ($level >= 0) // Call sublevels
|
if ($level >= 0) // Call sublevels
|
||||||
{
|
{
|
||||||
$level++;
|
$level++;
|
||||||
if ($lines[$i]->id) projectLinesa($inc, $lines[$i]->id, $lines, $level, $var, $showproject, $taskrole, $projectsListId, $addordertick);
|
if ($lines[$i]->id) projectLinesa($inc, $lines[$i]->id, $lines, $level, $var, $showproject, $taskrole, $projectsListId, $addordertick);
|
||||||
$level--;
|
$level--;
|
||||||
}
|
}
|
||||||
|
|
||||||
$total_projectlinesa_spent += $lines[$i]->duration;
|
$total_projectlinesa_spent += $lines[$i]->duration;
|
||||||
@ -605,13 +605,13 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
|||||||
// Create a smaller array with sublevels only to be used later. This increase dramatically performances.
|
// Create a smaller array with sublevels only to be used later. This increase dramatically performances.
|
||||||
if ($parent == 0) // Always and only if at first level
|
if ($parent == 0) // Always and only if at first level
|
||||||
{
|
{
|
||||||
for ($i = 0 ; $i < $numlines ; $i++)
|
for ($i = 0 ; $i < $numlines ; $i++)
|
||||||
{
|
{
|
||||||
if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[]=$lines[$i];
|
if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[]=$lines[$i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//dol_syslog('projectLinesPerDay inc='.$inc.' preselectedday='.$preselectedday.' task parent id='.$parent.' level='.$level." count(lines)=".$numlines." count(lineswithoutlevel0)=".count($lineswithoutlevel0));
|
//dol_syslog('projectLinesPerDay inc='.$inc.' preselectedday='.$preselectedday.' task parent id='.$parent.' level='.$level." count(lines)=".$numlines." count(lineswithoutlevel0)=".count($lineswithoutlevel0));
|
||||||
for ($i = 0 ; $i < $numlines ; $i++)
|
for ($i = 0 ; $i < $numlines ; $i++)
|
||||||
{
|
{
|
||||||
if ($parent == 0) $level = 0;
|
if ($parent == 0) $level = 0;
|
||||||
@ -621,26 +621,26 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
|||||||
// If we want all or we have a role on task, we show it
|
// If we want all or we have a role on task, we show it
|
||||||
if (empty($mine) || ! empty($tasksrole[$lines[$i]->id]))
|
if (empty($mine) || ! empty($tasksrole[$lines[$i]->id]))
|
||||||
{
|
{
|
||||||
//dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project);
|
//dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project);
|
||||||
|
|
||||||
// Break on a new project
|
// Break on a new project
|
||||||
if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
|
if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
|
||||||
{
|
{
|
||||||
$lastprojectid=$lines[$i]->fk_project;
|
$lastprojectid=$lines[$i]->fk_project;
|
||||||
if ($preselectedday)
|
if ($preselectedday)
|
||||||
{
|
{
|
||||||
$projectstatic->id = $lines[$i]->fk_project;
|
$projectstatic->id = $lines[$i]->fk_project;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($workloadforid[$projectstatic->id]))
|
if (empty($workloadforid[$projectstatic->id]))
|
||||||
{
|
{
|
||||||
if ($preselectedday)
|
if ($preselectedday)
|
||||||
{
|
{
|
||||||
$projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week
|
$projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week
|
||||||
$workloadforid[$projectstatic->id]=1;
|
$workloadforid[$projectstatic->id]=1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$projectstatic->id=$lines[$i]->fk_project;
|
$projectstatic->id=$lines[$i]->fk_project;
|
||||||
$projectstatic->ref=$lines[$i]->projectref;
|
$projectstatic->ref=$lines[$i]->projectref;
|
||||||
@ -665,12 +665,12 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
|||||||
|
|
||||||
if (! empty($conf->global->PROJECT_LINES_PERDAY_SHOW_THIRDPARTY))
|
if (! empty($conf->global->PROJECT_LINES_PERDAY_SHOW_THIRDPARTY))
|
||||||
{
|
{
|
||||||
// Thirdparty
|
// Thirdparty
|
||||||
print '<td class="tdoverflowmax100">';
|
print '<td class="tdoverflowmax100">';
|
||||||
$thirdpartystatic->id=$lines[$i]->socid;
|
$thirdpartystatic->id=$lines[$i]->socid;
|
||||||
$thirdpartystatic->name=$lines[$i]->thirdparty_name;
|
$thirdpartystatic->name=$lines[$i]->thirdparty_name;
|
||||||
print $thirdpartystatic->getNomUrl(1, 'project', 10);
|
print $thirdpartystatic->getNomUrl(1, 'project', 10);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
@ -753,14 +753,14 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
|||||||
print '<td align="center" class="duration'.($cssonholiday?' '.$cssonholiday:'').'">';
|
print '<td align="center" class="duration'.($cssonholiday?' '.$cssonholiday:'').'">';
|
||||||
|
|
||||||
$dayWorkLoad = $projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id];
|
$dayWorkLoad = $projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id];
|
||||||
$alreadyspent='';
|
$alreadyspent='';
|
||||||
if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($dayWorkLoad,'allhourmin');
|
if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($dayWorkLoad,'allhourmin');
|
||||||
|
|
||||||
$idw = 0;
|
$idw = 0;
|
||||||
|
|
||||||
$tableCell='';
|
$tableCell='';
|
||||||
$tableCell.='<span class="timesheetalreadyrecorded"><input type="text" class="center" size="2" disabled id="timespent['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="'.$alreadyspent.'"></span>';
|
$tableCell.='<span class="timesheetalreadyrecorded"><input type="text" class="center" size="2" disabled id="timespent['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="'.$alreadyspent.'"></span>';
|
||||||
$tableCell.='<span class="hideonsmartphone"> + </span>';
|
$tableCell.='<span class="hideonsmartphone"> + </span>';
|
||||||
//$tableCell.=' ';
|
//$tableCell.=' ';
|
||||||
$tableCell.=$form->select_duration($lines[$i]->id.'duration','',$disabledtask,'text',0,1);
|
$tableCell.=$form->select_duration($lines[$i]->id.'duration','',$disabledtask,'text',0,1);
|
||||||
//$tableCell.=' <input type="submit" class="button"'.($disabledtask?' disabled':'').' value="'.$langs->trans("Add").'">';
|
//$tableCell.=' <input type="submit" class="button"'.($disabledtask?' disabled':'').' value="'.$langs->trans("Add").'">';
|
||||||
@ -800,8 +800,8 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
|||||||
$level++;
|
$level++;
|
||||||
if ($lines[$i]->id > 0)
|
if ($lines[$i]->id > 0)
|
||||||
{
|
{
|
||||||
if ($parent == 0) projectLinesPerDay($inc, $lines[$i]->id, $fuser, $lineswithoutlevel0, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday, $isavailable);
|
if ($parent == 0) projectLinesPerDay($inc, $lines[$i]->id, $fuser, $lineswithoutlevel0, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday, $isavailable);
|
||||||
else projectLinesPerDay($inc, $lines[$i]->id, $fuser, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday, $isavailable);
|
else projectLinesPerDay($inc, $lines[$i]->id, $fuser, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday, $isavailable);
|
||||||
}
|
}
|
||||||
$level--;
|
$level--;
|
||||||
}
|
}
|
||||||
@ -845,13 +845,13 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
|||||||
// Create a smaller array with sublevels only to be used later. This increase dramatically performances.
|
// Create a smaller array with sublevels only to be used later. This increase dramatically performances.
|
||||||
if ($parent == 0) // Always and only if at first level
|
if ($parent == 0) // Always and only if at first level
|
||||||
{
|
{
|
||||||
for ($i = 0 ; $i < $numlines ; $i++)
|
for ($i = 0 ; $i < $numlines ; $i++)
|
||||||
{
|
{
|
||||||
if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[]=$lines[$i];
|
if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[]=$lines[$i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//dol_syslog('projectLinesPerWeek inc='.$inc.' firstdaytoshow='.$firstdaytoshow.' task parent id='.$parent.' level='.$level." count(lines)=".$numlines." count(lineswithoutlevel0)=".count($lineswithoutlevel0));
|
//dol_syslog('projectLinesPerWeek inc='.$inc.' firstdaytoshow='.$firstdaytoshow.' task parent id='.$parent.' level='.$level." count(lines)=".$numlines." count(lineswithoutlevel0)=".count($lineswithoutlevel0));
|
||||||
|
|
||||||
for ($i = 0 ; $i < $numlines ; $i++)
|
for ($i = 0 ; $i < $numlines ; $i++)
|
||||||
{
|
{
|
||||||
@ -862,20 +862,20 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
|||||||
// If we want all or we have a role on task, we show it
|
// If we want all or we have a role on task, we show it
|
||||||
if (empty($mine) || ! empty($tasksrole[$lines[$i]->id]))
|
if (empty($mine) || ! empty($tasksrole[$lines[$i]->id]))
|
||||||
{
|
{
|
||||||
//dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project);
|
//dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project);
|
||||||
|
|
||||||
// Break on a new project
|
// Break on a new project
|
||||||
if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
|
if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
|
||||||
{
|
{
|
||||||
$lastprojectid=$lines[$i]->fk_project;
|
$lastprojectid=$lines[$i]->fk_project;
|
||||||
$projectstatic->id = $lines[$i]->fk_project;
|
$projectstatic->id = $lines[$i]->fk_project;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($workloadforid[$projectstatic->id]))
|
if (empty($workloadforid[$projectstatic->id]))
|
||||||
{
|
{
|
||||||
$projectstatic->loadTimeSpent($firstdaytoshow, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week
|
$projectstatic->loadTimeSpent($firstdaytoshow, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week
|
||||||
$workloadforid[$projectstatic->id]=1;
|
$workloadforid[$projectstatic->id]=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$projectstatic->id=$lines[$i]->fk_project;
|
$projectstatic->id=$lines[$i]->fk_project;
|
||||||
$projectstatic->ref=$lines[$i]->projectref;
|
$projectstatic->ref=$lines[$i]->projectref;
|
||||||
@ -899,12 +899,12 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
|||||||
|
|
||||||
if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY))
|
if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY))
|
||||||
{
|
{
|
||||||
// Thirdparty
|
// Thirdparty
|
||||||
print '<td class="tdoverflowmax100">';
|
print '<td class="tdoverflowmax100">';
|
||||||
$thirdpartystatic->id=$lines[$i]->thirdparty_id;
|
$thirdpartystatic->id=$lines[$i]->thirdparty_id;
|
||||||
$thirdpartystatic->name=$lines[$i]->thirdparty_name;
|
$thirdpartystatic->name=$lines[$i]->thirdparty_name;
|
||||||
print $thirdpartystatic->getNomUrl(1, 'project');
|
print $thirdpartystatic->getNomUrl(1, 'project');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
@ -979,7 +979,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
|||||||
// Fields to show current time
|
// Fields to show current time
|
||||||
$tableCell=''; $modeinput='hours';
|
$tableCell=''; $modeinput='hours';
|
||||||
for ($idw = 0; $idw < 7; $idw++)
|
for ($idw = 0; $idw < 7; $idw++)
|
||||||
{
|
{
|
||||||
$tmpday=dol_time_plus_duree($firstdaytoshow, $idw, 'd');
|
$tmpday=dol_time_plus_duree($firstdaytoshow, $idw, 'd');
|
||||||
|
|
||||||
$cssonholiday='';
|
$cssonholiday='';
|
||||||
@ -988,28 +988,28 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
|||||||
elseif (! $isavailable[$tmpday]['afternoon']) $cssonholiday.='onholidayafternoon ';
|
elseif (! $isavailable[$tmpday]['afternoon']) $cssonholiday.='onholidayafternoon ';
|
||||||
|
|
||||||
$tmparray=dol_getdate($tmpday);
|
$tmparray=dol_getdate($tmpday);
|
||||||
$dayWorkLoad = $projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id];
|
$dayWorkLoad = $projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id];
|
||||||
$alreadyspent='';
|
$alreadyspent='';
|
||||||
if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($dayWorkLoad,'allhourmin');
|
if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($dayWorkLoad,'allhourmin');
|
||||||
$alttitle=$langs->trans("AddHereTimeSpentForDay",$tmparray['day'],$tmparray['mon']);
|
$alttitle=$langs->trans("AddHereTimeSpentForDay",$tmparray['day'],$tmparray['mon']);
|
||||||
|
|
||||||
$tableCell ='<td align="center" class="hide'.$idw.($cssonholiday?' '.$cssonholiday:'').'">';
|
$tableCell ='<td align="center" class="hide'.$idw.($cssonholiday?' '.$cssonholiday:'').'">';
|
||||||
if ($alreadyspent)
|
if ($alreadyspent)
|
||||||
{
|
{
|
||||||
$tableCell.='<span class="timesheetalreadyrecorded"><input type="text" class="center smallpadd" size="2" disabled id="timespent['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="'.$alreadyspent.'"></span>';
|
$tableCell.='<span class="timesheetalreadyrecorded"><input type="text" class="center smallpadd" size="2" disabled id="timespent['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="'.$alreadyspent.'"></span>';
|
||||||
//$placeholder=' placeholder="00:00"';
|
//$placeholder=' placeholder="00:00"';
|
||||||
$placeholder='';
|
$placeholder='';
|
||||||
//$tableCell.='+';
|
//$tableCell.='+';
|
||||||
}
|
}
|
||||||
$tableCell.='<input type="text" alt="'.($disabledtask?'':$alttitle).'" title="'.($disabledtask?'':$alttitle).'" '.($disabledtask?'disabled':$placeholder).' class="center smallpadd" size="2" id="timeadded['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="" cols="2" maxlength="5"';
|
$tableCell.='<input type="text" alt="'.($disabledtask?'':$alttitle).'" title="'.($disabledtask?'':$alttitle).'" '.($disabledtask?'disabled':$placeholder).' class="center smallpadd" size="2" id="timeadded['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="" cols="2" maxlength="5"';
|
||||||
$tableCell.=' onkeypress="return regexEvent(this,event,\'timeChar\')"';
|
$tableCell.=' onkeypress="return regexEvent(this,event,\'timeChar\')"';
|
||||||
$tableCell.=' onkeyup="updateTotal('.$idw.',\''.$modeinput.'\')"';
|
$tableCell.=' onkeyup="updateTotal('.$idw.',\''.$modeinput.'\')"';
|
||||||
$tableCell.=' onblur="regexEvent(this,event,\''.$modeinput.'\'); updateTotal('.$idw.',\''.$modeinput.'\')" />';
|
$tableCell.=' onblur="regexEvent(this,event,\''.$modeinput.'\'); updateTotal('.$idw.',\''.$modeinput.'\')" />';
|
||||||
$tableCell.='</td>';
|
$tableCell.='</td>';
|
||||||
print $tableCell;
|
print $tableCell;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warning
|
// Warning
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("UserIsNotContactOfProject"));
|
if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("UserIsNotContactOfProject"));
|
||||||
else if ($disabledtask)
|
else if ($disabledtask)
|
||||||
@ -1021,7 +1021,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
|||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call to show task with a lower level (task under the current task)
|
// Call to show task with a lower level (task under the current task)
|
||||||
@ -1029,8 +1029,8 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
|||||||
$level++;
|
$level++;
|
||||||
if ($lines[$i]->id > 0)
|
if ($lines[$i]->id > 0)
|
||||||
{
|
{
|
||||||
if ($parent == 0) projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, $lineswithoutlevel0, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable);
|
if ($parent == 0) projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, $lineswithoutlevel0, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable);
|
||||||
else projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable);
|
else projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable);
|
||||||
}
|
}
|
||||||
$level--;
|
$level--;
|
||||||
}
|
}
|
||||||
@ -1100,7 +1100,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||||
|
|
||||||
$projectstatic=new Project($db);
|
$projectstatic=new Project($db);
|
||||||
$thirdpartystatic=new Societe($db);
|
$thirdpartystatic=new Societe($db);
|
||||||
|
|
||||||
$sortfield='';
|
$sortfield='';
|
||||||
$sortorder='';
|
$sortorder='';
|
||||||
@ -1161,12 +1161,12 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
|||||||
$resql = $db->query($sql1);
|
$resql = $db->query($sql1);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$i=0;
|
$i=0;
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
$arrayidofprojects[$objp->projectid]=$objp->projectid;
|
$arrayidofprojects[$objp->projectid]=$objp->projectid;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1194,22 +1194,22 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
|||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre($title.' <span class="badge">'.$num.'</span>',$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder);
|
print_liste_field_titre($title.' <span class="badge">'.$num.'</span>',$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder);
|
||||||
print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder);
|
print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder);
|
||||||
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
||||||
{
|
{
|
||||||
print_liste_field_titre("OpportunityAmount","","","","",'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre("OpportunityAmount","","","","",'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre("OpportunityStatus","","","","",'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre("OpportunityStatus","","","","",'align="right"',$sortfield,$sortorder);
|
||||||
}
|
}
|
||||||
if (empty($conf->global->PROJECT_HIDE_TASKS))
|
if (empty($conf->global->PROJECT_HIDE_TASKS))
|
||||||
{
|
{
|
||||||
print_liste_field_titre("Tasks","","","","",'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre("Tasks","","","","",'align="right"',$sortfield,$sortorder);
|
||||||
if (! in_array('plannedworkload', $hiddenfields)) print_liste_field_titre("PlannedWorkload","","","","",'align="right"',$sortfield,$sortorder);
|
if (! in_array('plannedworkload', $hiddenfields)) print_liste_field_titre("PlannedWorkload","","","","",'align="right"',$sortfield,$sortorder);
|
||||||
if (! in_array('declaredprogress', $hiddenfields)) print_liste_field_titre("ProgressDeclared","","","","",'align="right"',$sortfield,$sortorder);
|
if (! in_array('declaredprogress', $hiddenfields)) print_liste_field_titre("ProgressDeclared","","","","",'align="right"',$sortfield,$sortorder);
|
||||||
}
|
}
|
||||||
print_liste_field_titre("Status","","","","",'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre("Status","","","","",'align="right"',$sortfield,$sortorder);
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
@ -1223,11 +1223,11 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
|||||||
$userAccess = $projectstatic->restrictedProjectArea($user);
|
$userAccess = $projectstatic->restrictedProjectArea($user);
|
||||||
if ($userAccess >= 0)
|
if ($userAccess >= 0)
|
||||||
{
|
{
|
||||||
$projectstatic->ref=$objp->ref;
|
$projectstatic->ref=$objp->ref;
|
||||||
$projectstatic->statut = $objp->status;
|
$projectstatic->statut = $objp->status;
|
||||||
$projectstatic->title = $objp->title;
|
$projectstatic->title = $objp->title;
|
||||||
$projectstatic->datee = $db->jdate($objp->datee);
|
$projectstatic->datee = $db->jdate($objp->datee);
|
||||||
$projectstatic->dateo = $db->jdate($objp->dateo);
|
$projectstatic->dateo = $db->jdate($objp->dateo);
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
@ -1238,41 +1238,41 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
|||||||
print '<td>';
|
print '<td>';
|
||||||
if ($objp->fk_soc > 0)
|
if ($objp->fk_soc > 0)
|
||||||
{
|
{
|
||||||
$thirdpartystatic->id=$objp->fk_soc;
|
$thirdpartystatic->id=$objp->fk_soc;
|
||||||
$thirdpartystatic->ref=$objp->socname;
|
$thirdpartystatic->ref=$objp->socname;
|
||||||
$thirdpartystatic->name=$objp->socname;
|
$thirdpartystatic->name=$objp->socname;
|
||||||
print $thirdpartystatic->getNomUrl(1);
|
print $thirdpartystatic->getNomUrl(1);
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
||||||
{
|
{
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
if ($objp->opp_amount) print price($objp->opp_amount, 0, '', 1, -1, -1, $conf->currency);
|
if ($objp->opp_amount) print price($objp->opp_amount, 0, '', 1, -1, -1, $conf->currency);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
$code = dol_getIdFromCode($db, $objp->opp_status, 'c_lead_status', 'rowid', 'code');
|
$code = dol_getIdFromCode($db, $objp->opp_status, 'c_lead_status', 'rowid', 'code');
|
||||||
if ($code) print $langs->trans("OppStatus".$code);
|
if ($code) print $langs->trans("OppStatus".$code);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (empty($conf->global->PROJECT_HIDE_TASKS))
|
if (empty($conf->global->PROJECT_HIDE_TASKS))
|
||||||
{
|
{
|
||||||
print '<td align="right">'.$objp->nb.'</td>';
|
print '<td align="right">'.$objp->nb.'</td>';
|
||||||
|
|
||||||
$plannedworkload=$objp->planned_workload;
|
$plannedworkload=$objp->planned_workload;
|
||||||
$total_plannedworkload+=$plannedworkload;
|
$total_plannedworkload+=$plannedworkload;
|
||||||
if (! in_array('plannedworkload', $hiddenfields))
|
if (! in_array('plannedworkload', $hiddenfields))
|
||||||
{
|
{
|
||||||
print '<td align="right">'.($plannedworkload?convertSecondToTime($plannedworkload):'').'</td>';
|
print '<td align="right">'.($plannedworkload?convertSecondToTime($plannedworkload):'').'</td>';
|
||||||
}
|
}
|
||||||
if (! in_array('declaredprogress', $hiddenfields))
|
if (! in_array('declaredprogress', $hiddenfields))
|
||||||
{
|
{
|
||||||
$declaredprogressworkload=$objp->declared_progess_workload;
|
$declaredprogressworkload=$objp->declared_progess_workload;
|
||||||
$total_declaredprogressworkload+=$declaredprogressworkload;
|
$total_declaredprogressworkload+=$declaredprogressworkload;
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
//print $objp->planned_workload.'-'.$objp->declared_progess_workload."<br>";
|
//print $objp->planned_workload.'-'.$objp->declared_progess_workload."<br>";
|
||||||
print ($plannedworkload?round(100*$declaredprogressworkload/$plannedworkload,0).'%':'');
|
print ($plannedworkload?round(100*$declaredprogressworkload/$plannedworkload,0).'%':'');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<td align="right">'.$projectstatic->getLibStatut(3).'</td>';
|
print '<td align="right">'.$projectstatic->getLibStatut(3).'</td>';
|
||||||
@ -1295,12 +1295,12 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
|||||||
}
|
}
|
||||||
if (empty($conf->global->PROJECT_HIDE_TASKS))
|
if (empty($conf->global->PROJECT_HIDE_TASKS))
|
||||||
{
|
{
|
||||||
print '<td class="liste_total" align="right">'.$total_task.'</td>';
|
print '<td class="liste_total" align="right">'.$total_task.'</td>';
|
||||||
if (! in_array('plannedworkload', $hiddenfields)) print '<td class="liste_total" align="right">'.($total_plannedworkload?convertSecondToTime($total_plannedworkload):'').'</td>';
|
if (! in_array('plannedworkload', $hiddenfields)) print '<td class="liste_total" align="right">'.($total_plannedworkload?convertSecondToTime($total_plannedworkload):'').'</td>';
|
||||||
if (! in_array('declaredprogress', $hiddenfields)) print '<td class="liste_total" align="right">'.($total_plannedworkload?round(100*$total_declaredprogressworkload/$total_plannedworkload,0).'%':'').'</td>';
|
if (! in_array('declaredprogress', $hiddenfields)) print '<td class="liste_total" align="right">'.($total_plannedworkload?round(100*$total_declaredprogressworkload/$total_plannedworkload,0).'%':'').'</td>';
|
||||||
}
|
}
|
||||||
print '<td class="liste_total"></td>';
|
print '<td class="liste_total"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,10 +45,10 @@ function user_prepare_head($object)
|
|||||||
$h = 0;
|
$h = 0;
|
||||||
$head = array();
|
$head = array();
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/user/card.php?id='.$object->id;
|
$head[$h][0] = DOL_URL_ROOT.'/user/card.php?id='.$object->id;
|
||||||
$head[$h][1] = $langs->trans("UserCard");
|
$head[$h][1] = $langs->trans("UserCard");
|
||||||
$head[$h][2] = 'user';
|
$head[$h][2] = 'user';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
if ((! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_SYNCHRO_ACTIVE))
|
if ((! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_SYNCHRO_ACTIVE))
|
||||||
&& (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || ! empty($user->admin)))
|
&& (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || ! empty($user->admin)))
|
||||||
@ -60,10 +60,10 @@ function user_prepare_head($object)
|
|||||||
$h++;
|
$h++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/user/param_ihm.php?id='.$object->id;
|
$head[$h][0] = DOL_URL_ROOT.'/user/param_ihm.php?id='.$object->id;
|
||||||
$head[$h][1] = $langs->trans("UserGUISetup");
|
$head[$h][1] = $langs->trans("UserGUISetup");
|
||||||
$head[$h][2] = 'guisetup';
|
$head[$h][2] = 'guisetup';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
if ($canreadperms)
|
if ($canreadperms)
|
||||||
{
|
{
|
||||||
@ -73,116 +73,116 @@ function user_prepare_head($object)
|
|||||||
$h++;
|
$h++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->agenda->enabled))
|
if (! empty($conf->agenda->enabled))
|
||||||
{
|
{
|
||||||
if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5;
|
if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5;
|
||||||
$MAXAGENDA=$conf->global->AGENDA_EXT_NB;
|
$MAXAGENDA=$conf->global->AGENDA_EXT_NB;
|
||||||
|
|
||||||
$i=1;
|
$i=1;
|
||||||
$nbagenda = 0;
|
$nbagenda = 0;
|
||||||
while ($i <= $MAXAGENDA)
|
while ($i <= $MAXAGENDA)
|
||||||
{
|
{
|
||||||
$key=$i;
|
$key=$i;
|
||||||
$name='AGENDA_EXT_NAME_'.$object->id.'_'.$key;
|
$name='AGENDA_EXT_NAME_'.$object->id.'_'.$key;
|
||||||
$src='AGENDA_EXT_SRC_'.$object->id.'_'.$key;
|
$src='AGENDA_EXT_SRC_'.$object->id.'_'.$key;
|
||||||
$offsettz='AGENDA_EXT_OFFSETTZ_'.$object->id.'_'.$key;
|
$offsettz='AGENDA_EXT_OFFSETTZ_'.$object->id.'_'.$key;
|
||||||
$color='AGENDA_EXT_COLOR_'.$object->id.'_'.$key;
|
$color='AGENDA_EXT_COLOR_'.$object->id.'_'.$key;
|
||||||
$i++;
|
$i++;
|
||||||
|
|
||||||
if (! empty($object->conf->$name)) $nbagenda++;
|
if (! empty($object->conf->$name)) $nbagenda++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/user/agenda_extsites.php?id='.$object->id;
|
$head[$h][0] = DOL_URL_ROOT.'/user/agenda_extsites.php?id='.$object->id;
|
||||||
$head[$h][1] = $langs->trans("ExtSites").($nbagenda ? ' <span class="badge">'.$nbagenda.'</span>' : '');
|
$head[$h][1] = $langs->trans("ExtSites").($nbagenda ? ' <span class="badge">'.$nbagenda.'</span>' : '');
|
||||||
$head[$h][2] = 'extsites';
|
$head[$h][2] = 'extsites';
|
||||||
$h++;
|
$h++;
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($conf->clicktodial->enabled))
|
|
||||||
{
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/user/clicktodial.php?id='.$object->id;
|
|
||||||
$head[$h][1] = $langs->trans("ClickToDial");
|
|
||||||
$head[$h][2] = 'clicktodial';
|
|
||||||
$h++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Notifications
|
|
||||||
if ($user->societe_id == 0 && ! empty($conf->notification->enabled))
|
|
||||||
{
|
|
||||||
$nbNote = 0;
|
|
||||||
$sql = "SELECT COUNT(n.rowid) as nb";
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n";
|
|
||||||
$sql.= " WHERE fk_user = ".$object->id;
|
|
||||||
$resql=$db->query($sql);
|
|
||||||
if ($resql)
|
|
||||||
{
|
|
||||||
$num = $db->num_rows($resql);
|
|
||||||
$i = 0;
|
|
||||||
while ($i < $num)
|
|
||||||
{
|
|
||||||
$obj = $db->fetch_object($resql);
|
|
||||||
$nbNote=$obj->nb;
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/user/notify/card.php?id='.$object->id;
|
|
||||||
$head[$h][1] = $langs->trans("Notifications");
|
|
||||||
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
|
||||||
$head[$h][2] = 'notify';
|
|
||||||
$h++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Show more tabs from modules
|
|
||||||
// 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); to remove a tab
|
|
||||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'user');
|
|
||||||
|
|
||||||
if ((! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read))
|
|
||||||
|| (! empty($conf->hrm->enabled) && ! empty($user->rights->hrm->employee->read)))
|
|
||||||
{
|
|
||||||
// Bank
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/user/bank.php?id='.$object->id;
|
|
||||||
$head[$h][1] = $langs->trans("HRAndBank");
|
|
||||||
$head[$h][2] = 'bank';
|
|
||||||
$h++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Such info on users is visible only by internal user
|
if (! empty($conf->clicktodial->enabled))
|
||||||
if (empty($user->societe_id))
|
{
|
||||||
{
|
$head[$h][0] = DOL_URL_ROOT.'/user/clicktodial.php?id='.$object->id;
|
||||||
// Notes
|
$head[$h][1] = $langs->trans("ClickToDial");
|
||||||
$nbNote = 0;
|
$head[$h][2] = 'clicktodial';
|
||||||
if(!empty($object->note)) $nbNote++;
|
$h++;
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/user/note.php?id='.$object->id;
|
}
|
||||||
$head[$h][1] = $langs->trans("Note");
|
|
||||||
|
// Notifications
|
||||||
|
if ($user->societe_id == 0 && ! empty($conf->notification->enabled))
|
||||||
|
{
|
||||||
|
$nbNote = 0;
|
||||||
|
$sql = "SELECT COUNT(n.rowid) as nb";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n";
|
||||||
|
$sql.= " WHERE fk_user = ".$object->id;
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
$i = 0;
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
$nbNote=$obj->nb;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
|
||||||
|
$head[$h][0] = DOL_URL_ROOT.'/user/notify/card.php?id='.$object->id;
|
||||||
|
$head[$h][1] = $langs->trans("Notifications");
|
||||||
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||||
$head[$h][2] = 'note';
|
$head[$h][2] = 'notify';
|
||||||
$h++;
|
$h++;
|
||||||
|
}
|
||||||
|
|
||||||
// Attached files
|
// Show more tabs from modules
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
// Entries must be declared in modules descriptor with line
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||||
$upload_dir = $conf->user->dir_output . "/" . $object->id;
|
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
|
complete_head_from_modules($conf,$langs,$object,$head,$h,'user');
|
||||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/user/document.php?userid='.$object->id;
|
|
||||||
$head[$h][1] = $langs->trans("Documents");
|
|
||||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
|
||||||
$head[$h][2] = 'document';
|
|
||||||
$h++;
|
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/user/info.php?id='.$object->id;
|
if ((! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read))
|
||||||
$head[$h][1] = $langs->trans("Info");
|
|| (! empty($conf->hrm->enabled) && ! empty($user->rights->hrm->employee->read)))
|
||||||
$head[$h][2] = 'info';
|
{
|
||||||
$h++;
|
// Bank
|
||||||
}
|
$head[$h][0] = DOL_URL_ROOT.'/user/bank.php?id='.$object->id;
|
||||||
|
$head[$h][1] = $langs->trans("HRAndBank");
|
||||||
|
$head[$h][2] = 'bank';
|
||||||
|
$h++;
|
||||||
|
}
|
||||||
|
|
||||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'user','remove');
|
// Such info on users is visible only by internal user
|
||||||
|
if (empty($user->societe_id))
|
||||||
|
{
|
||||||
|
// Notes
|
||||||
|
$nbNote = 0;
|
||||||
|
if(!empty($object->note)) $nbNote++;
|
||||||
|
$head[$h][0] = DOL_URL_ROOT.'/user/note.php?id='.$object->id;
|
||||||
|
$head[$h][1] = $langs->trans("Note");
|
||||||
|
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||||
|
$head[$h][2] = 'note';
|
||||||
|
$h++;
|
||||||
|
|
||||||
|
// Attached files
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||||
|
$upload_dir = $conf->user->dir_output . "/" . $object->id;
|
||||||
|
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
|
||||||
|
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||||
|
$head[$h][0] = DOL_URL_ROOT.'/user/document.php?userid='.$object->id;
|
||||||
|
$head[$h][1] = $langs->trans("Documents");
|
||||||
|
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||||
|
$head[$h][2] = 'document';
|
||||||
|
$h++;
|
||||||
|
|
||||||
|
$head[$h][0] = DOL_URL_ROOT.'/user/info.php?id='.$object->id;
|
||||||
|
$head[$h][1] = $langs->trans("Info");
|
||||||
|
$head[$h][2] = 'info';
|
||||||
|
$h++;
|
||||||
|
}
|
||||||
|
|
||||||
|
complete_head_from_modules($conf,$langs,$object,$head,$h,'user','remove');
|
||||||
|
|
||||||
return $head;
|
return $head;
|
||||||
}
|
}
|
||||||
@ -206,10 +206,10 @@ function group_prepare_head($object)
|
|||||||
$h = 0;
|
$h = 0;
|
||||||
$head = array();
|
$head = array();
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/user/group/card.php?id='.$object->id;
|
$head[$h][0] = DOL_URL_ROOT.'/user/group/card.php?id='.$object->id;
|
||||||
$head[$h][1] = $langs->trans("GroupCard");
|
$head[$h][1] = $langs->trans("GroupCard");
|
||||||
$head[$h][2] = 'group';
|
$head[$h][2] = 'group';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
if ((! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_SYNCHRO_ACTIVE))
|
if ((! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_SYNCHRO_ACTIVE))
|
||||||
&& (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || ! empty($user->admin)))
|
&& (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || ! empty($user->admin)))
|
||||||
@ -229,15 +229,15 @@ function group_prepare_head($object)
|
|||||||
$h++;
|
$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
|
||||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'group');
|
complete_head_from_modules($conf,$langs,$object,$head,$h,'group');
|
||||||
|
|
||||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'group','remove');
|
complete_head_from_modules($conf,$langs,$object,$head,$h,'group','remove');
|
||||||
|
|
||||||
return $head;
|
return $head;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -252,25 +252,25 @@ function user_admin_prepare_head()
|
|||||||
$langs->load("users");
|
$langs->load("users");
|
||||||
$h=0;
|
$h=0;
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/admin/user.php';
|
$head[$h][0] = DOL_URL_ROOT.'/admin/user.php';
|
||||||
$head[$h][1] = $langs->trans("Parameters");
|
$head[$h][1] = $langs->trans("Parameters");
|
||||||
$head[$h][2] = 'card';
|
$head[$h][2] = 'card';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/admin/usergroup.php';
|
$head[$h][0] = DOL_URL_ROOT.'/admin/usergroup.php';
|
||||||
$head[$h][1] = $langs->trans("Group");
|
$head[$h][1] = $langs->trans("Group");
|
||||||
$head[$h][2] = 'usergroupcard';
|
$head[$h][2] = 'usergroupcard';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/user/admin/user_extrafields.php';
|
$head[$h][0] = DOL_URL_ROOT.'/user/admin/user_extrafields.php';
|
||||||
$head[$h][1] = $langs->trans("ExtraFields");
|
$head[$h][1] = $langs->trans("ExtraFields");
|
||||||
$head[$h][2] = 'attributes';
|
$head[$h][2] = 'attributes';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/user/admin/group_extrafields.php';
|
$head[$h][0] = DOL_URL_ROOT.'/user/admin/group_extrafields.php';
|
||||||
$head[$h][1] = $langs->trans("ExtraFields")." ".$langs->trans("Groups");
|
$head[$h][1] = $langs->trans("ExtraFields")." ".$langs->trans("Groups");
|
||||||
$head[$h][2] = 'attributes_group';
|
$head[$h][2] = 'attributes_group';
|
||||||
$h++;
|
$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
|
||||||
@ -293,134 +293,134 @@ function user_admin_prepare_head()
|
|||||||
*/
|
*/
|
||||||
function show_theme($fuser,$edit=0,$foruserprofile=false)
|
function show_theme($fuser,$edit=0,$foruserprofile=false)
|
||||||
{
|
{
|
||||||
global $conf,$langs,$db,$form;
|
global $conf,$langs,$db,$form;
|
||||||
global $bc;
|
global $bc;
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||||
|
|
||||||
$formother = new FormOther($db);
|
$formother = new FormOther($db);
|
||||||
|
|
||||||
$dirthemes=array('/theme');
|
$dirthemes=array('/theme');
|
||||||
if (! empty($conf->modules_parts['theme'])) // Using this feature slow down application
|
if (! empty($conf->modules_parts['theme'])) // Using this feature slow down application
|
||||||
{
|
{
|
||||||
foreach($conf->modules_parts['theme'] as $reldir)
|
foreach($conf->modules_parts['theme'] as $reldir)
|
||||||
{
|
{
|
||||||
$dirthemes=array_merge($dirthemes,(array) ($reldir.'theme'));
|
$dirthemes=array_merge($dirthemes,(array) ($reldir.'theme'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$dirthemes=array_unique($dirthemes);
|
$dirthemes=array_unique($dirthemes);
|
||||||
// Now dir_themes=array('/themes') or dir_themes=array('/theme','/mymodule/theme')
|
// Now dir_themes=array('/themes') or dir_themes=array('/theme','/mymodule/theme')
|
||||||
|
|
||||||
$selected_theme='';
|
$selected_theme='';
|
||||||
if (empty($foruserprofile)) $selected_theme=$conf->global->MAIN_THEME;
|
if (empty($foruserprofile)) $selected_theme=$conf->global->MAIN_THEME;
|
||||||
else $selected_theme=((is_object($fuser) && ! empty($fuser->conf->MAIN_THEME))?$fuser->conf->MAIN_THEME:'');
|
else $selected_theme=((is_object($fuser) && ! empty($fuser->conf->MAIN_THEME))?$fuser->conf->MAIN_THEME:'');
|
||||||
|
|
||||||
$hoverdisabled='';
|
$hoverdisabled='';
|
||||||
if (empty($foruserprofile)) $hoverdisabled=(isset($conf->global->THEME_ELDY_USE_HOVER) && $conf->global->THEME_ELDY_USE_HOVER == '0');
|
if (empty($foruserprofile)) $hoverdisabled=(isset($conf->global->THEME_ELDY_USE_HOVER) && $conf->global->THEME_ELDY_USE_HOVER == '0');
|
||||||
else $hoverdisabled=(is_object($fuser)?(empty($fuser->conf->THEME_ELDY_USE_HOVER) || $fuser->conf->THEME_ELDY_USE_HOVER == '0'):'');
|
else $hoverdisabled=(is_object($fuser)?(empty($fuser->conf->THEME_ELDY_USE_HOVER) || $fuser->conf->THEME_ELDY_USE_HOVER == '0'):'');
|
||||||
|
|
||||||
$colspan=2;
|
$colspan=2;
|
||||||
if ($foruserprofile) $colspan=4;
|
if ($foruserprofile) $colspan=4;
|
||||||
|
|
||||||
$thumbsbyrow=6;
|
$thumbsbyrow=6;
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
// Title
|
// Title
|
||||||
if ($foruserprofile)
|
if ($foruserprofile)
|
||||||
{
|
{
|
||||||
print '<tr class="liste_titre"><th class="titlefield">'.$langs->trans("Parameter").'</th><th>'.$langs->trans("DefaultValue").'</th>';
|
print '<tr class="liste_titre"><th class="titlefield">'.$langs->trans("Parameter").'</th><th>'.$langs->trans("DefaultValue").'</th>';
|
||||||
print '<th colspan="2"> </th>';
|
print '<th colspan="2"> </th>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>'.$langs->trans("DefaultSkin").'</td>';
|
print '<td>'.$langs->trans("DefaultSkin").'</td>';
|
||||||
print '<td>'.$conf->global->MAIN_THEME.'</td>';
|
print '<td>'.$conf->global->MAIN_THEME.'</td>';
|
||||||
print '<td align="left" class="nowrap" width="20%"><input id="check_MAIN_THEME" name="check_MAIN_THEME"'.($edit?'':' disabled').' type="checkbox" '.($selected_theme?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>';
|
print '<td align="left" class="nowrap" width="20%"><input id="check_MAIN_THEME" name="check_MAIN_THEME"'.($edit?'':' disabled').' type="checkbox" '.($selected_theme?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>';
|
||||||
print '<td> </td>';
|
print '<td> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<tr class="liste_titre"><th class="titlefield">'.$langs->trans("DefaultSkin").'</th>';
|
print '<tr class="liste_titre"><th class="titlefield">'.$langs->trans("DefaultSkin").'</th>';
|
||||||
print '<th align="right">';
|
print '<th align="right">';
|
||||||
$url='https://www.dolistore.com/lang-en/4-skins';
|
$url='https://www.dolistore.com/lang-en/4-skins';
|
||||||
if (preg_match('/fr/i',$langs->defaultlang)) $url='https://www.dolistore.com/fr/4-themes';
|
if (preg_match('/fr/i',$langs->defaultlang)) $url='https://www.dolistore.com/fr/4-themes';
|
||||||
//if (preg_match('/es/i',$langs->defaultlang)) $url='http://www.dolistore.com/lang-es/4-themes';
|
//if (preg_match('/es/i',$langs->defaultlang)) $url='http://www.dolistore.com/lang-es/4-themes';
|
||||||
print '<a href="'.$url.'" target="_blank">';
|
print '<a href="'.$url.'" target="_blank">';
|
||||||
print $langs->trans('DownloadMoreSkins');
|
print $langs->trans('DownloadMoreSkins');
|
||||||
print '</a>';
|
print '</a>';
|
||||||
print '</th></tr>';
|
print '</th></tr>';
|
||||||
|
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>'.$langs->trans("ThemeDir").'</td>';
|
print '<td>'.$langs->trans("ThemeDir").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
foreach($dirthemes as $dirtheme)
|
foreach($dirthemes as $dirtheme)
|
||||||
{
|
{
|
||||||
echo '"'.$dirtheme.'" ';
|
echo '"'.$dirtheme.'" ';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr><td colspan="'.$colspan.'">';
|
print '<tr><td colspan="'.$colspan.'">';
|
||||||
|
|
||||||
print '<table class="nobordernopadding" width="100%"><tr><td><div align="center">';
|
print '<table class="nobordernopadding" width="100%"><tr><td><div align="center">';
|
||||||
|
|
||||||
$i=0;
|
$i=0;
|
||||||
foreach($dirthemes as $dir)
|
foreach($dirthemes as $dir)
|
||||||
{
|
{
|
||||||
//print $dirroot.$dir;exit;
|
//print $dirroot.$dir;exit;
|
||||||
$dirtheme=dol_buildpath($dir,0); // This include loop on $conf->file->dol_document_root
|
$dirtheme=dol_buildpath($dir,0); // This include loop on $conf->file->dol_document_root
|
||||||
$urltheme=dol_buildpath($dir,1);
|
$urltheme=dol_buildpath($dir,1);
|
||||||
|
|
||||||
if (is_dir($dirtheme))
|
if (is_dir($dirtheme))
|
||||||
{
|
{
|
||||||
$handle=opendir($dirtheme);
|
$handle=opendir($dirtheme);
|
||||||
if (is_resource($handle))
|
if (is_resource($handle))
|
||||||
{
|
{
|
||||||
while (($subdir = readdir($handle))!==false)
|
while (($subdir = readdir($handle))!==false)
|
||||||
{
|
{
|
||||||
if (is_dir($dirtheme."/".$subdir) && substr($subdir, 0, 1) <> '.'
|
if (is_dir($dirtheme."/".$subdir) && substr($subdir, 0, 1) <> '.'
|
||||||
&& substr($subdir, 0, 3) <> 'CVS' && ! preg_match('/common|phones/i',$subdir))
|
&& substr($subdir, 0, 3) <> 'CVS' && ! preg_match('/common|phones/i',$subdir))
|
||||||
{
|
{
|
||||||
// Disable not stable themes (dir ends with _exp or _dev)
|
// Disable not stable themes (dir ends with _exp or _dev)
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL < 2 && preg_match('/_dev$/i',$subdir)) continue;
|
if ($conf->global->MAIN_FEATURES_LEVEL < 2 && preg_match('/_dev$/i',$subdir)) continue;
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL < 1 && preg_match('/_exp$/i',$subdir)) continue;
|
if ($conf->global->MAIN_FEATURES_LEVEL < 1 && preg_match('/_exp$/i',$subdir)) continue;
|
||||||
|
|
||||||
print '<div class="inline-block" style="margin-top: 10px; margin-bottom: 10px; margin-right: 20px; margin-left: 20px;">';
|
print '<div class="inline-block" style="margin-top: 10px; margin-bottom: 10px; margin-right: 20px; margin-left: 20px;">';
|
||||||
$file=$dirtheme."/".$subdir."/thumb.png";
|
$file=$dirtheme."/".$subdir."/thumb.png";
|
||||||
$url=$urltheme."/".$subdir."/thumb.png";
|
$url=$urltheme."/".$subdir."/thumb.png";
|
||||||
if (! file_exists($file)) $url=DOL_URL_ROOT.'/public/theme/common/nophoto.png';
|
if (! file_exists($file)) $url=DOL_URL_ROOT.'/public/theme/common/nophoto.png';
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].($edit?'?action=edit&theme=':'?theme=').$subdir.(GETPOST('optioncss','alpha',1)?'&optioncss='.GETPOST('optioncss','alpha',1):'').($fuser?'&id='.$fuser->id:'').'" style="font-weight: normal;" alt="'.$langs->trans("Preview").'">';
|
print '<a href="'.$_SERVER["PHP_SELF"].($edit?'?action=edit&theme=':'?theme=').$subdir.(GETPOST('optioncss','alpha',1)?'&optioncss='.GETPOST('optioncss','alpha',1):'').($fuser?'&id='.$fuser->id:'').'" style="font-weight: normal;" alt="'.$langs->trans("Preview").'">';
|
||||||
if ($subdir == $conf->global->MAIN_THEME) $title=$langs->trans("ThemeCurrentlyActive");
|
if ($subdir == $conf->global->MAIN_THEME) $title=$langs->trans("ThemeCurrentlyActive");
|
||||||
else $title=$langs->trans("ShowPreview");
|
else $title=$langs->trans("ShowPreview");
|
||||||
print '<img src="'.$url.'" border="0" width="80" height="60" alt="'.$title.'" title="'.$title.'" style="margin-bottom: 5px;">';
|
print '<img src="'.$url.'" border="0" width="80" height="60" alt="'.$title.'" title="'.$title.'" style="margin-bottom: 5px;">';
|
||||||
print '</a><br>';
|
print '</a><br>';
|
||||||
if ($subdir == $selected_theme)
|
if ($subdir == $selected_theme)
|
||||||
{
|
{
|
||||||
print '<input '.($edit?'':'disabled').' type="radio" class="themethumbs" style="border: 0px;" checked name="main_theme" value="'.$subdir.'"> <b>'.$subdir.'</b>';
|
print '<input '.($edit?'':'disabled').' type="radio" class="themethumbs" style="border: 0px;" checked name="main_theme" value="'.$subdir.'"> <b>'.$subdir.'</b>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<input '.($edit?'':'disabled').' type="radio" class="themethumbs" style="border: 0px;" name="main_theme" value="'.$subdir.'"> '.$subdir;
|
print '<input '.($edit?'':'disabled').' type="radio" class="themethumbs" style="border: 0px;" name="main_theme" value="'.$subdir.'"> '.$subdir;
|
||||||
}
|
}
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</div></td></tr></table>';
|
print '</div></td></tr></table>';
|
||||||
|
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// TopMenuDisableImages
|
// TopMenuDisableImages
|
||||||
if ($foruserprofile)
|
if ($foruserprofile)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$langs->trans("TopMenuDisableImages").'</td>';
|
print '<td>'.$langs->trans("TopMenuDisableImages").'</td>';
|
||||||
print '<td>'.($conf->global->THEME_TOPMENU_DISABLE_IMAGE?$conf->global->THEME_TOPMENU_DISABLE_IMAGE:$langs->trans("Default")).'</td>';
|
print '<td>'.($conf->global->THEME_TOPMENU_DISABLE_IMAGE?$conf->global->THEME_TOPMENU_DISABLE_IMAGE:$langs->trans("Default")).'</td>';
|
||||||
@ -440,30 +440,30 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
|
|||||||
}
|
}
|
||||||
if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
|
if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
|
||||||
print '</td>';*/
|
print '</td>';*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$default=$langs->trans('No');
|
$default=$langs->trans('No');
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$langs->trans("TopMenuDisableImages").'</td>';
|
print '<td>'.$langs->trans("TopMenuDisableImages").'</td>';
|
||||||
print '<td colspan="'.($colspan-1).'">';
|
print '<td colspan="'.($colspan-1).'">';
|
||||||
if ($edit)
|
if ($edit)
|
||||||
{
|
{
|
||||||
print $form->selectyesno('THEME_TOPMENU_DISABLE_IMAGE', $conf->global->THEME_TOPMENU_DISABLE_IMAGE, 1);
|
print $form->selectyesno('THEME_TOPMENU_DISABLE_IMAGE', $conf->global->THEME_TOPMENU_DISABLE_IMAGE, 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print yn($conf->global->THEME_TOPMENU_DISABLE_IMAGE);
|
print yn($conf->global->THEME_TOPMENU_DISABLE_IMAGE);
|
||||||
}
|
}
|
||||||
print ' ('.$langs->trans("Default").': <strong>'.$default.'</strong>) ';
|
print ' ('.$langs->trans("Default").': <strong>'.$default.'</strong>) ';
|
||||||
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
|
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Background color THEME_ELDY_BACKBODY
|
// Background color THEME_ELDY_BACKBODY
|
||||||
if ($foruserprofile)
|
if ($foruserprofile)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
|
print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
|
||||||
print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TOPMENU_BACK1:$langs->trans("Default")).'</td>';
|
print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TOPMENU_BACK1:$langs->trans("Default")).'</td>';
|
||||||
@ -486,29 +486,29 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$langs->trans("BackgroundColor").'</td>';
|
print '<td>'.$langs->trans("BackgroundColor").'</td>';
|
||||||
print '<td colspan="'.($colspan-1).'">';
|
print '<td colspan="'.($colspan-1).'">';
|
||||||
//var_dump($conf->global->THEME_ELDY_BACKBODY);
|
//var_dump($conf->global->THEME_ELDY_BACKBODY);
|
||||||
if ($edit)
|
if ($edit)
|
||||||
{
|
{
|
||||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY,array()),''),'THEME_ELDY_BACKBODY','formcolor',1).' ';
|
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY,array()),''),'THEME_ELDY_BACKBODY','formcolor',1).' ';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY,array()),'');
|
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY,array()),'');
|
||||||
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
|
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
|
||||||
else print $langs->trans("Default");
|
else print $langs->trans("Default");
|
||||||
}
|
}
|
||||||
print ' ('.$langs->trans("Default").': <strong>ffffff</strong>) ';
|
print ' ('.$langs->trans("Default").': <strong>ffffff</strong>) ';
|
||||||
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
|
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// TopMenuBackgroundColor
|
// TopMenuBackgroundColor
|
||||||
if ($foruserprofile)
|
if ($foruserprofile)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
|
print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
|
||||||
print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TOPMENU_BACK1:$langs->trans("Default")).'</td>';
|
print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TOPMENU_BACK1:$langs->trans("Default")).'</td>';
|
||||||
@ -531,25 +531,25 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$default='5a6482';
|
$default='5a6482';
|
||||||
if ($conf->theme == 'md') $default='5a3278';
|
if ($conf->theme == 'md') $default='5a3278';
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
|
print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
|
||||||
print '<td colspan="'.($colspan-1).'">';
|
print '<td colspan="'.($colspan-1).'">';
|
||||||
if ($edit)
|
if ($edit)
|
||||||
{
|
{
|
||||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','formcolor',1).' ';
|
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','formcolor',1).' ';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),'');
|
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),'');
|
||||||
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
|
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
|
||||||
else print $langs->trans("Default");
|
else print $langs->trans("Default");
|
||||||
}
|
}
|
||||||
print ' ('.$langs->trans("Default").': <strong>'.$default.'</strong>) ';
|
print ' ('.$langs->trans("Default").': <strong>'.$default.'</strong>) ';
|
||||||
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
|
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// LeftMenuBackgroundColor
|
// LeftMenuBackgroundColor
|
||||||
@ -607,22 +607,22 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$langs->trans("BackgroundTableTitleColor").'</td>';
|
print '<td>'.$langs->trans("BackgroundTableTitleColor").'</td>';
|
||||||
print '<td colspan="'.($colspan-1).'">';
|
print '<td colspan="'.($colspan-1).'">';
|
||||||
if ($edit)
|
if ($edit)
|
||||||
{
|
{
|
||||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKTITLE1,array()),''),'THEME_ELDY_BACKTITLE1','formcolor',1).' ';
|
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKTITLE1,array()),''),'THEME_ELDY_BACKTITLE1','formcolor',1).' ';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $formother->showColor($conf->global->THEME_ELDY_BACKTITLE1, $langs->trans("Default"));
|
print $formother->showColor($conf->global->THEME_ELDY_BACKTITLE1, $langs->trans("Default"));
|
||||||
}
|
}
|
||||||
print ' ('.$langs->trans("Default").': <strong>f0f0f0</strong>) '; // $colorbacktitle1 in CSS
|
print ' ('.$langs->trans("Default").': <strong>f0f0f0</strong>) '; // $colorbacktitle1 in CSS
|
||||||
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
|
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// BackgroundTableLineOddColor
|
// BackgroundTableLineOddColor
|
||||||
@ -632,25 +632,25 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$default='ffffff';
|
$default='ffffff';
|
||||||
if ($conf->theme == 'md') $default='ffffff';
|
if ($conf->theme == 'md') $default='ffffff';
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$langs->trans("BackgroundTableLineOddColor").'</td>';
|
print '<td>'.$langs->trans("BackgroundTableLineOddColor").'</td>';
|
||||||
print '<td colspan="'.($colspan-1).'">';
|
print '<td colspan="'.($colspan-1).'">';
|
||||||
if ($edit)
|
if ($edit)
|
||||||
{
|
{
|
||||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1,array()),''),'THEME_ELDY_LINEIMPAIR1','formcolor',1).' ';
|
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1,array()),''),'THEME_ELDY_LINEIMPAIR1','formcolor',1).' ';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1,array()),'');
|
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1,array()),'');
|
||||||
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
|
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
|
||||||
else print $langs->trans("Default");
|
else print $langs->trans("Default");
|
||||||
}
|
}
|
||||||
print ' ('.$langs->trans("Default").': <strong>'.$default.'</strong>) ';
|
print ' ('.$langs->trans("Default").': <strong>'.$default.'</strong>) ';
|
||||||
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
|
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// BackgroundTableLineEvenColor
|
// BackgroundTableLineEvenColor
|
||||||
@ -660,25 +660,25 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$default='f8f8f8';
|
$default='f8f8f8';
|
||||||
if ($conf->theme == 'md') $default='f8f8f8';
|
if ($conf->theme == 'md') $default='f8f8f8';
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$langs->trans("BackgroundTableLineEvenColor").'</td>';
|
print '<td>'.$langs->trans("BackgroundTableLineEvenColor").'</td>';
|
||||||
print '<td colspan="'.($colspan-1).'">';
|
print '<td colspan="'.($colspan-1).'">';
|
||||||
if ($edit)
|
if ($edit)
|
||||||
{
|
{
|
||||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1,array()),''),'THEME_ELDY_LINEPAIR1','formcolor',1).' ';
|
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1,array()),''),'THEME_ELDY_LINEPAIR1','formcolor',1).' ';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1,array()),'');
|
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1,array()),'');
|
||||||
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
|
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
|
||||||
else print $langs->trans("Default");
|
else print $langs->trans("Default");
|
||||||
}
|
}
|
||||||
print ' ('.$langs->trans("Default").': <strong>'.$default.'</strong>) ';
|
print ' ('.$langs->trans("Default").': <strong>'.$default.'</strong>) ';
|
||||||
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
|
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// TextTitleColor
|
// TextTitleColor
|
||||||
@ -689,29 +689,29 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$langs->trans("TextTitleColor").'</td>';
|
print '<td>'.$langs->trans("TextTitleColor").'</td>';
|
||||||
print '<td colspan="'.($colspan-1).'">';
|
print '<td colspan="'.($colspan-1).'">';
|
||||||
if ($edit)
|
if ($edit)
|
||||||
{
|
{
|
||||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLENOTAB,array()),''),'THEME_ELDY_TEXTTITLENOTAB','formcolor',1).' ';
|
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLENOTAB,array()),''),'THEME_ELDY_TEXTTITLENOTAB','formcolor',1).' ';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLENOTAB, $langs->trans("Default"));
|
print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLENOTAB, $langs->trans("Default"));
|
||||||
}
|
}
|
||||||
print ' ('.$langs->trans("Default").': <strong><span style="color: #3c3c14">3c3c14</span></strong>) ';
|
print ' ('.$langs->trans("Default").': <strong><span style="color: #3c3c14">3c3c14</span></strong>) ';
|
||||||
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
|
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
|
||||||
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Text LinkColor
|
// Text LinkColor
|
||||||
if ($foruserprofile)
|
if ($foruserprofile)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
|
print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
|
||||||
print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TEXTLINK:$langs->trans("Default")).'</td>';
|
print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TEXTLINK:$langs->trans("Default")).'</td>';
|
||||||
@ -734,33 +734,33 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$langs->trans("LinkColor").'</td>';
|
print '<td>'.$langs->trans("LinkColor").'</td>';
|
||||||
print '<td colspan="'.($colspan-1).'">';
|
print '<td colspan="'.($colspan-1).'">';
|
||||||
if ($edit)
|
if ($edit)
|
||||||
{
|
{
|
||||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),''),'THEME_ELDY_TEXTLINK','formcolor',1).' ';
|
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),''),'THEME_ELDY_TEXTLINK','formcolor',1).' ';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),'');
|
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),'');
|
||||||
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
|
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$defaultcolor.'" value="'.$langs->trans("Default").'">';
|
//print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$defaultcolor.'" value="'.$langs->trans("Default").'">';
|
||||||
//print '<span style="color: #000078">'.$langs->trans("Default").'</span>';
|
//print '<span style="color: #000078">'.$langs->trans("Default").'</span>';
|
||||||
print $langs->trans("Default");
|
print $langs->trans("Default");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print ' ('.$langs->trans("Default").': <strong><span style="color: #000078">000078</span></strong>) ';
|
print ' ('.$langs->trans("Default").': <strong><span style="color: #000078">000078</span></strong>) ';
|
||||||
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
|
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use Hover
|
// Use Hover
|
||||||
if ($foruserprofile)
|
if ($foruserprofile)
|
||||||
{
|
{
|
||||||
/* Must first change option to choose color of highlight instead of yes or no.
|
/* Must first change option to choose color of highlight instead of yes or no.
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$langs->trans("HighlightLinesOnMouseHover").'</td>';
|
print '<td>'.$langs->trans("HighlightLinesOnMouseHover").'</td>';
|
||||||
print '<td><input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER" disabled="disabled" type="checkbox" '.($conf->global->THEME_ELDY_USE_HOVER?" checked":"").'></td>';
|
print '<td><input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER" disabled="disabled" type="checkbox" '.($conf->global->THEME_ELDY_USE_HOVER?" checked":"").'></td>';
|
||||||
@ -773,33 +773,33 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$langs->trans("HighlightLinesColor").'</td>';
|
print '<td>'.$langs->trans("HighlightLinesColor").'</td>';
|
||||||
print '<td colspan="'.($colspan-1).'">';
|
print '<td colspan="'.($colspan-1).'">';
|
||||||
//print '<input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
|
//print '<input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
|
||||||
//print ' ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
|
//print ' ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
|
||||||
if ($edit)
|
if ($edit)
|
||||||
{
|
{
|
||||||
if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='edf4fb';
|
if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='edf4fb';
|
||||||
else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER,array()),'');
|
else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER,array()),'');
|
||||||
print $formother->selectColor($color,'THEME_ELDY_USE_HOVER','formcolor',1).' ';
|
print $formother->selectColor($color,'THEME_ELDY_USE_HOVER','formcolor',1).' ';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='edf4fb';
|
if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='edf4fb';
|
||||||
else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER,array()),'');
|
else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER,array()),'');
|
||||||
if ($color)
|
if ($color)
|
||||||
{
|
{
|
||||||
if ($color != 'edf4fb') print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
|
if ($color != 'edf4fb') print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
|
||||||
else print $langs->trans("Default");
|
else print $langs->trans("Default");
|
||||||
}
|
}
|
||||||
else print $langs->trans("None");
|
else print $langs->trans("None");
|
||||||
}
|
}
|
||||||
print ' ('.$langs->trans("Default").': <strong>edf4fb</strong>) ';
|
print ' ('.$langs->trans("Default").': <strong>edf4fb</strong>) ';
|
||||||
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
|
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,59 +31,59 @@
|
|||||||
*/
|
*/
|
||||||
function dolWebsiteOutput($content)
|
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 (mode=".(defined('USEDOLIBARRSERVER')?'USEDOLIBARRSERVER':'').')');
|
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
|
||||||
|
|
||||||
// Note: This seems never called when page is output inside the website editor (search 'REPLACEMENT OF LINKS When page called by website editor')
|
// 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
|
if (! defined('USEDOLIBARRSERVER')) // REPLACEMENT OF LINKS When page called from virtual host
|
||||||
{
|
{
|
||||||
$symlinktomediaexists=1;
|
$symlinktomediaexists=1;
|
||||||
|
|
||||||
// Make a change into HTML code to allow to include images from medias directory correct with direct link for virtual server
|
// Make a change into HTML code to allow to include images from medias directory correct with direct link for virtual server
|
||||||
// <img alt="" src="/dolibarr_dev/htdocs/viewimage.php?modulepart=medias&entity=1&file=image/ldestailleur_166x166.jpg" style="height:166px; width:166px" />
|
// <img alt="" src="/dolibarr_dev/htdocs/viewimage.php?modulepart=medias&entity=1&file=image/ldestailleur_166x166.jpg" style="height:166px; width:166px" />
|
||||||
// become
|
// become
|
||||||
// <img alt="" src="'.$urlwithroot.'/medias/image/ldestailleur_166x166.jpg" style="height:166px; width:166px" />
|
// <img alt="" src="'.$urlwithroot.'/medias/image/ldestailleur_166x166.jpg" style="height:166px; width:166px" />
|
||||||
$nbrep=0;
|
$nbrep=0;
|
||||||
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);
|
$content=preg_replace('/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)modulepart=medias([^\)]*)file=([^\)]*)(["\']?\))/', '\1'.$urlwithroot.'/viewimage.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$content=preg_replace('/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^\/]*\/?>)/', '\1medias/\4\5', $content, -1, $nbrep);
|
$content=preg_replace('/(<img[^>]*src=")[^\"]*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);
|
$content=preg_replace('/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)modulepart=medias([^\)]*)file=([^\)]*)(["\']?\))/', '\1medias/\4\5', $content, -1, $nbrep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // REPLACEMENT OF LINKS When page called from dolibarr server
|
else // REPLACEMENT OF LINKS When page called from dolibarr server
|
||||||
{
|
{
|
||||||
global $website;
|
global $website;
|
||||||
|
|
||||||
// Replace relative link / with dolibarr URL: ...href="/"...
|
// 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: ...href="....php"
|
// 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="
|
// 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);
|
$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="
|
// 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);
|
$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/
|
// 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);
|
$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");
|
||||||
|
|
||||||
print $content;
|
print $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -98,12 +98,12 @@ function check_user_password_ldap($usertotest,$passwordtotest,$entitytotest)
|
|||||||
$resultFetchLdapUser=0;
|
$resultFetchLdapUser=0;
|
||||||
|
|
||||||
// Define $userSearchFilter
|
// Define $userSearchFilter
|
||||||
$userSearchFilter = "";
|
$userSearchFilter = "";
|
||||||
if (empty($dolibarr_main_auth_ldap_filter)) {
|
if (empty($dolibarr_main_auth_ldap_filter)) {
|
||||||
$userSearchFilter = "(" . $ldapuserattr . "=" . $usertotest . ")";
|
$userSearchFilter = "(" . $ldapuserattr . "=" . $usertotest . ")";
|
||||||
} else {
|
} else {
|
||||||
$userSearchFilter = str_replace('%1%', $usertotest, $dolibarr_main_auth_ldap_filter);
|
$userSearchFilter = str_replace('%1%', $usertotest, $dolibarr_main_auth_ldap_filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If admin login provided
|
// If admin login provided
|
||||||
// Code to get user in LDAP from an admin connection (may differ from user connection, done later)
|
// Code to get user in LDAP from an admin connection (may differ from user connection, done later)
|
||||||
@ -127,7 +127,7 @@ function check_user_password_ldap($usertotest,$passwordtotest,$entitytotest)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($ldapdebug) print "DEBUG: ".$ldap->error."<br>\n";
|
if ($ldapdebug) print "DEBUG: ".$ldap->error."<br>\n";
|
||||||
}
|
}
|
||||||
$ldap->close();
|
$ldap->close();
|
||||||
}
|
}
|
||||||
@ -135,15 +135,15 @@ function check_user_password_ldap($usertotest,$passwordtotest,$entitytotest)
|
|||||||
// Forge LDAP user and password to test with them
|
// Forge LDAP user and password to test with them
|
||||||
// If LDAP need a dn with login like "uid=jbloggs,ou=People,dc=foo,dc=com", default dn may work even if previous code with
|
// If LDAP need a dn with login like "uid=jbloggs,ou=People,dc=foo,dc=com", default dn may work even if previous code with
|
||||||
// admin login no exectued.
|
// admin login no exectued.
|
||||||
$ldap->searchUser=$ldapuserattr."=".$usertotest.",".$ldapdn; // Default dn (will work if LDAP accept a dn with login value inside)
|
$ldap->searchUser=$ldapuserattr."=".$usertotest.",".$ldapdn; // Default dn (will work if LDAP accept a dn with login value inside)
|
||||||
// But if LDAP need a dn with name like "cn=Jhon Bloggs,ou=People,dc=foo,dc=com", previous part must have been executed to have
|
// But if LDAP need a dn with name like "cn=Jhon Bloggs,ou=People,dc=foo,dc=com", previous part must have been executed to have
|
||||||
// dn detected into ldapUserDN.
|
// dn detected into ldapUserDN.
|
||||||
if ($resultFetchLdapUser && !empty($ldap->ldapUserDN)) $ldap->searchUser = $ldap->ldapUserDN;
|
if ($resultFetchLdapUser && !empty($ldap->ldapUserDN)) $ldap->searchUser = $ldap->ldapUserDN;
|
||||||
$ldap->searchPassword=$passwordtotest;
|
$ldap->searchPassword=$passwordtotest;
|
||||||
|
|
||||||
// Test with this->seachUser and this->searchPassword
|
// Test with this->seachUser and this->searchPassword
|
||||||
//print $resultFetchLdapUser."-".$ldap->ldapUserDN."-".$ldap->searchUser.'-'.$ldap->searchPassword;exit;
|
//print $resultFetchLdapUser."-".$ldap->ldapUserDN."-".$ldap->searchUser.'-'.$ldap->searchPassword;exit;
|
||||||
$result=$ldap->connect_bind();
|
$result=$ldap->connect_bind();
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
if ($result == 2) // Connection is ok for user/pass into LDAP
|
if ($result == 2) // Connection is ok for user/pass into LDAP
|
||||||
@ -214,7 +214,7 @@ function check_user_password_ldap($usertotest,$passwordtotest,$entitytotest)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Login failed. Return false, together with the error code and text from
|
/* Login failed. Return false, together with the error code and text from
|
||||||
** the LDAP server. The common error codes and reasons are listed below :
|
** the LDAP server. The common error codes and reasons are listed below :
|
||||||
** (for iPlanet, other servers may differ)
|
** (for iPlanet, other servers may differ)
|
||||||
** 19 - Account locked out (too many invalid login attempts)
|
** 19 - Account locked out (too many invalid login attempts)
|
||||||
@ -222,13 +222,13 @@ function check_user_password_ldap($usertotest,$passwordtotest,$entitytotest)
|
|||||||
** 49 - Wrong password
|
** 49 - Wrong password
|
||||||
** 53 - Account inactive (manually locked out by administrator)
|
** 53 - Account inactive (manually locked out by administrator)
|
||||||
*/
|
*/
|
||||||
dol_syslog("functions_ldap::check_user_password_ldap Authentification ko failed to connect to LDAP for '".$usertotest."'");
|
dol_syslog("functions_ldap::check_user_password_ldap Authentification ko failed to connect to LDAP for '".$usertotest."'");
|
||||||
if (is_resource($ldap->connection)) // If connection ok but bind ko
|
if (is_resource($ldap->connection)) // If connection ok but bind ko
|
||||||
{
|
{
|
||||||
$ldap->ldapErrorCode = ldap_errno($ldap->connection);
|
$ldap->ldapErrorCode = ldap_errno($ldap->connection);
|
||||||
$ldap->ldapErrorText = ldap_error($ldap->connection);
|
$ldap->ldapErrorText = ldap_error($ldap->connection);
|
||||||
dol_syslog("functions_ldap::check_user_password_ldap ".$ldap->ldapErrorCode." ".$ldap->ldapErrorText);
|
dol_syslog("functions_ldap::check_user_password_ldap ".$ldap->ldapErrorCode." ".$ldap->ldapErrorText);
|
||||||
}
|
}
|
||||||
sleep(2); // Anti brut force protection
|
sleep(2); // Anti brut force protection
|
||||||
$langs->load('main');
|
$langs->load('main');
|
||||||
$langs->load('other');
|
$langs->load('other');
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -35,22 +35,22 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
|||||||
*/
|
*/
|
||||||
class html_cerfafr extends ModeleDon
|
class html_cerfafr extends ModeleDon
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param DoliDb $db Database handler
|
* @param DoliDb $db Database handler
|
||||||
*/
|
*/
|
||||||
function __construct($db)
|
function __construct($db)
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
$this->name = "cerfafr";
|
$this->name = "cerfafr";
|
||||||
$this->description = $langs->trans('DonationsReceiptModel').' - fr_FR - Cerfa 11580*03';
|
$this->description = $langs->trans('DonationsReceiptModel').' - fr_FR - Cerfa 11580*03';
|
||||||
|
|
||||||
// Dimension page for size A4
|
// Dimension page for size A4
|
||||||
$this->type = 'html';
|
$this->type = 'html';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -64,16 +64,16 @@ class html_cerfafr extends ModeleDon
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write the object to document file to disk
|
* Write the object to document file to disk
|
||||||
*
|
*
|
||||||
* @param Don $don Donation object
|
* @param Don $don Donation object
|
||||||
* @param Translate $outputlangs Lang object for output language
|
* @param Translate $outputlangs Lang object for output language
|
||||||
* @param string $currency Currency code
|
* @param string $currency Currency code
|
||||||
* @return int >0 if OK, <0 if KO
|
* @return int >0 if OK, <0 if KO
|
||||||
*/
|
*/
|
||||||
function write_file($don,$outputlangs,$currency='')
|
function write_file($don,$outputlangs,$currency='')
|
||||||
{
|
{
|
||||||
global $user,$conf,$langs,$mysoc;
|
global $user,$conf,$langs,$mysoc;
|
||||||
|
|
||||||
$now=dol_now();
|
$now=dol_now();
|
||||||
@ -91,13 +91,13 @@ class html_cerfafr extends ModeleDon
|
|||||||
$currency = !empty($currency) ? $currency : $conf->currency;
|
$currency = !empty($currency) ? $currency : $conf->currency;
|
||||||
|
|
||||||
if (! empty($conf->don->dir_output))
|
if (! empty($conf->don->dir_output))
|
||||||
{
|
{
|
||||||
// Definition of the object don (for upward compatibility)
|
// Definition of the object don (for upward compatibility)
|
||||||
if (! is_object($don))
|
if (! is_object($don))
|
||||||
{
|
{
|
||||||
$don = new Don($this->db);
|
$don = new Don($this->db);
|
||||||
$ret=$don->fetch($id);
|
$ret=$don->fetch($id);
|
||||||
$id=$don->id;
|
$id=$don->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Definition of $dir and $file
|
// Definition of $dir and $file
|
||||||
@ -113,27 +113,27 @@ class html_cerfafr extends ModeleDon
|
|||||||
$file = $dir . "/" . $donref . ".html";
|
$file = $dir . "/" . $donref . ".html";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! file_exists($dir))
|
if (! file_exists($dir))
|
||||||
{
|
{
|
||||||
if (dol_mkdir($dir) < 0)
|
if (dol_mkdir($dir) < 0)
|
||||||
{
|
{
|
||||||
$this->error=$langs->trans("ErrorCanNotCreateDir",$dir);
|
$this->error=$langs->trans("ErrorCanNotCreateDir",$dir);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file_exists($dir))
|
if (file_exists($dir))
|
||||||
{
|
{
|
||||||
$formclass = new Form($this->db);
|
$formclass = new Form($this->db);
|
||||||
|
|
||||||
// This is not the proper way to do it but $formclass->form_modes_reglement
|
// This is not the proper way to do it but $formclass->form_modes_reglement
|
||||||
// prints the translation instead of returning it
|
// prints the translation instead of returning it
|
||||||
if ($don->modepaiementid)
|
if ($don->modepaiementid)
|
||||||
{
|
{
|
||||||
$formclass->load_cache_types_paiements();
|
$formclass->load_cache_types_paiements();
|
||||||
$paymentmode = $formclass->cache_types_paiements[$don->modepaiementid]['label'];
|
$paymentmode = $formclass->cache_types_paiements[$don->modepaiementid]['label'];
|
||||||
}
|
}
|
||||||
else $paymentmode = '';
|
else $paymentmode = '';
|
||||||
|
|
||||||
if ($don->modepaiementid==7){
|
if ($don->modepaiementid==7){
|
||||||
$ModePaiement = '<td width="25%"><input type="checkbox"> Remise d\'espèces</td><td width="25%"><input type="checkbox" disabled="true" checked="checked"> Chèque</td><td width="50%"><input type="checkbox"> Virement, prélèvement, carte bancaire</td>';
|
$ModePaiement = '<td width="25%"><input type="checkbox"> Remise d\'espèces</td><td width="25%"><input type="checkbox" disabled="true" checked="checked"> Chèque</td><td width="50%"><input type="checkbox"> Virement, prélèvement, carte bancaire</td>';
|
||||||
@ -160,52 +160,52 @@ class html_cerfafr extends ModeleDon
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Define contents
|
// Define contents
|
||||||
$donmodel=DOL_DOCUMENT_ROOT ."/core/modules/dons/html_cerfafr.html";
|
$donmodel=DOL_DOCUMENT_ROOT ."/core/modules/dons/html_cerfafr.html";
|
||||||
$form = implode('', file($donmodel));
|
$form = implode('', file($donmodel));
|
||||||
$form = str_replace('__REF__',$don->id,$form);
|
$form = str_replace('__REF__',$don->id,$form);
|
||||||
$form = str_replace('__DATE__',dol_print_date($don->date,'day',false,$outputlangs),$form);
|
$form = str_replace('__DATE__',dol_print_date($don->date,'day',false,$outputlangs),$form);
|
||||||
//$form = str_replace('__IP__',$user->ip,$form); // TODO $user->ip not exist
|
//$form = str_replace('__IP__',$user->ip,$form); // TODO $user->ip not exist
|
||||||
$form = str_replace('__AMOUNT__',$don->amount,$form);
|
$form = str_replace('__AMOUNT__',$don->amount,$form);
|
||||||
$form = str_replace('__AMOUNTLETTERS__',chiffre_en_lettre($don->amount),$form);
|
$form = str_replace('__AMOUNTLETTERS__',chiffre_en_lettre($don->amount),$form);
|
||||||
$form = str_replace('__CURRENCY__',$outputlangs->transnoentitiesnoconv("Currency".$currency),$form);
|
$form = str_replace('__CURRENCY__',$outputlangs->transnoentitiesnoconv("Currency".$currency),$form);
|
||||||
$form = str_replace('__CURRENCYCODE__',$conf->currency,$form);
|
$form = str_replace('__CURRENCYCODE__',$conf->currency,$form);
|
||||||
$form = str_replace('__MAIN_INFO_SOCIETE_NOM__',$mysoc->name,$form);
|
$form = str_replace('__MAIN_INFO_SOCIETE_NOM__',$mysoc->name,$form);
|
||||||
$form = str_replace('__MAIN_INFO_SOCIETE_ADDRESS__',$mysoc->address,$form);
|
$form = str_replace('__MAIN_INFO_SOCIETE_ADDRESS__',$mysoc->address,$form);
|
||||||
$form = str_replace('__MAIN_INFO_SOCIETE_ZIP__',$mysoc->zip,$form);
|
$form = str_replace('__MAIN_INFO_SOCIETE_ZIP__',$mysoc->zip,$form);
|
||||||
$form = str_replace('__MAIN_INFO_SOCIETE_TOWN__',$mysoc->town,$form);
|
$form = str_replace('__MAIN_INFO_SOCIETE_TOWN__',$mysoc->town,$form);
|
||||||
$form = str_replace('__MAIN_INFO_SOCIETE_OBJECT__',$mysoc->object,$form);
|
$form = str_replace('__MAIN_INFO_SOCIETE_OBJECT__',$mysoc->object,$form);
|
||||||
$form = str_replace('__DONATOR_FIRSTNAME__',$don->firstname,$form);
|
$form = str_replace('__DONATOR_FIRSTNAME__',$don->firstname,$form);
|
||||||
$form = str_replace('__DONATOR_LASTNAME__',$don->lastname,$form);
|
$form = str_replace('__DONATOR_LASTNAME__',$don->lastname,$form);
|
||||||
$form = str_replace('__DONATOR_SOCIETE__',$don->societe,$form);
|
$form = str_replace('__DONATOR_SOCIETE__',$don->societe,$form);
|
||||||
$form = str_replace('__DONATOR_STATUT__',$don->statut,$form);
|
$form = str_replace('__DONATOR_STATUT__',$don->statut,$form);
|
||||||
$form = str_replace('__DONATOR_ADDRESS__',$don->address,$form);
|
$form = str_replace('__DONATOR_ADDRESS__',$don->address,$form);
|
||||||
$form = str_replace('__DONATOR_ZIP__',$don->zip,$form);
|
$form = str_replace('__DONATOR_ZIP__',$don->zip,$form);
|
||||||
$form = str_replace('__DONATOR_TOWN__',$don->town,$form);
|
$form = str_replace('__DONATOR_TOWN__',$don->town,$form);
|
||||||
$form = str_replace('__PAYMENTMODE_LIB__ ', $paymentmode,$form);
|
$form = str_replace('__PAYMENTMODE_LIB__ ', $paymentmode,$form);
|
||||||
$form = str_replace('__ModePaiement__', $ModePaiement,$form);
|
$form = str_replace('__ModePaiement__', $ModePaiement,$form);
|
||||||
$form = str_replace('__NOW__',dol_print_date($now,'day',false,$outputlangs),$form);
|
$form = str_replace('__NOW__',dol_print_date($now,'day',false,$outputlangs),$form);
|
||||||
$form = str_replace('__DonationRef__',$outputlangs->trans("DonationRef"),$form);
|
$form = str_replace('__DonationRef__',$outputlangs->trans("DonationRef"),$form);
|
||||||
$form = str_replace('__DonationTitle__',$outputlangs->trans("DonationTitle"),$form);
|
$form = str_replace('__DonationTitle__',$outputlangs->trans("DonationTitle"),$form);
|
||||||
$form = str_replace('__DonationReceipt__',$outputlangs->trans("DonationReceipt"),$form);
|
$form = str_replace('__DonationReceipt__',$outputlangs->trans("DonationReceipt"),$form);
|
||||||
$form = str_replace('__DonationRecipient__',$outputlangs->trans("DonationRecipient"),$form);
|
$form = str_replace('__DonationRecipient__',$outputlangs->trans("DonationRecipient"),$form);
|
||||||
$form = str_replace('__DonationDatePayment__',$outputlangs->trans("DonationDatePayment"),$form);
|
$form = str_replace('__DonationDatePayment__',$outputlangs->trans("DonationDatePayment"),$form);
|
||||||
$form = str_replace('__PaymentMode__',$outputlangs->trans("PaymentMode"),$form);
|
$form = str_replace('__PaymentMode__',$outputlangs->trans("PaymentMode"),$form);
|
||||||
// $form = str_replace('__CodeDon__',$CodeDon,$form);
|
// $form = str_replace('__CodeDon__',$CodeDon,$form);
|
||||||
$form = str_replace('__Name__',$outputlangs->trans("Name"),$form);
|
$form = str_replace('__Name__',$outputlangs->trans("Name"),$form);
|
||||||
$form = str_replace('__Address__',$outputlangs->trans("Address"),$form);
|
$form = str_replace('__Address__',$outputlangs->trans("Address"),$form);
|
||||||
$form = str_replace('__Zip__',$outputlangs->trans("Zip"),$form);
|
$form = str_replace('__Zip__',$outputlangs->trans("Zip"),$form);
|
||||||
$form = str_replace('__Town__',$outputlangs->trans("Town"),$form);
|
$form = str_replace('__Town__',$outputlangs->trans("Town"),$form);
|
||||||
$form = str_replace('__Object__',$outputlangs->trans("Object"),$form);
|
$form = str_replace('__Object__',$outputlangs->trans("Object"),$form);
|
||||||
$form = str_replace('__Donor__',$outputlangs->trans("Donor"),$form);
|
$form = str_replace('__Donor__',$outputlangs->trans("Donor"),$form);
|
||||||
$form = str_replace('__Date__',$outputlangs->trans("Date"),$form);
|
$form = str_replace('__Date__',$outputlangs->trans("Date"),$form);
|
||||||
$form = str_replace('__Signature__',$outputlangs->trans("Signature"),$form);
|
$form = str_replace('__Signature__',$outputlangs->trans("Signature"),$form);
|
||||||
$form = str_replace('__Message__',$outputlangs->trans("Message"),$form);
|
$form = str_replace('__Message__',$outputlangs->trans("Message"),$form);
|
||||||
$form = str_replace('__IConfirmDonationReception__',$outputlangs->trans("IConfirmDonationReception"),$form);
|
$form = str_replace('__IConfirmDonationReception__',$outputlangs->trans("IConfirmDonationReception"),$form);
|
||||||
$form = str_replace('__DonationMessage__',$conf->global->DONATION_MESSAGE,$form);
|
$form = str_replace('__DonationMessage__',$conf->global->DONATION_MESSAGE,$form);
|
||||||
|
|
||||||
$frencharticle='';
|
$frencharticle='';
|
||||||
if (preg_match('/fr/i',$outputlangs->defaultlang)) $frencharticle='<font size="+1">Article 200, 238 bis et 885-0 V bis A du code général des impôts (CGI)</font>';
|
if (preg_match('/fr/i',$outputlangs->defaultlang)) $frencharticle='<font size="+1">Article 200, 238 bis et 885-0 V bis A du code général des impôts (CGI)</font>';
|
||||||
$form = str_replace('__FrenchArticle__',$frencharticle,$form);
|
$form = str_replace('__FrenchArticle__',$frencharticle,$form);
|
||||||
|
|
||||||
$frencheligibility='';
|
$frencheligibility='';
|
||||||
@ -252,176 +252,176 @@ class html_cerfafr extends ModeleDon
|
|||||||
$form = str_replace('__ARTICLE885__',$art885,$form);
|
$form = str_replace('__ARTICLE885__',$art885,$form);
|
||||||
|
|
||||||
// Save file on disk
|
// Save file on disk
|
||||||
dol_syslog("html_cerfafr::write_file $file");
|
dol_syslog("html_cerfafr::write_file $file");
|
||||||
$handle=fopen($file,"w");
|
$handle=fopen($file,"w");
|
||||||
fwrite($handle,$form);
|
fwrite($handle,$form);
|
||||||
fclose($handle);
|
fclose($handle);
|
||||||
if (! empty($conf->global->MAIN_UMASK))
|
if (! empty($conf->global->MAIN_UMASK))
|
||||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||||
|
|
||||||
$this->result = array('fullpath'=>$file);
|
$this->result = array('fullpath'=>$file);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$langs->trans("ErrorCanNotCreateDir",$dir);
|
$this->error=$langs->trans("ErrorCanNotCreateDir",$dir);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->error=$langs->trans("ErrorConstantNotDefined","DON_OUTPUTDIR");
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
$this->error=$langs->trans("ErrorConstantNotDefined","DON_OUTPUTDIR");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function chiffre_en_lettre($montant, $devise1='', $devise2='')
|
function chiffre_en_lettre($montant, $devise1='', $devise2='')
|
||||||
{
|
{
|
||||||
if(empty($devise1)) $dev1='euros';
|
if(empty($devise1)) $dev1='euros';
|
||||||
else $dev1=$devise1;
|
else $dev1=$devise1;
|
||||||
if(empty($devise2)) $dev2='centimes';
|
if(empty($devise2)) $dev2='centimes';
|
||||||
else $dev2=$devise2;
|
else $dev2=$devise2;
|
||||||
$valeur_entiere=intval($montant);
|
$valeur_entiere=intval($montant);
|
||||||
$valeur_decimal=intval(round($montant-intval($montant), 2)*100);
|
$valeur_decimal=intval(round($montant-intval($montant), 2)*100);
|
||||||
$dix_c=intval($valeur_decimal%100/10);
|
$dix_c=intval($valeur_decimal%100/10);
|
||||||
$cent_c=intval($valeur_decimal%1000/100);
|
$cent_c=intval($valeur_decimal%1000/100);
|
||||||
$unite[1]=$valeur_entiere%10;
|
$unite[1]=$valeur_entiere%10;
|
||||||
$dix[1]=intval($valeur_entiere%100/10);
|
$dix[1]=intval($valeur_entiere%100/10);
|
||||||
$cent[1]=intval($valeur_entiere%1000/100);
|
$cent[1]=intval($valeur_entiere%1000/100);
|
||||||
$unite[2]=intval($valeur_entiere%10000/1000);
|
$unite[2]=intval($valeur_entiere%10000/1000);
|
||||||
$dix[2]=intval($valeur_entiere%100000/10000);
|
$dix[2]=intval($valeur_entiere%100000/10000);
|
||||||
$cent[2]=intval($valeur_entiere%1000000/100000);
|
$cent[2]=intval($valeur_entiere%1000000/100000);
|
||||||
$unite[3]=intval($valeur_entiere%10000000/1000000);
|
$unite[3]=intval($valeur_entiere%10000000/1000000);
|
||||||
$dix[3]=intval($valeur_entiere%100000000/10000000);
|
$dix[3]=intval($valeur_entiere%100000000/10000000);
|
||||||
$cent[3]=intval($valeur_entiere%1000000000/100000000);
|
$cent[3]=intval($valeur_entiere%1000000000/100000000);
|
||||||
$chif=array('', 'un', 'deux', 'trois', 'quatre', 'cinq', 'six', 'sept', 'huit', 'neuf', 'dix', 'onze', 'douze', 'treize', 'quatorze', 'quinze', 'seize', 'dix sept', 'dix huit', 'dix neuf');
|
$chif=array('', 'un', 'deux', 'trois', 'quatre', 'cinq', 'six', 'sept', 'huit', 'neuf', 'dix', 'onze', 'douze', 'treize', 'quatorze', 'quinze', 'seize', 'dix sept', 'dix huit', 'dix neuf');
|
||||||
$secon_c='';
|
$secon_c='';
|
||||||
$trio_c='';
|
$trio_c='';
|
||||||
for($i=1; $i<=3; $i++){
|
for($i=1; $i<=3; $i++){
|
||||||
$prim[$i]='';
|
$prim[$i]='';
|
||||||
$secon[$i]='';
|
$secon[$i]='';
|
||||||
$trio[$i]='';
|
$trio[$i]='';
|
||||||
if($dix[$i]==0){
|
if($dix[$i]==0){
|
||||||
$secon[$i]='';
|
$secon[$i]='';
|
||||||
$prim[$i]=$chif[$unite[$i]];
|
$prim[$i]=$chif[$unite[$i]];
|
||||||
}
|
}
|
||||||
else if($dix[$i]==1){
|
else if($dix[$i]==1){
|
||||||
$secon[$i]='';
|
$secon[$i]='';
|
||||||
$prim[$i]=$chif[($unite[$i]+10)];
|
$prim[$i]=$chif[($unite[$i]+10)];
|
||||||
}
|
}
|
||||||
else if($dix[$i]==2){
|
else if($dix[$i]==2){
|
||||||
if($unite[$i]==1){
|
if($unite[$i]==1){
|
||||||
$secon[$i]='vingt et';
|
$secon[$i]='vingt et';
|
||||||
$prim[$i]=$chif[$unite[$i]];
|
$prim[$i]=$chif[$unite[$i]];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$secon[$i]='vingt';
|
$secon[$i]='vingt';
|
||||||
$prim[$i]=$chif[$unite[$i]];
|
$prim[$i]=$chif[$unite[$i]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if($dix[$i]==3){
|
else if($dix[$i]==3){
|
||||||
if($unite[$i]==1){
|
if($unite[$i]==1){
|
||||||
$secon[$i]='trente et';
|
$secon[$i]='trente et';
|
||||||
$prim[$i]=$chif[$unite[$i]];
|
$prim[$i]=$chif[$unite[$i]];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$secon[$i]='trente';
|
$secon[$i]='trente';
|
||||||
$prim[$i]=$chif[$unite[$i]];
|
$prim[$i]=$chif[$unite[$i]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if($dix[$i]==4){
|
else if($dix[$i]==4){
|
||||||
if($unite[$i]==1){
|
if($unite[$i]==1){
|
||||||
$secon[$i]='quarante et';
|
$secon[$i]='quarante et';
|
||||||
$prim[$i]=$chif[$unite[$i]];
|
$prim[$i]=$chif[$unite[$i]];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$secon[$i]='quarante';
|
$secon[$i]='quarante';
|
||||||
$prim[$i]=$chif[$unite[$i]];
|
$prim[$i]=$chif[$unite[$i]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if($dix[$i]==5){
|
else if($dix[$i]==5){
|
||||||
if($unite[$i]==1){
|
if($unite[$i]==1){
|
||||||
$secon[$i]='cinquante et';
|
$secon[$i]='cinquante et';
|
||||||
$prim[$i]=$chif[$unite[$i]];
|
$prim[$i]=$chif[$unite[$i]];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$secon[$i]='cinquante';
|
$secon[$i]='cinquante';
|
||||||
$prim[$i]=$chif[$unite[$i]];
|
$prim[$i]=$chif[$unite[$i]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if($dix[$i]==6){
|
else if($dix[$i]==6){
|
||||||
if($unite[$i]==1){
|
if($unite[$i]==1){
|
||||||
$secon[$i]='soixante et';
|
$secon[$i]='soixante et';
|
||||||
$prim[$i]=$chif[$unite[$i]];
|
$prim[$i]=$chif[$unite[$i]];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$secon[$i]='soixante';
|
$secon[$i]='soixante';
|
||||||
$prim[$i]=$chif[$unite[$i]];
|
$prim[$i]=$chif[$unite[$i]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if($dix[$i]==7){
|
else if($dix[$i]==7){
|
||||||
if($unite[$i]==1){
|
if($unite[$i]==1){
|
||||||
$secon[$i]='soixante et';
|
$secon[$i]='soixante et';
|
||||||
$prim[$i]=$chif[$unite[$i]+10];
|
$prim[$i]=$chif[$unite[$i]+10];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$secon[$i]='soixante';
|
$secon[$i]='soixante';
|
||||||
$prim[$i]=$chif[$unite[$i]+10];
|
$prim[$i]=$chif[$unite[$i]+10];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if($dix[$i]==8){
|
else if($dix[$i]==8){
|
||||||
if($unite[$i]==1){
|
if($unite[$i]==1){
|
||||||
$secon[$i]='quatre-vingts et';
|
$secon[$i]='quatre-vingts et';
|
||||||
$prim[$i]=$chif[$unite[$i]];
|
$prim[$i]=$chif[$unite[$i]];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$secon[$i]='quatre-vingt';
|
$secon[$i]='quatre-vingt';
|
||||||
$prim[$i]=$chif[$unite[$i]];
|
$prim[$i]=$chif[$unite[$i]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if($dix[$i]==9){
|
else if($dix[$i]==9){
|
||||||
if($unite[$i]==1){
|
if($unite[$i]==1){
|
||||||
$secon[$i]='quatre-vingts et';
|
$secon[$i]='quatre-vingts et';
|
||||||
$prim[$i]=$chif[$unite[$i]+10];
|
$prim[$i]=$chif[$unite[$i]+10];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$secon[$i]='quatre-vingts';
|
$secon[$i]='quatre-vingts';
|
||||||
$prim[$i]=$chif[$unite[$i]+10];
|
$prim[$i]=$chif[$unite[$i]+10];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($cent[$i]==1) $trio[$i]='cent';
|
if($cent[$i]==1) $trio[$i]='cent';
|
||||||
else if($cent[$i]!=0 || $cent[$i]!='') $trio[$i]=$chif[$cent[$i]] .' cents';
|
else if($cent[$i]!=0 || $cent[$i]!='') $trio[$i]=$chif[$cent[$i]] .' cents';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$chif2=array('', 'dix', 'vingt', 'trente', 'quarante', 'cinquante', 'soixante', 'soixante-dix', 'quatre-vingts', 'quatre-vingts dix');
|
$chif2=array('', 'dix', 'vingt', 'trente', 'quarante', 'cinquante', 'soixante', 'soixante-dix', 'quatre-vingts', 'quatre-vingts dix');
|
||||||
$secon_c=$chif2[$dix_c];
|
$secon_c=$chif2[$dix_c];
|
||||||
if($cent_c==1) $trio_c='cent';
|
if($cent_c==1) $trio_c='cent';
|
||||||
else if($cent_c!=0 || $cent_c!='') $trio_c=$chif[$cent_c] .' cents';
|
else if($cent_c!=0 || $cent_c!='') $trio_c=$chif[$cent_c] .' cents';
|
||||||
|
|
||||||
if(($cent[3]==0 || $cent[3]=='') && ($dix[3]==0 || $dix[3]=='') && ($unite[3]==1))
|
if(($cent[3]==0 || $cent[3]=='') && ($dix[3]==0 || $dix[3]=='') && ($unite[3]==1))
|
||||||
$somme = $trio[3]. ' ' .$secon[3]. ' ' . $prim[3]. ' million ';
|
$somme = $trio[3]. ' ' .$secon[3]. ' ' . $prim[3]. ' million ';
|
||||||
else if(($cent[3]!=0 && $cent[3]!='') || ($dix[3]!=0 && $dix[3]!='') || ($unite[3]!=0 && $unite[3]!=''))
|
else if(($cent[3]!=0 && $cent[3]!='') || ($dix[3]!=0 && $dix[3]!='') || ($unite[3]!=0 && $unite[3]!=''))
|
||||||
$somme = $trio[3]. ' ' .$secon[3]. ' ' . $prim[3]. ' millions ';
|
$somme = $trio[3]. ' ' .$secon[3]. ' ' . $prim[3]. ' millions ';
|
||||||
else
|
else
|
||||||
$somme = $trio[3]. ' ' .$secon[3]. ' ' . $prim[3];
|
$somme = $trio[3]. ' ' .$secon[3]. ' ' . $prim[3];
|
||||||
|
|
||||||
if(($cent[2]==0 || $cent[2]=='') && ($dix[2]==0 || $dix[2]=='') && ($unite[2]==1))
|
if(($cent[2]==0 || $cent[2]=='') && ($dix[2]==0 || $dix[2]=='') && ($unite[2]==1))
|
||||||
$somme = $somme.' mille ';
|
$somme = $somme.' mille ';
|
||||||
else if(($cent[2]!=0 && $cent[2]!='') || ($dix[2]!=0 && $dix[2]!='') || ($unite[2]!=0 && $unite[2]!=''))
|
else if(($cent[2]!=0 && $cent[2]!='') || ($dix[2]!=0 && $dix[2]!='') || ($unite[2]!=0 && $unite[2]!=''))
|
||||||
$somme = $somme. $trio[2]. ' ' .$secon[2]. ' ' . $prim[2]. ' milles ';
|
$somme = $somme. $trio[2]. ' ' .$secon[2]. ' ' . $prim[2]. ' milles ';
|
||||||
else
|
else
|
||||||
$somme = $somme. $trio[2]. ' ' .$secon[2]. ' ' . $prim[2];
|
$somme = $somme. $trio[2]. ' ' .$secon[2]. ' ' . $prim[2];
|
||||||
|
|
||||||
$somme = $somme. $trio[1]. ' ' .$secon[1]. ' ' . $prim[1];
|
$somme = $somme. $trio[1]. ' ' .$secon[1]. ' ' . $prim[1];
|
||||||
|
|
||||||
$somme = $somme. ' '. $dev1 .' ' ;
|
$somme = $somme. ' '. $dev1 .' ' ;
|
||||||
|
|
||||||
if(($cent_c=='0' || $cent_c=='') && ($dix_c=='0' || $dix_c==''))
|
if(($cent_c=='0' || $cent_c=='') && ($dix_c=='0' || $dix_c==''))
|
||||||
return $somme. ' et zéro '. $dev2;
|
return $somme. ' et zéro '. $dev2;
|
||||||
else
|
else
|
||||||
return $somme. $trio_c. ' ' .$secon_c. ' ' . $dev2;
|
return $somme. $trio_c. ' ' .$secon_c. ' ' . $dev2;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,18 +35,18 @@ class InterfaceNotification extends DolibarrTriggers
|
|||||||
public $version = self::VERSION_DOLIBARR;
|
public $version = self::VERSION_DOLIBARR;
|
||||||
public $picto = 'email';
|
public $picto = 'email';
|
||||||
|
|
||||||
var $listofmanagedevents=array(
|
var $listofmanagedevents=array(
|
||||||
'BILL_VALIDATE',
|
'BILL_VALIDATE',
|
||||||
'BILL_PAYED',
|
'BILL_PAYED',
|
||||||
'ORDER_VALIDATE',
|
'ORDER_VALIDATE',
|
||||||
'PROPAL_VALIDATE',
|
'PROPAL_VALIDATE',
|
||||||
'PROPAL_CLOSE_SIGNED',
|
'PROPAL_CLOSE_SIGNED',
|
||||||
'FICHINTER_VALIDATE',
|
'FICHINTER_VALIDATE',
|
||||||
'FICHINTER_ADD_CONTACT',
|
'FICHINTER_ADD_CONTACT',
|
||||||
'ORDER_SUPPLIER_VALIDATE',
|
'ORDER_SUPPLIER_VALIDATE',
|
||||||
'ORDER_SUPPLIER_APPROVE',
|
'ORDER_SUPPLIER_APPROVE',
|
||||||
'ORDER_SUPPLIER_REFUSE',
|
'ORDER_SUPPLIER_REFUSE',
|
||||||
'SHIPPING_VALIDATE'
|
'SHIPPING_VALIDATE'
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -74,62 +74,62 @@ class InterfaceNotification extends DolibarrTriggers
|
|||||||
$notify->send($action, $object);
|
$notify->send($action, $object);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return list of events managed by notification module
|
* Return list of events managed by notification module
|
||||||
*
|
*
|
||||||
* @return array Array of events managed by notification module
|
* @return array Array of events managed by notification module
|
||||||
*/
|
*/
|
||||||
function getListOfManagedEvents()
|
function getListOfManagedEvents()
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$ret=array();
|
$ret=array();
|
||||||
|
|
||||||
$sql = "SELECT rowid, code, label, description, elementtype";
|
$sql = "SELECT rowid, code, label, description, elementtype";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_action_trigger";
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_action_trigger";
|
||||||
$sql.= $this->db->order("rang, elementtype, code");
|
$sql.= $this->db->order("rang, elementtype, code");
|
||||||
dol_syslog("getListOfManagedEvents Get list of notifications", LOG_DEBUG);
|
dol_syslog("getListOfManagedEvents Get list of notifications", LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$num=$this->db->num_rows($resql);
|
$num=$this->db->num_rows($resql);
|
||||||
$i=0;
|
$i=0;
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$obj=$this->db->fetch_object($resql);
|
$obj=$this->db->fetch_object($resql);
|
||||||
|
|
||||||
$qualified=0;
|
$qualified=0;
|
||||||
// Check is this event is supported by notification module
|
// Check is this event is supported by notification module
|
||||||
if (in_array($obj->code,$this->listofmanagedevents)) $qualified=1;
|
if (in_array($obj->code,$this->listofmanagedevents)) $qualified=1;
|
||||||
// Check if module for this event is active
|
// Check if module for this event is active
|
||||||
if ($qualified)
|
if ($qualified)
|
||||||
{
|
{
|
||||||
//print 'xx'.$obj->code;
|
//print 'xx'.$obj->code;
|
||||||
$element=$obj->elementtype;
|
$element=$obj->elementtype;
|
||||||
|
|
||||||
// Exclude events if related module is disabled
|
// Exclude events if related module is disabled
|
||||||
if ($element == 'order_supplier' && empty($conf->fournisseur->enabled)) $qualified=0;
|
if ($element == 'order_supplier' && empty($conf->fournisseur->enabled)) $qualified=0;
|
||||||
elseif ($element == 'invoice_supplier' && empty($conf->fournisseur->enabled)) $qualified=0;
|
elseif ($element == 'invoice_supplier' && empty($conf->fournisseur->enabled)) $qualified=0;
|
||||||
elseif ($element == 'withdraw' && empty($conf->prelevement->enabled)) $qualified=0;
|
elseif ($element == 'withdraw' && empty($conf->prelevement->enabled)) $qualified=0;
|
||||||
elseif ($element == 'shipping' && empty($conf->expedition->enabled)) $qualified=0;
|
elseif ($element == 'shipping' && empty($conf->expedition->enabled)) $qualified=0;
|
||||||
elseif ($element == 'member' && empty($conf->adherent->enabled)) $qualified=0;
|
elseif ($element == 'member' && empty($conf->adherent->enabled)) $qualified=0;
|
||||||
elseif (! in_array($element,array('order_supplier','invoice_supplier','withdraw','shipping','member')) && empty($conf->$element->enabled)) $qualified=0;
|
elseif (! in_array($element,array('order_supplier','invoice_supplier','withdraw','shipping','member')) && empty($conf->$element->enabled)) $qualified=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($qualified)
|
if ($qualified)
|
||||||
{
|
{
|
||||||
$ret[]=array('rowid'=>$obj->rowid,'code'=>$obj->code,'label'=>$obj->label,'description'=>$obj->description,'elementtype'=>$obj->elementtype);
|
$ret[]=array('rowid'=>$obj->rowid,'code'=>$obj->code,'label'=>$obj->label,'description'=>$obj->description,'elementtype'=>$obj->elementtype);
|
||||||
}
|
}
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else dol_print_error($this->db);
|
else dol_print_error($this->db);
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -88,7 +88,7 @@ class EcmFiles //extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function create(User $user, $notrigger = false)
|
public function create(User $user, $notrigger = false)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
@ -140,25 +140,25 @@ class EcmFiles //extends CommonObject
|
|||||||
if (isset($this->acl)) {
|
if (isset($this->acl)) {
|
||||||
$this->acl = trim($this->acl);
|
$this->acl = trim($this->acl);
|
||||||
}
|
}
|
||||||
if (empty($this->date_c)) $this->date_c = dol_now();
|
if (empty($this->date_c)) $this->date_c = dol_now();
|
||||||
|
|
||||||
// If ref not defined
|
// If ref not defined
|
||||||
$ref = dol_hash($this->filepath.'/'.$this->filename, 3);
|
$ref = dol_hash($this->filepath.'/'.$this->filename, 3);
|
||||||
if (! empty($this->ref)) $ref=$this->ref;
|
if (! empty($this->ref)) $ref=$this->ref;
|
||||||
|
|
||||||
$maxposition=0;
|
$maxposition=0;
|
||||||
if (empty($this->position)) // Get max used
|
if (empty($this->position)) // Get max used
|
||||||
{
|
{
|
||||||
$sql = "SELECT MAX(position) as maxposition FROM " . MAIN_DB_PREFIX . $this->table_element;
|
$sql = "SELECT MAX(position) as maxposition FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||||
$sql.= " WHERE filepath ='".$this->db->escape($this->filepath)."'";
|
$sql.= " WHERE filepath ='".$this->db->escape($this->filepath)."'";
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
$maxposition = (int) $obj->maxposition;
|
$maxposition = (int) $obj->maxposition;
|
||||||
}
|
}
|
||||||
else dol_print_error($this->db);
|
else dol_print_error($this->db);
|
||||||
}
|
}
|
||||||
$maxposition=$maxposition+1;
|
$maxposition=$maxposition+1;
|
||||||
|
|
||||||
@ -217,7 +217,7 @@ class EcmFiles //extends CommonObject
|
|||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
|
||||||
$this->position = $maxposition;
|
$this->position = $maxposition;
|
||||||
|
|
||||||
if (!$notrigger) {
|
if (!$notrigger) {
|
||||||
// Uncomment this and change MYOBJECT to your own tag if you
|
// Uncomment this and change MYOBJECT to your own tag if you
|
||||||
@ -408,7 +408,7 @@ class EcmFiles //extends CommonObject
|
|||||||
$sql .= $this->db->order($sortfield,$sortorder);
|
$sql .= $this->db->order($sortfield,$sortorder);
|
||||||
}
|
}
|
||||||
if (!empty($limit)) {
|
if (!empty($limit)) {
|
||||||
$sql .= ' ' . $this->db->plimit($limit, $offset);
|
$sql .= ' ' . $this->db->plimit($limit, $offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->lines = array();
|
$this->lines = array();
|
||||||
@ -676,49 +676,49 @@ class EcmFiles //extends CommonObject
|
|||||||
*
|
*
|
||||||
* @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
|
* @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
|
||||||
* @param string $option On what the link point to
|
* @param string $option On what the link point to
|
||||||
* @param int $notooltip 1=Disable tooltip
|
* @param int $notooltip 1=Disable tooltip
|
||||||
* @param int $maxlen Max length of visible user name
|
* @param int $maxlen Max length of visible user name
|
||||||
* @param string $morecss Add more css on link
|
* @param string $morecss Add more css on link
|
||||||
* @return string String with URL
|
* @return string String with URL
|
||||||
*/
|
*/
|
||||||
function getNomUrl($withpicto=0, $option='', $notooltip=0, $maxlen=24, $morecss='')
|
function getNomUrl($withpicto=0, $option='', $notooltip=0, $maxlen=24, $morecss='')
|
||||||
{
|
{
|
||||||
global $db, $conf, $langs;
|
global $db, $conf, $langs;
|
||||||
global $dolibarr_main_authentication, $dolibarr_main_demo;
|
global $dolibarr_main_authentication, $dolibarr_main_demo;
|
||||||
global $menumanager;
|
global $menumanager;
|
||||||
|
|
||||||
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
|
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
|
||||||
|
|
||||||
$result = '';
|
$result = '';
|
||||||
$companylink = '';
|
$companylink = '';
|
||||||
|
|
||||||
$label = '<u>' . $langs->trans("MyModule") . '</u>';
|
$label = '<u>' . $langs->trans("MyModule") . '</u>';
|
||||||
$label.= '<br>';
|
$label.= '<br>';
|
||||||
$label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
$label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
||||||
|
|
||||||
$url = DOL_URL_ROOT.'/ecm/'.$this->table_name.'_card.php?id='.$this->id;
|
$url = DOL_URL_ROOT.'/ecm/'.$this->table_name.'_card.php?id='.$this->id;
|
||||||
|
|
||||||
$linkclose='';
|
$linkclose='';
|
||||||
if (empty($notooltip))
|
if (empty($notooltip))
|
||||||
{
|
{
|
||||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||||
{
|
{
|
||||||
$label=$langs->trans("ShowProject");
|
$label=$langs->trans("ShowProject");
|
||||||
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||||
}
|
}
|
||||||
$linkclose.=' title="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose.=' title="'.dol_escape_htmltag($label, 1).'"';
|
||||||
$linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
|
$linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
|
||||||
}
|
}
|
||||||
else $linkclose = ($morecss?' class="'.$morecss.'"':'');
|
else $linkclose = ($morecss?' class="'.$morecss.'"':'');
|
||||||
|
|
||||||
$linkstart = '<a href="'.$url.'"';
|
$linkstart = '<a href="'.$url.'"';
|
||||||
$linkstart.=$linkclose.'>';
|
$linkstart.=$linkclose.'>';
|
||||||
$linkend='</a>';
|
$linkend='</a>';
|
||||||
|
|
||||||
if ($withpicto)
|
if ($withpicto)
|
||||||
{
|
{
|
||||||
$result.=($linkstart.img_object(($notooltip?'':$label), 'label', ($notooltip?'':'class="classfortooltip"')).$linkend);
|
$result.=($linkstart.img_object(($notooltip?'':$label), 'label', ($notooltip?'':'class="classfortooltip"')).$linkend);
|
||||||
if ($withpicto != 2) $result.=' ';
|
if ($withpicto != 2) $result.=' ';
|
||||||
}
|
}
|
||||||
$result.= $linkstart . $this->ref . $linkend;
|
$result.= $linkstart . $this->ref . $linkend;
|
||||||
return $result;
|
return $result;
|
||||||
@ -793,7 +793,7 @@ class EcmFiles //extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function initAsSpecimen()
|
public function initAsSpecimen()
|
||||||
{
|
{
|
||||||
global $conf,$user;
|
global $conf,$user;
|
||||||
|
|
||||||
$this->id = 0;
|
$this->id = 0;
|
||||||
|
|
||||||
|
|||||||
@ -48,7 +48,7 @@ class Expedition extends CommonObject
|
|||||||
public $table_element="expedition";
|
public $table_element="expedition";
|
||||||
public $table_element_line="expeditiondet";
|
public $table_element_line="expeditiondet";
|
||||||
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||||
public $picto = 'sending';
|
public $picto = 'sending';
|
||||||
|
|
||||||
var $socid;
|
var $socid;
|
||||||
var $ref_customer;
|
var $ref_customer;
|
||||||
@ -131,29 +131,29 @@ class Expedition extends CommonObject
|
|||||||
global $langs, $conf;
|
global $langs, $conf;
|
||||||
$langs->load("sendings");
|
$langs->load("sendings");
|
||||||
|
|
||||||
if (!empty($conf->global->EXPEDITION_ADDON_NUMBER))
|
if (!empty($conf->global->EXPEDITION_ADDON_NUMBER))
|
||||||
{
|
{
|
||||||
$mybool = false;
|
$mybool = false;
|
||||||
|
|
||||||
$file = $conf->global->EXPEDITION_ADDON_NUMBER.".php";
|
$file = $conf->global->EXPEDITION_ADDON_NUMBER.".php";
|
||||||
$classname = $conf->global->EXPEDITION_ADDON_NUMBER;
|
$classname = $conf->global->EXPEDITION_ADDON_NUMBER;
|
||||||
|
|
||||||
// Include file with class
|
// Include file with class
|
||||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||||
|
|
||||||
foreach ($dirmodels as $reldir) {
|
foreach ($dirmodels as $reldir) {
|
||||||
|
|
||||||
$dir = dol_buildpath($reldir."core/modules/expedition/");
|
$dir = dol_buildpath($reldir."core/modules/expedition/");
|
||||||
|
|
||||||
// Load file with numbering class (if found)
|
// Load file with numbering class (if found)
|
||||||
$mybool|=@include_once $dir.$file;
|
$mybool|=@include_once $dir.$file;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $mybool)
|
if (! $mybool)
|
||||||
{
|
{
|
||||||
dol_print_error('',"Failed to include file ".$file);
|
dol_print_error('',"Failed to include file ".$file);
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$obj = new $classname();
|
$obj = new $classname();
|
||||||
$numref = "";
|
$numref = "";
|
||||||
@ -168,19 +168,19 @@ class Expedition extends CommonObject
|
|||||||
dol_print_error($this->db,get_class($this)."::getNextNumRef ".$obj->error);
|
dol_print_error($this->db,get_class($this)."::getNextNumRef ".$obj->error);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $langs->trans("Error")." ".$langs->trans("Error_EXPEDITION_ADDON_NUMBER_NotDefined");
|
print $langs->trans("Error")." ".$langs->trans("Error_EXPEDITION_ADDON_NUMBER_NotDefined");
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create expedition en base
|
* Create expedition en base
|
||||||
*
|
*
|
||||||
* @param User $user Objet du user qui cree
|
* @param User $user Objet du user qui cree
|
||||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||||
* @return int <0 si erreur, id expedition creee si ok
|
* @return int <0 si erreur, id expedition creee si ok
|
||||||
*/
|
*/
|
||||||
function create($user, $notrigger=0)
|
function create($user, $notrigger=0)
|
||||||
@ -249,8 +249,8 @@ class Expedition extends CommonObject
|
|||||||
$sql.= ", ".(!empty($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null");
|
$sql.= ", ".(!empty($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null");
|
||||||
$sql.= ", ".(!empty($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null");
|
$sql.= ", ".(!empty($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null");
|
||||||
$sql.= ", ".(!empty($this->model_pdf)?"'".$this->db->escape($this->model_pdf)."'":"null");
|
$sql.= ", ".(!empty($this->model_pdf)?"'".$this->db->escape($this->model_pdf)."'":"null");
|
||||||
$sql.= ", ".(int) $this->fk_incoterms;
|
$sql.= ", ".(int) $this->fk_incoterms;
|
||||||
$sql.= ", '".$this->db->escape($this->location_incoterms)."'";
|
$sql.= ", '".$this->db->escape($this->location_incoterms)."'";
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||||
@ -315,10 +315,10 @@ class Expedition extends CommonObject
|
|||||||
|
|
||||||
if (! $error && ! $notrigger)
|
if (! $error && ! $notrigger)
|
||||||
{
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('SHIPPING_CREATE',$user);
|
$result=$this->call_trigger('SHIPPING_CREATE',$user);
|
||||||
if ($result < 0) { $error++; }
|
if ($result < 0) { $error++; }
|
||||||
// End call triggers
|
// End call triggers
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
@ -393,7 +393,7 @@ class Expedition extends CommonObject
|
|||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$line_id = $this->db->last_insert_id(MAIN_DB_PREFIX."expeditiondet");
|
$line_id = $this->db->last_insert_id(MAIN_DB_PREFIX."expeditiondet");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -471,7 +471,7 @@ class Expedition extends CommonObject
|
|||||||
* @param int $id Id of object to load
|
* @param int $id Id of object to load
|
||||||
* @param string $ref Ref of object
|
* @param string $ref Ref of object
|
||||||
* @param string $ref_ext External reference of object
|
* @param string $ref_ext External reference of object
|
||||||
* @param string $ref_int Internal reference of other object
|
* @param string $ref_int Internal reference of other object
|
||||||
* @return int >0 if OK, 0 if not found, <0 if KO
|
* @return int >0 if OK, 0 if not found, <0 if KO
|
||||||
*/
|
*/
|
||||||
function fetch($id, $ref='', $ref_ext='', $ref_int='')
|
function fetch($id, $ref='', $ref_ext='', $ref_int='')
|
||||||
@ -487,16 +487,16 @@ class Expedition extends CommonObject
|
|||||||
$sql.= ", e.fk_shipping_method, e.tracking_number";
|
$sql.= ", e.fk_shipping_method, e.tracking_number";
|
||||||
$sql.= ", el.fk_source as origin_id, el.sourcetype as origin";
|
$sql.= ", el.fk_source as origin_id, el.sourcetype as origin";
|
||||||
$sql.= ", e.note_private, e.note_public";
|
$sql.= ", e.note_private, e.note_public";
|
||||||
$sql.= ', e.fk_incoterms, e.location_incoterms';
|
$sql.= ', e.fk_incoterms, e.location_incoterms';
|
||||||
$sql.= ', i.libelle as libelle_incoterms';
|
$sql.= ', i.libelle as libelle_incoterms';
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."expedition as e";
|
$sql.= " FROM ".MAIN_DB_PREFIX."expedition as e";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = e.rowid AND el.targettype = '".$this->db->escape($this->element)."'";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = e.rowid AND el.targettype = '".$this->db->escape($this->element)."'";
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON e.fk_incoterms = i.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON e.fk_incoterms = i.rowid';
|
||||||
$sql.= " WHERE e.entity IN (".getEntity('expedition').")";
|
$sql.= " WHERE e.entity IN (".getEntity('expedition').")";
|
||||||
if ($id) $sql.= " AND e.rowid=".$id;
|
if ($id) $sql.= " AND e.rowid=".$id;
|
||||||
if ($ref) $sql.= " AND e.ref='".$this->db->escape($ref)."'";
|
if ($ref) $sql.= " AND e.ref='".$this->db->escape($ref)."'";
|
||||||
if ($ref_ext) $sql.= " AND e.ref_ext='".$this->db->escape($ref_ext)."'";
|
if ($ref_ext) $sql.= " AND e.ref_ext='".$this->db->escape($ref_ext)."'";
|
||||||
if ($ref_int) $sql.= " AND e.ref_int='".$this->db->escape($ref_int)."'";
|
if ($ref_int) $sql.= " AND e.ref_int='".$this->db->escape($ref_int)."'";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
@ -600,14 +600,14 @@ class Expedition extends CommonObject
|
|||||||
* Validate object and update stock if option enabled
|
* Validate object and update stock if option enabled
|
||||||
*
|
*
|
||||||
* @param User $user Object user that validate
|
* @param User $user Object user that validate
|
||||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||||
* @return int <0 if OK, >0 if KO
|
* @return int <0 if OK, >0 if KO
|
||||||
*/
|
*/
|
||||||
function valid($user, $notrigger=0)
|
function valid($user, $notrigger=0)
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::valid");
|
dol_syslog(get_class($this)."::valid");
|
||||||
|
|
||||||
@ -618,8 +618,8 @@ class Expedition extends CommonObject
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->expedition->creer))
|
if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->expedition->creer))
|
||||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->expedition->shipping_advance->validate))))
|
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->expedition->shipping_advance->validate))))
|
||||||
{
|
{
|
||||||
$this->error='Permission denied';
|
$this->error='Permission denied';
|
||||||
dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR);
|
dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR);
|
||||||
@ -646,7 +646,7 @@ class Expedition extends CommonObject
|
|||||||
{
|
{
|
||||||
$numref = "EXP".$this->id;
|
$numref = "EXP".$this->id;
|
||||||
}
|
}
|
||||||
$this->newref = $numref;
|
$this->newref = $numref;
|
||||||
|
|
||||||
$now=dol_now();
|
$now=dol_now();
|
||||||
|
|
||||||
@ -725,7 +725,7 @@ class Expedition extends CommonObject
|
|||||||
// line with batch detail
|
// line with batch detail
|
||||||
|
|
||||||
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record.
|
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record.
|
||||||
// Note: ->fk_origin_stock = id into table llx_product_batch (may be rename into llx_product_stock_batch in another version)
|
// Note: ->fk_origin_stock = id into table llx_product_batch (may be rename into llx_product_stock_batch in another version)
|
||||||
$result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentValidatedInDolibarr",$numref), '', $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, $obj->fk_origin_stock);
|
$result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentValidatedInDolibarr",$numref), '', $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, $obj->fk_origin_stock);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
@ -748,22 +748,22 @@ class Expedition extends CommonObject
|
|||||||
// Change status of order to "shipment in process"
|
// Change status of order to "shipment in process"
|
||||||
$ret = $this->setStatut(Commande::STATUS_SHIPMENTONPROCESS, $this->origin_id, $this->origin);
|
$ret = $this->setStatut(Commande::STATUS_SHIPMENTONPROCESS, $this->origin_id, $this->origin);
|
||||||
|
|
||||||
if (! $ret)
|
if (! $ret)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error && ! $notrigger)
|
if (! $error && ! $notrigger)
|
||||||
{
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('SHIPPING_VALIDATE',$user);
|
$result=$this->call_trigger('SHIPPING_VALIDATE',$user);
|
||||||
if ($result < 0) { $error++; }
|
if ($result < 0) { $error++; }
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$this->oldref = $this->ref;
|
$this->oldref = $this->ref;
|
||||||
|
|
||||||
// Rename directory if dir was a temporary ref
|
// Rename directory if dir was a temporary ref
|
||||||
if (preg_match('/^[\(]?PROV/i', $this->ref))
|
if (preg_match('/^[\(]?PROV/i', $this->ref))
|
||||||
@ -780,17 +780,17 @@ class Expedition extends CommonObject
|
|||||||
|
|
||||||
if (@rename($dirsource, $dirdest))
|
if (@rename($dirsource, $dirdest))
|
||||||
{
|
{
|
||||||
dol_syslog("Rename ok");
|
dol_syslog("Rename ok");
|
||||||
// Rename docs starting with $oldref with $newref
|
// Rename docs starting with $oldref with $newref
|
||||||
$listoffiles=dol_dir_list($conf->expedition->dir_output.'/sending/'.$newref, 'files', 1, '^'.preg_quote($oldref,'/'));
|
$listoffiles=dol_dir_list($conf->expedition->dir_output.'/sending/'.$newref, 'files', 1, '^'.preg_quote($oldref,'/'));
|
||||||
foreach($listoffiles as $fileentry)
|
foreach($listoffiles as $fileentry)
|
||||||
{
|
{
|
||||||
$dirsource=$fileentry['name'];
|
$dirsource=$fileentry['name'];
|
||||||
$dirdest=preg_replace('/^'.preg_quote($oldref,'/').'/',$newref, $dirsource);
|
$dirdest=preg_replace('/^'.preg_quote($oldref,'/').'/',$newref, $dirsource);
|
||||||
$dirsource=$fileentry['path'].'/'.$dirsource;
|
$dirsource=$fileentry['path'].'/'.$dirsource;
|
||||||
$dirdest=$fileentry['path'].'/'.$dirdest;
|
$dirdest=$fileentry['path'].'/'.$dirdest;
|
||||||
@rename($dirsource, $dirdest);
|
@rename($dirsource, $dirdest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -812,8 +812,8 @@ class Expedition extends CommonObject
|
|||||||
{
|
{
|
||||||
foreach($this->errors as $errmsg)
|
foreach($this->errors as $errmsg)
|
||||||
{
|
{
|
||||||
dol_syslog(get_class($this)."::valid ".$errmsg, LOG_ERR);
|
dol_syslog(get_class($this)."::valid ".$errmsg, LOG_ERR);
|
||||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||||
}
|
}
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1*$error;
|
return -1*$error;
|
||||||
@ -885,14 +885,14 @@ class Expedition extends CommonObject
|
|||||||
|
|
||||||
if (! ($entrepot_id > 0) && empty($conf->global->STOCK_WAREHOUSE_NOT_REQUIRED_FOR_SHIPMENTS))
|
if (! ($entrepot_id > 0) && empty($conf->global->STOCK_WAREHOUSE_NOT_REQUIRED_FOR_SHIPMENTS))
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$this->error=$langs->trans("ErrorWarehouseRequiredIntoShipmentLine");
|
$this->error=$langs->trans("ErrorWarehouseRequiredIntoShipmentLine");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT)
|
if ($conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT)
|
||||||
{
|
{
|
||||||
// Check must be done for stock of product into warehouse if $entrepot_id defined
|
// Check must be done for stock of product into warehouse if $entrepot_id defined
|
||||||
$product=new Product($this->db);
|
$product=new Product($this->db);
|
||||||
$result=$product->fetch($fk_product);
|
$result=$product->fetch($fk_product);
|
||||||
|
|
||||||
@ -906,8 +906,8 @@ class Expedition extends CommonObject
|
|||||||
$product_type=$product->type;
|
$product_type=$product->type;
|
||||||
if ($product_type == 0 && $product_stock < $qty)
|
if ($product_type == 0 && $product_stock < $qty)
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnShipment', $product->ref);
|
$this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnShipment', $product->ref);
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
@ -917,8 +917,8 @@ class Expedition extends CommonObject
|
|||||||
// If product need a batch number, we should not have called this function but addline_batch instead.
|
// If product need a batch number, we should not have called this function but addline_batch instead.
|
||||||
if (! empty($conf->productbatch->enabled) && ! empty($orderline->fk_product) && ! empty($orderline->product_tobatch))
|
if (! empty($conf->productbatch->enabled) && ! empty($orderline->fk_product) && ! empty($orderline->product_tobatch))
|
||||||
{
|
{
|
||||||
$this->error='ADDLINE_WAS_CALLED_INSTEAD_OF_ADDLINEBATCH';
|
$this->error='ADDLINE_WAS_CALLED_INSTEAD_OF_ADDLINEBATCH';
|
||||||
return -4;
|
return -4;
|
||||||
}
|
}
|
||||||
|
|
||||||
// extrafields
|
// extrafields
|
||||||
@ -928,7 +928,7 @@ class Expedition extends CommonObject
|
|||||||
$this->lines[$num] = $line;
|
$this->lines[$num] = $line;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a shipment line with batch record
|
* Add a shipment line with batch record
|
||||||
*
|
*
|
||||||
* @param array $dbatch Array of value (key 'detail' -> Array, key 'qty' total quantity for line, key ix_l : original line index)
|
* @param array $dbatch Array of value (key 'detail' -> Array, key 'qty' total quantity for line, key ix_l : original line index)
|
||||||
@ -952,7 +952,7 @@ class Expedition extends CommonObject
|
|||||||
// $value['id_batch']=id into llx_product_batch of record to move
|
// $value['id_batch']=id into llx_product_batch of record to move
|
||||||
//var_dump($value);
|
//var_dump($value);
|
||||||
|
|
||||||
$linebatch = new ExpeditionLineBatch($this->db);
|
$linebatch = new ExpeditionLineBatch($this->db);
|
||||||
$ret=$linebatch->fetchFromStock($value['id_batch']); // load serial, sellby, eatby
|
$ret=$linebatch->fetchFromStock($value['id_batch']); // load serial, sellby, eatby
|
||||||
if ($ret<0)
|
if ($ret<0)
|
||||||
{
|
{
|
||||||
@ -970,8 +970,8 @@ class Expedition extends CommonObject
|
|||||||
|
|
||||||
if ($prod_batch->qty < $linebatch->dluo_qty)
|
if ($prod_batch->qty < $linebatch->dluo_qty)
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$this->errors[]=$langs->trans('ErrorStockIsNotEnoughToAddProductOnShipment', $prod_batch->fk_product);
|
$this->errors[]=$langs->trans('ErrorStockIsNotEnoughToAddProductOnShipment', $prod_batch->fk_product);
|
||||||
dol_syslog(get_class($this)."::addline_batch error=Product ".$prod_batch->batch.": ".$this->errorsToString(), LOG_ERR);
|
dol_syslog(get_class($this)."::addline_batch error=Product ".$prod_batch->batch.": ".$this->errorsToString(), LOG_ERR);
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
@ -996,16 +996,16 @@ class Expedition extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update database
|
* Update database
|
||||||
*
|
*
|
||||||
* @param User $user User that modify
|
* @param User $user User that modify
|
||||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function update($user=null, $notrigger=0)
|
function update($user=null, $notrigger=0)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
@ -1035,8 +1035,8 @@ class Expedition extends CommonObject
|
|||||||
// Check parameters
|
// Check parameters
|
||||||
// Put here code to add control on parameters values
|
// Put here code to add control on parameters values
|
||||||
|
|
||||||
// Update request
|
// Update request
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."expedition SET";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."expedition SET";
|
||||||
|
|
||||||
$sql.= " tms=".(dol_strlen($this->tms)!=0 ? "'".$this->db->idate($this->tms)."'" : 'null').",";
|
$sql.= " tms=".(dol_strlen($this->tms)!=0 ? "'".$this->db->idate($this->tms)."'" : 'null').",";
|
||||||
$sql.= " ref=".(isset($this->ref)?"'".$this->db->escape($this->ref)."'":"null").",";
|
$sql.= " ref=".(isset($this->ref)?"'".$this->db->escape($this->ref)."'":"null").",";
|
||||||
@ -1063,32 +1063,32 @@ class Expedition extends CommonObject
|
|||||||
$sql.= " model_pdf=".(isset($this->modelpdf)?"'".$this->db->escape($this->modelpdf)."'":"null").",";
|
$sql.= " model_pdf=".(isset($this->modelpdf)?"'".$this->db->escape($this->modelpdf)."'":"null").",";
|
||||||
$sql.= " entity=".$conf->entity;
|
$sql.= " entity=".$conf->entity;
|
||||||
|
|
||||||
$sql.= " WHERE rowid=".$this->id;
|
$sql.= " WHERE rowid=".$this->id;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('SHIPPING_MODIFY',$user);
|
$result=$this->call_trigger('SHIPPING_MODIFY',$user);
|
||||||
if ($result < 0) { $error++; }
|
if ($result < 0) { $error++; }
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commit or rollback
|
// Commit or rollback
|
||||||
if ($error)
|
if ($error)
|
||||||
{
|
{
|
||||||
foreach($this->errors as $errmsg)
|
foreach($this->errors as $errmsg)
|
||||||
{
|
{
|
||||||
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
|
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
|
||||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||||
}
|
}
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1*$error;
|
return -1*$error;
|
||||||
@ -1098,7 +1098,7 @@ class Expedition extends CommonObject
|
|||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete shipment.
|
* Delete shipment.
|
||||||
@ -1231,18 +1231,18 @@ class Expedition extends CommonObject
|
|||||||
|
|
||||||
if (! empty($this->origin) && $this->origin_id > 0)
|
if (! empty($this->origin) && $this->origin_id > 0)
|
||||||
{
|
{
|
||||||
$this->fetch_origin();
|
$this->fetch_origin();
|
||||||
$origin=$this->origin;
|
$origin=$this->origin;
|
||||||
if ($this->$origin->statut == Commande::STATUS_SHIPMENTONPROCESS) // If order source of shipment is "shipment in progress"
|
if ($this->$origin->statut == Commande::STATUS_SHIPMENTONPROCESS) // If order source of shipment is "shipment in progress"
|
||||||
{
|
{
|
||||||
// Check if there is no more shipment. If not, we can move back status of order to "validated" instead of "shipment in progress"
|
// Check if there is no more shipment. If not, we can move back status of order to "validated" instead of "shipment in progress"
|
||||||
$this->$origin->loadExpeditions();
|
$this->$origin->loadExpeditions();
|
||||||
//var_dump($this->$origin->expeditions);exit;
|
//var_dump($this->$origin->expeditions);exit;
|
||||||
if (count($this->$origin->expeditions) <= 0)
|
if (count($this->$origin->expeditions) <= 0)
|
||||||
{
|
{
|
||||||
$this->$origin->setStatut(Commande::STATUS_VALIDATED);
|
$this->$origin->setStatut(Commande::STATUS_VALIDATED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -1354,13 +1354,13 @@ class Expedition extends CommonObject
|
|||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
if ($originline == $obj->fk_origin_line) {
|
if ($originline == $obj->fk_origin_line) {
|
||||||
$line->entrepot_id = 0; // entrepod_id in details_entrepot
|
$line->entrepot_id = 0; // entrepod_id in details_entrepot
|
||||||
$line->qty_shipped += $obj->qty_shipped;
|
$line->qty_shipped += $obj->qty_shipped;
|
||||||
} else {
|
} else {
|
||||||
$line = new ExpeditionLigne($this->db);
|
$line = new ExpeditionLigne($this->db);
|
||||||
$line->entrepot_id = $obj->fk_entrepot;
|
$line->entrepot_id = $obj->fk_entrepot;
|
||||||
$line->qty_shipped = $obj->qty_shipped;
|
$line->qty_shipped = $obj->qty_shipped;
|
||||||
}
|
}
|
||||||
|
|
||||||
$detail_entrepot = new stdClass;
|
$detail_entrepot = new stdClass;
|
||||||
@ -1368,13 +1368,13 @@ class Expedition extends CommonObject
|
|||||||
$detail_entrepot->qty_shipped = $obj->qty_shipped;
|
$detail_entrepot->qty_shipped = $obj->qty_shipped;
|
||||||
$line->details_entrepot[] = $detail_entrepot;
|
$line->details_entrepot[] = $detail_entrepot;
|
||||||
|
|
||||||
$line->line_id = $obj->line_id;
|
$line->line_id = $obj->line_id;
|
||||||
$line->rowid = $obj->line_id; // TODO deprecated
|
$line->rowid = $obj->line_id; // TODO deprecated
|
||||||
$line->id = $obj->line_id;
|
$line->id = $obj->line_id;
|
||||||
|
|
||||||
$line->fk_origin = 'orderline';
|
$line->fk_origin = 'orderline';
|
||||||
$line->fk_origin_line = $obj->fk_origin_line;
|
$line->fk_origin_line = $obj->fk_origin_line;
|
||||||
$line->origin_line_id = $obj->fk_origin_line; // TODO deprecated
|
$line->origin_line_id = $obj->fk_origin_line; // TODO deprecated
|
||||||
|
|
||||||
$line->fk_expedition = $this->id; // id of parent
|
$line->fk_expedition = $this->id; // id of parent
|
||||||
|
|
||||||
@ -1382,8 +1382,8 @@ class Expedition extends CommonObject
|
|||||||
$line->fk_product = $obj->fk_product;
|
$line->fk_product = $obj->fk_product;
|
||||||
$line->fk_product_type = $obj->fk_product_type;
|
$line->fk_product_type = $obj->fk_product_type;
|
||||||
$line->ref = $obj->product_ref; // TODO deprecated
|
$line->ref = $obj->product_ref; // TODO deprecated
|
||||||
$line->product_ref = $obj->product_ref;
|
$line->product_ref = $obj->product_ref;
|
||||||
$line->product_label = $obj->product_label;
|
$line->product_label = $obj->product_label;
|
||||||
$line->libelle = $obj->product_label; // TODO deprecated
|
$line->libelle = $obj->product_label; // TODO deprecated
|
||||||
$line->product_tobatch = $obj->product_tobatch;
|
$line->product_tobatch = $obj->product_tobatch;
|
||||||
$line->label = $obj->custom_label;
|
$line->label = $obj->custom_label;
|
||||||
@ -1440,34 +1440,34 @@ class Expedition extends CommonObject
|
|||||||
// Eat-by date
|
// Eat-by date
|
||||||
if (! empty($conf->productbatch->enabled) && $obj->line_id > 0)
|
if (! empty($conf->productbatch->enabled) && $obj->line_id > 0)
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expeditionbatch.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expeditionbatch.class.php';
|
||||||
|
|
||||||
$newdetailbatch = ExpeditionLineBatch::fetchAll($this->db,$obj->line_id);
|
$newdetailbatch = ExpeditionLineBatch::fetchAll($this->db,$obj->line_id);
|
||||||
if (is_array($newdetailbatch))
|
if (is_array($newdetailbatch))
|
||||||
{
|
{
|
||||||
if ($originline != $obj->fk_origin_line)
|
if ($originline != $obj->fk_origin_line)
|
||||||
{
|
|
||||||
$line->detail_batch = $newdetailbatch;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
$line->detail_batch = array_merge($line->detail_batch, $newdetailbatch);
|
$line->detail_batch = $newdetailbatch;
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
$line->detail_batch = array_merge($line->detail_batch, $newdetailbatch);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($originline != $obj->fk_origin_line)
|
if ($originline != $obj->fk_origin_line)
|
||||||
{
|
{
|
||||||
$this->lines[$lineindex] = $line;
|
$this->lines[$lineindex] = $line;
|
||||||
$lineindex++;
|
$lineindex++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$line->total_ht += $tabprice[0];
|
$line->total_ht += $tabprice[0];
|
||||||
$line->total_localtax1 += $tabprice[9];
|
$line->total_localtax1 += $tabprice[9];
|
||||||
$line->total_localtax2 += $tabprice[10];
|
$line->total_localtax2 += $tabprice[10];
|
||||||
$line->total_ttc += $tabprice[2];
|
$line->total_ttc += $tabprice[2];
|
||||||
$line->total_tva += $tabprice[1];
|
$line->total_tva += $tabprice[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
@ -1484,24 +1484,24 @@ class Expedition extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return clicable link of object (with eventually picto)
|
* Return clicable link of object (with eventually picto)
|
||||||
*
|
*
|
||||||
* @param int $withpicto Add picto into link
|
* @param int $withpicto Add picto into link
|
||||||
* @param string $option Where the link point to
|
* @param string $option Where the link point to
|
||||||
* @param int $max Max length to show
|
* @param int $max Max length to show
|
||||||
* @param int $short Use short labels
|
* @param int $short Use short labels
|
||||||
* @param int $notooltip 1=No tooltip
|
* @param int $notooltip 1=No tooltip
|
||||||
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||||
* @return string String with URL
|
* @return string String with URL
|
||||||
*/
|
*/
|
||||||
function getNomUrl($withpicto=0, $option='', $max=0, $short=0, $notooltip=0, $save_lastsearch_value=-1)
|
function getNomUrl($withpicto=0, $option='', $max=0, $short=0, $notooltip=0, $save_lastsearch_value=-1)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
$label = '<u>' . $langs->trans("ShowSending") . '</u>';
|
$label = '<u>' . $langs->trans("ShowSending") . '</u>';
|
||||||
$label .= '<br><b>' . $langs->trans('Ref') . ':</b> '.$this->ref;
|
$label .= '<br><b>' . $langs->trans('Ref') . ':</b> '.$this->ref;
|
||||||
$label .= '<br><b>'.$langs->trans('RefCustomer').':</b> '.($this->ref_customer ? $this->ref_customer : $this->ref_client);
|
$label .= '<br><b>'.$langs->trans('RefCustomer').':</b> '.($this->ref_customer ? $this->ref_customer : $this->ref_client);
|
||||||
|
|
||||||
$url = DOL_URL_ROOT.'/expedition/card.php?id='.$this->id;
|
$url = DOL_URL_ROOT.'/expedition/card.php?id='.$this->id;
|
||||||
|
|
||||||
@ -1518,16 +1518,16 @@ class Expedition extends CommonObject
|
|||||||
$linkclose='';
|
$linkclose='';
|
||||||
if (empty($notooltip))
|
if (empty($notooltip))
|
||||||
{
|
{
|
||||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||||
{
|
{
|
||||||
$label=$langs->trans("ShowSending");
|
$label=$langs->trans("ShowSending");
|
||||||
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||||
}
|
}
|
||||||
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||||
$linkclose.=' class="classfortooltip"';
|
$linkclose.=' class="classfortooltip"';
|
||||||
}
|
}
|
||||||
|
|
||||||
$linkstart = '<a href="'.$url.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
$linkstart = '<a href="'.$url.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$linkend='</a>';
|
$linkend='</a>';
|
||||||
|
|
||||||
$picto='sending';
|
$picto='sending';
|
||||||
@ -1539,11 +1539,11 @@ class Expedition extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return status label
|
* Return status label
|
||||||
*
|
*
|
||||||
* @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto
|
* @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto
|
||||||
* @return string Libelle
|
* @return string Libelle
|
||||||
*/
|
*/
|
||||||
function getLibStatut($mode=0)
|
function getLibStatut($mode=0)
|
||||||
{
|
{
|
||||||
return $this->LibStatut($this->statut,$mode);
|
return $this->LibStatut($this->statut,$mode);
|
||||||
@ -1593,11 +1593,11 @@ class Expedition extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialise an instance with random values.
|
* Initialise an instance with random values.
|
||||||
* Used to build previews or test instances.
|
* Used to build previews or test instances.
|
||||||
* id must be 0 if object instance is a specimen.
|
* id must be 0 if object instance is a specimen.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function initAsSpecimen()
|
function initAsSpecimen()
|
||||||
{
|
{
|
||||||
@ -1607,7 +1607,7 @@ class Expedition extends CommonObject
|
|||||||
|
|
||||||
dol_syslog(get_class($this)."::initAsSpecimen");
|
dol_syslog(get_class($this)."::initAsSpecimen");
|
||||||
|
|
||||||
// Load array of products prodids
|
// Load array of products prodids
|
||||||
$num_prods = 0;
|
$num_prods = 0;
|
||||||
$prodids = array();
|
$prodids = array();
|
||||||
$sql = "SELECT rowid";
|
$sql = "SELECT rowid";
|
||||||
@ -1648,11 +1648,11 @@ class Expedition extends CommonObject
|
|||||||
$this->commande_id = 0;
|
$this->commande_id = 0;
|
||||||
$this->commande = $order;
|
$this->commande = $order;
|
||||||
|
|
||||||
$this->origin_id = 1;
|
$this->origin_id = 1;
|
||||||
$this->origin = 'commande';
|
$this->origin = 'commande';
|
||||||
|
|
||||||
$this->note_private = 'Private note';
|
$this->note_private = 'Private note';
|
||||||
$this->note_public = 'Public note';
|
$this->note_public = 'Public note';
|
||||||
|
|
||||||
$nbp = 5;
|
$nbp = 5;
|
||||||
$xnbp = 0;
|
$xnbp = 0;
|
||||||
@ -1732,99 +1732,99 @@ class Expedition extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch all deliveries method and return an array. Load array this->listmeths.
|
* Fetch all deliveries method and return an array. Load array this->listmeths.
|
||||||
*
|
*
|
||||||
* @param id $id only this carrier, all if none
|
* @param id $id only this carrier, all if none
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function list_delivery_methods($id='')
|
function list_delivery_methods($id='')
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$this->listmeths = array();
|
$this->listmeths = array();
|
||||||
$i=0;
|
$i=0;
|
||||||
|
|
||||||
$sql = "SELECT em.rowid, em.code, em.libelle, em.description, em.tracking, em.active";
|
$sql = "SELECT em.rowid, em.code, em.libelle, em.description, em.tracking, em.active";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as em";
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as em";
|
||||||
if ($id!='') $sql.= " WHERE em.rowid=".$id;
|
if ($id!='') $sql.= " WHERE em.rowid=".$id;
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
while ($obj = $this->db->fetch_object($resql))
|
while ($obj = $this->db->fetch_object($resql))
|
||||||
{
|
{
|
||||||
$this->listmeths[$i]['rowid'] = $obj->rowid;
|
$this->listmeths[$i]['rowid'] = $obj->rowid;
|
||||||
$this->listmeths[$i]['code'] = $obj->code;
|
$this->listmeths[$i]['code'] = $obj->code;
|
||||||
$label=$langs->trans('SendingMethod'.$obj->code);
|
$label=$langs->trans('SendingMethod'.$obj->code);
|
||||||
$this->listmeths[$i]['libelle'] = ($label != 'SendingMethod'.$obj->code?$label:$obj->libelle);
|
$this->listmeths[$i]['libelle'] = ($label != 'SendingMethod'.$obj->code?$label:$obj->libelle);
|
||||||
$this->listmeths[$i]['description'] = $obj->description;
|
$this->listmeths[$i]['description'] = $obj->description;
|
||||||
$this->listmeths[$i]['tracking'] = $obj->tracking;
|
$this->listmeths[$i]['tracking'] = $obj->tracking;
|
||||||
$this->listmeths[$i]['active'] = $obj->active;
|
$this->listmeths[$i]['active'] = $obj->active;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update/create delivery method.
|
* Update/create delivery method.
|
||||||
*
|
*
|
||||||
* @param string $id id method to activate
|
* @param string $id id method to activate
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function update_delivery_method($id='')
|
function update_delivery_method($id='')
|
||||||
{
|
{
|
||||||
if ($id=='')
|
if ($id=='')
|
||||||
{
|
{
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."c_shipment_mode (code, libelle, description, tracking)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."c_shipment_mode (code, libelle, description, tracking)";
|
||||||
$sql.=" VALUES ('".$this->db->escape($this->update['code'])."','".$this->db->escape($this->update['libelle'])."','".$this->db->escape($this->update['description'])."','".$this->db->escape($this->update['tracking'])."')";
|
$sql.=" VALUES ('".$this->db->escape($this->update['code'])."','".$this->db->escape($this->update['libelle'])."','".$this->db->escape($this->update['description'])."','".$this->db->escape($this->update['tracking'])."')";
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."c_shipment_mode SET";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."c_shipment_mode SET";
|
||||||
$sql.= " code='".$this->db->escape($this->update['code'])."'";
|
$sql.= " code='".$this->db->escape($this->update['code'])."'";
|
||||||
$sql.= ",libelle='".$this->db->escape($this->update['libelle'])."'";
|
$sql.= ",libelle='".$this->db->escape($this->update['libelle'])."'";
|
||||||
$sql.= ",description='".$this->db->escape($this->update['description'])."'";
|
$sql.= ",description='".$this->db->escape($this->update['description'])."'";
|
||||||
$sql.= ",tracking='".$this->db->escape($this->update['tracking'])."'";
|
$sql.= ",tracking='".$this->db->escape($this->update['tracking'])."'";
|
||||||
$sql.= " WHERE rowid=".$id;
|
$sql.= " WHERE rowid=".$id;
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
}
|
}
|
||||||
if ($resql < 0) dol_print_error($this->db,'');
|
if ($resql < 0) dol_print_error($this->db,'');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activate delivery method.
|
* Activate delivery method.
|
||||||
*
|
*
|
||||||
* @param id $id id method to activate
|
* @param id $id id method to activate
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function activ_delivery_method($id)
|
function activ_delivery_method($id)
|
||||||
{
|
{
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'c_shipment_mode SET active=1';
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.'c_shipment_mode SET active=1';
|
||||||
$sql.= ' WHERE rowid='.$id;
|
$sql.= ' WHERE rowid='.$id;
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DesActivate delivery method.
|
* DesActivate delivery method.
|
||||||
*
|
*
|
||||||
* @param id $id id method to desactivate
|
* @param id $id id method to desactivate
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function disable_delivery_method($id)
|
function disable_delivery_method($id)
|
||||||
{
|
{
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'c_shipment_mode SET active=0';
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.'c_shipment_mode SET active=0';
|
||||||
$sql.= ' WHERE rowid='.$id;
|
$sql.= ' WHERE rowid='.$id;
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1959,8 +1959,8 @@ class Expedition extends CommonObject
|
|||||||
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record
|
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record
|
||||||
$result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentClassifyClosedInDolibarr",$numref));
|
$result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentClassifyClosedInDolibarr",$numref));
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$this->error = $mouvS->error;
|
$this->error = $mouvS->error;
|
||||||
$this->errors = $mouvS->errors;
|
$this->errors = $mouvS->errors;
|
||||||
$error++; break;
|
$error++; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1971,9 +1971,9 @@ class Expedition extends CommonObject
|
|||||||
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record
|
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record
|
||||||
$result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentClassifyClosedInDolibarr",$numref), '', $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, $obj->fk_origin_stock);
|
$result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentClassifyClosedInDolibarr",$numref), '', $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, $obj->fk_origin_stock);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$this->error = $mouvS->error;
|
$this->error = $mouvS->error;
|
||||||
$this->errors = $mouvS->errors;
|
$this->errors = $mouvS->errors;
|
||||||
$error++; break;
|
$error++; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1988,27 +1988,27 @@ class Expedition extends CommonObject
|
|||||||
// Call trigger
|
// Call trigger
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$result=$this->call_trigger('SHIPPING_CLOSED',$user);
|
$result=$this->call_trigger('SHIPPING_CLOSED',$user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2019,7 +2019,7 @@ class Expedition extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function set_billed()
|
function set_billed()
|
||||||
{
|
{
|
||||||
global $user;
|
global $user;
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
@ -2125,8 +2125,8 @@ class Expedition extends CommonObject
|
|||||||
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record
|
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record
|
||||||
$result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, -$qty, $obj->subprice, $langs->trans("ShipmentUnClassifyCloseddInDolibarr",$numref));
|
$result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, -$qty, $obj->subprice, $langs->trans("ShipmentUnClassifyCloseddInDolibarr",$numref));
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$this->error = $mouvS->error;
|
$this->error = $mouvS->error;
|
||||||
$this->errors = $mouvS->errors;
|
$this->errors = $mouvS->errors;
|
||||||
$error++; break;
|
$error++; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2137,9 +2137,9 @@ class Expedition extends CommonObject
|
|||||||
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record
|
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record
|
||||||
$result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, -$qty, $obj->subprice, $langs->trans("ShipmentUnClassifyCloseddInDolibarr",$numref), '', $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, $obj->fk_origin_stock);
|
$result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, -$qty, $obj->subprice, $langs->trans("ShipmentUnClassifyCloseddInDolibarr",$numref), '', $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, $obj->fk_origin_stock);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$this->error = $mouvS->error;
|
$this->error = $mouvS->error;
|
||||||
$this->errors = $mouvS->errors;
|
$this->errors = $mouvS->errors;
|
||||||
$error++; break;
|
$error++; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2153,11 +2153,11 @@ class Expedition extends CommonObject
|
|||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('SHIPPING_REOPEN',$user);
|
$result=$this->call_trigger('SHIPPING_REOPEN',$user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -2280,11 +2280,11 @@ class ExpeditionLigne extends CommonObjectLine
|
|||||||
*/
|
*/
|
||||||
var $libelle;
|
var $libelle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param DoliDB $db Database handler
|
* @param DoliDB $db Database handler
|
||||||
*/
|
*/
|
||||||
function __construct($db)
|
function __construct($db)
|
||||||
{
|
{
|
||||||
$this->db=$db;
|
$this->db=$db;
|
||||||
|
|||||||
@ -38,7 +38,7 @@ class Fichinter extends CommonObject
|
|||||||
public $table_element='fichinter';
|
public $table_element='fichinter';
|
||||||
public $fk_element='fk_fichinter';
|
public $fk_element='fk_fichinter';
|
||||||
public $table_element_line='fichinterdet';
|
public $table_element_line='fichinterdet';
|
||||||
public $picto = 'intervention';
|
public $picto = 'intervention';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
@ -83,7 +83,7 @@ class Fichinter extends CommonObject
|
|||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param DoliDB $db Database handler
|
* @param DoliDB $db Database handler
|
||||||
*/
|
*/
|
||||||
function __construct($db)
|
function __construct($db)
|
||||||
{
|
{
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
@ -152,7 +152,7 @@ class Fichinter extends CommonObject
|
|||||||
* Create an intervention into data base
|
* Create an intervention into data base
|
||||||
*
|
*
|
||||||
* @param User $user Objet user that make creation
|
* @param User $user Objet user that make creation
|
||||||
* @param int $notrigger Disable all triggers
|
* @param int $notrigger Disable all triggers
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function create($user, $notrigger=0)
|
function create($user, $notrigger=0)
|
||||||
@ -237,13 +237,13 @@ class Fichinter extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||||
{
|
{
|
||||||
$result=$this->insertExtraFields();
|
$result=$this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add linked object
|
// Add linked object
|
||||||
if (! $error && $this->origin && $this->origin_id)
|
if (! $error && $this->origin && $this->origin_id)
|
||||||
@ -253,13 +253,13 @@ class Fichinter extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('FICHINTER_CREATE',$user);
|
$result=$this->call_trigger('FICHINTER_CREATE',$user);
|
||||||
if ($result < 0) { $error++; }
|
if ($result < 0) { $error++; }
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
@ -287,7 +287,7 @@ class Fichinter extends CommonObject
|
|||||||
* Update an intervention
|
* Update an intervention
|
||||||
*
|
*
|
||||||
* @param User $user Objet user that make creation
|
* @param User $user Objet user that make creation
|
||||||
* @param int $notrigger Disable all triggers
|
* @param int $notrigger Disable all triggers
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function update($user, $notrigger=0)
|
function update($user, $notrigger=0)
|
||||||
@ -316,10 +316,10 @@ class Fichinter extends CommonObject
|
|||||||
|
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('FICHINTER_MODIFY',$user);
|
$result=$this->call_trigger('FICHINTER_MODIFY',$user);
|
||||||
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
@ -446,7 +446,7 @@ class Fichinter extends CommonObject
|
|||||||
* Validate a intervention
|
* Validate a intervention
|
||||||
*
|
*
|
||||||
* @param User $user User that validate
|
* @param User $user User that validate
|
||||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function setValid($user, $notrigger=0)
|
function setValid($user, $notrigger=0)
|
||||||
@ -471,7 +471,7 @@ class Fichinter extends CommonObject
|
|||||||
{
|
{
|
||||||
$num = $this->ref;
|
$num = $this->ref;
|
||||||
}
|
}
|
||||||
$this->newref = $num;
|
$this->newref = $num;
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter";
|
||||||
$sql.= " SET fk_statut = 1";
|
$sql.= " SET fk_statut = 1";
|
||||||
@ -492,10 +492,10 @@ class Fichinter extends CommonObject
|
|||||||
|
|
||||||
if (! $error && ! $notrigger)
|
if (! $error && ! $notrigger)
|
||||||
{
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('FICHINTER_VALIDATE',$user);
|
$result=$this->call_trigger('FICHINTER_VALIDATE',$user);
|
||||||
if ($result < 0) { $error++; }
|
if ($result < 0) { $error++; }
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -517,17 +517,17 @@ class Fichinter extends CommonObject
|
|||||||
|
|
||||||
if (@rename($dirsource, $dirdest))
|
if (@rename($dirsource, $dirdest))
|
||||||
{
|
{
|
||||||
dol_syslog("Rename ok");
|
dol_syslog("Rename ok");
|
||||||
// Rename docs starting with $oldref with $newref
|
// Rename docs starting with $oldref with $newref
|
||||||
$listoffiles=dol_dir_list($conf->ficheinter->dir_output.'/'.$newref, 'files', 1, '^'.preg_quote($oldref,'/'));
|
$listoffiles=dol_dir_list($conf->ficheinter->dir_output.'/'.$newref, 'files', 1, '^'.preg_quote($oldref,'/'));
|
||||||
foreach($listoffiles as $fileentry)
|
foreach($listoffiles as $fileentry)
|
||||||
{
|
{
|
||||||
$dirsource=$fileentry['name'];
|
$dirsource=$fileentry['name'];
|
||||||
$dirdest=preg_replace('/^'.preg_quote($oldref,'/').'/',$newref, $dirsource);
|
$dirdest=preg_replace('/^'.preg_quote($oldref,'/').'/',$newref, $dirsource);
|
||||||
$dirsource=$fileentry['path'].'/'.$dirsource;
|
$dirsource=$fileentry['path'].'/'.$dirsource;
|
||||||
$dirdest=$fileentry['path'].'/'.$dirdest;
|
$dirdest=$fileentry['path'].'/'.$dirdest;
|
||||||
@rename($dirsource, $dirdest);
|
@rename($dirsource, $dirdest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -647,7 +647,7 @@ class Fichinter extends CommonObject
|
|||||||
if ($mode == 5)
|
if ($mode == 5)
|
||||||
return '<span class="hideonsmartphone">'.$langs->trans($this->statuts_short[$statut]).' </span>'.img_picto($langs->trans($this->statuts[$statut]),$this->statuts_logo[$statut]);
|
return '<span class="hideonsmartphone">'.$langs->trans($this->statuts_short[$statut]).' </span>'.img_picto($langs->trans($this->statuts[$statut]),$this->statuts_logo[$statut]);
|
||||||
if ($mode == 6)
|
if ($mode == 6)
|
||||||
return '<span class="hideonsmartphone">'.$langs->trans($this->statuts[$statut]).' </span>'.img_picto($langs->trans($this->statuts[$statut]),$this->statuts_logo[$statut]);
|
return '<span class="hideonsmartphone">'.$langs->trans($this->statuts[$statut]).' </span>'.img_picto($langs->trans($this->statuts[$statut]),$this->statuts_logo[$statut]);
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@ -657,8 +657,8 @@ class Fichinter extends CommonObject
|
|||||||
*
|
*
|
||||||
* @param int $withpicto 0=_No picto, 1=Includes the picto in the linkn, 2=Picto only
|
* @param int $withpicto 0=_No picto, 1=Includes the picto in the linkn, 2=Picto only
|
||||||
* @param string $option Options
|
* @param string $option Options
|
||||||
* @param int $notooltip 1=Disable tooltip
|
* @param int $notooltip 1=Disable tooltip
|
||||||
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||||
* @return string String with URL
|
* @return string String with URL
|
||||||
*/
|
*/
|
||||||
function getNomUrl($withpicto=0, $option='', $notooltip=0, $save_lastsearch_value=-1)
|
function getNomUrl($withpicto=0, $option='', $notooltip=0, $save_lastsearch_value=-1)
|
||||||
@ -667,20 +667,20 @@ class Fichinter extends CommonObject
|
|||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
|
|
||||||
$label = '<u>' . $langs->trans("ShowIntervention") . '</u>';
|
$label = '<u>' . $langs->trans("ShowIntervention") . '</u>';
|
||||||
if (! empty($this->ref))
|
if (! empty($this->ref))
|
||||||
$label .= '<br><b>' . $langs->trans('Ref') . ':</b> '.$this->ref;
|
$label .= '<br><b>' . $langs->trans('Ref') . ':</b> '.$this->ref;
|
||||||
|
|
||||||
$picto='intervention';
|
$picto='intervention';
|
||||||
$url = DOL_URL_ROOT.'/fichinter/card.php?id='.$this->id;
|
$url = DOL_URL_ROOT.'/fichinter/card.php?id='.$this->id;
|
||||||
|
|
||||||
if ($option !== 'nolink')
|
if ($option !== 'nolink')
|
||||||
{
|
{
|
||||||
// Add param to save lastsearch_values or not
|
// Add param to save lastsearch_values or not
|
||||||
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
|
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
|
||||||
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
|
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
|
||||||
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
|
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
|
||||||
}
|
}
|
||||||
|
|
||||||
$linkclose='';
|
$linkclose='';
|
||||||
if (empty($notooltip))
|
if (empty($notooltip))
|
||||||
@ -698,7 +698,7 @@ class Fichinter extends CommonObject
|
|||||||
$linkstart.=$linkclose.'>';
|
$linkstart.=$linkclose.'>';
|
||||||
$linkend='</a>';
|
$linkend='</a>';
|
||||||
|
|
||||||
if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend);
|
if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend);
|
||||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||||
if ($withpicto != 2) $result.=$linkstart.$this->ref.$linkend;
|
if ($withpicto != 2) $result.=$linkstart.$this->ref.$linkend;
|
||||||
return $result;
|
return $result;
|
||||||
@ -833,7 +833,7 @@ class Fichinter extends CommonObject
|
|||||||
function delete($user, $notrigger=0)
|
function delete($user, $notrigger=0)
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
@ -899,10 +899,10 @@ class Fichinter extends CommonObject
|
|||||||
|
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('FICHINTER_DELETE',$user);
|
$result=$this->call_trigger('FICHINTER_DELETE',$user);
|
||||||
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
@ -1024,98 +1024,98 @@ class Fichinter extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load an object from its id and create a new one in database
|
* Load an object from its id and create a new one in database
|
||||||
*
|
*
|
||||||
* @param int $socid Id of thirdparty
|
* @param int $socid Id of thirdparty
|
||||||
* @return int New id of clone
|
* @return int New id of clone
|
||||||
*/
|
*/
|
||||||
function createFromClone($socid=0)
|
function createFromClone($socid=0)
|
||||||
{
|
{
|
||||||
global $user,$hookmanager;
|
global $user,$hookmanager;
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$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
|
||||||
foreach($this->lines as $line)
|
foreach($this->lines as $line)
|
||||||
$line->fetch_optionals($line->rowid);
|
$line->fetch_optionals($line->rowid);
|
||||||
|
|
||||||
// Load source object
|
// Load source object
|
||||||
$objFrom = clone $this;
|
$objFrom = clone $this;
|
||||||
|
|
||||||
// Change socid if needed
|
// Change socid if needed
|
||||||
if (! empty($socid) && $socid != $this->socid)
|
if (! empty($socid) && $socid != $this->socid)
|
||||||
{
|
{
|
||||||
$objsoc = new Societe($this->db);
|
$objsoc = new Societe($this->db);
|
||||||
|
|
||||||
if ($objsoc->fetch($socid)>0)
|
if ($objsoc->fetch($socid)>0)
|
||||||
{
|
{
|
||||||
$this->socid = $objsoc->id;
|
$this->socid = $objsoc->id;
|
||||||
//$this->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0);
|
//$this->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0);
|
||||||
//$this->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0);
|
//$this->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0);
|
||||||
$this->fk_project = '';
|
$this->fk_project = '';
|
||||||
$this->fk_delivery_address = '';
|
$this->fk_delivery_address = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Change product price if multi-prices
|
// TODO Change product price if multi-prices
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->id=0;
|
$this->id=0;
|
||||||
$this->ref = '';
|
$this->ref = '';
|
||||||
$this->statut=0;
|
$this->statut=0;
|
||||||
|
|
||||||
// Clear fields
|
// Clear fields
|
||||||
$this->user_author_id = $user->id;
|
$this->user_author_id = $user->id;
|
||||||
$this->user_valid = '';
|
$this->user_valid = '';
|
||||||
$this->date_creation = '';
|
$this->date_creation = '';
|
||||||
$this->date_validation = '';
|
$this->date_validation = '';
|
||||||
$this->ref_client = '';
|
$this->ref_client = '';
|
||||||
|
|
||||||
// Create clone
|
// Create clone
|
||||||
$result=$this->create($user);
|
$result=$this->create($user);
|
||||||
if ($result < 0) $error++;
|
if ($result < 0) $error++;
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
// Add lines because it is not included into create function
|
// Add lines because it is not included into create function
|
||||||
foreach ($this->lines as $line)
|
foreach ($this->lines as $line)
|
||||||
{
|
{
|
||||||
$this->addline($user, $this->id, $line->desc, $line->datei, $line->duration);
|
$this->addline($user, $this->id, $line->desc, $line->datei, $line->duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hook of thirdparty module
|
// Hook of thirdparty module
|
||||||
if (is_object($hookmanager))
|
if (is_object($hookmanager))
|
||||||
{
|
{
|
||||||
$parameters=array('objFrom'=>$objFrom);
|
$parameters=array('objFrom'=>$objFrom);
|
||||||
$action='';
|
$action='';
|
||||||
$reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) $error++;
|
if ($reshook < 0) $error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('INTERVENTION_CLONE',$user);
|
$result=$this->call_trigger('INTERVENTION_CLONE',$user);
|
||||||
if ($result < 0) $error++;
|
if ($result < 0) $error++;
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($this->context['createfromclone']);
|
unset($this->context['createfromclone']);
|
||||||
|
|
||||||
// End
|
// End
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1338,7 +1338,7 @@ class FichinterLigne extends CommonObjectLine
|
|||||||
* Insert the line into database
|
* Insert the line into database
|
||||||
*
|
*
|
||||||
* @param User $user Objet user that make creation
|
* @param User $user Objet user that make creation
|
||||||
* @param int $notrigger Disable all triggers
|
* @param int $notrigger Disable all triggers
|
||||||
* @return int <0 if ko, >0 if ok
|
* @return int <0 if ko, >0 if ok
|
||||||
*/
|
*/
|
||||||
function insert($user, $notrigger=0)
|
function insert($user, $notrigger=0)
|
||||||
@ -1386,14 +1386,14 @@ class FichinterLigne extends CommonObjectLine
|
|||||||
$this->rowid=$this->db->last_insert_id(MAIN_DB_PREFIX.'fichinterdet');
|
$this->rowid=$this->db->last_insert_id(MAIN_DB_PREFIX.'fichinterdet');
|
||||||
|
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||||
{
|
{
|
||||||
$this->id=$this->rowid;
|
$this->id=$this->rowid;
|
||||||
$result=$this->insertExtraFields();
|
$result=$this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$result=$this->update_total();
|
$result=$this->update_total();
|
||||||
@ -1404,10 +1404,10 @@ class FichinterLigne extends CommonObjectLine
|
|||||||
|
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('LINEFICHINTER_CREATE',$user);
|
$result=$this->call_trigger('LINEFICHINTER_CREATE',$user);
|
||||||
if ($result < 0) { $error++; }
|
if ($result < 0) { $error++; }
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1434,7 +1434,7 @@ class FichinterLigne extends CommonObjectLine
|
|||||||
* Update intervention into database
|
* Update intervention into database
|
||||||
*
|
*
|
||||||
* @param User $user Objet user that make creation
|
* @param User $user Objet user that make creation
|
||||||
* @param int $notrigger Disable all triggers
|
* @param int $notrigger Disable all triggers
|
||||||
* @return int <0 if ko, >0 if ok
|
* @return int <0 if ko, >0 if ok
|
||||||
*/
|
*/
|
||||||
function update($user,$notrigger=0)
|
function update($user,$notrigger=0)
|
||||||
@ -1457,14 +1457,14 @@ class FichinterLigne extends CommonObjectLine
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||||
{
|
{
|
||||||
$this->id=$this->rowid;
|
$this->id=$this->rowid;
|
||||||
$result=$this->insertExtraFields();
|
$result=$this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$result=$this->update_total();
|
$result=$this->update_total();
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
@ -1472,10 +1472,10 @@ class FichinterLigne extends CommonObjectLine
|
|||||||
|
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('LINEFICHINTER_UPDATE',$user);
|
$result=$this->call_trigger('LINEFICHINTER_UPDATE',$user);
|
||||||
if ($result < 0) { $error++; }
|
if ($result < 0) { $error++; }
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1555,7 +1555,7 @@ class FichinterLigne extends CommonObjectLine
|
|||||||
* Delete a intervention line
|
* Delete a intervention line
|
||||||
*
|
*
|
||||||
* @param User $user Objet user that make creation
|
* @param User $user Objet user that make creation
|
||||||
* @param int $notrigger Disable all triggers
|
* @param int $notrigger Disable all triggers
|
||||||
* @return int >0 if ok, <0 if ko
|
* @return int >0 if ok, <0 if ko
|
||||||
*/
|
*/
|
||||||
function deleteline($user,$notrigger=0)
|
function deleteline($user,$notrigger=0)
|
||||||
@ -1577,14 +1577,14 @@ class FichinterLigne extends CommonObjectLine
|
|||||||
{
|
{
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('LINEFICHINTER_DELETE',$user);
|
$result=$this->call_trigger('LINEFICHINTER_DELETE',$user);
|
||||||
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -34,11 +34,11 @@ require_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php';
|
|||||||
*/
|
*/
|
||||||
class PaiementFourn extends Paiement
|
class PaiementFourn extends Paiement
|
||||||
{
|
{
|
||||||
public $element='payment_supplier';
|
public $element='payment_supplier';
|
||||||
public $table_element='paiementfourn';
|
public $table_element='paiementfourn';
|
||||||
public $picto = 'payment';
|
public $picto = 'payment';
|
||||||
|
|
||||||
var $statut; //Status of payment. 0 = unvalidated; 1 = validated
|
var $statut; //Status of payment. 0 = unvalidated; 1 = validated
|
||||||
// fk_paiement dans llx_paiement est l'id du type de paiement (7 pour CHQ, ...)
|
// fk_paiement dans llx_paiement est l'id du type de paiement (7 pour CHQ, ...)
|
||||||
// fk_paiement dans llx_paiement_facture est le rowid du paiement
|
// fk_paiement dans llx_paiement_facture est le rowid du paiement
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ class PaiementFourn extends Paiement
|
|||||||
*/
|
*/
|
||||||
function fetch($id, $ref='', $fk_bank='')
|
function fetch($id, $ref='', $fk_bank='')
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$sql = 'SELECT p.rowid, p.ref, p.entity, p.datep as dp, p.amount, p.statut, p.fk_bank,';
|
$sql = 'SELECT p.rowid, p.ref, p.entity, p.datep as dp, p.amount, p.statut, p.fk_bank,';
|
||||||
$sql.= ' c.code as paiement_code, c.libelle as paiement_type,';
|
$sql.= ' c.code as paiement_code, c.libelle as paiement_type,';
|
||||||
@ -210,22 +210,22 @@ class PaiementFourn extends Paiement
|
|||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
// If we want to closed payed invoices
|
// If we want to closed payed invoices
|
||||||
if ($closepaidinvoices)
|
if ($closepaidinvoices)
|
||||||
{
|
{
|
||||||
$invoice=new FactureFournisseur($this->db);
|
$invoice=new FactureFournisseur($this->db);
|
||||||
$invoice->fetch($facid);
|
$invoice->fetch($facid);
|
||||||
$paiement = $invoice->getSommePaiement();
|
$paiement = $invoice->getSommePaiement();
|
||||||
//$creditnotes=$invoice->getSumCreditNotesUsed();
|
//$creditnotes=$invoice->getSumCreditNotesUsed();
|
||||||
$creditnotes=0;
|
$creditnotes=0;
|
||||||
//$deposits=$invoice->getSumDepositsUsed();
|
//$deposits=$invoice->getSumDepositsUsed();
|
||||||
$deposits=0;
|
$deposits=0;
|
||||||
$alreadypayed=price2num($paiement + $creditnotes + $deposits,'MT');
|
$alreadypayed=price2num($paiement + $creditnotes + $deposits,'MT');
|
||||||
$remaintopay=price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits,'MT');
|
$remaintopay=price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits,'MT');
|
||||||
if ($remaintopay == 0)
|
if ($remaintopay == 0)
|
||||||
{
|
{
|
||||||
$result=$invoice->set_paid($user, '', '');
|
$result=$invoice->set_paid($user, '', '');
|
||||||
}
|
}
|
||||||
else dol_syslog("Remain to pay for invoice ".$facid." not null. We do nothing.");
|
else dol_syslog("Remain to pay for invoice ".$facid." not null. We do nothing.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -243,10 +243,10 @@ class PaiementFourn extends Paiement
|
|||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('PAYMENT_SUPPLIER_CREATE',$user);
|
$result=$this->call_trigger('PAYMENT_SUPPLIER_CREATE',$user);
|
||||||
if ($result < 0) $error++;
|
if ($result < 0) $error++;
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -265,7 +265,7 @@ class PaiementFourn extends Paiement
|
|||||||
if ($totalamount <> 0 && $error == 0) // On accepte les montants negatifs
|
if ($totalamount <> 0 && $error == 0) // On accepte les montants negatifs
|
||||||
{
|
{
|
||||||
$this->amount=$total;
|
$this->amount=$total;
|
||||||
$this->total=$total;
|
$this->total=$total;
|
||||||
$this->multicurrency_amount=$mtotal;
|
$this->multicurrency_amount=$mtotal;
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
dol_syslog('PaiementFourn::Create Ok Total = '.$this->total);
|
dol_syslog('PaiementFourn::Create Ok Total = '.$this->total);
|
||||||
@ -289,7 +289,7 @@ class PaiementFourn extends Paiement
|
|||||||
*/
|
*/
|
||||||
function delete($notrigger=0)
|
function delete($notrigger=0)
|
||||||
{
|
{
|
||||||
global $conf, $user, $langs;
|
global $conf, $user, $langs;
|
||||||
|
|
||||||
$bank_line_id = $this->bank_line;
|
$bank_line_id = $this->bank_line;
|
||||||
|
|
||||||
@ -346,30 +346,30 @@ class PaiementFourn extends Paiement
|
|||||||
// Supprimer l'ecriture bancaire si paiement lie a ecriture
|
// Supprimer l'ecriture bancaire si paiement lie a ecriture
|
||||||
if ($bank_line_id)
|
if ($bank_line_id)
|
||||||
{
|
{
|
||||||
$accline = new AccountLine($this->db);
|
$accline = new AccountLine($this->db);
|
||||||
$result=$accline->fetch($bank_line_id);
|
$result=$accline->fetch($bank_line_id);
|
||||||
if ($result > 0) // If result = 0, record not found, we don't try to delete
|
if ($result > 0) // If result = 0, record not found, we don't try to delete
|
||||||
{
|
{
|
||||||
$result=$accline->delete($user);
|
$result=$accline->delete($user);
|
||||||
}
|
}
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$this->error=$accline->error;
|
$this->error=$accline->error;
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -4;
|
return -4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Appel des triggers
|
||||||
$result=$this->call_trigger('PAYMENT_SUPPLIER_DELETE', $user);
|
$result=$this->call_trigger('PAYMENT_SUPPLIER_DELETE', $user);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
// Fin appel triggers
|
// Fin appel triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
@ -466,23 +466,23 @@ class PaiementFourn extends Paiement
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee)
|
* Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee)
|
||||||
*
|
*
|
||||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||||
* @return string Libelle
|
* @return string Libelle
|
||||||
*/
|
*/
|
||||||
function getLibStatut($mode=0)
|
function getLibStatut($mode=0)
|
||||||
{
|
{
|
||||||
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
|
||||||
*
|
*
|
||||||
* @param int $status Statut
|
* @param int $status Statut
|
||||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||||
* @return string Libelle du statut
|
* @return string Libelle du statut
|
||||||
*/
|
*/
|
||||||
function LibStatut($status,$mode=0)
|
function LibStatut($status,$mode=0)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
@ -540,19 +540,19 @@ class PaiementFourn extends Paiement
|
|||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
$text=$this->ref; // Sometimes ref contains label
|
$text=$this->ref; // Sometimes ref contains label
|
||||||
if (preg_match('/^\((.*)\)$/i',$text,$reg)) {
|
if (preg_match('/^\((.*)\)$/i',$text,$reg)) {
|
||||||
// Label generique car entre parentheses. On l'affiche en le traduisant
|
// Label generique car entre parentheses. On l'affiche en le traduisant
|
||||||
if ($reg[1]=='paiement') $reg[1]='Payment';
|
if ($reg[1]=='paiement') $reg[1]='Payment';
|
||||||
$text=$langs->trans($reg[1]);
|
$text=$langs->trans($reg[1]);
|
||||||
}
|
}
|
||||||
$label = $langs->trans("ShowPayment").': '.$text;
|
$label = $langs->trans("ShowPayment").': '.$text;
|
||||||
|
|
||||||
$link = '<a href="'.DOL_URL_ROOT.'/fourn/paiement/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
$link = '<a href="'.DOL_URL_ROOT.'/fourn/paiement/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$linkend='</a>';
|
$linkend='</a>';
|
||||||
|
|
||||||
|
|
||||||
if ($withpicto) $result.=($link.img_object($langs->trans("ShowPayment"), 'payment', 'class="classfortooltip"').$linkend);
|
if ($withpicto) $result.=($link.img_object($langs->trans("ShowPayment"), 'payment', 'class="classfortooltip"').$linkend);
|
||||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||||
if ($withpicto != 2) $result.=$link.$text.$linkend;
|
if ($withpicto != 2) $result.=$link.$text.$linkend;
|
||||||
return $result;
|
return $result;
|
||||||
@ -699,13 +699,13 @@ class PaiementFourn extends Paiement
|
|||||||
|
|
||||||
if (empty($modele))
|
if (empty($modele))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$modelpath = "core/modules/supplier_payment/doc/";
|
$modelpath = "core/modules/supplier_payment/doc/";
|
||||||
|
|
||||||
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -54,20 +54,20 @@ $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($co
|
|||||||
|
|
||||||
if ($action == 'setnote' && $user->rights->fournisseur->facture->creer)
|
if ($action == 'setnote' && $user->rights->fournisseur->facture->creer)
|
||||||
{
|
{
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$result = $object->update_note(GETPOST('note','none'));
|
$result = $object->update_note(GETPOST('note','none'));
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fournisseur->facture->supprimer)
|
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fournisseur->facture->supprimer)
|
||||||
@ -90,8 +90,8 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fournisse
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'confirm_valide' && $confirm == 'yes' &&
|
if ($action == 'confirm_valide' && $confirm == 'yes' &&
|
||||||
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->facture->creer))
|
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->facture->creer))
|
||||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->supplier_invoice_advance->validate)))
|
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->supplier_invoice_advance->validate)))
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
$db->begin();
|
$db->begin();
|
||||||
@ -113,7 +113,7 @@ if ($action == 'confirm_valide' && $confirm == 'yes' &&
|
|||||||
if ($action == 'setnum_paiement' && ! empty($_POST['num_paiement']))
|
if ($action == 'setnum_paiement' && ! empty($_POST['num_paiement']))
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$res = $object->update_num($_POST['num_paiement']);
|
$res = $object->update_num($_POST['num_paiement']);
|
||||||
if ($res === 0)
|
if ($res === 0)
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans('PaymentNumberUpdateSucceeded'), null, 'mesgs');
|
setEventMessages($langs->trans('PaymentNumberUpdateSucceeded'), null, 'mesgs');
|
||||||
@ -127,7 +127,7 @@ if ($action == 'setnum_paiement' && ! empty($_POST['num_paiement']))
|
|||||||
if ($action == 'setdatep' && ! empty($_POST['datepday']))
|
if ($action == 'setdatep' && ! empty($_POST['datepday']))
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$datepaye = dol_mktime(12, 0, 0, $_POST['datepmonth'], $_POST['datepday'], $_POST['datepyear']);
|
$datepaye = dol_mktime(12, 0, 0, $_POST['datepmonth'], $_POST['datepday'], $_POST['datepyear']);
|
||||||
$res = $object->update_date($datepaye);
|
$res = $object->update_date($datepaye);
|
||||||
if ($res === 0)
|
if ($res === 0)
|
||||||
{
|
{
|
||||||
@ -197,18 +197,18 @@ if ($result > 0)
|
|||||||
print '</td></tr>';*/
|
print '</td></tr>';*/
|
||||||
|
|
||||||
// Date payment
|
// Date payment
|
||||||
print '<tr><td class="titlefield" colspan="2">'.$form->editfieldkey("Date",'datep',$object->date,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer).'</td><td colspan="3">';
|
print '<tr><td class="titlefield" colspan="2">'.$form->editfieldkey("Date",'datep',$object->date,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer).'</td><td colspan="3">';
|
||||||
print $form->editfieldval("Date",'datep',$object->date,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer,'datepicker','',null,$langs->trans('PaymentDateUpdateSucceeded'));
|
print $form->editfieldval("Date",'datep',$object->date,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer,'datepicker','',null,$langs->trans('PaymentDateUpdateSucceeded'));
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Payment mode
|
// Payment mode
|
||||||
$labeltype=$langs->trans("PaymentType".$object->type_code)!=("PaymentType".$object->type_code)?$langs->trans("PaymentType".$object->type_code):$object->type_libelle;
|
$labeltype=$langs->trans("PaymentType".$object->type_code)!=("PaymentType".$object->type_code)?$langs->trans("PaymentType".$object->type_code):$object->type_libelle;
|
||||||
print '<tr><td colspan="2">'.$langs->trans('PaymentMode').'</td><td colspan="3">'.$labeltype.'</td></tr>';
|
print '<tr><td colspan="2">'.$langs->trans('PaymentMode').'</td><td colspan="3">'.$labeltype.'</td></tr>';
|
||||||
|
|
||||||
// Payment numero
|
// Payment numero
|
||||||
print '<tr><td colspan="2">'.$form->editfieldkey("Numero",'num_paiement',$object->numero,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer).'</td><td colspan="3">';
|
print '<tr><td colspan="2">'.$form->editfieldkey("Numero",'num_paiement',$object->numero,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer).'</td><td colspan="3">';
|
||||||
print $form->editfieldval("Numero",'num_paiement',$object->numero,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer,'string','',null,$langs->trans('PaymentNumberUpdateSucceeded'));
|
print $form->editfieldval("Numero",'num_paiement',$object->numero,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer,'string','',null,$langs->trans('PaymentNumberUpdateSucceeded'));
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Amount
|
// Amount
|
||||||
print '<tr><td colspan="2">'.$langs->trans('Amount').'</td><td colspan="3">'.price($object->montant,'',$langs,0,0,-1,$conf->currency).'</td></tr>';
|
print '<tr><td colspan="2">'.$langs->trans('Amount').'</td><td colspan="3">'.price($object->montant,'',$langs,0,0,-1,$conf->currency).'</td></tr>';
|
||||||
@ -219,41 +219,41 @@ if ($result > 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Note
|
// Note
|
||||||
print '<tr><td colspan="2">'.$form->editfieldkey("Note",'note',$object->note,$object,$user->rights->fournisseur->facture->creer).'</td><td colspan="3">';
|
print '<tr><td colspan="2">'.$form->editfieldkey("Note",'note',$object->note,$object,$user->rights->fournisseur->facture->creer).'</td><td colspan="3">';
|
||||||
print $form->editfieldval("Note",'note',$object->note,$object,$user->rights->fournisseur->facture->creer,'textarea');
|
print $form->editfieldval("Note",'note',$object->note,$object,$user->rights->fournisseur->facture->creer,'textarea');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
$allow_delete = 1 ;
|
$allow_delete = 1 ;
|
||||||
// Bank account
|
// Bank account
|
||||||
if (! empty($conf->banque->enabled))
|
if (! empty($conf->banque->enabled))
|
||||||
{
|
{
|
||||||
if ($object->bank_account)
|
if ($object->bank_account)
|
||||||
{
|
{
|
||||||
$bankline=new AccountLine($db);
|
$bankline=new AccountLine($db);
|
||||||
$bankline->fetch($object->bank_line);
|
$bankline->fetch($object->bank_line);
|
||||||
if ($bankline->rappro)
|
if ($bankline->rappro)
|
||||||
{
|
{
|
||||||
$allow_delete=0;
|
$allow_delete=0;
|
||||||
$title_button = dol_escape_htmltag($langs->transnoentitiesnoconv("CantRemoveConciliatedPayment"));
|
$title_button = dol_escape_htmltag($langs->transnoentitiesnoconv("CantRemoveConciliatedPayment"));
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td colspan="2">'.$langs->trans('BankTransactionLine').'</td>';
|
print '<td colspan="2">'.$langs->trans('BankTransactionLine').'</td>';
|
||||||
print '<td colspan="3">';
|
print '<td colspan="3">';
|
||||||
print $bankline->getNomUrl(1,0,'showconciliated');
|
print $bankline->getNomUrl(1,0,'showconciliated');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td colspan="2">'.$langs->trans('BankAccount').'</td>';
|
print '<td colspan="2">'.$langs->trans('BankAccount').'</td>';
|
||||||
print '<td colspan="3">';
|
print '<td colspan="3">';
|
||||||
$accountstatic=new Account($db);
|
$accountstatic=new Account($db);
|
||||||
$accountstatic->fetch($bankline->fk_account);
|
$accountstatic->fetch($bankline->fk_account);
|
||||||
print $accountstatic->getNomUrl(1);
|
print $accountstatic->getNomUrl(1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
@ -315,7 +315,7 @@ if ($result > 0)
|
|||||||
if ($objp->paye == 1)
|
if ($objp->paye == 1)
|
||||||
{
|
{
|
||||||
$allow_delete = 0;
|
$allow_delete = 0;
|
||||||
$title_button = dol_escape_htmltag($langs->transnoentitiesnoconv("CantRemovePaymentWithOneInvoicePaid"));
|
$title_button = dol_escape_htmltag($langs->transnoentitiesnoconv("CantRemovePaymentWithOneInvoicePaid"));
|
||||||
}
|
}
|
||||||
$total = $total + $objp->amount;
|
$total = $total + $objp->amount;
|
||||||
$i++;
|
$i++;
|
||||||
@ -343,8 +343,8 @@ if ($result > 0)
|
|||||||
{
|
{
|
||||||
if ($user->societe_id == 0 && $object->statut == 0 && $action == '')
|
if ($user->societe_id == 0 && $object->statut == 0 && $action == '')
|
||||||
{
|
{
|
||||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->facture->creer))
|
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->facture->creer))
|
||||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->supplier_invoice_advance->validate)))
|
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->supplier_invoice_advance->validate)))
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=valide">'.$langs->trans('Valid').'</a>';
|
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=valide">'.$langs->trans('Valid').'</a>';
|
||||||
|
|
||||||
@ -355,14 +355,14 @@ if ($result > 0)
|
|||||||
{
|
{
|
||||||
if ($user->rights->fournisseur->facture->supprimer)
|
if ($user->rights->fournisseur->facture->supprimer)
|
||||||
{
|
{
|
||||||
if ($allow_delete)
|
if ($allow_delete)
|
||||||
{
|
{
|
||||||
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete">'.$langs->trans('Delete').'</a>';
|
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete">'.$langs->trans('Delete').'</a>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<a class="butActionRefused" href="#" title="'.$title_button.'">'.$langs->trans('Delete').'</a>';
|
print '<a class="butActionRefused" href="#" title="'.$title_button.'">'.$langs->trans('Delete').'</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print '</div>';
|
print '</div>';
|
||||||
@ -372,27 +372,27 @@ if ($result > 0)
|
|||||||
/*
|
/*
|
||||||
* Documents generes
|
* Documents generes
|
||||||
*/
|
*/
|
||||||
$ref=dol_sanitizeFileName($object->ref);
|
$ref=dol_sanitizeFileName($object->ref);
|
||||||
$filedir = $conf->fournisseur->payment->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
$filedir = $conf->fournisseur->payment->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$object->id;
|
$urlsource=$_SERVER['PHP_SELF'].'?id='.$object->id;
|
||||||
$genallowed=$user->rights->fournisseur->facture->creer;
|
$genallowed=$user->rights->fournisseur->facture->creer;
|
||||||
$delallowed=$user->rights->fournisseur->facture->supprimer;
|
$delallowed=$user->rights->fournisseur->facture->supprimer;
|
||||||
$modelpdf=(! empty($object->modelpdf)?$object->modelpdf:(empty($conf->global->SUPPLIER_PAYMENT_ADDON_PDF)?'':$conf->global->SUPPLIER_PAYMENT_ADDON_PDF));
|
$modelpdf=(! empty($object->modelpdf)?$object->modelpdf:(empty($conf->global->SUPPLIER_PAYMENT_ADDON_PDF)?'':$conf->global->SUPPLIER_PAYMENT_ADDON_PDF));
|
||||||
|
|
||||||
print $formfile->showdocuments('supplier_payment',$ref,$filedir,$urlsource,$genallowed,$delallowed,$modelpdf,1,0,0,40,0,'','','',$societe->default_lang);
|
print $formfile->showdocuments('supplier_payment',$ref,$filedir,$urlsource,$genallowed,$delallowed,$modelpdf,1,0,0,40,0,'','','',$societe->default_lang);
|
||||||
$somethingshown=$formfile->numoffiles;
|
$somethingshown=$formfile->numoffiles;
|
||||||
|
|
||||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||||
//print '</td><td valign="top" width="50%">';
|
//print '</td><td valign="top" width="50%">';
|
||||||
//print '<br>';
|
//print '<br>';
|
||||||
|
|
||||||
// List of actions on element
|
// List of actions on element
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||||
$formactions=new FormActions($db);
|
$formactions=new FormActions($db);
|
||||||
$somethingshown = $formactions->showactions($object,'supplier_payment',$socid,1,'listaction'.($genallowed?'largetitle':''));
|
$somethingshown = $formactions->showactions($object,'supplier_payment',$socid,1,'listaction'.($genallowed?'largetitle':''));
|
||||||
|
|
||||||
print '</div></div></div>';
|
print '</div></div></div>';
|
||||||
//print '</td></tr></table>';
|
//print '</td></tr></table>';
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -82,13 +82,13 @@ else if ($year && $month && $day) $daytoparse=dol_mktime(0, 0, 0, $month, $day,
|
|||||||
|
|
||||||
if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id)
|
if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id)
|
||||||
{
|
{
|
||||||
$usertoprocess=$user;
|
$usertoprocess=$user;
|
||||||
$search_usertoprocessid=$usertoprocess->id;
|
$search_usertoprocessid=$usertoprocess->id;
|
||||||
}
|
}
|
||||||
elseif ($search_usertoprocessid > 0)
|
elseif ($search_usertoprocessid > 0)
|
||||||
{
|
{
|
||||||
$usertoprocess=new User($db);
|
$usertoprocess=new User($db);
|
||||||
$usertoprocess->fetch($search_usertoprocessid);
|
$usertoprocess->fetch($search_usertoprocessid);
|
||||||
$search_usertoprocessid=$usertoprocess->id;
|
$search_usertoprocessid=$usertoprocess->id;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -106,17 +106,17 @@ $object=new Task($db);
|
|||||||
// Purge criteria
|
// Purge 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
|
||||||
{
|
{
|
||||||
$action = '';
|
$action = '';
|
||||||
$search_categ='';
|
$search_categ='';
|
||||||
$search_usertoprocessid = $user->id;
|
$search_usertoprocessid = $user->id;
|
||||||
$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",'alpha') || GETPOST("button_search.x",'alpha') || GETPOST("button_search",'alpha'))
|
if (GETPOST("button_search_x",'alpha') || GETPOST("button_search.x",'alpha') || GETPOST("button_search",'alpha'))
|
||||||
{
|
{
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GETPOST('submitdateselect'))
|
if (GETPOST('submitdateselect'))
|
||||||
@ -129,57 +129,57 @@ if (GETPOST('submitdateselect'))
|
|||||||
|
|
||||||
if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask'))
|
if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask'))
|
||||||
{
|
{
|
||||||
$action = 'assigntask';
|
$action = 'assigntask';
|
||||||
|
|
||||||
if ($taskid > 0)
|
if ($taskid > 0)
|
||||||
{
|
{
|
||||||
$result = $object->fetch($taskid, $ref);
|
$result = $object->fetch($taskid, $ref);
|
||||||
if ($result < 0) $error++;
|
if ($result < 0) $error++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Task")), '', 'errors');
|
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Task")), '', 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
if (! GETPOST('type'))
|
if (! GETPOST('type'))
|
||||||
{
|
{
|
||||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), '', 'errors');
|
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), '', 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$idfortaskuser=$usertoprocess->id;
|
$idfortaskuser=$usertoprocess->id;
|
||||||
$result = $object->add_contact($idfortaskuser, GETPOST("type"), 'internal');
|
$result = $object->add_contact($idfortaskuser, GETPOST("type"), 'internal');
|
||||||
|
|
||||||
if ($result >= 0 || $result == -2) // Contact add ok or already contact of task
|
if ($result >= 0 || $result == -2) // Contact add ok or already contact of task
|
||||||
{
|
{
|
||||||
// Test if we are already contact of the project (should be rare but sometimes we can add as task contact without being contact of project, like when admin user has been removed from contact of project)
|
// Test if we are already contact of the project (should be rare but sometimes we can add as task contact without being contact of project, like when admin user has been removed from contact of project)
|
||||||
$sql='SELECT ec.rowid FROM '.MAIN_DB_PREFIX.'element_contact as ec, '.MAIN_DB_PREFIX.'c_type_contact as tc WHERE tc.rowid = ec.fk_c_type_contact';
|
$sql='SELECT ec.rowid FROM '.MAIN_DB_PREFIX.'element_contact as ec, '.MAIN_DB_PREFIX.'c_type_contact as tc WHERE tc.rowid = ec.fk_c_type_contact';
|
||||||
$sql.=' AND ec.fk_socpeople = '.$idfortaskuser." AND ec.element_id = '.$object->fk_project.' AND tc.element = 'project' AND source = 'internal'";
|
$sql.=' AND ec.fk_socpeople = '.$idfortaskuser." AND ec.element_id = '.$object->fk_project.' AND tc.element = 'project' AND source = 'internal'";
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$obj=$db->fetch_object($resql);
|
$obj=$db->fetch_object($resql);
|
||||||
if (! $obj) // User is not already linked to project, so we will create link to first type
|
if (! $obj) // User is not already linked to project, so we will create link to first type
|
||||||
{
|
{
|
||||||
$project = new Project($db);
|
$project = new Project($db);
|
||||||
$project->fetch($object->fk_project);
|
$project->fetch($object->fk_project);
|
||||||
// Get type
|
// Get type
|
||||||
$listofprojcontact=$project->liste_type_contact('internal');
|
$listofprojcontact=$project->liste_type_contact('internal');
|
||||||
|
|
||||||
if (count($listofprojcontact))
|
if (count($listofprojcontact))
|
||||||
{
|
{
|
||||||
$typeforprojectcontact=reset(array_keys($listofprojcontact));
|
$typeforprojectcontact=reset(array_keys($listofprojcontact));
|
||||||
$result = $project->add_contact($idfortaskuser, $typeforprojectcontact, 'internal');
|
$result = $project->add_contact($idfortaskuser, $typeforprojectcontact, 'internal');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
@ -206,48 +206,48 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask')
|
|||||||
|
|
||||||
if ($action == 'addtime' && $user->rights->projet->lire)
|
if ($action == 'addtime' && $user->rights->projet->lire)
|
||||||
{
|
{
|
||||||
$timespent_duration=array();
|
$timespent_duration=array();
|
||||||
|
|
||||||
if (is_array($_POST))
|
if (is_array($_POST))
|
||||||
{
|
{
|
||||||
foreach($_POST as $key => $time)
|
foreach($_POST as $key => $time)
|
||||||
{
|
{
|
||||||
if (intval($time) > 0)
|
if (intval($time) > 0)
|
||||||
{
|
|
||||||
// Hours or minutes of duration
|
|
||||||
if (preg_match("/([0-9]+)duration(hour|min)/",$key,$matches))
|
|
||||||
{
|
|
||||||
$id = $matches[1];
|
|
||||||
if ($id > 0)
|
|
||||||
{
|
|
||||||
// We store HOURS in seconds
|
|
||||||
if($matches[2]=='hour') $timespent_duration[$id] += $time*60*60;
|
|
||||||
|
|
||||||
// We store MINUTES in seconds
|
|
||||||
if($matches[2]=='min') $timespent_duration[$id] += $time*60;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (count($timespent_duration) > 0)
|
|
||||||
{
|
|
||||||
foreach($timespent_duration as $key => $val)
|
|
||||||
{
|
|
||||||
$object->fetch($key);
|
|
||||||
$object->progress = GETPOST($key.'progress', 'int');
|
|
||||||
$object->timespent_duration = $val;
|
|
||||||
$object->timespent_fk_user = $user->id;
|
|
||||||
$object->timespent_note = GETPOST($key.'note');
|
|
||||||
if (GETPOST($key."hour") != '' && GETPOST($key."hour") >= 0) // If hour was entered
|
|
||||||
{
|
|
||||||
$object->timespent_datehour = dol_mktime(GETPOST($key."hour"),GETPOST($key."min"),0,$monthofday,$dayofday,$yearofday);
|
|
||||||
$object->timespent_withhour = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
$object->timespent_datehour = dol_mktime(12,0,0,$monthofday,$dayofday,$yearofday);
|
// Hours or minutes of duration
|
||||||
|
if (preg_match("/([0-9]+)duration(hour|min)/",$key,$matches))
|
||||||
|
{
|
||||||
|
$id = $matches[1];
|
||||||
|
if ($id > 0)
|
||||||
|
{
|
||||||
|
// We store HOURS in seconds
|
||||||
|
if($matches[2]=='hour') $timespent_duration[$id] += $time*60*60;
|
||||||
|
|
||||||
|
// We store MINUTES in seconds
|
||||||
|
if($matches[2]=='min') $timespent_duration[$id] += $time*60;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($timespent_duration) > 0)
|
||||||
|
{
|
||||||
|
foreach($timespent_duration as $key => $val)
|
||||||
|
{
|
||||||
|
$object->fetch($key);
|
||||||
|
$object->progress = GETPOST($key.'progress', 'int');
|
||||||
|
$object->timespent_duration = $val;
|
||||||
|
$object->timespent_fk_user = $user->id;
|
||||||
|
$object->timespent_note = GETPOST($key.'note');
|
||||||
|
if (GETPOST($key."hour") != '' && GETPOST($key."hour") >= 0) // If hour was entered
|
||||||
|
{
|
||||||
|
$object->timespent_datehour = dol_mktime(GETPOST($key."hour"),GETPOST($key."min"),0,$monthofday,$dayofday,$yearofday);
|
||||||
|
$object->timespent_withhour = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$object->timespent_datehour = dol_mktime(12,0,0,$monthofday,$dayofday,$yearofday);
|
||||||
}
|
}
|
||||||
$object->timespent_date = $object->timespent_datehour;
|
$object->timespent_date = $object->timespent_datehour;
|
||||||
|
|
||||||
@ -268,21 +268,21 @@ if ($action == 'addtime' && $user->rights->projet->lire)
|
|||||||
$error++;
|
$error++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
||||||
|
|
||||||
// Redirect to avoid submit twice on back
|
// Redirect to avoid submit twice on back
|
||||||
header('Location: '.$_SERVER["PHP_SELF"].'?'.($projectid?'id='.$projectid:'').($search_usertoprocessid?'&search_usertoprocessid='.$search_usertoprocessid:'').($mode?'&mode='.$mode:'').'&year='.$yearofday.'&month='.$monthofday.'&day='.$dayofday);
|
header('Location: '.$_SERVER["PHP_SELF"].'?'.($projectid?'id='.$projectid:'').($search_usertoprocessid?'&search_usertoprocessid='.$search_usertoprocessid:'').($mode?'&mode='.$mode:'').'&year='.$yearofday.'&month='.$monthofday.'&day='.$dayofday);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("ErrorTimeSpentIsEmpty"), null, 'errors');
|
setEventMessages($langs->trans("ErrorTimeSpentIsEmpty"), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -318,8 +318,8 @@ $projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertoprocess,(e
|
|||||||
|
|
||||||
if ($id)
|
if ($id)
|
||||||
{
|
{
|
||||||
$project->fetch($id);
|
$project->fetch($id);
|
||||||
$project->fetch_thirdparty();
|
$project->fetch_thirdparty();
|
||||||
}
|
}
|
||||||
|
|
||||||
$onlyopenedproject=1; // or -1
|
$onlyopenedproject=1; // or -1
|
||||||
@ -465,7 +465,7 @@ print '<tr class="liste_titre">';
|
|||||||
print '<td>'.$langs->trans("ProjectRef").'</td>';
|
print '<td>'.$langs->trans("ProjectRef").'</td>';
|
||||||
if (! empty($conf->global->PROJECT_LINES_PERDAY_SHOW_THIRDPARTY))
|
if (! empty($conf->global->PROJECT_LINES_PERDAY_SHOW_THIRDPARTY))
|
||||||
{
|
{
|
||||||
print '<td>'.$langs->trans("ThirdParty").'</td>';
|
print '<td>'.$langs->trans("ThirdParty").'</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>';
|
||||||
|
|||||||
@ -95,13 +95,13 @@ $lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 7, 'd');
|
|||||||
|
|
||||||
if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id)
|
if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id)
|
||||||
{
|
{
|
||||||
$usertoprocess=$user;
|
$usertoprocess=$user;
|
||||||
$search_usertoprocessid=$usertoprocess->id;
|
$search_usertoprocessid=$usertoprocess->id;
|
||||||
}
|
}
|
||||||
elseif ($search_usertoprocessid > 0)
|
elseif ($search_usertoprocessid > 0)
|
||||||
{
|
{
|
||||||
$usertoprocess=new User($db);
|
$usertoprocess=new User($db);
|
||||||
$usertoprocess->fetch($search_usertoprocessid);
|
$usertoprocess->fetch($search_usertoprocessid);
|
||||||
$search_usertoprocessid=$usertoprocess->id;
|
$search_usertoprocessid=$usertoprocess->id;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -119,17 +119,17 @@ $object=new Task($db);
|
|||||||
// Purge criteria
|
// Purge 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
|
||||||
{
|
{
|
||||||
$action = '';
|
$action = '';
|
||||||
$search_categ='';
|
$search_categ='';
|
||||||
$search_usertoprocessid = $user->id;
|
$search_usertoprocessid = $user->id;
|
||||||
$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",'alpha') || GETPOST("button_search.x",'alpha') || GETPOST("button_search",'alpha'))
|
if (GETPOST("button_search_x",'alpha') || GETPOST("button_search.x",'alpha') || GETPOST("button_search",'alpha'))
|
||||||
{
|
{
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GETPOST('submitdateselect'))
|
if (GETPOST('submitdateselect'))
|
||||||
@ -141,58 +141,58 @@ if (GETPOST('submitdateselect'))
|
|||||||
|
|
||||||
if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask'))
|
if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask'))
|
||||||
{
|
{
|
||||||
$action = 'assigntask';
|
$action = 'assigntask';
|
||||||
|
|
||||||
if ($taskid > 0)
|
if ($taskid > 0)
|
||||||
{
|
{
|
||||||
$result = $object->fetch($taskid, $ref);
|
$result = $object->fetch($taskid, $ref);
|
||||||
if ($result < 0) $error++;
|
if ($result < 0) $error++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Task")), '', 'errors');
|
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Task")), '', 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
if (! GETPOST('type'))
|
if (! GETPOST('type'))
|
||||||
{
|
{
|
||||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), '', 'errors');
|
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), '', 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$idfortaskuser=$usertoprocess->id;
|
$idfortaskuser=$usertoprocess->id;
|
||||||
$result = $object->add_contact($idfortaskuser, GETPOST("type"), 'internal');
|
$result = $object->add_contact($idfortaskuser, GETPOST("type"), 'internal');
|
||||||
|
|
||||||
if ($result >= 0 || $result == -2) // Contact add ok or already contact of task
|
if ($result >= 0 || $result == -2) // Contact add ok or already contact of task
|
||||||
{
|
{
|
||||||
// Test if we are already contact of the project (should be rare but sometimes we can add as task contact without being contact of project, like when admin user has been removed from contact of project)
|
// Test if we are already contact of the project (should be rare but sometimes we can add as task contact without being contact of project, like when admin user has been removed from contact of project)
|
||||||
$sql='SELECT ec.rowid FROM '.MAIN_DB_PREFIX.'element_contact as ec, '.MAIN_DB_PREFIX.'c_type_contact as tc WHERE tc.rowid = ec.fk_c_type_contact';
|
$sql='SELECT ec.rowid FROM '.MAIN_DB_PREFIX.'element_contact as ec, '.MAIN_DB_PREFIX.'c_type_contact as tc WHERE tc.rowid = ec.fk_c_type_contact';
|
||||||
$sql.=' AND ec.fk_socpeople = '.$idfortaskuser." AND ec.element_id = '.$object->fk_project.' AND tc.element = 'project' AND source = 'internal'";
|
$sql.=' AND ec.fk_socpeople = '.$idfortaskuser." AND ec.element_id = '.$object->fk_project.' AND tc.element = 'project' AND source = 'internal'";
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$obj=$db->fetch_object($resql);
|
$obj=$db->fetch_object($resql);
|
||||||
if (! $obj) // User is not already linked to project, so we will create link to first type
|
if (! $obj) // User is not already linked to project, so we will create link to first type
|
||||||
{
|
{
|
||||||
$project = new Project($db);
|
$project = new Project($db);
|
||||||
$project->fetch($object->fk_project);
|
$project->fetch($object->fk_project);
|
||||||
// Get type
|
// Get type
|
||||||
$listofprojcontact=$project->liste_type_contact('internal');
|
$listofprojcontact=$project->liste_type_contact('internal');
|
||||||
|
|
||||||
if (count($listofprojcontact))
|
if (count($listofprojcontact))
|
||||||
{
|
{
|
||||||
$typeforprojectcontact=reset(array_keys($listofprojcontact));
|
$typeforprojectcontact=reset(array_keys($listofprojcontact));
|
||||||
$result = $project->add_contact($idfortaskuser, $typeforprojectcontact, 'internal');
|
$result = $project->add_contact($idfortaskuser, $typeforprojectcontact, 'internal');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
@ -219,35 +219,35 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask')
|
|||||||
|
|
||||||
if ($action == 'addtime' && $user->rights->projet->lire)
|
if ($action == 'addtime' && $user->rights->projet->lire)
|
||||||
{
|
{
|
||||||
$timetoadd=$_POST['task'];
|
$timetoadd=$_POST['task'];
|
||||||
if (empty($timetoadd))
|
if (empty($timetoadd))
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("ErrorTimeSpentIsEmpty"), null, 'errors');
|
setEventMessages($langs->trans("ErrorTimeSpentIsEmpty"), null, 'errors');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach($timetoadd as $taskid => $value) // Loop on each task
|
foreach($timetoadd as $taskid => $value) // Loop on each task
|
||||||
{
|
{
|
||||||
$updateoftaskdone=0;
|
$updateoftaskdone=0;
|
||||||
foreach($value as $key => $val) // Loop on each day
|
foreach($value as $key => $val) // Loop on each day
|
||||||
{
|
{
|
||||||
$amountoadd=$timetoadd[$taskid][$key];
|
$amountoadd=$timetoadd[$taskid][$key];
|
||||||
if (! empty($amountoadd))
|
if (! empty($amountoadd))
|
||||||
{
|
{
|
||||||
$tmpduration=explode(':',$amountoadd);
|
$tmpduration=explode(':',$amountoadd);
|
||||||
$newduration=0;
|
$newduration=0;
|
||||||
if (! empty($tmpduration[0])) $newduration+=($tmpduration[0] * 3600);
|
if (! empty($tmpduration[0])) $newduration+=($tmpduration[0] * 3600);
|
||||||
if (! empty($tmpduration[1])) $newduration+=($tmpduration[1] * 60);
|
if (! empty($tmpduration[1])) $newduration+=($tmpduration[1] * 60);
|
||||||
if (! empty($tmpduration[2])) $newduration+=($tmpduration[2]);
|
if (! empty($tmpduration[2])) $newduration+=($tmpduration[2]);
|
||||||
|
|
||||||
if ($newduration > 0)
|
if ($newduration > 0)
|
||||||
{
|
{
|
||||||
$object->fetch($taskid);
|
$object->fetch($taskid);
|
||||||
$object->progress = GETPOST($taskid . 'progress', 'int');
|
$object->progress = GETPOST($taskid . 'progress', 'int');
|
||||||
$object->timespent_duration = $newduration;
|
$object->timespent_duration = $newduration;
|
||||||
$object->timespent_fk_user = $usertoprocess->id;
|
$object->timespent_fk_user = $usertoprocess->id;
|
||||||
$object->timespent_date = dol_time_plus_duree($firstdaytoshow, $key, 'd');
|
$object->timespent_date = dol_time_plus_duree($firstdaytoshow, $key, 'd');
|
||||||
$object->timespent_datehour = $object->timespent_date;
|
$object->timespent_datehour = $object->timespent_date;
|
||||||
|
|
||||||
$result=$object->addTimeSpent($user);
|
$result=$object->addTimeSpent($user);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -258,35 +258,35 @@ if ($action == 'addtime' && $user->rights->projet->lire)
|
|||||||
}
|
}
|
||||||
|
|
||||||
$updateoftaskdone++;
|
$updateoftaskdone++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $updateoftaskdone) // Check to update progress if no update were done on task.
|
if (! $updateoftaskdone) // Check to update progress if no update were done on task.
|
||||||
{
|
{
|
||||||
$object->fetch($taskid);
|
$object->fetch($taskid);
|
||||||
//var_dump($object->progress);var_dump(GETPOST($taskid . 'progress', 'int')); exit;
|
//var_dump($object->progress);var_dump(GETPOST($taskid . 'progress', 'int')); exit;
|
||||||
if ($object->progress != GETPOST($taskid . 'progress', 'int'))
|
if ($object->progress != GETPOST($taskid . 'progress', 'int'))
|
||||||
{
|
{
|
||||||
$object->progress = GETPOST($taskid . 'progress', 'int');
|
$object->progress = GETPOST($taskid . 'progress', 'int');
|
||||||
$result=$object->update($user);
|
$result=$object->update($user);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
||||||
|
|
||||||
// Redirect to avoid submit twice on back
|
// Redirect to avoid submit twice on back
|
||||||
header('Location: '.$_SERVER["PHP_SELF"].'?'.($projectid?'id='.$projectid:'').($search_usertoprocessid?'&search_usertoprocessid='.$search_usertoprocessid:'').($mode?'&mode='.$mode:'').($day?'&day='.$day:'').($month?'&month='.$month:'').($year?'&year='.$year:''));
|
header('Location: '.$_SERVER["PHP_SELF"].'?'.($projectid?'id='.$projectid:'').($search_usertoprocessid?'&search_usertoprocessid='.$search_usertoprocessid:'').($mode?'&mode='.$mode:'').($day?'&day='.$day:'').($month?'&month='.$month:'').($year?'&year='.$year:''));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -313,8 +313,8 @@ $projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertoprocess,(e
|
|||||||
//var_dump($projectsListId);
|
//var_dump($projectsListId);
|
||||||
if ($id)
|
if ($id)
|
||||||
{
|
{
|
||||||
$project->fetch($id);
|
$project->fetch($id);
|
||||||
$project->fetch_thirdparty();
|
$project->fetch_thirdparty();
|
||||||
}
|
}
|
||||||
|
|
||||||
$onlyopenedproject=1; // or -1
|
$onlyopenedproject=1; // or -1
|
||||||
@ -449,7 +449,7 @@ print '<td class="liste_titre"></td>';
|
|||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre"></td>';
|
||||||
for($i=0;$i<7;$i++)
|
for($i=0;$i<7;$i++)
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre"></td>';
|
||||||
}
|
}
|
||||||
// Action column
|
// Action column
|
||||||
print '<td class="liste_titre nowrap" align="right">';
|
print '<td class="liste_titre nowrap" align="right">';
|
||||||
@ -462,7 +462,7 @@ print '<tr class="liste_titre">';
|
|||||||
print '<td>'.$langs->trans("ProjectRef").'</td>';
|
print '<td>'.$langs->trans("ProjectRef").'</td>';
|
||||||
if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY))
|
if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY))
|
||||||
{
|
{
|
||||||
print '<td>'.$langs->trans("ThirdParty").'</td>';
|
print '<td>'.$langs->trans("ThirdParty").'</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>';
|
||||||
@ -504,8 +504,8 @@ $restrictviewformytask=(empty($conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED
|
|||||||
|
|
||||||
if (count($tasksarray) > 0)
|
if (count($tasksarray) > 0)
|
||||||
{
|
{
|
||||||
//var_dump($tasksarray);
|
//var_dump($tasksarray);
|
||||||
//var_dump($tasksrole);
|
//var_dump($tasksrole);
|
||||||
|
|
||||||
$j=0;
|
$j=0;
|
||||||
$level=0;
|
$level=0;
|
||||||
@ -516,9 +516,9 @@ if (count($tasksarray) > 0)
|
|||||||
|
|
||||||
print '<tr class="liste_total">
|
print '<tr class="liste_total">
|
||||||
<td class="liste_total" colspan="'.$colspan.'">';
|
<td class="liste_total" colspan="'.$colspan.'">';
|
||||||
print $langs->trans("Total");
|
print $langs->trans("Total");
|
||||||
print ' - '.$langs->trans("ExpectedWorkedHours").': <strong>'.price($usertoprocess->weeklyhours, 1, $langs, 0, 0).'</strong>';
|
print ' - '.$langs->trans("ExpectedWorkedHours").': <strong>'.price($usertoprocess->weeklyhours, 1, $langs, 0, 0).'</strong>';
|
||||||
print '</td>
|
print '</td>
|
||||||
<td class="liste_total hide0" align="center"><div id="totalDay[0]"> </div></td>
|
<td class="liste_total hide0" align="center"><div id="totalDay[0]"> </div></td>
|
||||||
<td class="liste_total hide1" align="center"><div id="totalDay[1]"> </div></td>
|
<td class="liste_total hide1" align="center"><div id="totalDay[1]"> </div></td>
|
||||||
<td class="liste_total hide2" align="center"><div id="totalDay[2]"> </div></td>
|
<td class="liste_total hide2" align="center"><div id="totalDay[2]"> </div></td>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -112,32 +112,32 @@ $fieldstosearchall = array(
|
|||||||
'p.ref'=>"Ref",
|
'p.ref'=>"Ref",
|
||||||
'p.title'=>"Label",
|
'p.title'=>"Label",
|
||||||
's.nom'=>"ThirdPartyName",
|
's.nom'=>"ThirdPartyName",
|
||||||
"p.note_public"=>"NotePublic"
|
"p.note_public"=>"NotePublic"
|
||||||
);
|
);
|
||||||
if (empty($user->socid)) $fieldstosearchall["p.note_private"]="NotePrivate";
|
if (empty($user->socid)) $fieldstosearchall["p.note_private"]="NotePrivate";
|
||||||
|
|
||||||
$arrayfields=array(
|
$arrayfields=array(
|
||||||
'p.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
'p.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
||||||
'p.title'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
|
'p.title'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
|
||||||
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1, 'enabled'=>$conf->societe->enabled),
|
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1, 'enabled'=>$conf->societe->enabled),
|
||||||
'commercial'=>array('label'=>$langs->trans("SaleRepresentativesOfThirdParty"), 'checked'=>0),
|
'commercial'=>array('label'=>$langs->trans("SaleRepresentativesOfThirdParty"), 'checked'=>0),
|
||||||
'p.dateo'=>array('label'=>$langs->trans("DateStart"), 'checked'=>1, 'position'=>100),
|
'p.dateo'=>array('label'=>$langs->trans("DateStart"), 'checked'=>1, 'position'=>100),
|
||||||
'p.datee'=>array('label'=>$langs->trans("DateEnd"), 'checked'=>1, 'position'=>101),
|
'p.datee'=>array('label'=>$langs->trans("DateEnd"), 'checked'=>1, 'position'=>101),
|
||||||
'p.public'=>array('label'=>$langs->trans("Visibility"), 'checked'=>1, 'position'=>102),
|
'p.public'=>array('label'=>$langs->trans("Visibility"), 'checked'=>1, 'position'=>102),
|
||||||
'p.opp_amount'=>array('label'=>$langs->trans("OpportunityAmountShort"), 'checked'=>1, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>103),
|
'p.opp_amount'=>array('label'=>$langs->trans("OpportunityAmountShort"), 'checked'=>1, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>103),
|
||||||
'p.fk_opp_status'=>array('label'=>$langs->trans("OpportunityStatusShort"), 'checked'=>1, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>104),
|
'p.fk_opp_status'=>array('label'=>$langs->trans("OpportunityStatusShort"), 'checked'=>1, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>104),
|
||||||
'p.opp_percent'=>array('label'=>$langs->trans("OpportunityProbabilityShort"), 'checked'=>1, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>105),
|
'p.opp_percent'=>array('label'=>$langs->trans("OpportunityProbabilityShort"), 'checked'=>1, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>105),
|
||||||
'p.budget_amount'=>array('label'=>$langs->trans("Budget"), 'checked'=>0, 'position'=>110),
|
'p.budget_amount'=>array('label'=>$langs->trans("Budget"), 'checked'=>0, 'position'=>110),
|
||||||
'p.datec'=>array('label'=>$langs->trans("DateCreationShort"), 'checked'=>0, 'position'=>500),
|
'p.datec'=>array('label'=>$langs->trans("DateCreationShort"), 'checked'=>0, 'position'=>500),
|
||||||
'p.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
'p.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
||||||
'p.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
'p.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
||||||
);
|
);
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,44 +157,44 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
|||||||
|
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
// Selection of new fields
|
// Selection of new fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
// Purge search criteria
|
// 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_all='';
|
$search_all='';
|
||||||
$search_categ='';
|
$search_categ='';
|
||||||
$search_ref="";
|
$search_ref="";
|
||||||
$search_label="";
|
$search_label="";
|
||||||
$search_societe="";
|
$search_societe="";
|
||||||
$search_year="";
|
$search_year="";
|
||||||
$search_status=-1;
|
$search_status=-1;
|
||||||
$search_opp_status=-1;
|
$search_opp_status=-1;
|
||||||
$search_opp_amount='';
|
$search_opp_amount='';
|
||||||
$search_opp_percent='';
|
$search_opp_percent='';
|
||||||
$search_budget_amount='';
|
$search_budget_amount='';
|
||||||
$search_public="";
|
$search_public="";
|
||||||
$search_sale="";
|
$search_sale="";
|
||||||
$search_project_user='';
|
$search_project_user='';
|
||||||
$search_sday="";
|
$search_sday="";
|
||||||
$search_smonth="";
|
$search_smonth="";
|
||||||
$search_syear="";
|
$search_syear="";
|
||||||
$search_eday="";
|
$search_eday="";
|
||||||
$search_emonth="";
|
$search_emonth="";
|
||||||
$search_eyear="";
|
$search_eyear="";
|
||||||
$toselect='';
|
$toselect='';
|
||||||
$search_array_options=array();
|
$search_array_options=array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Mass actions
|
// Mass actions
|
||||||
$objectclass='Project';
|
$objectclass='Project';
|
||||||
$objectlabel='Project';
|
$objectlabel='Project';
|
||||||
$permtoread = $user->rights->projet->lire;
|
$permtoread = $user->rights->projet->lire;
|
||||||
$permtodelete = $user->rights->projet->supprimer;
|
$permtodelete = $user->rights->projet->supprimer;
|
||||||
$uploaddir = $conf->projet->dir_output;
|
$uploaddir = $conf->projet->dir_output;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -223,10 +223,10 @@ $sql.= " AND ctc.source = 'internal'";
|
|||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
while($obj = $db->fetch_object($resql))
|
while($obj = $db->fetch_object($resql))
|
||||||
{
|
{
|
||||||
$listofprojectcontacttype[$obj->rowid]=$obj->code;
|
$listofprojectcontacttype[$obj->rowid]=$obj->code;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else dol_print_error($db);
|
else dol_print_error($db);
|
||||||
if (count($listofprojectcontacttype) == 0) $listofprojectcontacttype[0]='0'; // To avoid sql syntax error if not found
|
if (count($listofprojectcontacttype) == 0) $listofprojectcontacttype[0]='0'; // To avoid sql syntax error if not found
|
||||||
@ -272,42 +272,42 @@ if ($search_opp_amount) $sql .= natural_search('p.opp_amount', $search_opp_amoun
|
|||||||
if ($search_opp_percent) $sql .= natural_search('p.opp_percent', $search_opp_percent, 1);
|
if ($search_opp_percent) $sql .= natural_search('p.opp_percent', $search_opp_percent, 1);
|
||||||
if ($search_smonth > 0)
|
if ($search_smonth > 0)
|
||||||
{
|
{
|
||||||
if ($search_syear > 0 && empty($search_sday))
|
if ($search_syear > 0 && empty($search_sday))
|
||||||
$sql.= " AND p.dateo BETWEEN '".$db->idate(dol_get_first_day($search_syear,$search_smonth,false))."' AND '".$db->idate(dol_get_last_day($search_syear,$search_smonth,false))."'";
|
$sql.= " AND p.dateo BETWEEN '".$db->idate(dol_get_first_day($search_syear,$search_smonth,false))."' AND '".$db->idate(dol_get_last_day($search_syear,$search_smonth,false))."'";
|
||||||
else if ($search_syear > 0 && ! empty($search_sday))
|
else if ($search_syear > 0 && ! empty($search_sday))
|
||||||
$sql.= " AND p.dateo BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_smonth, $search_sday, $search_syear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_smonth, $search_sday, $search_syear))."'";
|
$sql.= " AND p.dateo BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_smonth, $search_sday, $search_syear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_smonth, $search_sday, $search_syear))."'";
|
||||||
else
|
else
|
||||||
$sql.= " AND date_format(p.dateo, '%m') = '".$search_smonth."'";
|
$sql.= " AND date_format(p.dateo, '%m') = '".$search_smonth."'";
|
||||||
}
|
}
|
||||||
else if ($search_syear > 0)
|
else if ($search_syear > 0)
|
||||||
{
|
{
|
||||||
$sql.= " AND p.dateo BETWEEN '".$db->idate(dol_get_first_day($search_syear,1,false))."' AND '".$db->idate(dol_get_last_day($search_syear,12,false))."'";
|
$sql.= " AND p.dateo BETWEEN '".$db->idate(dol_get_first_day($search_syear,1,false))."' AND '".$db->idate(dol_get_last_day($search_syear,12,false))."'";
|
||||||
}
|
}
|
||||||
if ($search_emonth > 0)
|
if ($search_emonth > 0)
|
||||||
{
|
{
|
||||||
if ($search_eyear > 0 && empty($search_eday))
|
if ($search_eyear > 0 && empty($search_eday))
|
||||||
$sql.= " AND p.datee BETWEEN '".$db->idate(dol_get_first_day($search_eyear,$search_emonth,false))."' AND '".$db->idate(dol_get_last_day($search_eyear,$search_emonth,false))."'";
|
$sql.= " AND p.datee BETWEEN '".$db->idate(dol_get_first_day($search_eyear,$search_emonth,false))."' AND '".$db->idate(dol_get_last_day($search_eyear,$search_emonth,false))."'";
|
||||||
else if ($search_eyear > 0 && ! empty($search_eday))
|
else if ($search_eyear > 0 && ! empty($search_eday))
|
||||||
$sql.= " AND p.datee BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_emonth, $search_eday, $search_eyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_emonth, $search_eday, $search_eyear))."'";
|
$sql.= " AND p.datee BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_emonth, $search_eday, $search_eyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_emonth, $search_eday, $search_eyear))."'";
|
||||||
else
|
else
|
||||||
$sql.= " AND date_format(p.datee, '%m') = '".$search_emonth."'";
|
$sql.= " AND date_format(p.datee, '%m') = '".$search_emonth."'";
|
||||||
}
|
}
|
||||||
else if ($search_eyear > 0)
|
else if ($search_eyear > 0)
|
||||||
{
|
{
|
||||||
$sql.= " AND p.datee BETWEEN '".$db->idate(dol_get_first_day($search_eyear,1,false))."' AND '".$db->idate(dol_get_last_day($search_eyear,12,false))."'";
|
$sql.= " AND p.datee BETWEEN '".$db->idate(dol_get_first_day($search_eyear,1,false))."' AND '".$db->idate(dol_get_last_day($search_eyear,12,false))."'";
|
||||||
}
|
}
|
||||||
if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
|
if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
|
||||||
if ($search_status >= 0)
|
if ($search_status >= 0)
|
||||||
{
|
{
|
||||||
if ($search_status == 99) $sql .= " AND p.fk_statut <> 2";
|
if ($search_status == 99) $sql .= " AND p.fk_statut <> 2";
|
||||||
else $sql .= " AND p.fk_statut = ".$db->escape($search_status);
|
else $sql .= " AND p.fk_statut = ".$db->escape($search_status);
|
||||||
}
|
}
|
||||||
if ($search_opp_status)
|
if ($search_opp_status)
|
||||||
{
|
{
|
||||||
if (is_numeric($search_opp_status) && $search_opp_status > 0) $sql .= " AND p.fk_opp_status = ".$db->escape($search_opp_status);
|
if (is_numeric($search_opp_status) && $search_opp_status > 0) $sql .= " AND p.fk_opp_status = ".$db->escape($search_opp_status);
|
||||||
if ($search_opp_status == 'all') $sql .= " AND p.fk_opp_status IS NOT NULL";
|
if ($search_opp_status == 'all') $sql .= " AND p.fk_opp_status IS NOT NULL";
|
||||||
if ($search_opp_status == 'openedopp') $sql .= " AND p.fk_opp_status IS NOT NULL AND p.fk_opp_status NOT IN (SELECT rowid FROM ".MAIN_DB_PREFIX."c_lead_status WHERE code IN ('WON','LOST'))";
|
if ($search_opp_status == 'openedopp') $sql .= " AND p.fk_opp_status IS NOT NULL AND p.fk_opp_status NOT IN (SELECT rowid FROM ".MAIN_DB_PREFIX."c_lead_status WHERE code IN ('WON','LOST'))";
|
||||||
if ($search_opp_status == 'none') $sql .= " AND p.fk_opp_status IS NULL";
|
if ($search_opp_status == 'none') $sql .= " AND p.fk_opp_status IS NULL";
|
||||||
}
|
}
|
||||||
if ($search_public!='') $sql .= " AND p.public = ".$db->escape($search_public);
|
if ($search_public!='') $sql .= " AND p.public = ".$db->escape($search_public);
|
||||||
if ($search_sale > 0) $sql.= " AND sc.fk_user = " .$search_sale;
|
if ($search_sale > 0) $sql.= " AND sc.fk_user = " .$search_sale;
|
||||||
@ -319,16 +319,16 @@ if ($search_budget_amount != '') $sql .= natural_search('p.budget_amount', $sear
|
|||||||
// Add where from extra fields
|
// Add where from extra fields
|
||||||
foreach ($search_array_options as $key => $val)
|
foreach ($search_array_options as $key => $val)
|
||||||
{
|
{
|
||||||
$crit=$val;
|
$crit=$val;
|
||||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||||
$typ=$extrafields->attribute_type[$tmpkey];
|
$typ=$extrafields->attribute_type[$tmpkey];
|
||||||
$mode=0;
|
$mode=0;
|
||||||
if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
|
if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
|
||||||
if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
|
if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
|
||||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
|
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
|
||||||
{
|
{
|
||||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add where from hooks
|
// Add where from hooks
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
@ -339,8 +339,8 @@ $sql.= $db->order($sortfield,$sortorder);
|
|||||||
$nbtotalofrecords = '';
|
$nbtotalofrecords = '';
|
||||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||||
{
|
{
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
$nbtotalofrecords = $db->num_rows($result);
|
$nbtotalofrecords = $db->num_rows($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql.= $db->plimit($limit + 1,$offset);
|
$sql.= $db->plimit($limit + 1,$offset);
|
||||||
@ -351,8 +351,8 @@ dol_syslog("list allowed project", LOG_DEBUG);
|
|||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if (! $resql)
|
if (! $resql)
|
||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
@ -361,9 +361,9 @@ $arrayofselected=is_array($toselect)?$toselect:array();
|
|||||||
|
|
||||||
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all)
|
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
header("Location: ".DOL_URL_ROOT.'/projet/card.php?id='.$obj->id);
|
header("Location: ".DOL_URL_ROOT.'/projet/card.php?id='.$obj->id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$help_url="EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos";
|
$help_url="EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos";
|
||||||
@ -395,9 +395,9 @@ 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)
|
||||||
{
|
{
|
||||||
$crit=$val;
|
$crit=$val;
|
||||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||||
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
|
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
|
||||||
}
|
}
|
||||||
|
|
||||||
// List of mass actions available
|
// List of mass actions available
|
||||||
@ -433,8 +433,8 @@ else
|
|||||||
|
|
||||||
if ($search_all)
|
if ($search_all)
|
||||||
{
|
{
|
||||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||||
print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall);
|
print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall);
|
||||||
}
|
}
|
||||||
|
|
||||||
$moreforfilter='';
|
$moreforfilter='';
|
||||||
@ -442,11 +442,11 @@ $moreforfilter='';
|
|||||||
// Filter on categories
|
// Filter on categories
|
||||||
if (! empty($conf->categorie->enabled))
|
if (! empty($conf->categorie->enabled))
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
|
||||||
$moreforfilter.='<div class="divsearchfield">';
|
$moreforfilter.='<div class="divsearchfield">';
|
||||||
$moreforfilter.=$langs->trans('ProjectCategories'). ': ';
|
$moreforfilter.=$langs->trans('ProjectCategories'). ': ';
|
||||||
$moreforfilter.=$formother->select_categories('project', $search_categ, 'search_categ', 1, 1, 'maxwidth300');
|
$moreforfilter.=$formother->select_categories('project', $search_categ, 'search_categ', 1, 1, 'maxwidth300');
|
||||||
$moreforfilter.='</div>';
|
$moreforfilter.='</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the user can view user other than himself
|
// If the user can view user other than himself
|
||||||
@ -536,14 +536,14 @@ if (! empty($arrayfields['p.public']['checked']))
|
|||||||
{
|
{
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
$array=array(''=>'',0 => $langs->trans("PrivateProject"),1 => $langs->trans("SharedProject"));
|
$array=array(''=>'',0 => $langs->trans("PrivateProject"),1 => $langs->trans("SharedProject"));
|
||||||
print $form->selectarray('search_public',$array,$search_public);
|
print $form->selectarray('search_public',$array,$search_public);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['p.fk_opp_status']['checked']))
|
if (! empty($arrayfields['p.fk_opp_status']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre nowrap center">';
|
print '<td class="liste_titre nowrap center">';
|
||||||
print $formproject->selectOpportunityStatus('search_opp_status', $search_opp_status, 1, 1, 1, 0, 'maxwidth100');
|
print $formproject->selectOpportunityStatus('search_opp_status', $search_opp_status, 1, 1, 1, 0, 'maxwidth100');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['p.opp_amount']['checked']))
|
if (! empty($arrayfields['p.opp_amount']['checked']))
|
||||||
{
|
{
|
||||||
@ -561,30 +561,30 @@ if (! empty($arrayfields['p.budget_amount']['checked']))
|
|||||||
{
|
{
|
||||||
print '<td class="liste_titre nowrap" align="right">';
|
print '<td class="liste_titre nowrap" align="right">';
|
||||||
print '<input type="text" class="flat" name="search_budget_amount" size="4" value="'.$search_budget_amount.'">';
|
print '<input type="text" class="flat" name="search_budget_amount" size="4" value="'.$search_budget_amount.'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||||
{
|
{
|
||||||
$align=$extrafields->getAlignFlag($key);
|
$align=$extrafields->getAlignFlag($key);
|
||||||
$typeofextrafield=$extrafields->attribute_type[$key];
|
$typeofextrafield=$extrafields->attribute_type[$key];
|
||||||
print '<td class="liste_titre'.($align?' '.$align:'').'">';
|
print '<td class="liste_titre'.($align?' '.$align:'').'">';
|
||||||
if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')) && empty($extrafields->attribute_computed[$key]))
|
if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')) && empty($extrafields->attribute_computed[$key]))
|
||||||
{
|
{
|
||||||
$crit=$val;
|
$crit=$val;
|
||||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||||
$searchclass='';
|
$searchclass='';
|
||||||
if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring';
|
if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring';
|
||||||
if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
|
if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
|
||||||
print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">';
|
print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Fields from hook
|
// Fields from hook
|
||||||
$parameters=array('arrayfields'=>$arrayfields);
|
$parameters=array('arrayfields'=>$arrayfields);
|
||||||
@ -592,24 +592,24 @@ $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // N
|
|||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (! empty($arrayfields['p.datec']['checked']))
|
if (! empty($arrayfields['p.datec']['checked']))
|
||||||
{
|
{
|
||||||
// Date creation
|
// Date creation
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['p.tms']['checked']))
|
if (! empty($arrayfields['p.tms']['checked']))
|
||||||
{
|
{
|
||||||
// Date modification
|
// Date modification
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['p.fk_statut']['checked']))
|
if (! empty($arrayfields['p.fk_statut']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre nowrap" align="right">';
|
print '<td class="liste_titre nowrap" align="right">';
|
||||||
$arrayofstatus = array();
|
$arrayofstatus = array();
|
||||||
foreach($object->statuts_short as $key => $val) $arrayofstatus[$key]=$langs->trans($val);
|
foreach($object->statuts_short as $key => $val) $arrayofstatus[$key]=$langs->trans($val);
|
||||||
$arrayofstatus['99']=$langs->trans("NotClosed").' ('.$langs->trans('Draft').'+'.$langs->trans('Opened').')';
|
$arrayofstatus['99']=$langs->trans("NotClosed").' ('.$langs->trans('Draft').'+'.$langs->trans('Opened').')';
|
||||||
print $form->selectarray('search_status', $arrayofstatus, $search_status, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100');
|
print $form->selectarray('search_status', $arrayofstatus, $search_status, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Action column
|
// Action column
|
||||||
print '<td class="liste_titre" align="right">';
|
print '<td class="liste_titre" align="right">';
|
||||||
@ -634,16 +634,16 @@ if (! empty($arrayfields['p.budget_amount']['checked'])) print_liste_field_titre
|
|||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||||
{
|
{
|
||||||
$align=$extrafields->getAlignFlag($key);
|
$align=$extrafields->getAlignFlag($key);
|
||||||
$sortonfield = "ef.".$key;
|
$sortonfield = "ef.".$key;
|
||||||
if (! empty($extrafields->attribute_computed[$key])) $sortonfield='';
|
if (! empty($extrafields->attribute_computed[$key])) $sortonfield='';
|
||||||
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
|
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Hook fields
|
// Hook fields
|
||||||
$parameters=array('arrayfields'=>$arrayfields);
|
$parameters=array('arrayfields'=>$arrayfields);
|
||||||
@ -675,168 +675,168 @@ while ($i < min($num,$limit))
|
|||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
// Project url
|
// Project url
|
||||||
if (! empty($arrayfields['p.ref']['checked']))
|
if (! empty($arrayfields['p.ref']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="nowrap">';
|
print '<td class="nowrap">';
|
||||||
print $object->getNomUrl(1);
|
print $object->getNomUrl(1);
|
||||||
if ($object->hasDelay()) print img_warning($langs->trans('Late'));
|
if ($object->hasDelay()) print img_warning($langs->trans('Late'));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
// Title
|
// Title
|
||||||
if (! empty($arrayfields['p.title']['checked']))
|
if (! empty($arrayfields['p.title']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="tdoverflowmax100">';
|
print '<td class="tdoverflowmax100">';
|
||||||
print dol_trunc($obj->title,80);
|
print dol_trunc($obj->title,80);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
// Company
|
// Company
|
||||||
if (! empty($arrayfields['s.nom']['checked']))
|
if (! empty($arrayfields['s.nom']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="tdoverflowmax100">';
|
print '<td class="tdoverflowmax100">';
|
||||||
if ($obj->socid)
|
if ($obj->socid)
|
||||||
{
|
{
|
||||||
$socstatic->id=$obj->socid;
|
$socstatic->id=$obj->socid;
|
||||||
$socstatic->name=$obj->name;
|
$socstatic->name=$obj->name;
|
||||||
print $socstatic->getNomUrl(1);
|
print $socstatic->getNomUrl(1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print ' ';
|
print ' ';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
// Sales Representatives
|
// Sales Representatives
|
||||||
if (! empty($arrayfields['commercial']['checked']))
|
if (! empty($arrayfields['commercial']['checked']))
|
||||||
{
|
{
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if ($obj->socid)
|
if ($obj->socid)
|
||||||
{
|
{
|
||||||
$socstatic->id=$obj->socid;
|
$socstatic->id=$obj->socid;
|
||||||
$socstatic->name=$obj->name;
|
$socstatic->name=$obj->name;
|
||||||
$listsalesrepresentatives=$socstatic->getSalesRepresentatives($user);
|
$listsalesrepresentatives=$socstatic->getSalesRepresentatives($user);
|
||||||
$nbofsalesrepresentative=count($listsalesrepresentatives);
|
$nbofsalesrepresentative=count($listsalesrepresentatives);
|
||||||
if ($nbofsalesrepresentative > 3) // We print only number
|
if ($nbofsalesrepresentative > 3) // We print only number
|
||||||
{
|
{
|
||||||
print '<a href="'.DOL_URL_ROOT.'/societe/commerciaux.php?socid='.$socstatic->id.'">';
|
print '<a href="'.DOL_URL_ROOT.'/societe/commerciaux.php?socid='.$socstatic->id.'">';
|
||||||
print $nbofsalesrepresentative;
|
print $nbofsalesrepresentative;
|
||||||
print '</a>';
|
print '</a>';
|
||||||
}
|
}
|
||||||
else if ($nbofsalesrepresentative > 0)
|
else if ($nbofsalesrepresentative > 0)
|
||||||
{
|
{
|
||||||
$userstatic=new User($db);
|
$userstatic=new User($db);
|
||||||
$j=0;
|
$j=0;
|
||||||
foreach($listsalesrepresentatives as $val)
|
foreach($listsalesrepresentatives as $val)
|
||||||
{
|
{
|
||||||
$userstatic->id=$val['id'];
|
$userstatic->id=$val['id'];
|
||||||
$userstatic->lastname=$val['lastname'];
|
$userstatic->lastname=$val['lastname'];
|
||||||
$userstatic->firstname=$val['firstname'];
|
$userstatic->firstname=$val['firstname'];
|
||||||
$userstatic->email=$val['email'];
|
$userstatic->email=$val['email'];
|
||||||
$userstatic->statut=$val['statut'];
|
$userstatic->statut=$val['statut'];
|
||||||
$userstatic->entity=$val['entity'];
|
$userstatic->entity=$val['entity'];
|
||||||
$userstatic->photo=$val['photo'];
|
$userstatic->photo=$val['photo'];
|
||||||
//print $userstatic->getNomUrl(1, '', 0, 0, 12);
|
//print $userstatic->getNomUrl(1, '', 0, 0, 12);
|
||||||
print $userstatic->getNomUrl(-2);
|
print $userstatic->getNomUrl(-2);
|
||||||
$j++;
|
$j++;
|
||||||
if ($j < $nbofsalesrepresentative) print ' ';
|
if ($j < $nbofsalesrepresentative) print ' ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//else print $langs->trans("NoSalesRepresentativeAffected");
|
//else print $langs->trans("NoSalesRepresentativeAffected");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print ' ';
|
print ' ';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
// Date start
|
// Date start
|
||||||
if (! empty($arrayfields['p.dateo']['checked']))
|
if (! empty($arrayfields['p.dateo']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print dol_print_date($db->jdate($obj->date_start),'day');
|
print dol_print_date($db->jdate($obj->date_start),'day');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
// Date end
|
// Date end
|
||||||
if (! empty($arrayfields['p.datee']['checked']))
|
if (! empty($arrayfields['p.datee']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print dol_print_date($db->jdate($obj->date_end),'day');
|
print dol_print_date($db->jdate($obj->date_end),'day');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
// Visibility
|
// Visibility
|
||||||
if (! empty($arrayfields['p.public']['checked']))
|
if (! empty($arrayfields['p.public']['checked']))
|
||||||
{
|
{
|
||||||
print '<td align="left">';
|
print '<td align="left">';
|
||||||
if ($obj->public) print $langs->trans('SharedProject');
|
if ($obj->public) print $langs->trans('SharedProject');
|
||||||
else print $langs->trans('PrivateProject');
|
else print $langs->trans('PrivateProject');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
// Opp Status
|
// Opp Status
|
||||||
if (! empty($arrayfields['p.fk_opp_status']['checked']))
|
if (! empty($arrayfields['p.fk_opp_status']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
if ($obj->opp_status_code) print $langs->trans("OppStatusShort".$obj->opp_status_code);
|
if ($obj->opp_status_code) print $langs->trans("OppStatusShort".$obj->opp_status_code);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
// Opp Amount
|
// Opp Amount
|
||||||
if (! empty($arrayfields['p.opp_amount']['checked']))
|
if (! empty($arrayfields['p.opp_amount']['checked']))
|
||||||
{
|
{
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
//if ($obj->opp_status_code)
|
//if ($obj->opp_status_code)
|
||||||
if (strcmp($obj->opp_amount,''))
|
if (strcmp($obj->opp_amount,''))
|
||||||
{
|
{
|
||||||
print price($obj->opp_amount, 1, $langs, 1, -1, -1, '');
|
print price($obj->opp_amount, 1, $langs, 1, -1, -1, '');
|
||||||
$totalarray['totalopp'] += $obj->opp_amount;
|
$totalarray['totalopp'] += $obj->opp_amount;
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
if (! $i) $totalarray['totaloppfield']=$totalarray['nbfield'];
|
if (! $i) $totalarray['totaloppfield']=$totalarray['nbfield'];
|
||||||
}
|
}
|
||||||
// Opp percent
|
// Opp percent
|
||||||
if (! empty($arrayfields['p.opp_percent']['checked']))
|
if (! empty($arrayfields['p.opp_percent']['checked']))
|
||||||
{
|
{
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
if ($obj->opp_percent) print price($obj->opp_percent, 1, $langs, 1, 0).'%';
|
if ($obj->opp_percent) print price($obj->opp_percent, 1, $langs, 1, 0).'%';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
// Budget
|
// Budget
|
||||||
if (! empty($arrayfields['p.budget_amount']['checked']))
|
if (! empty($arrayfields['p.budget_amount']['checked']))
|
||||||
{
|
{
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
if ($obj->budget_amount != '')
|
if ($obj->budget_amount != '')
|
||||||
{
|
{
|
||||||
print price($obj->budget_amount, 1, $langs, 1, -1, -1);
|
print price($obj->budget_amount, 1, $langs, 1, -1, -1);
|
||||||
$totalarray['totalbudget'] += $obj->budget_amount;
|
$totalarray['totalbudget'] += $obj->budget_amount;
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
if (! $i) $totalarray['totalbudgetfield']=$totalarray['nbfield'];
|
if (! $i) $totalarray['totalbudgetfield']=$totalarray['nbfield'];
|
||||||
}
|
}
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||||
{
|
{
|
||||||
print '<td';
|
print '<td';
|
||||||
$align=$extrafields->getAlignFlag($key);
|
$align=$extrafields->getAlignFlag($key);
|
||||||
if ($align) print ' align="'.$align.'"';
|
if ($align) print ' align="'.$align.'"';
|
||||||
print '>';
|
print '>';
|
||||||
$tmpkey='options_'.$key;
|
$tmpkey='options_'.$key;
|
||||||
print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1);
|
print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Fields from hook
|
// Fields from hook
|
||||||
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||||
@ -845,34 +845,34 @@ while ($i < min($num,$limit))
|
|||||||
// Date creation
|
// Date creation
|
||||||
if (! empty($arrayfields['p.datec']['checked']))
|
if (! empty($arrayfields['p.datec']['checked']))
|
||||||
{
|
{
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print dol_print_date($db->jdate($obj->date_creation), 'dayhour');
|
print dol_print_date($db->jdate($obj->date_creation), 'dayhour');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
// Date modification
|
// Date modification
|
||||||
if (! empty($arrayfields['p.tms']['checked']))
|
if (! empty($arrayfields['p.tms']['checked']))
|
||||||
{
|
{
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print dol_print_date($db->jdate($obj->date_update), 'dayhour');
|
print dol_print_date($db->jdate($obj->date_update), 'dayhour');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
// Status
|
// Status
|
||||||
if (! empty($arrayfields['p.fk_statut']['checked']))
|
if (! empty($arrayfields['p.fk_statut']['checked']))
|
||||||
{
|
{
|
||||||
print '<td align="right">'.$object->getLibStatut(5).'</td>';
|
print '<td align="right">'.$object->getLibStatut(5).'</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
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
|
||||||
{
|
{
|
||||||
$selected=0;
|
$selected=0;
|
||||||
if (in_array($obj->id, $arrayofselected)) $selected=1;
|
if (in_array($obj->id, $arrayofselected)) $selected=1;
|
||||||
print '<input id="cb'.$obj->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.'"'.($selected?' checked="checked"':'').'>';
|
print '<input id="cb'.$obj->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.'"'.($selected?' checked="checked"':'').'>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@ -885,21 +885,21 @@ while ($i < min($num,$limit))
|
|||||||
// Show total line
|
// Show total line
|
||||||
if (isset($totalarray['totaloppfield']) || isset($totalarray['totalbudgetfield']))
|
if (isset($totalarray['totaloppfield']) || isset($totalarray['totalbudgetfield']))
|
||||||
{
|
{
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
$i=0;
|
$i=0;
|
||||||
while ($i < $totalarray['nbfield'])
|
while ($i < $totalarray['nbfield'])
|
||||||
{
|
{
|
||||||
$i++;
|
$i++;
|
||||||
if ($i == 1)
|
if ($i == 1)
|
||||||
{
|
{
|
||||||
if ($num < $limit && empty($offset)) print '<td align="left">'.$langs->trans("Total").'</td>';
|
if ($num < $limit && empty($offset)) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||||
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||||
}
|
}
|
||||||
elseif ($totalarray['totaloppfield'] == $i) print '<td align="right">'.price($totalarray['totalopp'], 1, $langs, 1, -1, -1).'</td>';
|
elseif ($totalarray['totaloppfield'] == $i) print '<td align="right">'.price($totalarray['totalopp'], 1, $langs, 1, -1, -1).'</td>';
|
||||||
elseif ($totalarray['totalbudgetfield'] == $i) print '<td align="right">'.price($totalarray['totalbudget'], 1, $langs, 1, -1, -1).'</td>';
|
elseif ($totalarray['totalbudgetfield'] == $i) print '<td align="right">'.price($totalarray['totalbudget'], 1, $langs, 1, -1, -1).'</td>';
|
||||||
else print '<td></td>';
|
else print '<td></td>';
|
||||||
}
|
}
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
|
|||||||
@ -115,11 +115,11 @@ if (! isset($conf->global->THEME_ELDY_TEXTLINK)) $conf->global->THEME_ELDY_TEXTL
|
|||||||
// Case of option editable only if option THEME_ELDY_ENABLE_PERSONALIZED is on
|
// Case of option editable only if option THEME_ELDY_ENABLE_PERSONALIZED is on
|
||||||
if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED))
|
if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED))
|
||||||
{
|
{
|
||||||
$conf->global->THEME_ELDY_BACKTABCARD1='255,255,255'; // card
|
$conf->global->THEME_ELDY_BACKTABCARD1='255,255,255'; // card
|
||||||
$conf->global->THEME_ELDY_BACKTABACTIVE='234,234,234';
|
$conf->global->THEME_ELDY_BACKTABACTIVE='234,234,234';
|
||||||
$conf->global->THEME_ELDY_TEXT='0,0,0';
|
$conf->global->THEME_ELDY_TEXT='0,0,0';
|
||||||
$conf->global->THEME_ELDY_FONT_SIZE1='13';
|
$conf->global->THEME_ELDY_FONT_SIZE1='13';
|
||||||
$conf->global->THEME_ELDY_FONT_SIZE2='12';
|
$conf->global->THEME_ELDY_FONT_SIZE2='12';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Case of option availables only if THEME_ELDY_ENABLE_PERSONALIZED is on
|
// Case of option availables only if THEME_ELDY_ENABLE_PERSONALIZED is on
|
||||||
@ -145,7 +145,7 @@ $fontsizesmaller =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty(
|
|||||||
$colorbacklinepairhover=((! isset($conf->global->THEME_ELDY_USE_HOVER) || (string) $conf->global->THEME_ELDY_USE_HOVER === '0')?'':($conf->global->THEME_ELDY_USE_HOVER === '1'?'edf4fb':$conf->global->THEME_ELDY_USE_HOVER));
|
$colorbacklinepairhover=((! isset($conf->global->THEME_ELDY_USE_HOVER) || (string) $conf->global->THEME_ELDY_USE_HOVER === '0')?'':($conf->global->THEME_ELDY_USE_HOVER === '1'?'edf4fb':$conf->global->THEME_ELDY_USE_HOVER));
|
||||||
if (! empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED))
|
if (! empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED))
|
||||||
{
|
{
|
||||||
$colorbacklinepairhover=((! isset($user->conf->THEME_ELDY_USE_HOVER) || $user->conf->THEME_ELDY_USE_HOVER === '0')?'':($user->conf->THEME_ELDY_USE_HOVER === '1'?'edf4fb':$user->conf->THEME_ELDY_USE_HOVER));
|
$colorbacklinepairhover=((! isset($user->conf->THEME_ELDY_USE_HOVER) || $user->conf->THEME_ELDY_USE_HOVER === '0')?'':($user->conf->THEME_ELDY_USE_HOVER === '1'?'edf4fb':$user->conf->THEME_ELDY_USE_HOVER));
|
||||||
}
|
}
|
||||||
|
|
||||||
//$colortopbordertitle1=$colorbackhmenu1;
|
//$colortopbordertitle1=$colorbackhmenu1;
|
||||||
@ -167,9 +167,9 @@ $colorbacktitle1=join(',',colorStringToArray($colorbacktitle1)); // Normalize
|
|||||||
$tmppart=explode(',',$colorbacktitle1);
|
$tmppart=explode(',',$colorbacktitle1);
|
||||||
if ($colortexttitle == '')
|
if ($colortexttitle == '')
|
||||||
{
|
{
|
||||||
$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0);
|
$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0);
|
||||||
if ($tmpval <= 460) { $colortexttitle='FFFFFF'; $colorshadowtitle='888888'; }
|
if ($tmpval <= 460) { $colortexttitle='FFFFFF'; $colorshadowtitle='888888'; }
|
||||||
else { $colortexttitle='000000'; $colorshadowtitle='FFFFFF'; }
|
else { $colortexttitle='000000'; $colorshadowtitle='FFFFFF'; }
|
||||||
}
|
}
|
||||||
|
|
||||||
$colorbacktabcard1=join(',',colorStringToArray($colorbacktabcard1)); // Normalize value to 'x,y,z'
|
$colorbacktabcard1=join(',',colorStringToArray($colorbacktabcard1)); // Normalize value to 'x,y,z'
|
||||||
|
|||||||
3190
htdocs/user/card.php
3190
htdocs/user/card.php
File diff suppressed because it is too large
Load Diff
@ -53,17 +53,17 @@ class User extends CommonObject
|
|||||||
public $job;
|
public $job;
|
||||||
public $signature;
|
public $signature;
|
||||||
public $address;
|
public $address;
|
||||||
public $zip;
|
public $zip;
|
||||||
public $town;
|
public $town;
|
||||||
public $state_id;
|
public $state_id;
|
||||||
public $state_code;
|
public $state_code;
|
||||||
public $state;
|
public $state;
|
||||||
public $office_phone;
|
public $office_phone;
|
||||||
public $office_fax;
|
public $office_fax;
|
||||||
public $user_mobile;
|
public $user_mobile;
|
||||||
public $admin;
|
public $admin;
|
||||||
public $login;
|
public $login;
|
||||||
public $api_key;
|
public $api_key;
|
||||||
public $entity;
|
public $entity;
|
||||||
|
|
||||||
//! Clear password in memory
|
//! Clear password in memory
|
||||||
@ -202,22 +202,22 @@ class User extends CommonObject
|
|||||||
$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.= " 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";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON u.fk_country = c.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON u.fk_country = c.rowid";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d ON u.fk_state = d.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d ON u.fk_state = d.rowid";
|
||||||
|
|
||||||
if ($entity < 0)
|
if ($entity < 0)
|
||||||
{
|
{
|
||||||
if ((empty($conf->multicompany->enabled) || empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) && (! empty($user->entity)))
|
if ((empty($conf->multicompany->enabled) || empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) && (! empty($user->entity)))
|
||||||
{
|
{
|
||||||
$sql.= " WHERE u.entity IN (0,".$conf->entity.")";
|
$sql.= " WHERE u.entity IN (0,".$conf->entity.")";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sql.= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database
|
$sql.= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // The fetch was forced on an entity
|
else // The fetch was forced on an entity
|
||||||
{
|
{
|
||||||
@ -266,19 +266,19 @@ class User extends CommonObject
|
|||||||
$this->pass_indatabase_crypted = $obj->pass_crypted;
|
$this->pass_indatabase_crypted = $obj->pass_crypted;
|
||||||
$this->pass = $obj->pass;
|
$this->pass = $obj->pass;
|
||||||
$this->pass_temp = $obj->pass_temp;
|
$this->pass_temp = $obj->pass_temp;
|
||||||
$this->api_key = $obj->api_key;
|
$this->api_key = $obj->api_key;
|
||||||
|
|
||||||
$this->address = $obj->address;
|
$this->address = $obj->address;
|
||||||
$this->zip = $obj->zip;
|
$this->zip = $obj->zip;
|
||||||
$this->town = $obj->town;
|
$this->town = $obj->town;
|
||||||
|
|
||||||
$this->country_id = $obj->country_id;
|
$this->country_id = $obj->country_id;
|
||||||
$this->country_code = $obj->country_id?$obj->country_code:'';
|
$this->country_code = $obj->country_id?$obj->country_code:'';
|
||||||
//$this->country = $obj->country_id?($langs->trans('Country'.$obj->country_code)!='Country'.$obj->country_code?$langs->transnoentities('Country'.$obj->country_code):$obj->country):'';
|
//$this->country = $obj->country_id?($langs->trans('Country'.$obj->country_code)!='Country'.$obj->country_code?$langs->transnoentities('Country'.$obj->country_code):$obj->country):'';
|
||||||
|
|
||||||
$this->state_id = $obj->state_id;
|
$this->state_id = $obj->state_id;
|
||||||
$this->state_code = $obj->state_code;
|
$this->state_code = $obj->state_code;
|
||||||
$this->state = ($obj->state!='-'?$obj->state:'');
|
$this->state = ($obj->state!='-'?$obj->state:'');
|
||||||
|
|
||||||
$this->office_phone = $obj->office_phone;
|
$this->office_phone = $obj->office_phone;
|
||||||
$this->office_fax = $obj->office_fax;
|
$this->office_fax = $obj->office_fax;
|
||||||
@ -349,7 +349,7 @@ class User extends CommonObject
|
|||||||
// To get back the global configuration unique to the user
|
// To get back the global configuration unique to the user
|
||||||
if ($loadpersonalconf)
|
if ($loadpersonalconf)
|
||||||
{
|
{
|
||||||
// Load user->conf for user
|
// Load user->conf for user
|
||||||
$sql = "SELECT param, value FROM ".MAIN_DB_PREFIX."user_param";
|
$sql = "SELECT param, value FROM ".MAIN_DB_PREFIX."user_param";
|
||||||
$sql.= " WHERE fk_user = ".$this->id;
|
$sql.= " WHERE fk_user = ".$this->id;
|
||||||
$sql.= " AND entity = ".$conf->entity;
|
$sql.= " AND entity = ".$conf->entity;
|
||||||
@ -382,35 +382,35 @@ class User extends CommonObject
|
|||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
while ($obj = $this->db->fetch_object($resql))
|
while ($obj = $this->db->fetch_object($resql))
|
||||||
{
|
{
|
||||||
if (! empty($obj->page) && ! empty($obj->type) && ! empty($obj->param))
|
if (! empty($obj->page) && ! empty($obj->type) && ! empty($obj->param))
|
||||||
{
|
{
|
||||||
// $obj->page is relative URL with or without params
|
// $obj->page is relative URL with or without params
|
||||||
// $obj->type can be 'filters', 'sortorder', 'createform', ...
|
// $obj->type can be 'filters', 'sortorder', 'createform', ...
|
||||||
// $obj->param is key or param
|
// $obj->param is key or param
|
||||||
$pagewithoutquerystring=$obj->page;
|
$pagewithoutquerystring=$obj->page;
|
||||||
$pagequeries='';
|
$pagequeries='';
|
||||||
if (preg_match('/^([^\?]+)\?(.*)$/', $pagewithoutquerystring, $reg)) // There is query param
|
if (preg_match('/^([^\?]+)\?(.*)$/', $pagewithoutquerystring, $reg)) // There is query param
|
||||||
{
|
{
|
||||||
$pagewithoutquerystring=$reg[1];
|
$pagewithoutquerystring=$reg[1];
|
||||||
$pagequeries=$reg[2];
|
$pagequeries=$reg[2];
|
||||||
}
|
}
|
||||||
$this->default_values[$pagewithoutquerystring][$obj->type][$pagequeries?$pagequeries:'_noquery_'][$obj->param]=$obj->value;
|
$this->default_values[$pagewithoutquerystring][$obj->type][$pagequeries?$pagequeries:'_noquery_'][$obj->param]=$obj->value;
|
||||||
//if ($pagequeries) $this->default_values[$pagewithoutquerystring][$obj->type.'_queries']=$pagequeries;
|
//if ($pagequeries) $this->default_values[$pagewithoutquerystring][$obj->type.'_queries']=$pagequeries;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Sort by key, so _noquery_ is last
|
// Sort by key, so _noquery_ is last
|
||||||
if(!empty($this->default_values)) {
|
if(!empty($this->default_values)) {
|
||||||
foreach($this->default_values as $a => $b)
|
foreach($this->default_values as $a => $b)
|
||||||
{
|
{
|
||||||
foreach($b as $c => $d)
|
foreach($b as $c => $d)
|
||||||
{
|
{
|
||||||
krsort($this->default_values[$a][$c]);
|
krsort($this->default_values[$a][$c]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -429,7 +429,7 @@ class User extends CommonObject
|
|||||||
* @param string $allmodule Ajouter tous les droits du module allmodule
|
* @param string $allmodule Ajouter tous les droits du module allmodule
|
||||||
* @param string $allperms Ajouter tous les droits du module allmodule, perms allperms
|
* @param string $allperms Ajouter tous les droits du module allmodule, perms allperms
|
||||||
* @param int $entity Entity to use
|
* @param int $entity Entity to use
|
||||||
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
|
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
|
||||||
* @return int > 0 if OK, < 0 if KO
|
* @return int > 0 if OK, < 0 if KO
|
||||||
*/
|
*/
|
||||||
function addrights($rid, $allmodule='', $allperms='', $entity=0, $notrigger=0)
|
function addrights($rid, $allmodule='', $allperms='', $entity=0, $notrigger=0)
|
||||||
@ -515,12 +515,12 @@ class User extends CommonObject
|
|||||||
|
|
||||||
if (! $error && ! $notrigger)
|
if (! $error && ! $notrigger)
|
||||||
{
|
{
|
||||||
$this->context = array('audit'=>$langs->trans("PermissionsAdd"));
|
$this->context = array('audit'=>$langs->trans("PermissionsAdd"));
|
||||||
|
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('USER_MODIFY',$user);
|
$result=$this->call_trigger('USER_MODIFY',$user);
|
||||||
if ($result < 0) { $error++; }
|
if ($result < 0) { $error++; }
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($error) {
|
if ($error) {
|
||||||
@ -542,7 +542,7 @@ class User extends CommonObject
|
|||||||
* @param string $allmodule Retirer tous les droits du module allmodule
|
* @param string $allmodule Retirer tous les droits du module allmodule
|
||||||
* @param string $allperms Retirer tous les droits du module allmodule, perms allperms
|
* @param string $allperms Retirer tous les droits du module allmodule, perms allperms
|
||||||
* @param int $entity Entity to use
|
* @param int $entity Entity to use
|
||||||
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
|
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
|
||||||
* @return int > 0 if OK, < 0 if OK
|
* @return int > 0 if OK, < 0 if OK
|
||||||
*/
|
*/
|
||||||
function delrights($rid, $allmodule='', $allperms='', $entity=0, $notrigger=0)
|
function delrights($rid, $allmodule='', $allperms='', $entity=0, $notrigger=0)
|
||||||
@ -625,12 +625,12 @@ class User extends CommonObject
|
|||||||
|
|
||||||
if (! $error && ! $notrigger)
|
if (! $error && ! $notrigger)
|
||||||
{
|
{
|
||||||
$this->context = array('audit'=>$langs->trans("PermissionsDelete"));
|
$this->context = array('audit'=>$langs->trans("PermissionsDelete"));
|
||||||
|
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('USER_MODIFY',$user);
|
$result=$this->call_trigger('USER_MODIFY',$user);
|
||||||
if ($result < 0) { $error++; }
|
if ($result < 0) { $error++; }
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($error) {
|
if ($error) {
|
||||||
@ -840,10 +840,10 @@ class User extends CommonObject
|
|||||||
dol_syslog(get_class($this)."::setstatus", LOG_DEBUG);
|
dol_syslog(get_class($this)."::setstatus", LOG_DEBUG);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('USER_ENABLEDISABLE',$user);
|
$result=$this->call_trigger('USER_ENABLEDISABLE',$user);
|
||||||
if ($result < 0) { $error++; }
|
if ($result < 0) { $error++; }
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($error)
|
if ($error)
|
||||||
@ -926,7 +926,7 @@ class User extends CommonObject
|
|||||||
if (! $error && ! $this->db->query($sql))
|
if (! $error && ! $this->db->query($sql))
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$this->error = $this->db->lasterror();
|
$this->error = $this->db->lasterror();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove group
|
// Remove group
|
||||||
@ -934,7 +934,7 @@ class User extends CommonObject
|
|||||||
if (! $error && ! $this->db->query($sql))
|
if (! $error && ! $this->db->query($sql))
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$this->error = $this->db->lasterror();
|
$this->error = $this->db->lasterror();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If contact, remove link
|
// If contact, remove link
|
||||||
@ -944,44 +944,44 @@ class User extends CommonObject
|
|||||||
if (! $error && ! $this->db->query($sql))
|
if (! $error && ! $this->db->query($sql))
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$this->error = $this->db->lasterror();
|
$this->error = $this->db->lasterror();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove extrafields
|
// Remove extrafields
|
||||||
if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
|
if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
|
||||||
{
|
{
|
||||||
$result=$this->deleteExtraFields();
|
$result=$this->deleteExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
|
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove user
|
// Remove user
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."user WHERE rowid = ".$this->id;
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."user WHERE rowid = ".$this->id;
|
||||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||||
if (! $this->db->query($sql))
|
if (! $this->db->query($sql))
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$this->error = $this->db->lasterror();
|
$this->error = $this->db->lasterror();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('USER_DELETE',$user);
|
$result=$this->call_trigger('USER_DELETE',$user);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
// End call triggers
|
// End call triggers
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
@ -1089,10 +1089,10 @@ class User extends CommonObject
|
|||||||
|
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('USER_CREATE',$user);
|
$result=$this->call_trigger('USER_CREATE',$user);
|
||||||
if ($result < 0) { $error++; }
|
if ($result < 0) { $error++; }
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -1145,7 +1145,7 @@ class User extends CommonObject
|
|||||||
$this->firstname = $contact->firstname;
|
$this->firstname = $contact->firstname;
|
||||||
$this->gender = $contact->gender;
|
$this->gender = $contact->gender;
|
||||||
$this->email = $contact->email;
|
$this->email = $contact->email;
|
||||||
$this->skype = $contact->skype;
|
$this->skype = $contact->skype;
|
||||||
$this->office_phone = $contact->phone_pro;
|
$this->office_phone = $contact->phone_pro;
|
||||||
$this->office_fax = $contact->fax;
|
$this->office_fax = $contact->fax;
|
||||||
$this->user_mobile = $contact->phone_mobile;
|
$this->user_mobile = $contact->phone_mobile;
|
||||||
@ -1154,7 +1154,7 @@ class User extends CommonObject
|
|||||||
$this->town = $contact->town;
|
$this->town = $contact->town;
|
||||||
$this->state_id = $contact->state_id;
|
$this->state_id = $contact->state_id;
|
||||||
$this->country_id = $contact->country_id;
|
$this->country_id = $contact->country_id;
|
||||||
$this->employee = 0;
|
$this->employee = 0;
|
||||||
|
|
||||||
if (empty($login)) $login=strtolower(substr($contact->firstname, 0, 4)) . strtolower(substr($contact->lastname, 0, 4));
|
if (empty($login)) $login=strtolower(substr($contact->firstname, 0, 4)) . strtolower(substr($contact->lastname, 0, 4));
|
||||||
$this->login = $login;
|
$this->login = $login;
|
||||||
@ -1176,10 +1176,10 @@ class User extends CommonObject
|
|||||||
{
|
{
|
||||||
$this->context['createfromcontact']='createfromcontact';
|
$this->context['createfromcontact']='createfromcontact';
|
||||||
|
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('USER_CREATE',$user);
|
$result=$this->call_trigger('USER_CREATE',$user);
|
||||||
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||||
// End call triggers
|
// End call triggers
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return $this->id;
|
return $this->id;
|
||||||
@ -1345,12 +1345,12 @@ class User extends CommonObject
|
|||||||
$this->gender = trim($this->gender);
|
$this->gender = trim($this->gender);
|
||||||
$this->birth = trim($this->birth);
|
$this->birth = trim($this->birth);
|
||||||
$this->pass = trim($this->pass);
|
$this->pass = trim($this->pass);
|
||||||
$this->api_key = trim($this->api_key);
|
$this->api_key = trim($this->api_key);
|
||||||
$this->address = $this->address?trim($this->address):trim($this->address);
|
$this->address = $this->address?trim($this->address):trim($this->address);
|
||||||
$this->zip = $this->zip?trim($this->zip):trim($this->zip);
|
$this->zip = $this->zip?trim($this->zip):trim($this->zip);
|
||||||
$this->town = $this->town?trim($this->town):trim($this->town);
|
$this->town = $this->town?trim($this->town):trim($this->town);
|
||||||
$this->state_id = trim($this->state_id);
|
$this->state_id = trim($this->state_id);
|
||||||
$this->country_id = ($this->country_id > 0)?$this->country_id:0;
|
$this->country_id = ($this->country_id > 0)?$this->country_id:0;
|
||||||
$this->office_phone = trim($this->office_phone);
|
$this->office_phone = trim($this->office_phone);
|
||||||
$this->office_fax = trim($this->office_fax);
|
$this->office_fax = trim($this->office_fax);
|
||||||
$this->user_mobile = trim($this->user_mobile);
|
$this->user_mobile = trim($this->user_mobile);
|
||||||
@ -1390,7 +1390,7 @@ class User extends CommonObject
|
|||||||
$sql.= ", firstname = '".$this->db->escape($this->firstname)."'";
|
$sql.= ", firstname = '".$this->db->escape($this->firstname)."'";
|
||||||
$sql.= ", employee = ".$this->employee;
|
$sql.= ", employee = ".$this->employee;
|
||||||
$sql.= ", login = '".$this->db->escape($this->login)."'";
|
$sql.= ", login = '".$this->db->escape($this->login)."'";
|
||||||
$sql.= ", api_key = ".($this->api_key ? "'".$this->db->escape($this->api_key)."'" : "null");
|
$sql.= ", api_key = ".($this->api_key ? "'".$this->db->escape($this->api_key)."'" : "null");
|
||||||
$sql.= ", gender = ".($this->gender != -1 ? "'".$this->db->escape($this->gender)."'" : "null"); // 'man' or 'woman'
|
$sql.= ", gender = ".($this->gender != -1 ? "'".$this->db->escape($this->gender)."'" : "null"); // 'man' or 'woman'
|
||||||
$sql.= ", birth=".(strval($this->birth)!='' ? "'".$this->db->idate($this->birth)."'" : 'null');
|
$sql.= ", birth=".(strval($this->birth)!='' ? "'".$this->db->idate($this->birth)."'" : 'null');
|
||||||
if (! empty($user->admin)) $sql.= ", admin = ".$this->admin; // admin flag can be set/unset only by an admin user
|
if (! empty($user->admin)) $sql.= ", admin = ".$this->admin; // admin flag can be set/unset only by an admin user
|
||||||
@ -1445,7 +1445,7 @@ class User extends CommonObject
|
|||||||
if ($this->fk_member > 0)
|
if ($this->fk_member > 0)
|
||||||
{
|
{
|
||||||
dol_syslog(get_class($this)."::update remove link with member. We will recreate it later", LOG_DEBUG);
|
dol_syslog(get_class($this)."::update remove link with member. We will recreate it later", LOG_DEBUG);
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member = NULL where fk_member = ".$this->fk_member;
|
$sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member = NULL where fk_member = ".$this->fk_member;
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (! $resql) { $this->error=$this->db->error(); $this->db->rollback(); return -5; }
|
if (! $resql) { $this->error=$this->db->error(); $this->db->rollback(); return -5; }
|
||||||
}
|
}
|
||||||
@ -1459,7 +1459,7 @@ class User extends CommonObject
|
|||||||
{
|
{
|
||||||
if ($this->fk_member > 0 && ! $nosyncmember)
|
if ($this->fk_member > 0 && ! $nosyncmember)
|
||||||
{
|
{
|
||||||
dol_syslog(get_class($this)."::update user is linked with a member. We try to update member too.", LOG_DEBUG);
|
dol_syslog(get_class($this)."::update user is linked with a member. We try to update member too.", LOG_DEBUG);
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||||
|
|
||||||
@ -1491,10 +1491,10 @@ class User extends CommonObject
|
|||||||
$adh->user_login=$this->login;
|
$adh->user_login=$this->login;
|
||||||
|
|
||||||
$result=$adh->update($user,0,1,0);
|
$result=$adh->update($user,0,1,0);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$this->error=$adh->error;
|
$this->error=$adh->error;
|
||||||
$this->errors=$adh->errors;
|
$this->errors=$adh->errors;
|
||||||
dol_syslog(get_class($this)."::update error after calling adh->update to sync it with user: ".$this->error, LOG_ERR);
|
dol_syslog(get_class($this)."::update error after calling adh->update to sync it with user: ".$this->error, LOG_ERR);
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
@ -1522,10 +1522,10 @@ class User extends CommonObject
|
|||||||
|
|
||||||
if (! $error && ! $notrigger)
|
if (! $error && ! $notrigger)
|
||||||
{
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('USER_MODIFY',$user);
|
$result=$this->call_trigger('USER_MODIFY',$user);
|
||||||
if ($result < 0) { $error++; }
|
if ($result < 0) { $error++; }
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -1612,11 +1612,11 @@ class User extends CommonObject
|
|||||||
// Mise a jour
|
// Mise a jour
|
||||||
if (! $changelater)
|
if (! $changelater)
|
||||||
{
|
{
|
||||||
if (! is_object($this->oldcopy)) $this->oldcopy = clone $this;
|
if (! is_object($this->oldcopy)) $this->oldcopy = clone $this;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."user";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."user";
|
||||||
$sql.= " SET pass_crypted = '".$this->db->escape($password_crypted)."',";
|
$sql.= " SET pass_crypted = '".$this->db->escape($password_crypted)."',";
|
||||||
$sql.= " pass_temp = null";
|
$sql.= " pass_temp = null";
|
||||||
if (! empty($conf->global->DATABASE_PWD_ENCRYPTED))
|
if (! empty($conf->global->DATABASE_PWD_ENCRYPTED))
|
||||||
@ -1669,10 +1669,10 @@ class User extends CommonObject
|
|||||||
|
|
||||||
if (! $error && ! $notrigger)
|
if (! $error && ! $notrigger)
|
||||||
{
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('USER_NEW_PASSWORD',$user);
|
$result=$this->call_trigger('USER_NEW_PASSWORD',$user);
|
||||||
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
@ -1680,13 +1680,13 @@ class User extends CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1791,19 +1791,19 @@ class User extends CommonObject
|
|||||||
dol_syslog(get_class($this)."::send_password changelater is on, url=".$url);
|
dol_syslog(get_class($this)."::send_password changelater is on, url=".$url);
|
||||||
}
|
}
|
||||||
|
|
||||||
$mailfile = new CMailFile(
|
$mailfile = new CMailFile(
|
||||||
$subject,
|
$subject,
|
||||||
$this->email,
|
$this->email,
|
||||||
$conf->notification->email_from,
|
$conf->notification->email_from,
|
||||||
$mesg,
|
$mesg,
|
||||||
array(),
|
array(),
|
||||||
array(),
|
array(),
|
||||||
array(),
|
array(),
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
0,
|
0,
|
||||||
$msgishtml
|
$msgishtml
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($mailfile->sendfile())
|
if ($mailfile->sendfile())
|
||||||
{
|
{
|
||||||
@ -1934,13 +1934,13 @@ class User extends CommonObject
|
|||||||
{
|
{
|
||||||
if (! $error && ! $notrigger)
|
if (! $error && ! $notrigger)
|
||||||
{
|
{
|
||||||
$this->newgroupid=$group; // deprecated. Remove this.
|
$this->newgroupid=$group; // deprecated. Remove this.
|
||||||
$this->context = array('audit'=>$langs->trans("UserSetInGroup"), 'newgroupid'=>$group);
|
$this->context = array('audit'=>$langs->trans("UserSetInGroup"), 'newgroupid'=>$group);
|
||||||
|
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('USER_MODIFY',$user);
|
$result=$this->call_trigger('USER_MODIFY',$user);
|
||||||
if ($result < 0) { $error++; }
|
if ($result < 0) { $error++; }
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -1989,13 +1989,13 @@ class User extends CommonObject
|
|||||||
{
|
{
|
||||||
if (! $error && ! $notrigger)
|
if (! $error && ! $notrigger)
|
||||||
{
|
{
|
||||||
$this->oldgroupid=$group; // deprecated. Remove this.
|
$this->oldgroupid=$group; // deprecated. Remove this.
|
||||||
$this->context = array('audit'=>$langs->trans("UserRemovedFromGroup"), 'oldgroupid'=>$group);
|
$this->context = array('audit'=>$langs->trans("UserRemovedFromGroup"), 'oldgroupid'=>$group);
|
||||||
|
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('USER_MODIFY',$user);
|
$result=$this->call_trigger('USER_MODIFY',$user);
|
||||||
if ($result < 0) { $error++; }
|
if ($result < 0) { $error++; }
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -2027,7 +2027,7 @@ class User extends CommonObject
|
|||||||
* @param int $width Width of image
|
* @param int $width Width of image
|
||||||
* @param int $height Height of image
|
* @param int $height Height of image
|
||||||
* @param string $cssclass Force a css class
|
* @param string $cssclass Force a css class
|
||||||
* @param string $imagesize 'mini', 'small' or '' (original)
|
* @param string $imagesize 'mini', 'small' or '' (original)
|
||||||
* @return string String with URL link
|
* @return string String with URL link
|
||||||
*/
|
*/
|
||||||
function getPhotoUrl($width, $height, $cssclass='', $imagesize='')
|
function getPhotoUrl($width, $height, $cssclass='', $imagesize='')
|
||||||
@ -2035,10 +2035,10 @@ class User extends CommonObject
|
|||||||
$result='';
|
$result='';
|
||||||
|
|
||||||
$result.='<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$this->id.'">';
|
$result.='<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$this->id.'">';
|
||||||
$result.=Form::showphoto('userphoto', $this, $width, $height, 0, $cssclass, $imagesize);
|
$result.=Form::showphoto('userphoto', $this, $width, $height, 0, $cssclass, $imagesize);
|
||||||
$result.='</a>';
|
$result.='</a>';
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2047,13 +2047,13 @@ class User extends CommonObject
|
|||||||
*
|
*
|
||||||
* @param int $withpictoimg Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto, -1=Include photo into link, -2=Only picto photo, -3=Only photo very small)
|
* @param int $withpictoimg Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto, -1=Include photo into link, -2=Only picto photo, -3=Only photo very small)
|
||||||
* @param string $option On what the link point to
|
* @param string $option On what the link point to
|
||||||
* @param integer $infologin Add complete info tooltip
|
* @param integer $infologin Add complete info tooltip
|
||||||
* @param integer $notooltip 1=Disable tooltip on picto and name
|
* @param integer $notooltip 1=Disable tooltip on picto and name
|
||||||
* @param int $maxlen Max length of visible user name
|
* @param int $maxlen Max length of visible user name
|
||||||
* @param int $hidethirdpartylogo Hide logo of thirdparty if user is external user
|
* @param int $hidethirdpartylogo Hide logo of thirdparty if user is external user
|
||||||
* @param string $mode ''=Show firstname and lastname, 'firstname'=Show only firstname, 'login'=Show login
|
* @param string $mode ''=Show firstname and lastname, 'firstname'=Show only firstname, 'login'=Show login
|
||||||
* @param string $morecss Add more css on link
|
* @param string $morecss Add more css on link
|
||||||
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||||
* @return string String with URL
|
* @return string String with URL
|
||||||
*/
|
*/
|
||||||
function getNomUrl($withpictoimg=0, $option='', $infologin=0, $notooltip=0, $maxlen=24, $hidethirdpartylogo=0, $mode='',$morecss='', $save_lastsearch_value=-1)
|
function getNomUrl($withpictoimg=0, $option='', $infologin=0, $notooltip=0, $maxlen=24, $hidethirdpartylogo=0, $mode='',$morecss='', $save_lastsearch_value=-1)
|
||||||
@ -2064,14 +2064,14 @@ class User extends CommonObject
|
|||||||
|
|
||||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpictoimg) $withpictoimg=0;
|
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpictoimg) $withpictoimg=0;
|
||||||
|
|
||||||
$result=''; $label='';
|
$result=''; $label='';
|
||||||
$link=''; $linkstart=''; $linkend='';
|
$link=''; $linkstart=''; $linkend='';
|
||||||
|
|
||||||
if (! empty($this->photo))
|
if (! empty($this->photo))
|
||||||
{
|
{
|
||||||
$label.= '<div class="photointooltip">';
|
$label.= '<div class="photointooltip">';
|
||||||
$label.= Form::showphoto('userphoto', $this, 80, 0, 0, 'photowithmargin photologintooltip', 'small', 0, 1);
|
$label.= Form::showphoto('userphoto', $this, 80, 0, 0, 'photowithmargin photologintooltip', 'small', 0, 1);
|
||||||
$label.= '</div><div style="clear: both;"></div>';
|
$label.= '</div><div style="clear: both;"></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$label.= '<div class="centpercent">';
|
$label.= '<div class="centpercent">';
|
||||||
@ -2148,20 +2148,20 @@ class User extends CommonObject
|
|||||||
$reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook > 0) $linkclose = $hookmanager->resPrint;
|
if ($reshook > 0) $linkclose = $hookmanager->resPrint;
|
||||||
|
|
||||||
$link.=$linkclose.'>';
|
$link.=$linkclose.'>';
|
||||||
$linkend='</a>';
|
$linkend='</a>';
|
||||||
|
|
||||||
//if ($withpictoimg == -1) $result.='<div class="nowrap">';
|
//if ($withpictoimg == -1) $result.='<div class="nowrap">';
|
||||||
$result.=$link;
|
$result.=$link;
|
||||||
if ($withpictoimg)
|
if ($withpictoimg)
|
||||||
{
|
{
|
||||||
$paddafterimage='';
|
$paddafterimage='';
|
||||||
if (abs($withpictoimg) == 1) $paddafterimage='style="margin-right: 3px;"';
|
if (abs($withpictoimg) == 1) $paddafterimage='style="margin-right: 3px;"';
|
||||||
// Only picto
|
// Only picto
|
||||||
if ($withpictoimg > 0) $picto='<!-- picto user --><div class="inline-block nopadding '.($morecss?' userimg'.$morecss:'').'">'.img_object('', 'user', $paddafterimage.' '.($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).'</div>';
|
if ($withpictoimg > 0) $picto='<!-- picto user --><div class="inline-block nopadding '.($morecss?' userimg'.$morecss:'').'">'.img_object('', 'user', $paddafterimage.' '.($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).'</div>';
|
||||||
// Picto must be a photo
|
// Picto must be a photo
|
||||||
else $picto='<!-- picto photo user --><div class="inline-block nopadding '.($morecss?' userimg'.$morecss:'').'"'.($paddafterimage?' '.$paddafterimage:'').'>'.Form::showphoto('userphoto', $this, 0, 0, 0, 'userphoto'.($withpictoimg==-3?'small':''), 'mini', 0, 1).'</div>';
|
else $picto='<!-- picto photo user --><div class="inline-block nopadding '.($morecss?' userimg'.$morecss:'').'"'.($paddafterimage?' '.$paddafterimage:'').'>'.Form::showphoto('userphoto', $this, 0, 0, 0, 'userphoto'.($withpictoimg==-3?'small':''), 'mini', 0, 1).'</div>';
|
||||||
$result.=$picto;
|
$result.=$picto;
|
||||||
}
|
}
|
||||||
if ($withpictoimg > -2 && $withpictoimg != 2)
|
if ($withpictoimg > -2 && $withpictoimg != 2)
|
||||||
{
|
{
|
||||||
@ -2421,7 +2421,7 @@ class User extends CommonObject
|
|||||||
$this->gender='man';
|
$this->gender='man';
|
||||||
$this->note='This is a note';
|
$this->note='This is a note';
|
||||||
$this->email='email@specimen.com';
|
$this->email='email@specimen.com';
|
||||||
$this->skype='tom.hanson';
|
$this->skype='tom.hanson';
|
||||||
$this->office_phone='0999999999';
|
$this->office_phone='0999999999';
|
||||||
$this->office_fax='0999999998';
|
$this->office_fax='0999999998';
|
||||||
$this->user_mobile='0999999997';
|
$this->user_mobile='0999999997';
|
||||||
@ -2722,8 +2722,8 @@ class User extends CommonObject
|
|||||||
$result = $this->build_path_from_id_user($key,0); // Process a branch from the root user key (this user has no parent)
|
$result = $this->build_path_from_id_user($key,0); // Process a branch from the root user key (this user has no parent)
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$this->error='ErrorLoopInHierarchy';
|
$this->error='ErrorLoopInHierarchy';
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2763,26 +2763,26 @@ class User extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function getAllChildIds($addcurrentuser=0)
|
function getAllChildIds($addcurrentuser=0)
|
||||||
{
|
{
|
||||||
$childids=array();
|
$childids=array();
|
||||||
|
|
||||||
if (isset($this->cache_childids[$this->id]))
|
if (isset($this->cache_childids[$this->id]))
|
||||||
{
|
{
|
||||||
$childids = $this->cache_childids[$this->id];
|
$childids = $this->cache_childids[$this->id];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Init this->users
|
// Init this->users
|
||||||
$this->get_full_tree();
|
$this->get_full_tree();
|
||||||
|
|
||||||
$idtoscan=$this->id;
|
$idtoscan=$this->id;
|
||||||
|
|
||||||
dol_syslog("Build childid for id = ".$idtoscan);
|
dol_syslog("Build childid for id = ".$idtoscan);
|
||||||
foreach($this->users as $id => $val)
|
foreach($this->users as $id => $val)
|
||||||
{
|
{
|
||||||
//var_dump($val['fullpath']);
|
//var_dump($val['fullpath']);
|
||||||
if (preg_match('/_'.$idtoscan.'_/', $val['fullpath'])) $childids[$val['id']]=$val['id'];
|
if (preg_match('/_'.$idtoscan.'_/', $val['fullpath'])) $childids[$val['id']]=$val['id'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->cache_childids[$this->id] = $childids;
|
$this->cache_childids[$this->id] = $childids;
|
||||||
|
|
||||||
if ($addcurrentuser) $childids[$this->id]=$this->id;
|
if ($addcurrentuser) $childids[$this->id]=$this->id;
|
||||||
@ -2823,7 +2823,7 @@ class User extends CommonObject
|
|||||||
return -1; // Should not happen. Protection against looping hierarchy
|
return -1; // Should not happen. Protection against looping hierarchy
|
||||||
}
|
}
|
||||||
$useridfound[]=$this->parentof[$cursor_user];
|
$useridfound[]=$this->parentof[$cursor_user];
|
||||||
$this->users[$id_user]['fullpath'] = '_'.$this->parentof[$cursor_user].$this->users[$id_user]['fullpath'];
|
$this->users[$id_user]['fullpath'] = '_'.$this->parentof[$cursor_user].$this->users[$id_user]['fullpath'];
|
||||||
$this->users[$id_user]['fullname'] = $this->users[$this->parentof[$cursor_user]]['lastname'].' >> '.$this->users[$id_user]['fullname'];
|
$this->users[$id_user]['fullname'] = $this->users[$this->parentof[$cursor_user]]['lastname'].' >> '.$this->users[$id_user]['fullname'];
|
||||||
$i++; $cursor_user=$this->parentof[$cursor_user];
|
$i++; $cursor_user=$this->parentof[$cursor_user];
|
||||||
}
|
}
|
||||||
@ -2853,39 +2853,39 @@ class User extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Charge indicateurs this->nb pour le tableau de bord
|
* Charge indicateurs this->nb pour le tableau de bord
|
||||||
*
|
*
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function load_state_board()
|
function load_state_board()
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$this->nb=array();
|
$this->nb=array();
|
||||||
|
|
||||||
$sql = "SELECT count(u.rowid) as nb";
|
$sql = "SELECT count(u.rowid) as nb";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||||
$sql.= " WHERE u.statut > 0";
|
$sql.= " WHERE u.statut > 0";
|
||||||
//$sql.= " AND employee != 0";
|
//$sql.= " AND employee != 0";
|
||||||
$sql.= " AND u.entity IN (".getEntity('user').")";
|
$sql.= " AND u.entity IN (".getEntity('user').")";
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
while ($obj=$this->db->fetch_object($resql))
|
while ($obj=$this->db->fetch_object($resql))
|
||||||
{
|
{
|
||||||
$this->nb["users"]=$obj->nb;
|
$this->nb["users"]=$obj->nb;
|
||||||
}
|
}
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->error();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a document onto disk according to template module.
|
* Create a document onto disk according to template module.
|
||||||
|
|||||||
@ -112,25 +112,25 @@ print '<table class="border" width="100%">';
|
|||||||
print '<tr><td class="titlefield">'.$langs->trans("Login").'</td>';
|
print '<tr><td class="titlefield">'.$langs->trans("Login").'</td>';
|
||||||
if ($object->ldap_sid)
|
if ($object->ldap_sid)
|
||||||
{
|
{
|
||||||
print '<td class="warning">'.$langs->trans("LoginAccountDisableInDolibarr").'</td>';
|
print '<td class="warning">'.$langs->trans("LoginAccountDisableInDolibarr").'</td>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<td>'.$object->login.'</td>';
|
print '<td>'.$object->login.'</td>';
|
||||||
}
|
}
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
if ($conf->global->LDAP_SERVER_TYPE == "activedirectory")
|
if ($conf->global->LDAP_SERVER_TYPE == "activedirectory")
|
||||||
{
|
{
|
||||||
$ldap = new Ldap();
|
$ldap = new Ldap();
|
||||||
$result = $ldap->connect_bind();
|
$result = $ldap->connect_bind();
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$userSID = $ldap->getObjectSid($object->login);
|
$userSID = $ldap->getObjectSid($object->login);
|
||||||
}
|
}
|
||||||
print '<tr><td class="valigntop">'.$langs->trans("SID").'</td>';
|
print '<tr><td class="valigntop">'.$langs->trans("SID").'</td>';
|
||||||
print '<td>'.$userSID.'</td>';
|
print '<td>'.$userSID.'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// LDAP DN
|
// LDAP DN
|
||||||
@ -160,7 +160,7 @@ print '<div class="tabsAction">';
|
|||||||
|
|
||||||
if ($conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap')
|
if ($conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap')
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a>';
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</div>\n";
|
print "</div>\n";
|
||||||
@ -184,32 +184,32 @@ $ldap=new Ldap();
|
|||||||
$result=$ldap->connect_bind();
|
$result=$ldap->connect_bind();
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$info=$object->_load_ldap_info();
|
$info=$object->_load_ldap_info();
|
||||||
$dn=$object->_load_ldap_dn($info,1);
|
$dn=$object->_load_ldap_dn($info,1);
|
||||||
$search = "(".$object->_load_ldap_dn($info,2).")";
|
$search = "(".$object->_load_ldap_dn($info,2).")";
|
||||||
$records = $ldap->getAttribute($dn,$search);
|
$records = $ldap->getAttribute($dn,$search);
|
||||||
|
|
||||||
//print_r($records);
|
//print_r($records);
|
||||||
|
|
||||||
// Affichage arbre
|
// Affichage arbre
|
||||||
if ((! is_numeric($records) || $records != 0) && (! isset($records['count']) || $records['count'] > 0))
|
if ((! is_numeric($records) || $records != 0) && (! isset($records['count']) || $records['count'] > 0))
|
||||||
{
|
{
|
||||||
if (! is_array($records))
|
if (! is_array($records))
|
||||||
{
|
{
|
||||||
print '<tr '.$bc[false].'><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>';
|
print '<tr '.$bc[false].'><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$result=show_ldap_content($records,0,$records['count'],true);
|
$result=show_ldap_content($records,0,$records['count'],true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<tr '.$bc[false].'><td colspan="2">'.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')</td></tr>';
|
print '<tr '.$bc[false].'><td colspan="2">'.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$ldap->unbind();
|
$ldap->unbind();
|
||||||
$ldap->close();
|
$ldap->close();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user