Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
a57fe329cb
36
ChangeLog
36
ChangeLog
@ -3,6 +3,7 @@ English Dolibarr ChangeLog
|
||||
--------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 7.0.0 compared to 6.0.* *****
|
||||
|
||||
For developers:
|
||||
@ -18,8 +19,43 @@ Following changes may create regressions for some external modules, but were nec
|
||||
* Some REST API to access the dictionary (country, town, ...) were moved into a common API.
|
||||
* Page bank/index.php and bank/bankentries.php were renamed into bank/list.php and bank/bankentries_list.php to
|
||||
follow page naming conventions (so default filter/sort order features can also work).
|
||||
* The trigger ORDER_SUPPLIER_STATUS_ONPROCESS was renamed ORDER_SUPPLIER_STATUS_ORDERED
|
||||
* The trigger ORDER_SUPPLIER_STATUS_RECEIVED_ALL was renamed ORDER_SUPPLIER_STATUS_RECEIVED_COMPLETELY
|
||||
|
||||
|
||||
***** ChangeLog for 6.0.2 compared to 6.0.1 *****
|
||||
FIX: #7148
|
||||
FIX: #7288
|
||||
FIX: #7366 renaming table with pgsql
|
||||
FIX: #7435 Can't add payment term
|
||||
FIX: #7461
|
||||
FIX: #7464
|
||||
FIX: #7471
|
||||
FIX: #7473 Mass update of vat rates and other bugs on localtax
|
||||
FIX: #7475
|
||||
FIX: #7486 Empty value for multicurrency rate must be forbidden
|
||||
FIX: #7490
|
||||
FIX: #7505
|
||||
FIX: #7510 Bug: extrafield content disappear when generate pdf within intervention
|
||||
FIX: #7514
|
||||
FIX: #7531 #7537
|
||||
FIX: #7541
|
||||
FIX: #7546
|
||||
FIX: #7550
|
||||
FIX: #7554
|
||||
FIX: #7567
|
||||
FIX: Accountancy export model for Agiris Isacompta
|
||||
FIX: Allow create shipping if STOCK_SUPPORTS_SERVICES option is enabled
|
||||
FIX: Bad preview on scroping when special file names
|
||||
FIX: Generation of invoice from bulk action "Bill Orders"
|
||||
FIX: Implementation of a Luracast recommandation for the REST api server (#7370)
|
||||
FIX: Missing space in request
|
||||
FIX: Only modified values must be modified
|
||||
FIX: replenish if line test GETPOST on line 0
|
||||
FIX: Stripe not working on live mode
|
||||
FIX: wrong basePath in the swagger view
|
||||
FIX: Implementation of a Luracast recommandation for the REST api server
|
||||
|
||||
***** ChangeLog for 6.0.1 compared to 6.0.* *****
|
||||
FIX: #7000 Dashboard link for late pending payment supplier invoices do not work
|
||||
FIX: #7325 Default VAT rate when editing template invoices is 0%
|
||||
|
||||
@ -15,7 +15,7 @@ then
|
||||
echo "This push local files to transifex for project $project."
|
||||
echo "Note: If you push a language file (not source), file will be skipped if transifex file is newer."
|
||||
echo " Using -f will overwrite translation but not memory."
|
||||
echo "Usage: ./dev/translation/txpush.sh (source|xx_XX|all) [-r dolibarr.file] [-f] [--no-interactive]"
|
||||
echo "Usage: ./dev/translation/txpush.sh (source|xx_XX|all) [-r ".$project.".file] [-f] [--no-interactive]"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
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")
|
||||
$elementList = array();
|
||||
// Must match ids defined into eldy.lib.php
|
||||
$sourceList = array(
|
||||
// Must match ids defined into eldy.lib.php
|
||||
$sourceList = array(
|
||||
'1' => $langs->trans('AccountingJournalType1'),
|
||||
'2' => $langs->trans('AccountingJournalType2'),
|
||||
'3' => $langs->trans('AccountingJournalType3'),
|
||||
@ -144,216 +144,217 @@ $elementList = array();
|
||||
|
||||
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
|
||||
if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
{
|
||||
$listfield=explode(',', str_replace(' ', '',$tabfield[$id]));
|
||||
$listfieldinsert=explode(',',$tabfieldinsert[$id]);
|
||||
$listfieldmodify=explode(',',$tabfieldinsert[$id]);
|
||||
$listfieldvalue=explode(',',$tabfieldvalue[$id]);
|
||||
$listfield=explode(',', str_replace(' ', '',$tabfield[$id]));
|
||||
$listfieldinsert=explode(',',$tabfieldinsert[$id]);
|
||||
$listfieldmodify=explode(',',$tabfieldinsert[$id]);
|
||||
$listfieldvalue=explode(',',$tabfieldvalue[$id]);
|
||||
|
||||
// Check that all fields are filled
|
||||
$ok=1;
|
||||
foreach ($listfield as $f => $value)
|
||||
{
|
||||
// Check that all fields are filled
|
||||
$ok=1;
|
||||
foreach ($listfield as $f => $value)
|
||||
{
|
||||
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label';
|
||||
if ($fieldnamekey == 'code') $fieldnamekey = 'Code';
|
||||
if ($fieldnamekey == 'code') $fieldnamekey = 'Code';
|
||||
if ($fieldnamekey == 'nature') $fieldnamekey = 'Nature';
|
||||
}
|
||||
// Other checks
|
||||
if (isset($_POST["code"]))
|
||||
{
|
||||
if ($_POST["code"]=='0')
|
||||
{
|
||||
$ok=0;
|
||||
setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors');
|
||||
}
|
||||
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
|
||||
}
|
||||
// Other checks
|
||||
if (isset($_POST["code"]))
|
||||
{
|
||||
if ($_POST["code"]=='0')
|
||||
{
|
||||
$ok=0;
|
||||
setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors');
|
||||
}
|
||||
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
|
||||
{
|
||||
$ok = 0;
|
||||
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br>';
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
// 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_buy"] <= 0) $_POST["accountancy_code_buy"]=''; // If empty, we force to null
|
||||
|
||||
// Si verif ok et action add, on ajoute la ligne
|
||||
if ($ok && GETPOST('actionadd'))
|
||||
{
|
||||
if ($tabrowid[$id])
|
||||
{
|
||||
// Recupere id libre pour insertion
|
||||
$newid=0;
|
||||
$sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id];
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$newid=($obj->newid + 1);
|
||||
// Si verif ok et action add, on ajoute la ligne
|
||||
if ($ok && GETPOST('actionadd'))
|
||||
{
|
||||
if ($tabrowid[$id])
|
||||
{
|
||||
// Recupere id libre pour insertion
|
||||
$newid=0;
|
||||
$sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id];
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$newid=($obj->newid + 1);
|
||||
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// Add new entry
|
||||
$sql = "INSERT INTO ".$tabname[$id]." (";
|
||||
// List of fields
|
||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
|
||||
$sql.= $tabrowid[$id].",";
|
||||
$sql.= $tabfieldinsert[$id];
|
||||
$sql.=",active)";
|
||||
$sql.= " VALUES(";
|
||||
// Add new entry
|
||||
$sql = "INSERT INTO ".$tabname[$id]." (";
|
||||
// List of fields
|
||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
|
||||
$sql.= $tabrowid[$id].",";
|
||||
$sql.= $tabfieldinsert[$id];
|
||||
$sql.=",active)";
|
||||
$sql.= " VALUES(";
|
||||
|
||||
// List of values
|
||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
|
||||
$sql.= $newid.",";
|
||||
$i=0;
|
||||
foreach ($listfieldinsert as $f => $value)
|
||||
{
|
||||
if ($value == 'entity') {
|
||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||
}
|
||||
if ($i) $sql.=",";
|
||||
if ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = ''
|
||||
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||
$i++;
|
||||
}
|
||||
$sql.=",1)";
|
||||
// List of values
|
||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
|
||||
$sql.= $newid.",";
|
||||
$i=0;
|
||||
foreach ($listfieldinsert as $f => $value)
|
||||
{
|
||||
if ($value == 'entity') {
|
||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||
}
|
||||
if ($i) $sql.=",";
|
||||
if ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = ''
|
||||
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||
$i++;
|
||||
}
|
||||
$sql.=",1)";
|
||||
|
||||
dol_syslog("actionadd", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) // Add is ok
|
||||
{
|
||||
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
|
||||
$_POST=array('id'=>$id); // Clean $_POST array, we keep only
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||
setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors');
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
dol_syslog("actionadd", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) // Add is ok
|
||||
{
|
||||
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
|
||||
$_POST=array('id'=>$id); // Clean $_POST array, we keep only
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||
setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors');
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Si verif ok et action modify, on modifie la ligne
|
||||
if ($ok && GETPOST('actionmodify'))
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||
else { $rowidcol="rowid"; }
|
||||
// Si verif ok et action modify, on modifie la ligne
|
||||
if ($ok && GETPOST('actionmodify'))
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||
else { $rowidcol="rowid"; }
|
||||
|
||||
// Modify entry
|
||||
$sql = "UPDATE ".$tabname[$id]." SET ";
|
||||
// Modifie valeur des champs
|
||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldmodify))
|
||||
{
|
||||
$sql.= $tabrowid[$id]."=";
|
||||
$sql.= "'".$db->escape($rowid)."', ";
|
||||
}
|
||||
$i = 0;
|
||||
foreach ($listfieldmodify as $field)
|
||||
{
|
||||
if ($field == 'price' || preg_match('/^amount/i',$field) || $field == 'taux') {
|
||||
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU');
|
||||
}
|
||||
else if ($field == 'entity') {
|
||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||
}
|
||||
if ($i) $sql.=",";
|
||||
$sql.= $field."=";
|
||||
if ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = ''
|
||||
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||
$i++;
|
||||
}
|
||||
$sql.= " WHERE ".$rowidcol." = '".$rowid."'";
|
||||
// Modify entry
|
||||
$sql = "UPDATE ".$tabname[$id]." SET ";
|
||||
// Modifie valeur des champs
|
||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldmodify))
|
||||
{
|
||||
$sql.= $tabrowid[$id]."=";
|
||||
$sql.= "'".$db->escape($rowid)."', ";
|
||||
}
|
||||
$i = 0;
|
||||
foreach ($listfieldmodify as $field)
|
||||
{
|
||||
if ($field == 'price' || preg_match('/^amount/i',$field) || $field == 'taux') {
|
||||
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU');
|
||||
}
|
||||
else if ($field == 'entity') {
|
||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||
}
|
||||
if ($i) $sql.=",";
|
||||
$sql.= $field."=";
|
||||
if ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = ''
|
||||
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||
$i++;
|
||||
}
|
||||
$sql.= " WHERE ".$rowidcol." = '".$rowid."'";
|
||||
|
||||
dol_syslog("actionmodify", LOG_DEBUG);
|
||||
//print $sql;
|
||||
$resql = $db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
setEventMessages($db->error(), null, 'errors');
|
||||
}
|
||||
}
|
||||
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
|
||||
dol_syslog("actionmodify", LOG_DEBUG);
|
||||
//print $sql;
|
||||
$resql = $db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
setEventMessages($db->error(), null, 'errors');
|
||||
}
|
||||
}
|
||||
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
|
||||
}
|
||||
|
||||
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 ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||
else { $rowidcol="rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||
else { $rowidcol="rowid"; }
|
||||
|
||||
$sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'";
|
||||
$sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'";
|
||||
|
||||
dol_syslog("delete", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if (! $result)
|
||||
{
|
||||
if ($db->errno() == 'DB_ERROR_CHILD_EXISTS')
|
||||
{
|
||||
setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
dol_syslog("delete", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if (! $result)
|
||||
{
|
||||
if ($db->errno() == 'DB_ERROR_CHILD_EXISTS')
|
||||
{
|
||||
setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// activate
|
||||
if ($action == $acts[0])
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||
else { $rowidcol="rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||
else { $rowidcol="rowid"; }
|
||||
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'";
|
||||
}
|
||||
elseif ($code) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".$code."'";
|
||||
}
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'";
|
||||
}
|
||||
elseif ($code) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".$code."'";
|
||||
}
|
||||
|
||||
$result = $db->query($sql);
|
||||
if (!$result)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
$result = $db->query($sql);
|
||||
if (!$result)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// disable
|
||||
if ($action == $acts[1])
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||
else { $rowidcol="rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||
else { $rowidcol="rowid"; }
|
||||
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'";
|
||||
}
|
||||
elseif ($code) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".$code."'";
|
||||
}
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'";
|
||||
}
|
||||
elseif ($code) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".$code."'";
|
||||
}
|
||||
|
||||
$result = $db->query($sql);
|
||||
if (!$result)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
$result = $db->query($sql);
|
||||
if (!$result)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -367,8 +368,8 @@ $titre=$langs->trans("DictionarySetup");
|
||||
$linkback='';
|
||||
if ($id)
|
||||
{
|
||||
$titre.=' - '.$langs->trans($tablib[$id]);
|
||||
$titlepicto='title_accountancy';
|
||||
$titre.=' - '.$langs->trans($tablib[$id]);
|
||||
$titlepicto='title_accountancy';
|
||||
}
|
||||
|
||||
print load_fiche_titre($titre,$linkback,$titlepicto);
|
||||
@ -377,7 +378,7 @@ print load_fiche_titre($titre,$linkback,$titlepicto);
|
||||
// Confirmation de la suppression de la ligne
|
||||
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);
|
||||
|
||||
@ -386,315 +387,315 @@ if ($action == 'delete')
|
||||
*/
|
||||
if ($id)
|
||||
{
|
||||
// Complete requete recherche valeurs avec critere de tri
|
||||
$sql=$tabsql[$id];
|
||||
// Complete requete recherche valeurs avec critere de tri
|
||||
$sql=$tabsql[$id];
|
||||
|
||||
if ($search_country_id > 0)
|
||||
{
|
||||
if (preg_match('/ WHERE /',$sql)) $sql.= " AND ";
|
||||
else $sql.=" WHERE ";
|
||||
$sql.= " c.rowid = ".$search_country_id;
|
||||
}
|
||||
if ($search_country_id > 0)
|
||||
{
|
||||
if (preg_match('/ WHERE /',$sql)) $sql.= " AND ";
|
||||
else $sql.=" WHERE ";
|
||||
$sql.= " c.rowid = ".$search_country_id;
|
||||
}
|
||||
|
||||
if ($sortfield)
|
||||
{
|
||||
// If sort order is "country", we use country_code instead
|
||||
if ($sortfield == 'country') $sortfield='country_code';
|
||||
$sql.= " ORDER BY ".$sortfield;
|
||||
if ($sortorder)
|
||||
{
|
||||
$sql.=" ".strtoupper($sortorder);
|
||||
}
|
||||
$sql.=", ";
|
||||
// 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.',/i','',$tabsqlsort[$id]);
|
||||
}
|
||||
else {
|
||||
$sql.=" ORDER BY ";
|
||||
}
|
||||
$sql.=$tabsqlsort[$id];
|
||||
$sql.=$db->plimit($listlimit+1,$offset);
|
||||
//print $sql;
|
||||
if ($sortfield)
|
||||
{
|
||||
// If sort order is "country", we use country_code instead
|
||||
if ($sortfield == 'country') $sortfield='country_code';
|
||||
$sql.= " ORDER BY ".$sortfield;
|
||||
if ($sortorder)
|
||||
{
|
||||
$sql.=" ".strtoupper($sortorder);
|
||||
}
|
||||
$sql.=", ";
|
||||
// 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.',/i','',$tabsqlsort[$id]);
|
||||
}
|
||||
else {
|
||||
$sql.=" ORDER BY ";
|
||||
}
|
||||
$sql.=$tabsqlsort[$id];
|
||||
$sql.=$db->plimit($listlimit+1,$offset);
|
||||
//print $sql;
|
||||
|
||||
$fieldlist=explode(',',$tabfield[$id]);
|
||||
$fieldlist=explode(',',$tabfield[$id]);
|
||||
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
// Form to add a new line
|
||||
if ($tabname[$id])
|
||||
{
|
||||
$alabelisused=0;
|
||||
$var=false;
|
||||
// Form to add a new line
|
||||
if ($tabname[$id])
|
||||
{
|
||||
$alabelisused=0;
|
||||
$var=false;
|
||||
|
||||
$fieldlist=explode(',',$tabfield[$id]);
|
||||
$fieldlist=explode(',',$tabfield[$id]);
|
||||
|
||||
// Line for title
|
||||
print '<tr class="liste_titre">';
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
// Determine le nom du champ par rapport aux noms possibles
|
||||
// dans les dictionnaires de donnees
|
||||
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
|
||||
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
||||
$align="left";
|
||||
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
|
||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label')
|
||||
{
|
||||
$valuetoshow=$langs->trans("Label");
|
||||
}
|
||||
if ($fieldlist[$field]=='nature') { $valuetoshow=$langs->trans("Nature"); }
|
||||
// Line for title
|
||||
print '<tr class="liste_titre">';
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
// Determine le nom du champ par rapport aux noms possibles
|
||||
// dans les dictionnaires de donnees
|
||||
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
|
||||
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
||||
$align="left";
|
||||
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
|
||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label')
|
||||
{
|
||||
$valuetoshow=$langs->trans("Label");
|
||||
}
|
||||
if ($fieldlist[$field]=='nature') { $valuetoshow=$langs->trans("Nature"); }
|
||||
|
||||
if ($valuetoshow != '')
|
||||
{
|
||||
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>';
|
||||
else if (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow,$tabhelp[$id][$value]);
|
||||
else print $valuetoshow;
|
||||
print '</td>';
|
||||
}
|
||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
|
||||
}
|
||||
if ($valuetoshow != '')
|
||||
{
|
||||
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>';
|
||||
else if (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow,$tabhelp[$id][$value]);
|
||||
else print $valuetoshow;
|
||||
print '</td>';
|
||||
}
|
||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
|
||||
}
|
||||
|
||||
print '<td>';
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
print '</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 '<td>';
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
print '</td>';
|
||||
print '<td style="min-width: 26px;"></td>';
|
||||
print '<td style="min-width: 26px;"></td>';
|
||||
print '<td style="min-width: 26px;"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Line to enter new values
|
||||
print '<tr class="oddeven nodrag nodrap nohover">';
|
||||
// Line to enter new values
|
||||
print '<tr class="oddeven nodrag nodrap nohover">';
|
||||
|
||||
$obj = new stdClass();
|
||||
// If data was already input, we define them in obj to populate input fields.
|
||||
if (GETPOST('actionadd'))
|
||||
{
|
||||
foreach ($fieldlist as $key=>$val)
|
||||
{
|
||||
if (GETPOST($val) != '')
|
||||
$obj->$val=GETPOST($val);
|
||||
}
|
||||
}
|
||||
$obj = new stdClass();
|
||||
// If data was already input, we define them in obj to populate input fields.
|
||||
if (GETPOST('actionadd'))
|
||||
{
|
||||
foreach ($fieldlist as $key=>$val)
|
||||
{
|
||||
if (GETPOST($val) != '')
|
||||
$obj->$val=GETPOST($val);
|
||||
}
|
||||
}
|
||||
|
||||
$tmpaction = 'create';
|
||||
$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
|
||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||
$tmpaction = 'create';
|
||||
$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
|
||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
fieldListJournal($fieldlist,$obj,$tabname[$id],'add');
|
||||
}
|
||||
if (empty($reshook))
|
||||
{
|
||||
fieldListJournal($fieldlist,$obj,$tabname[$id],'add');
|
||||
}
|
||||
|
||||
print '<td colspan="4" align="right">';
|
||||
print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';
|
||||
print '</td>';
|
||||
print "</tr>";
|
||||
print '<td colspan="4" align="right">';
|
||||
print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';
|
||||
print '</td>';
|
||||
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
|
||||
dol_syslog("htdocs/admin/dict", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
$var=true;
|
||||
// List of available record in database
|
||||
dol_syslog("htdocs/admin/dict", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
$var=true;
|
||||
|
||||
$param = '&id='.$id;
|
||||
if ($search_country_id > 0) $param.= '&search_country_id='.$search_country_id;
|
||||
$paramwithsearch = $param;
|
||||
if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder;
|
||||
if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield;
|
||||
if (GETPOST('from')) $paramwithsearch.= '&from='.GETPOST('from','alpha');
|
||||
$param = '&id='.$id;
|
||||
if ($search_country_id > 0) $param.= '&search_country_id='.$search_country_id;
|
||||
$paramwithsearch = $param;
|
||||
if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder;
|
||||
if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield;
|
||||
if (GETPOST('from')) $paramwithsearch.= '&from='.GETPOST('from','alpha');
|
||||
|
||||
// There is several pages
|
||||
if ($num > $listlimit)
|
||||
{
|
||||
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 '</td></tr>';
|
||||
}
|
||||
// There is several pages
|
||||
if ($num > $listlimit)
|
||||
{
|
||||
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 '</td></tr>';
|
||||
}
|
||||
|
||||
// Title of lines
|
||||
print '<tr class="liste_titre liste_titre_add">';
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
// Determine le nom du champ par rapport aux noms possibles
|
||||
// dans les dictionnaires de donnees
|
||||
$showfield=1; // By defaut
|
||||
$align="left";
|
||||
$sortable=1;
|
||||
$valuetoshow='';
|
||||
/*
|
||||
// Title line with search boxes
|
||||
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" align="center">';
|
||||
if ($filterfound)
|
||||
{
|
||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpicto;
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Title of lines
|
||||
print '<tr class="liste_titre">';
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
// Determine le nom du champ par rapport aux noms possibles
|
||||
// dans les dictionnaires de donnees
|
||||
$showfield=1; // By defaut
|
||||
$align="left";
|
||||
$sortable=1;
|
||||
$valuetoshow='';
|
||||
/*
|
||||
$tmparray=getLabelOfField($fieldlist[$field]);
|
||||
$showfield=$tmp['showfield'];
|
||||
$valuetoshow=$tmp['valuetoshow'];
|
||||
$align=$tmp['align'];
|
||||
$sortable=$tmp['sortable'];
|
||||
*/
|
||||
$valuetoshow=ucfirst($fieldlist[$field]); // By defaut
|
||||
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
||||
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
|
||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); }
|
||||
if ($fieldlist[$field]=='nature') { $valuetoshow=$langs->trans("Nature"); }
|
||||
$valuetoshow=ucfirst($fieldlist[$field]); // By defaut
|
||||
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
||||
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
|
||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); }
|
||||
if ($fieldlist[$field]=='nature') { $valuetoshow=$langs->trans("Nature"); }
|
||||
|
||||
// Affiche nom du champ
|
||||
if ($showfield)
|
||||
{
|
||||
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder);
|
||||
}
|
||||
}
|
||||
// Affiche nom du champ
|
||||
if ($showfield)
|
||||
{
|
||||
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('');
|
||||
print getTitleFieldOfList('');
|
||||
print getTitleFieldOfList('');
|
||||
print '</tr>';
|
||||
print getTitleFieldOfList('');
|
||||
print getTitleFieldOfList('');
|
||||
print getTitleFieldOfList('');
|
||||
print '</tr>';
|
||||
|
||||
// Title line with search boxes
|
||||
print '<tr class="liste_titre_filter">';
|
||||
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">';
|
||||
if ($filterfound)
|
||||
{
|
||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpicto;
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
if ($num)
|
||||
{
|
||||
// Lines with values
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
//print_r($obj);
|
||||
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
|
||||
if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code)))
|
||||
{
|
||||
$tmpaction='edit';
|
||||
$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
|
||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||
|
||||
if ($num)
|
||||
{
|
||||
// Lines with values
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
//print_r($obj);
|
||||
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
|
||||
if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code)))
|
||||
{
|
||||
$tmpaction='edit';
|
||||
$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
|
||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||
// Show fields
|
||||
if (empty($reshook)) fieldListJournal($fieldlist,$obj,$tabname[$id],'edit');
|
||||
|
||||
// Show fields
|
||||
if (empty($reshook)) fieldListJournal($fieldlist,$obj,$tabname[$id],'edit');
|
||||
print '<td align="center" colspan="4">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
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="actioncancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '<div name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"></div>';
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$tmpaction = 'view';
|
||||
$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
|
||||
|
||||
print '<td align="center" colspan="4">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
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="actioncancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '<div name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"></div>';
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$tmpaction = 'view';
|
||||
$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
|
||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||
|
||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||
if (empty($reshook))
|
||||
{
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
$showfield=1;
|
||||
$align="left";
|
||||
$valuetoshow=$obj->{$fieldlist[$field]};
|
||||
if ($valuetoshow=='all') {
|
||||
$valuetoshow=$langs->trans('All');
|
||||
}
|
||||
else if ($fieldlist[$field]=='nature' && $tabname[$id]==MAIN_DB_PREFIX.'accounting_journal') {
|
||||
$langs->load("accountancy");
|
||||
$key=$langs->trans("AccountingJournalType".strtoupper($obj->nature));
|
||||
$valuetoshow=($obj->nature && $key != "AccountingJournalType".strtoupper($obj->nature)?$key:$obj->{$fieldlist[$field]});
|
||||
}
|
||||
|
||||
$showfield=1;
|
||||
$align="left";
|
||||
$valuetoshow=$obj->{$fieldlist[$field]};
|
||||
if ($valuetoshow=='all') {
|
||||
$valuetoshow=$langs->trans('All');
|
||||
}
|
||||
else if ($fieldlist[$field]=='nature' && $tabname[$id]==MAIN_DB_PREFIX.'accounting_journal') {
|
||||
$langs->load("accountancy");
|
||||
$key=$langs->trans("AccountingJournalType".strtoupper($obj->nature));
|
||||
$valuetoshow=($obj->nature && $key != "AccountingJournalType".strtoupper($obj->nature)?$key:$obj->{$fieldlist[$field]});
|
||||
}
|
||||
|
||||
$class='tddict';
|
||||
$class='tddict';
|
||||
// Show value for field
|
||||
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Can an entry be erased or disabled ?
|
||||
$iserasable=1;$canbedisabled=1;$canbemodified=1; // true by default
|
||||
if (isset($obj->code) && $id != 10)
|
||||
{
|
||||
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 == 'EF0') { $iserasable = 0; $canbedisabled = 0; }
|
||||
}
|
||||
// Can an entry be erased or disabled ?
|
||||
$iserasable=1;$canbedisabled=1;$canbemodified=1; // true by default
|
||||
if (isset($obj->code) && $id != 10)
|
||||
{
|
||||
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 == '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):'');
|
||||
if ($param) $url .= '&'.$param;
|
||||
$url.='&';
|
||||
$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;
|
||||
$url.='&';
|
||||
|
||||
// Active
|
||||
print '<td align="center" class="nowrap">';
|
||||
if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
|
||||
else
|
||||
{
|
||||
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('system')) && ! empty($obj->active) && $obj->code != 'AC_OTH') print $langs->trans("UsedOnlyWithTypeOption");
|
||||
else print $langs->trans("AlwaysActive");
|
||||
}
|
||||
print "</td>";
|
||||
// Active
|
||||
print '<td align="center" class="nowrap">';
|
||||
if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
|
||||
else
|
||||
{
|
||||
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('system')) && ! empty($obj->active) && $obj->code != 'AC_OTH') print $langs->trans("UsedOnlyWithTypeOption");
|
||||
else print $langs->trans("AlwaysActive");
|
||||
}
|
||||
print "</td>";
|
||||
|
||||
// Modify link
|
||||
if ($canbemodified) print '<td align="center"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>';
|
||||
else print '<td> </td>';
|
||||
// Modify link
|
||||
if ($canbemodified) print '<td align="center"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>';
|
||||
else print '<td> </td>';
|
||||
|
||||
// Delete link
|
||||
if ($iserasable)
|
||||
{
|
||||
print '<td align="center">';
|
||||
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
|
||||
print '</td>';
|
||||
}
|
||||
else print '<td> </td>';
|
||||
// Delete link
|
||||
if ($iserasable)
|
||||
{
|
||||
print '<td align="center">';
|
||||
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
|
||||
print '</td>';
|
||||
}
|
||||
else print '<td> </td>';
|
||||
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
|
||||
print '</td>';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
print '<br>';
|
||||
|
||||
@ -100,9 +100,9 @@ $sql .= " WHERE f.fk_statut > 0"; // TODO Facture annulée ?
|
||||
$sql .= " AND fd.fk_code_ventilation > 0";
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql .= " AND f.type IN (" . FactureFournisseur::TYPE_STANDARD . "," . FactureFournisseur::TYPE_REPLACEMENT . "," . FactureFournisseur::TYPE_CREDIT_NOTE . "," . FactureFournisseur::TYPE_SITUATION . ")";
|
||||
$sql .= " AND f.type IN (" . FactureFournisseur::TYPE_STANDARD . "," . FactureFournisseur::TYPE_REPLACEMENT . "," . FactureFournisseur::TYPE_CREDIT_NOTE . "," . FactureFournisseur::TYPE_SITUATION . ")";
|
||||
} else {
|
||||
$sql .= " AND f.type IN (" . FactureFournisseur::TYPE_STANDARD . "," . FactureFournisseur::TYPE_REPLACEMENT . "," . FactureFournisseur::TYPE_CREDIT_NOTE . "," . FactureFournisseur::TYPE_DEPOSIT . "," . FactureFournisseur::TYPE_SITUATION . ")";
|
||||
$sql .= " AND f.type IN (" . FactureFournisseur::TYPE_STANDARD . "," . FactureFournisseur::TYPE_REPLACEMENT . "," . FactureFournisseur::TYPE_CREDIT_NOTE . "," . FactureFournisseur::TYPE_DEPOSIT . "," . FactureFournisseur::TYPE_SITUATION . ")";
|
||||
}
|
||||
if ($date_start && $date_end)
|
||||
$sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'";
|
||||
@ -277,7 +277,7 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->doc_type = 'supplier_invoice';
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
|
||||
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->numero_compte = $k;
|
||||
|
||||
@ -295,7 +295,7 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->doc_type = 'customer_invoice';
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||
$bookkeeping->thirdparty_code = $companystatic->code_client;
|
||||
$bookkeeping->thirdparty_code = $companystatic->code_client;
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->numero_compte = $k;
|
||||
@ -550,12 +550,12 @@ if (empty($action) || $action == 'view') {
|
||||
|
||||
// Button to write into Ledger
|
||||
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
|
||||
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
||||
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
||||
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||
}
|
||||
print '<div class="tabsAction tabsActionNoBottom">';
|
||||
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
|
||||
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
||||
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
||||
}
|
||||
else {
|
||||
print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
|
||||
@ -240,9 +240,9 @@ $constantes=array(
|
||||
print load_fiche_titre($langs->trans("MembersCards"),'','');
|
||||
|
||||
$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||
$helptext.='%DOL_MAIN_URL_ROOT%, %ID%, %FIRSTNAME%, %LASTNAME%, %FULLNAME%, %LOGIN%, %PASSWORD%, ';
|
||||
$helptext.='%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %BIRTH%, %PHOTO%, %TYPE%, ';
|
||||
$helptext.='%YEAR%, %MONTH%, %DAY%';
|
||||
$helptext.='__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
|
||||
$helptext.='__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
|
||||
$helptext.='__YEAR__, __MONTH__, __DAY__';
|
||||
|
||||
form_constantes($constantes, 0, $helptext);
|
||||
|
||||
@ -257,9 +257,9 @@ $constantes=array('ADHERENT_ETIQUETTE_TYPE','ADHERENT_ETIQUETTE_TEXT');
|
||||
print load_fiche_titre($langs->trans("MembersTickets"),'','');
|
||||
|
||||
$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||
$helptext.='%DOL_MAIN_URL_ROOT%, %ID%, %FIRSTNAME%, %LASTNAME%, %FULLNAME%, %LOGIN%, %PASSWORD%, ';
|
||||
$helptext.='%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %BIRTH%, %PHOTO%, %TYPE%, ';
|
||||
$helptext.='%YEAR%, %MONTH%, %DAY%';
|
||||
$helptext.='__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
|
||||
$helptext.='__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
|
||||
$helptext.='__YEAR__, __MONTH__, __DAY__';
|
||||
|
||||
form_constantes($constantes, 0, $helptext);
|
||||
|
||||
|
||||
@ -171,14 +171,14 @@ $constantes=array(
|
||||
);
|
||||
|
||||
$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||
$helptext.='%DOL_MAIN_URL_ROOT%, %ID%, %FIRSTNAME%, %LASTNAME%, %FULLNAME%, %LOGIN%, %PASSWORD%, ';
|
||||
$helptext.='%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %BIRTH%, %PHOTO%, %TYPE%, ';
|
||||
$helptext.='%YEAR%, %MONTH%, %DAY%';
|
||||
$helptext.='__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
|
||||
$helptext.='__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
|
||||
$helptext.='__YEAR__, __MONTH__, __DAY__';
|
||||
|
||||
$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||
$helptext.='%DOL_MAIN_URL_ROOT%, %ID%, %FIRSTNAME%, %LASTNAME%, %FULLNAME%, %LOGIN%, %PASSWORD%, ';
|
||||
$helptext.='%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %BIRTH%, %PHOTO%, %TYPE%, ';
|
||||
//$helptext.='%YEAR%, %MONTH%, %DAY%'; // Not supported
|
||||
$helptext.='__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
|
||||
$helptext.='__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
|
||||
//$helptext.='__YEAR__, __MONTH__, __DAY__'; // Not supported
|
||||
|
||||
form_constantes($constantes, 0, $helptext);
|
||||
|
||||
|
||||
@ -121,7 +121,7 @@ $hookmanager->initHooks(array('membercard','globalcard'));
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$parameters=array('id'=>$id, 'rowid'=>$id, 'objcanvas'=>$objcanvas);
|
||||
$parameters=array('id'=>$id, 'rowid'=>$id, 'objcanvas'=>$objcanvas, 'confirm'=>$confirm);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
@ -223,7 +223,7 @@ if (empty($reshook))
|
||||
{
|
||||
// User creation
|
||||
$company = new Societe($db);
|
||||
$result=$company->create_from_member($object,GETPOST('companyname'));
|
||||
$result=$company->create_from_member($object, GETPOST('companyname', 'alpha'), GETPOST('companyalias', 'alpha'));
|
||||
|
||||
if ($result < 0)
|
||||
{
|
||||
@ -843,7 +843,7 @@ else
|
||||
// Login
|
||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
||||
{
|
||||
print '<tr><td><span class="fieldrequired">'.$langs->trans("Login").' / '.$langs->trans("Id").'</span></td><td><input type="text" name="member_login" class="maxwidth200" value="'.(isset($_POST["member_login"])?GETPOST("member_login", 'alpha', 2):$object->login).'"></td></tr>';
|
||||
print '<tr><td><span class="fieldrequired">'.$langs->trans("Login").' / '.$langs->trans("Id").'</span></td><td><input type="text" name="member_login" class="minwidth300" maxlength="50" value="'.(isset($_POST["member_login"])?GETPOST("member_login", 'alpha', 2):$object->login).'"></td></tr>';
|
||||
}
|
||||
|
||||
// Password
|
||||
@ -852,7 +852,7 @@ else
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
|
||||
$generated_password=getRandomPassword(false);
|
||||
print '<tr><td><span class="fieldrequired">'.$langs->trans("Password").'</span></td><td>';
|
||||
print '<input size="30" maxsize="32" type="text" name="password" value="'.$generated_password.'">';
|
||||
print '<input type="text" class="minwidth300" maxlength="50" name="password" value="'.$generated_password.'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -875,7 +875,7 @@ else
|
||||
print "</td>\n";
|
||||
|
||||
// Company
|
||||
print '<tr><td id="tdcompany">'.$langs->trans("Company").'</td><td><input type="text" name="societe" size="40" value="'.(GETPOST('societe','alpha')?GETPOST('societe','alpha'):$object->societe).'"></td></tr>';
|
||||
print '<tr><td id="tdcompany">'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="minwidth300" maxlength="128" value="'.(GETPOST('societe','alpha')?GETPOST('societe','alpha'):$object->societe).'"></td></tr>';
|
||||
|
||||
// Civility
|
||||
print '<tr><td>'.$langs->trans("UserTitle").'</td><td>';
|
||||
@ -883,15 +883,15 @@ else
|
||||
print '</tr>';
|
||||
|
||||
// Lastname
|
||||
print '<tr><td id="tdlastname">'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" value="'.(GETPOST('lastname','alpha')?GETPOST('lastname','alpha'):$object->lastname).'" size="40"></td>';
|
||||
print '<tr><td id="tdlastname">'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" class="minwidth300" maxlength="50" value="'.(GETPOST('lastname','alpha')?GETPOST('lastname','alpha'):$object->lastname).'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Firstname
|
||||
print '<tr><td id="tdfirstname">'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" size="40" value="'.(GETPOST('firstname','alpha')?GETPOST('firstname','alpha'):$object->firstname).'"></td>';
|
||||
print '<tr><td id="tdfirstname">'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" class="minwidth300" maxlength="50" value="'.(GETPOST('firstname','alpha')?GETPOST('firstname','alpha'):$object->firstname).'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// EMail
|
||||
print '<tr><td>'.($conf->global->ADHERENT_MAIL_REQUIRED?'<span class="fieldrequired">':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'</span>':'').'</td><td><input type="text" name="member_email" size="40" value="'.(GETPOST('member_email','alpha')?GETPOST('member_email','alpha'):$object->email).'"></td></tr>';
|
||||
print '<tr><td>'.($conf->global->ADHERENT_MAIL_REQUIRED?'<span class="fieldrequired">':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'</span>':'').'</td><td><input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(GETPOST('member_email','alpha')?GETPOST('member_email','alpha'):$object->email).'"></td></tr>';
|
||||
|
||||
// Address
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Address").'</td><td>';
|
||||
@ -1081,13 +1081,13 @@ else
|
||||
// Login
|
||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
||||
{
|
||||
print '<tr><td><span class="fieldrequired">'.$langs->trans("Login").' / '.$langs->trans("Id").'</span></td><td><input type="text" name="login" class="maxwidth200" value="'.(isset($_POST["login"])?GETPOST("login",'alpha',2):$object->login).'"></td></tr>';
|
||||
print '<tr><td><span class="fieldrequired">'.$langs->trans("Login").' / '.$langs->trans("Id").'</span></td><td><input type="text" name="login" class="minwidth300" maxlength="50" value="'.(isset($_POST["login"])?GETPOST("login",'alpha',2):$object->login).'"></td></tr>';
|
||||
}
|
||||
|
||||
// Password
|
||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
||||
{
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Password").'</td><td><input type="password" name="pass" class="maxwdith200" value="'.(isset($_POST["pass"])?GETPOST("pass",'',2):$object->pass).'"></td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Password").'</td><td><input type="password" name="pass" class="minwidth300" maxlength="50" value="'.(isset($_POST["pass"])?GETPOST("pass",'',2):$object->pass).'"></td></tr>';
|
||||
}
|
||||
// Morphy
|
||||
$morphys["phy"] = $langs->trans("Physical");
|
||||
@ -1110,7 +1110,7 @@ else
|
||||
print "</td></tr>";
|
||||
|
||||
// Company
|
||||
print '<tr><td id="tdcompany">'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="minwidth100" value="'.(isset($_POST["societe"])?GETPOST("societe",'',2):$object->societe).'"></td></tr>';
|
||||
print '<tr><td id="tdcompany">'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="minwidth300" maxlength="128" value="'.(isset($_POST["societe"])?GETPOST("societe",'',2):$object->societe).'"></td></tr>';
|
||||
|
||||
// Civility
|
||||
print '<tr><td>'.$langs->trans("UserTitle").'</td><td>';
|
||||
@ -1119,11 +1119,11 @@ else
|
||||
print '</tr>';
|
||||
|
||||
// Lastname
|
||||
print '<tr><td id="tdlastname">'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" class="minwidth100" value="'.(isset($_POST["lastname"])?GETPOST("lastname",'',2):$object->lastname).'"></td>';
|
||||
print '<tr><td id="tdlastname">'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" class="minwidth300" maxlength="50" value="'.(isset($_POST["lastname"])?GETPOST("lastname",'',2):$object->lastname).'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Firstname
|
||||
print '<tr><td id="tdfirstname">'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" class="minwidth100" value="'.(isset($_POST["firstname"])?GETPOST("firstname",'',3):$object->firstname).'"></td>';
|
||||
print '<tr><td id="tdfirstname">'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" class="minwidth300" maxlength="50" value="'.(isset($_POST["firstname"])?GETPOST("firstname",'',3):$object->firstname).'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Photo
|
||||
@ -1142,7 +1142,7 @@ else
|
||||
print '</td></tr>';
|
||||
|
||||
// EMail
|
||||
print '<tr><td>'.($conf->global->ADHERENT_MAIL_REQUIRED?'<span class="fieldrequired">':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'</span>':'').'</td><td><input type="text" name="member_email" size="40" value="'.(isset($_POST["member_email"])?GETPOST("member_email",'',2):$object->email).'"></td></tr>';
|
||||
print '<tr><td>'.($conf->global->ADHERENT_MAIL_REQUIRED?'<span class="fieldrequired">':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'</span>':'').'</td><td><input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(isset($_POST["member_email"])?GETPOST("member_email",'',2):$object->email).'"></td></tr>';
|
||||
|
||||
// Address
|
||||
print '<tr><td>'.$langs->trans("Address").'</td><td>';
|
||||
@ -1319,18 +1319,25 @@ else
|
||||
// Confirm create third party
|
||||
if ($action == 'create_thirdparty')
|
||||
{
|
||||
$name = $object->getFullName($langs);
|
||||
if (! empty($name))
|
||||
$companyalias='';
|
||||
$fullname = $object->getFullName($langs);
|
||||
|
||||
if ($object->morphy == 'mor')
|
||||
{
|
||||
if ($object->societe) $name.=' ('.$object->societe.')';
|
||||
$companyname=$object->societe;
|
||||
if (! empty($fullname)) $companyalias=$fullname;
|
||||
}
|
||||
else
|
||||
{
|
||||
$name=$object->societe;
|
||||
$companyname=$fullname;
|
||||
if (! empty($object->societe)) $companyalias=$object->societe;
|
||||
}
|
||||
|
||||
// Create a form array
|
||||
$formquestion=array( array('label' => $langs->trans("NameToCreate"), 'type' => 'text', 'name' => 'companyname', 'value' => $name));
|
||||
$formquestion=array(
|
||||
array('label' => $langs->trans("NameToCreate"), 'type' => 'text', 'name' => 'companyname', 'value' => $companyname, 'morecss' => 'minwidth300', 'moreattr' => 'maxlength="128"'),
|
||||
array('label' => $langs->trans("AliasNames"), 'type' => 'text', 'name' => 'companyalias', 'value' => $companyalias, 'morecss' => 'minwidth300', 'moreattr' => 'maxlength="128"')
|
||||
);
|
||||
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id,$langs->trans("CreateDolibarrThirdParty"),$langs->trans("ConfirmCreateThirdParty"),"confirm_create_thirdparty",$formquestion,1);
|
||||
}
|
||||
@ -1347,8 +1354,8 @@ else
|
||||
$texttosend=$object->makeSubstitution($adht->getMailOnValid());
|
||||
|
||||
$tmp=$langs->trans("SendAnEMailToMember");
|
||||
$tmp.='<br>('.$langs->trans("MailFrom").': <b>'.$conf->global->ADHERENT_MAIL_FROM.'</b>, ';
|
||||
$tmp.=$langs->trans("MailRecipient").': <b>'.$object->email.'</b>)';
|
||||
$tmp.='<br>'.$langs->trans("MailFrom").': <b>'.$conf->global->ADHERENT_MAIL_FROM.'</b>, ';
|
||||
$tmp.='<br>'.$langs->trans("MailRecipient").': <b>'.$object->email.'</b>';
|
||||
$helpcontent='';
|
||||
$helpcontent.='<b>'.$langs->trans("MailFrom").'</b>: '.$conf->global->ADHERENT_MAIL_FROM.'<br>'."\n";
|
||||
$helpcontent.='<b>'.$langs->trans("MailRecipient").'</b>: '.$object->email.'<br>'."\n";
|
||||
|
||||
@ -116,25 +116,25 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
|
||||
|
||||
// List of values to scan for a replacement
|
||||
$substitutionarray = array (
|
||||
'%ID%'=>$objp->rowid,
|
||||
'%LOGIN%'=>$objp->login,
|
||||
'%FIRSTNAME%'=>$objp->firstname,
|
||||
'%LASTNAME%'=>$objp->lastname,
|
||||
'%FULLNAME%'=>$adherentstatic->getFullName($langs),
|
||||
'%COMPANY%'=>$objp->company,
|
||||
'%ADDRESS%'=>$objp->address,
|
||||
'%ZIP%'=>$objp->zip,
|
||||
'%TOWN%'=>$objp->town,
|
||||
'%COUNTRY%'=>$objp->country,
|
||||
'%COUNTRY_CODE%'=>$objp->country_code,
|
||||
'%EMAIL%'=>$objp->email,
|
||||
'%BIRTH%'=>dol_print_date($objp->birth,'day'),
|
||||
'%TYPE%'=>$objp->type,
|
||||
'%YEAR%'=>$year,
|
||||
'%MONTH%'=>$month,
|
||||
'%DAY%'=>$day,
|
||||
'%DOL_MAIN_URL_ROOT%'=>DOL_MAIN_URL_ROOT,
|
||||
'%SERVER%'=>"http://".$_SERVER["SERVER_NAME"]."/"
|
||||
'__ID__'=>$objp->rowid,
|
||||
'__LOGIN__'=>$objp->login,
|
||||
'__FIRSTNAME__'=>$objp->firstname,
|
||||
'__LASTNAME__'=>$objp->lastname,
|
||||
'__FULLNAME__'=>$adherentstatic->getFullName($langs),
|
||||
'__COMPANY__'=>$objp->company,
|
||||
'__ADDRESS__'=>$objp->address,
|
||||
'__ZIP__'=>$objp->zip,
|
||||
'__TOWN__'=>$objp->town,
|
||||
'__COUNTRY__'=>$objp->country,
|
||||
'__COUNTRY_CODE__'=>$objp->country_code,
|
||||
'__EMAIL__'=>$objp->email,
|
||||
'__BIRTH__'=>dol_print_date($objp->birth,'day'),
|
||||
'__TYPE__'=>$objp->type,
|
||||
'__YEAR__'=>$year,
|
||||
'__MONTH__'=>$month,
|
||||
'__DAY__'=>$day,
|
||||
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT,
|
||||
'__SERVER__'=>"http://".$_SERVER["SERVER_NAME"]."/"
|
||||
);
|
||||
complete_substitutions_array($substitutionarray, $langs, $adherentstatic);
|
||||
|
||||
@ -179,7 +179,7 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
|
||||
// For labels
|
||||
if ($mode == 'label')
|
||||
{
|
||||
if (empty($conf->global->ADHERENT_ETIQUETTE_TEXT)) $conf->global->ADHERENT_ETIQUETTE_TEXT="%FULLNAME%\n%ADDRESS%\n%ZIP% %TOWN%\n%COUNTRY%";
|
||||
if (empty($conf->global->ADHERENT_ETIQUETTE_TEXT)) $conf->global->ADHERENT_ETIQUETTE_TEXT="__FULLNAME__\n__ADDRESS__\n__ZIP__ __TOWN__\n__COUNTRY__";
|
||||
$textleft=make_substitutions($conf->global->ADHERENT_ETIQUETTE_TEXT, $substitutionarray);
|
||||
$textheader='';
|
||||
$textfooter='';
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -55,9 +55,9 @@ class AdherentType extends CommonObject
|
||||
* @since 5.0
|
||||
*/
|
||||
public $subscription;
|
||||
/** @var string Public note */
|
||||
/** @var string Public note */
|
||||
public $note;
|
||||
/** @var bool Can vote*/
|
||||
/** @var integer Can vote */
|
||||
public $vote;
|
||||
/** @var string Email sent during validation */
|
||||
public $mail_valid;
|
||||
|
||||
@ -59,26 +59,23 @@ if (! $result)
|
||||
|
||||
if ($action == 'dolibarr2ldap')
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$ldap=new Ldap();
|
||||
$result=$ldap->connect_bind();
|
||||
|
||||
$info=$object->_load_ldap_info();
|
||||
$dn=$object->_load_ldap_dn($info);
|
||||
$olddn=$dn; // We can say that old dn = dn as we force synchro
|
||||
|
||||
$result=$ldap->update($dn,$info,$user,$olddn);
|
||||
|
||||
if ($result >= 0)
|
||||
if ($result > 0)
|
||||
{
|
||||
setEventMessages($langs->trans("MemberSynchronized"), null, 'mesgs');
|
||||
$db->commit();
|
||||
$info=$object->_load_ldap_info();
|
||||
$dn=$object->_load_ldap_dn($info);
|
||||
$olddn=$dn; // We can say that old dn = dn as we force synchro
|
||||
|
||||
$result=$ldap->update($dn,$info,$user,$olddn);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if ($result >= 0) {
|
||||
setEventMessages($langs->trans("MemberSynchronized"), null, 'mesgs');
|
||||
}
|
||||
else {
|
||||
setEventMessages($ldap->errors, $ldap->error, 'errors');
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -825,7 +825,7 @@ while ($i < min($num, $limit))
|
||||
if (! empty($arrayfields['d.datec']['checked']))
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
print dol_print_date($db->jdate($obj->date_creation), 'dayhour');
|
||||
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
@ -833,7 +833,7 @@ while ($i < min($num, $limit))
|
||||
if (! empty($arrayfields['d.tms']['checked']))
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
print dol_print_date($db->jdate($obj->date_update), 'dayhour');
|
||||
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -109,7 +109,7 @@ if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights
|
||||
{
|
||||
// Creation user
|
||||
$company = new Societe($db);
|
||||
$result=$company->create_from_member($object,$_POST["companyname"]);
|
||||
$result=$company->create_from_member($object, GETPOST('companyname', 'alpha'), GETPOST('companyalias', 'alpha'));
|
||||
|
||||
if ($result < 0)
|
||||
{
|
||||
@ -960,19 +960,25 @@ if ($rowid > 0)
|
||||
// Confirm create third party
|
||||
if ($action == 'create_thirdparty')
|
||||
{
|
||||
$name = $object->getFullName($langs);
|
||||
if (! empty($name))
|
||||
$companyalias='';
|
||||
$fullname = $object->getFullName($langs);
|
||||
|
||||
if ($object->morphy == 'mor')
|
||||
{
|
||||
if ($object->morphy == 'mor' && ! empty($object->societe)) $name=$object->societe.' ('.$name.')';
|
||||
else if ($object->societe) $name.=' ('.$object->societe.')';
|
||||
$companyname=$object->societe;
|
||||
if (! empty($fullname)) $companyalias=$fullname;
|
||||
}
|
||||
else
|
||||
{
|
||||
$name=$object->societe;
|
||||
$companyname=$fullname;
|
||||
if (! empty($object->societe)) $companyalias=$object->societe;
|
||||
}
|
||||
|
||||
// Create a form array
|
||||
$formquestion=array(array('label' => $langs->trans("NameToCreate"), 'type' => 'text', 'name' => 'companyname', 'value' => $name));
|
||||
$formquestion=array(
|
||||
array('label' => $langs->trans("NameToCreate"), 'type' => 'text', 'name' => 'companyname', 'value' => $companyname, 'morecss' => 'minwidth300', 'moreattr' => 'maxlength="128"'),
|
||||
array('label' => $langs->trans("AliasNames"), 'type' => 'text', 'name' => 'companyalias', 'value' => $companyalias, 'morecss' => 'minwidth300', 'moreattr' => 'maxlength="128"')
|
||||
);
|
||||
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id,$langs->trans("CreateDolibarrThirdParty"),$langs->trans("ConfirmCreateThirdParty"),"confirm_create_thirdparty",$formquestion,1);
|
||||
}
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011-2017 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -45,10 +45,18 @@ if (! $user->admin) accessforbidden();
|
||||
|
||||
$error=0;
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$contextpage=array('admincompany','globaladmin');
|
||||
$hookmanager->initHooks($contextpage);
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if ( ($action == 'update' && ! GETPOST("cancel",'alpha'))
|
||||
|| ($action == 'updateedit') )
|
||||
{
|
||||
|
||||
622
htdocs/admin/emailsenderprofile_card.php
Normal file
622
htdocs/admin/emailsenderprofile_card.php
Normal file
@ -0,0 +1,622 @@
|
||||
<?php
|
||||
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) ---Put here your own copyright and developer email---
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file emailsenderprofile_card.php
|
||||
* \ingroup monmodule
|
||||
* \brief Page to create/edit/view emailsenderprofile
|
||||
*/
|
||||
|
||||
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1');
|
||||
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1');
|
||||
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||
//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION','1'); // Do not check anti CSRF attack test
|
||||
//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION','1'); // Do not check anti CSRF attack test
|
||||
//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check anti CSRF attack test done when option MAIN_SECURITY_CSRF_WITH_TOKEN is on.
|
||||
//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data
|
||||
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not check anti POST attack test
|
||||
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu
|
||||
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
|
||||
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not load ajax.lib.php library
|
||||
//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
|
||||
|
||||
// Load Dolibarr environment
|
||||
$res=0;
|
||||
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
|
||||
if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include($_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php");
|
||||
// Try main.inc.php into web root detected using web root caluclated from SCRIPT_FILENAME
|
||||
$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1;
|
||||
while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; }
|
||||
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include(substr($tmp, 0, ($i+1))."/main.inc.php");
|
||||
if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php");
|
||||
// Try main.inc.php using relative path
|
||||
if (! $res && file_exists("../main.inc.php")) $res=@include("../main.inc.php");
|
||||
if (! $res && file_exists("../../main.inc.php")) $res=@include("../../main.inc.php");
|
||||
if (! $res && file_exists("../../../main.inc.php")) $res=@include("../../../main.inc.php");
|
||||
if (! $res) die("Include of main fails");
|
||||
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php');
|
||||
dol_include_once('/monmodule/class/emailsenderprofile.class.php');
|
||||
dol_include_once('/monmodule/lib/emailsenderprofile.lib.php');
|
||||
|
||||
// Load traductions files requiredby by page
|
||||
$langs->loadLangs(array("monmodule@monmodule","other"));
|
||||
|
||||
// Get parameters
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'aZ09');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
||||
// Initialize technical objects
|
||||
$object=new EmailSenderProfile($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
$diroutputmassaction=$conf->monmodule->dir_output . '/temp/massgeneration/'.$user->id;
|
||||
$hookmanager->initHooks(array('emailsenderprofilecard')); // Note that conf->hooks_modules contains array
|
||||
// Fetch optionals attributes and labels
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('emailsenderprofile');
|
||||
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
|
||||
|
||||
// Initialize array of search criterias
|
||||
$search_all=trim(GETPOST("search_all",'alpha'));
|
||||
$search=array();
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key,'alpha');
|
||||
}
|
||||
|
||||
if (empty($action) && empty($id) && empty($ref)) $action='view';
|
||||
|
||||
// Security check - Protection if external user
|
||||
//if ($user->societe_id > 0) access_forbidden();
|
||||
//if ($user->societe_id > 0) $socid = $user->societe_id;
|
||||
//$result = restrictedArea($user, 'monmodule', $id);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
// Load object
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* ACTIONS
|
||||
*
|
||||
* Put here all code to do according to value of "action" parameter
|
||||
*/
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
$error=0;
|
||||
|
||||
if ($cancel)
|
||||
{
|
||||
if (! empty($backtopage))
|
||||
{
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
}
|
||||
$action='';
|
||||
}
|
||||
|
||||
// Action to add record
|
||||
if ($action == 'add' && ! empty($user->rights->monmodule->create))
|
||||
{
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue; // Ignore special fields
|
||||
|
||||
$object->$key=GETPOST($key,'alpha');
|
||||
if ($val['notnull'] > 0 && $object->$key == '')
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv($val['label'])), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$result=$object->createCommon($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
// Creation OK
|
||||
$urltogo=$backtopage?$backtopage:dol_buildpath('/monmodule/emailsenderprofile_list.php',1);
|
||||
header("Location: ".$urltogo);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Creation KO
|
||||
if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
|
||||
else setEventMessages($object->error, null, 'errors');
|
||||
$action='create';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$action='create';
|
||||
}
|
||||
}
|
||||
|
||||
// Action to update record
|
||||
if ($action == 'update' && ! empty($user->rights->monmodule->create))
|
||||
{
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue; // Ignore special fields
|
||||
|
||||
$object->$key=GETPOST($key,'alpha');
|
||||
if ($val['notnull'] > 0 && $object->$key == '')
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv($val['label'])), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$result=$object->updateCommon($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
$action='view';
|
||||
}
|
||||
else
|
||||
{
|
||||
// Creation KO
|
||||
if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
|
||||
else setEventMessages($object->error, null, 'errors');
|
||||
$action='edit';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$action='edit';
|
||||
}
|
||||
}
|
||||
|
||||
// Action to delete
|
||||
if ($action == 'confirm_delete' && ! empty($user->rights->monmodule->delete))
|
||||
{
|
||||
$result=$object->deleteCommon($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
// Delete OK
|
||||
setEventMessages("RecordDeleted", null, 'mesgs');
|
||||
header("Location: ".dol_buildpath('/monmodule/emailsenderprofile_list.php',1));
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
|
||||
else setEventMessages($object->error, null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// Actions when printing a doc from card
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||
|
||||
// Actions to send emails
|
||||
$trigger_name='MYOBJECT_SENTBYMAIL';
|
||||
$autocopy='MAIN_MAIL_AUTOCOPY_MYOBJECT_TO';
|
||||
$trackid='emailsenderprofile'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* VIEW
|
||||
*
|
||||
* Put here all code to build page
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
$formfile=new FormFile($db);
|
||||
|
||||
llxHeader('','EmailSenderProfile','');
|
||||
|
||||
// Example : Adding jquery code
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
function init_myfunc()
|
||||
{
|
||||
jQuery("#myid").removeAttr(\'disabled\');
|
||||
jQuery("#myid").attr(\'disabled\',\'disabled\');
|
||||
}
|
||||
init_myfunc();
|
||||
jQuery("#mybutton").click(function() {
|
||||
init_myfunc();
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
|
||||
// Part to create
|
||||
if ($action == 'create')
|
||||
{
|
||||
print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("EmailSenderProfile")));
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
||||
|
||||
dol_fiche_head(array(), '');
|
||||
|
||||
print '<table class="border centpercent">'."\n";
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue;
|
||||
print '<tr id="field_'.$key.'">';
|
||||
print '<td';
|
||||
print ' class="titlefieldcreate';
|
||||
if ($val['notnull'] > 0) print ' fieldrequired';
|
||||
if ($val['type'] == 'text') print ' tdtop';
|
||||
print '"';
|
||||
print '>';
|
||||
print $langs->trans($val['label']);
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$defaultcss='minwidth100';
|
||||
if ($val['type'] == 'text')
|
||||
{
|
||||
print '<textarea class="flat quatrevingtpercent" rows="'.ROWS_4.'" name="'.$key.'">';
|
||||
print GETPOST($key,'none');
|
||||
print '</textarea>';
|
||||
}
|
||||
elseif (is_array($val['arrayofkeyval']))
|
||||
{
|
||||
print $form->selectarray($key, $val['arrayofkeyval'], GETPOST($key, 'int'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$cssforinput = empty($val['css'])?$defaultcss:$val['css'];
|
||||
print '<input class="flat'.($cssforinput?' '.$cssforinput:'').'" class="'.$cssforinput.'" type="text" name="'.$key.'" value="'.(GETPOST($key,'alpha')?GETPOST($key,'alpha'):'').'">';
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php';
|
||||
|
||||
print '</table>'."\n";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" name="add" value="'.dol_escape_htmltag($langs->trans("Create")).'">';
|
||||
print ' ';
|
||||
print '<input type="button" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'" onclick="javascript:history.go(-1)">'; // Cancel for create doe not post form
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
// Part to edit record
|
||||
if (($id || $ref) && $action == 'edit')
|
||||
{
|
||||
print load_fiche_titre($langs->trans("EmailSenderProfile"));
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
print '<table class="border centpercent">'."\n";
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue;
|
||||
|
||||
print '<tr><td';
|
||||
print ' class="titlefieldcreate';
|
||||
if ($val['notnull'] > 0) print ' fieldrequired';
|
||||
if ($val['type'] == 'text') print ' tdtop';
|
||||
print '"';
|
||||
print '>'.$langs->trans($val['label']).'</td>';
|
||||
print '<td>';
|
||||
$defaultcss='minwidth100';
|
||||
if ($val['type'] == 'text')
|
||||
{
|
||||
print '<textarea class="flat quatrevingtpercent" rows="'.ROWS_4.'" name="'.$key.'">';
|
||||
print GETPOST($key,'none')?GETPOST($key,'none'):$object->$key;
|
||||
print '</textarea>';
|
||||
}
|
||||
elseif (is_array($val['arrayofkeyval']))
|
||||
{
|
||||
print $form->selectarray($key, $val['arrayofkeyval'], GETPOST($key, 'int')!=''?GETPOST($key, 'int'):$object->$key);
|
||||
}
|
||||
else
|
||||
{
|
||||
$cssforinput = empty($val['css'])?$defaultcss:$val['css'];
|
||||
print '<input class="flat'.($cssforinput?' '.$cssforinput:'').'" type="text" name="'.$key.'" value="'.(GETPOST($key,'alpha')?GETPOST($key,'alpha'):$object->$key).'">';
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php';
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
||||
print ' <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
// Part to show record
|
||||
if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create')))
|
||||
{
|
||||
$res = $object->fetch_optionals($object->id, $extralabels);
|
||||
|
||||
$head = emailsenderprofilePrepareHead($object);
|
||||
dol_fiche_head($head, 'card', $langs->trans("EmailSenderProfile"), -1, 'emailsenderprofile@monmodule');
|
||||
|
||||
$formconfirm = '';
|
||||
|
||||
// Confirmation to delete
|
||||
if ($action == 'delete') {
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteEmailSenderProfile'), $langs->trans('ConfirmDeleteEmailSenderProfile'), 'confirm_delete', '', 0, 1);
|
||||
}
|
||||
|
||||
// Confirmation of action xxxx
|
||||
if ($action == 'xxx')
|
||||
{
|
||||
$formquestion=array();
|
||||
/*
|
||||
$formquestion = array(
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
||||
// array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1)));
|
||||
}*/
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220);
|
||||
}
|
||||
|
||||
if (! $formconfirm) {
|
||||
$parameters = array('lineid' => $lineid);
|
||||
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
|
||||
elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
|
||||
}
|
||||
|
||||
// Print form confirm
|
||||
print $formconfirm;
|
||||
|
||||
|
||||
// Object card
|
||||
// ------------------------------------------------------------
|
||||
$linkback = '<a href="' .dol_buildpath('/monmodule/emailsenderprofile_list.php',1) . '?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
/*
|
||||
// Ref bis
|
||||
$morehtmlref.=$form->editfieldkey("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->monmodule->creer, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->monmodule->creer, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1);
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->monmodule->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
{
|
||||
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent">'."\n";
|
||||
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
if (in_array($key, array('rowid', 'ref', 'entity', 'note_public', 'note_private', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key', 'status'))) continue;
|
||||
|
||||
print '<tr><td';
|
||||
print ' class="titlefield';
|
||||
if ($val['notnull'] > 0) print ' fieldrequired';
|
||||
print '"';
|
||||
print '>'.$langs->trans($val['label']).'</td>';
|
||||
print '<td>';
|
||||
print dol_escape_htmltag($object->$key, 1, 1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
//if ($key == 'targetsrcfile3') break; // key used for break on second column
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '<div class="fichehalfright">';
|
||||
print '<div class="ficheaddleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
$alreadyoutput = 1;
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
if ($alreadyoutput)
|
||||
{
|
||||
//if ($key == 'targetsrcfile3') $alreadyoutput = 0; // key used for break on second column
|
||||
continue;
|
||||
}
|
||||
|
||||
if (in_array($key, array('rowid', 'ref', 'entity', 'note_public', 'note_private', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key', 'status'))) continue;
|
||||
|
||||
print '<tr><td';
|
||||
print ' class="titlefield';
|
||||
if ($val['notnull'] > 0) print ' fieldrequired';
|
||||
print '"';
|
||||
print '>'.$langs->trans($val['label']).'</td>';
|
||||
print '<td>';
|
||||
print dol_escape_htmltag($object->$key, 1, 1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
print '<div class="clearboth"></div><br>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
// Buttons for actions
|
||||
if ($action != 'presend' && $action != 'editline') {
|
||||
print '<div class="tabsAction">'."\n";
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
// Send
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendByMail') . '</a></div>'."\n";
|
||||
|
||||
if ($user->rights->monmodule->write)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a></div>'."\n";
|
||||
}
|
||||
|
||||
/*
|
||||
if ($user->rights->sellyoursaas->create)
|
||||
{
|
||||
if ($object->status == 1)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=disable">'.$langs->trans("Disable").'</a></div>'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=enable">'.$langs->trans("Enable").'</a></div>'."\n";
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if ($user->rights->monmodule->delete)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete">'.$langs->trans('Delete').'</a></div>'."\n";
|
||||
}
|
||||
}
|
||||
print '</div>'."\n";
|
||||
}
|
||||
|
||||
|
||||
// Select mail models is same action as presend
|
||||
if (GETPOST('modelselected')) {
|
||||
$action = 'presend';
|
||||
}
|
||||
|
||||
if ($action != 'presend')
|
||||
{
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
print '<a name="builddoc"></a>'; // ancre
|
||||
// Documents
|
||||
$comref = dol_sanitizeFileName($object->ref);
|
||||
$relativepath = $comref . '/' . $comref . '.pdf';
|
||||
$filedir = $conf->monmodule->dir_output . '/' . $comref;
|
||||
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
|
||||
$genallowed = $user->rights->monmodule->creer;
|
||||
$delallowed = $user->rights->monmodule->supprimer;
|
||||
print $formfile->showdocuments('monmodule', $comref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
|
||||
|
||||
|
||||
// Show links to link elements
|
||||
$linktoelem = $form->showLinkToObjectBlock($object, null, array('emailsenderprofile'));
|
||||
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
|
||||
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
$MAXEVENT = 10;
|
||||
|
||||
// List of actions on element
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||
$formactions = new FormActions($db);
|
||||
$somethingshown = $formactions->showactions($object, 'emailsenderprofile', $socid, 1, '', $MAXEVENT);
|
||||
|
||||
print '</div></div></div>';
|
||||
}
|
||||
|
||||
// Presend form
|
||||
$modelmail='emailsenderprofile';
|
||||
$defaulttopic='Information';
|
||||
$diroutput = $conf->monmodule->dir_output;
|
||||
$trackid = 'emailsenderprofile'.$object->id;
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
||||
}
|
||||
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
661
htdocs/admin/emailsenderprofile_list.php
Normal file
661
htdocs/admin/emailsenderprofile_list.php
Normal file
@ -0,0 +1,661 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) ---Put here your own copyright and developer email---
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file emailsenderprofile_list.php
|
||||
* \ingroup monmodule
|
||||
* \brief List page for emailsenderprofile
|
||||
*/
|
||||
|
||||
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1');
|
||||
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1');
|
||||
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||
//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION','1'); // Do not check anti CSRF attack test
|
||||
//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION','1'); // Do not check anti CSRF attack test
|
||||
//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check anti CSRF attack test done when option MAIN_SECURITY_CSRF_WITH_TOKEN is on.
|
||||
//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data
|
||||
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not check anti POST attack test
|
||||
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu
|
||||
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
|
||||
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not load ajax.lib.php library
|
||||
//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
|
||||
|
||||
|
||||
// Load Dolibarr environment
|
||||
$res=0;
|
||||
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
|
||||
if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include($_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php");
|
||||
// Try main.inc.php into web root detected using web root caluclated from SCRIPT_FILENAME
|
||||
$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1;
|
||||
while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; }
|
||||
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include(substr($tmp, 0, ($i+1))."/main.inc.php");
|
||||
if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php");
|
||||
// Try main.inc.php using relative path
|
||||
if (! $res && file_exists("../main.inc.php")) $res=@include("../main.inc.php");
|
||||
if (! $res && file_exists("../../main.inc.php")) $res=@include("../../main.inc.php");
|
||||
if (! $res && file_exists("../../../main.inc.php")) $res=@include("../../../main.inc.php");
|
||||
if (! $res) die("Include of main fails");
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
dol_include_once('/monmodule/class/emailsenderprofile.class.php');
|
||||
|
||||
// Load traductions files requiredby by page
|
||||
$langs->loadLangs(array("monmodule@monmodule","other"));
|
||||
|
||||
$action = GETPOST('action','alpha'); // The action 'add', 'create', 'edit', 'update', 'view', ...
|
||||
$massaction = GETPOST('massaction','alpha'); // The bulk action (combo box choice into lists)
|
||||
$show_files = GETPOST('show_files','int'); // Show files area generated by bulk actions ?
|
||||
$confirm = GETPOST('confirm','alpha'); // Result of a confirmation
|
||||
$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
|
||||
$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
|
||||
$contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'emailsenderprofilelist'; // To manage different context of search
|
||||
$backtopage = GETPOST('backtopage','alpha'); // Go back to a dedicated page
|
||||
$optioncss = GETPOST('optioncss','aZ'); // Option for the css output (always '' except when 'print')
|
||||
|
||||
$id = GETPOST('id','int');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield','alpha');
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
$page = GETPOST('page','int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
// Initialize technical objects
|
||||
$object=new EmailSenderProfile($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
$diroutputmassaction=$conf->monmodule->dir_output . '/temp/massgeneration/'.$user->id;
|
||||
$hookmanager->initHooks(array('emailsenderprofilelist')); // Note that conf->hooks_modules contains array
|
||||
// Fetch optionals attributes and labels
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('emailsenderprofile');
|
||||
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
|
||||
|
||||
// Default sort order (if not yet defined by previous GETPOST)
|
||||
if (! $sortfield) $sortfield="t.".key($object->fields); // Set here default search field. By default 1st field in definition.
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
|
||||
// Protection if external user
|
||||
$socid=0;
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
//$socid = $user->societe_id;
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
// Initialize array of search criterias
|
||||
$search_all=trim(GETPOST("search_all",'alpha'));
|
||||
$search=array();
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key,'alpha');
|
||||
}
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array();
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
if ($val['searchall']) $fieldstosearchall['t.'.$key]=$val['label'];
|
||||
}
|
||||
|
||||
// Definition of fields for list
|
||||
$arrayfields=array();
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
// If $val['visible']==0, then we never show the field
|
||||
if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled']);
|
||||
}
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
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]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* ACTIONS
|
||||
*
|
||||
* Put here all code to do according to value of "$action" parameter
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
// Selection of new fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
// 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
|
||||
{
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
$search[$key]='';
|
||||
}
|
||||
$toselect='';
|
||||
$search_array_options=array();
|
||||
}
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')
|
||||
|| GETPOST('button_search_x','alpha') || GETPOST('button_search.x','alpha') || GETPOST('button_search','alpha'))
|
||||
{
|
||||
$massaction=''; // Protection to avoid mass action if we force a new search during a mass action confirmation
|
||||
}
|
||||
|
||||
// Mass actions
|
||||
$objectclass='EmailSenderProfile';
|
||||
$objectlabel='EmailSenderProfile';
|
||||
$permtoread = $user->rights->monmodule->read;
|
||||
$permtodelete = $user->rights->monmodule->delete;
|
||||
$uploaddir = $conf->monmodule->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* VIEW
|
||||
*
|
||||
* Put here all code to build page
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
//$help_url="EN:Module_EmailSenderProfile|FR:Module_EmailSenderProfile_FR|ES:Módulo_EmailSenderProfile";
|
||||
$help_url='';
|
||||
$title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("EmailSenderProfiles"));
|
||||
|
||||
|
||||
// Build and execute select
|
||||
// --------------------------------------------------------------------
|
||||
$sql = 'SELECT ';
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
$sql.='t.'.$key.', ';
|
||||
}
|
||||
// Add fields from extrafields
|
||||
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||
// Add fields from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql=preg_replace('/, $/','', $sql);
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."emailsenderprofile as t";
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."emailsenderprofile_extrafields as ef on (t.rowid = ef.fk_object)";
|
||||
$sql.= " WHERE t.entity IN (".getEntity('emailsenderprofile').")";
|
||||
foreach($search as $key => $val)
|
||||
{
|
||||
$mode_search=(($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key]))?1:0);
|
||||
if ($search[$key] != '') $sql.=natural_search($key, $search[$key], (($key == 'status')?2:$mode_search));
|
||||
}
|
||||
if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all);
|
||||
// Add where from extra fields
|
||||
foreach ($search_array_options as $key => $val)
|
||||
{
|
||||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode_search=0;
|
||||
if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search);
|
||||
}
|
||||
}
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
|
||||
/* If a group by is required
|
||||
$sql.= " GROUP BY "
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
$sql.='t.'.$key.', ';
|
||||
}
|
||||
// Add fields from extrafields
|
||||
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key : '');
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
*/
|
||||
|
||||
$sql.=$db->order($sortfield,$sortorder);
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
|
||||
dol_syslog($script_file, LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
// Direct jump if only one record found
|
||||
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$id = $obj->rowid;
|
||||
header("Location: ".DOL_URL_ROOT.'/monmodule/emailsenderprofile_card.php?id='.$id);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
// Output page
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
// Example : Adding jquery code
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
function init_myfunc()
|
||||
{
|
||||
jQuery("#myid").removeAttr(\'disabled\');
|
||||
jQuery("#myid").attr(\'disabled\',\'disabled\');
|
||||
}
|
||||
init_myfunc();
|
||||
jQuery("#mybutton").click(function() {
|
||||
init_myfunc();
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||
foreach($search as $key => $val)
|
||||
{
|
||||
$param.= '&search_'.$key.'='.urlencode($search[$key]);
|
||||
}
|
||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||
// Add $param from extra fields
|
||||
foreach ($search_array_options as $key => $val)
|
||||
{
|
||||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
|
||||
}
|
||||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array(
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
if ($user->rights->monmodule->delete) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
if ($massaction == 'presend') $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit);
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||
print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
|
||||
}
|
||||
|
||||
$moreforfilter = '';
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
|
||||
$moreforfilter.= '</div>';
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
|
||||
else $moreforfilter = $hookmanager->resPrint;
|
||||
|
||||
if (! empty($moreforfilter))
|
||||
{
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print $moreforfilter;
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
$selectedfields.=(count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
|
||||
|
||||
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
|
||||
// Fields title search
|
||||
// --------------------------------------------------------------------
|
||||
print '<tr class="liste_titre">';
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
if (in_array($key, array('date_creation', 'tms', 'import_key', 'status'))) continue;
|
||||
$align='';
|
||||
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
|
||||
if (in_array($val['type'], array('timestamp'))) $align.=' nowrap';
|
||||
if ($key == 'status') $align.=($align?' ':'').'center';
|
||||
if (! empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($align?' '.$align:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>';
|
||||
}
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||
{
|
||||
$align=$extrafields->getAlignFlag($key);
|
||||
$typeofextrafield=$extrafields->attribute_type[$key];
|
||||
print '<td class="liste_titre'.($align?' '.$align:'').'">';
|
||||
if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')) && empty($extrafields->attribute_computed[$key]))
|
||||
{
|
||||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$searchclass='';
|
||||
if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring';
|
||||
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 '</td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Rest of fields search
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
if (! in_array($key, array('date_creation', 'tms', 'import_key', 'status'))) continue;
|
||||
$align='';
|
||||
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
|
||||
if (in_array($val['type'], array('timestamp'))) $align.=' nowrap';
|
||||
if ($key == 'status') $align.=($align?' ':'').'center';
|
||||
if (! empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($align?' '.$align:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>';
|
||||
}
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
|
||||
// Fields title label
|
||||
// --------------------------------------------------------------------
|
||||
print '<tr class="liste_titre">';
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
if (in_array($key, array('date_creation', 'tms', 'import_key', 'status'))) continue;
|
||||
$align='';
|
||||
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
|
||||
if (in_array($val['type'], array('timestamp'))) $align.='nowrap';
|
||||
if ($key == 'status') $align.=($align?' ':'').'center';
|
||||
if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n";
|
||||
}
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||
{
|
||||
$align=$extrafields->getAlignFlag($key);
|
||||
$sortonfield = "ef.".$key;
|
||||
if (! empty($extrafields->attribute_computed[$key])) $sortonfield='';
|
||||
print getTitleFieldOfList($langs->trans($extralabels[$key]), 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder)."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
// Hook fields
|
||||
$parameters=array('arrayfields'=>$arrayfields);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Rest of fields title
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
if (! in_array($key, array('date_creation', 'tms', 'import_key', 'status'))) continue;
|
||||
$align='';
|
||||
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
|
||||
if (in_array($val['type'], array('timestamp'))) $align.=' nowrap';
|
||||
if ($key == 'status') $align.=($align?' ':'').'center';
|
||||
if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n";
|
||||
}
|
||||
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
|
||||
// Detect if we need a fetch on each output line
|
||||
$needToFetchEachLine=0;
|
||||
foreach ($extrafields->attribute_computed as $key => $val)
|
||||
{
|
||||
if (preg_match('/\$object/',$val)) $needToFetchEachLine++; // There is at least one compute field that use $object
|
||||
}
|
||||
|
||||
|
||||
// Loop on record
|
||||
// --------------------------------------------------------------------
|
||||
$i=0;
|
||||
$totalarray=array();
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if (empty($obj)) break; // Should not happen
|
||||
|
||||
// Store properties in $object
|
||||
$object->id = $obj->rowid;
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
if (isset($obj->$key)) $object->$key = $obj->$key;
|
||||
}
|
||||
|
||||
// Show here line of result
|
||||
print '<tr class="oddeven">';
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
if (in_array($key, array('date_creation', 'tms', 'import_key', 'status'))) continue;
|
||||
$align='';
|
||||
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
|
||||
if (in_array($val['type'], array('timestamp'))) $align.='nowrap';
|
||||
if ($key == 'status') $align.=($align?' ':'').'center';
|
||||
if (! empty($arrayfields['t.'.$key]['checked']))
|
||||
{
|
||||
print '<td'.($align?' class="'.$align.'"':'').'>';
|
||||
if (in_array($val['type'], array('date','datetime','timestamp'))) print dol_print_date($db->jdate($obj->$key), 'dayhour');
|
||||
elseif ($key == 'ref') print $object->getNomUrl(1, '', 0, '', 1);
|
||||
elseif ($key == 'status') print $object->getLibStatut(3);
|
||||
else print $obj->$key;
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! empty($val['isameasure']))
|
||||
{
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.'.$key;
|
||||
$totalarray['val']['t.'.$key] += $obj->$key;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||
{
|
||||
print '<td';
|
||||
$align=$extrafields->getAlignFlag($key);
|
||||
if ($align) print ' align="'.$align.'"';
|
||||
print '>';
|
||||
$tmpkey='options_'.$key;
|
||||
print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1);
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! empty($val['isameasure']))
|
||||
{
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='ef.'.$tmpkey;
|
||||
$totalarray['val']['ef.'.$tmpkey] += $obj->$tmpkey;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Rest of fields
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
if (! in_array($key, array('date_creation', 'tms', 'import_key', 'status'))) continue;
|
||||
$align='';
|
||||
if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center';
|
||||
if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap';
|
||||
if ($key == 'status') $align.=($align?' ':'').'center';
|
||||
if (! empty($arrayfields['t.'.$key]['checked']))
|
||||
{
|
||||
print '<td'.($align?' class="'.$align.'"':'').'>';
|
||||
if (in_array($val['type'], array('date','datetime','timestamp'))) print dol_print_date($db->jdate($obj->$key), 'dayhour');
|
||||
elseif ($key == 'status') print $object->getLibStatut(3);
|
||||
else print $obj->$key;
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! empty($val['isameasure']))
|
||||
{
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.'.$key;
|
||||
$totalarray['val']['t.'.$key] += $obj->$key;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Action column
|
||||
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
|
||||
{
|
||||
$selected=0;
|
||||
if (in_array($obj->rowid, $arrayofselected)) $selected=1;
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
|
||||
}
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
print '</tr>';
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Show total line
|
||||
if (isset($totalarray['pos']))
|
||||
{
|
||||
print '<tr class="liste_total">';
|
||||
$i=0;
|
||||
while ($i < $totalarray['nbfield'])
|
||||
{
|
||||
$i++;
|
||||
if (! empty($totalarray['pos'][$i])) print '<td align="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
|
||||
else
|
||||
{
|
||||
if ($i == 1)
|
||||
{
|
||||
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
}
|
||||
else print '<td></td>';
|
||||
}
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// If no record found
|
||||
if ($num == 0)
|
||||
{
|
||||
$colspan=1;
|
||||
foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; }
|
||||
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
$db->free($resql);
|
||||
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '</table>'."\n";
|
||||
print '</div>'."\n";
|
||||
|
||||
print '</form>'."\n";
|
||||
|
||||
if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords))
|
||||
{
|
||||
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php');
|
||||
$formfile = new FormFile($db);
|
||||
|
||||
// Show list of available documents
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
|
||||
$urlsource.=str_replace('&','&',$param);
|
||||
|
||||
$filedir=$diroutputmassaction;
|
||||
$genallowed=$user->rights->monmodule->read;
|
||||
$delallowed=$user->rights->monmodule->read;
|
||||
|
||||
print $formfile->showdocuments('massfilesarea_monmodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -47,29 +47,36 @@ if (! $user->admin) accessforbidden();
|
||||
|
||||
$action = GETPOST('action','aZ09');
|
||||
|
||||
|
||||
if (! defined("MAIN_MOTD")) define("MAIN_MOTD","");
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$contextpage=array('adminihm','globaladmin');
|
||||
$hookmanager->initHooks($contextpage);
|
||||
|
||||
|
||||
/*
|
||||
* Action
|
||||
*/
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if (GETPOST('cancel','alpha'))
|
||||
{
|
||||
$action='';
|
||||
$action='';
|
||||
}
|
||||
|
||||
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;
|
||||
dol_delete_file($logofile);
|
||||
dolibarr_del_const($db, "MAIN_LOGIN_BACKGROUND",$conf->entity);
|
||||
$mysoc->logo='';
|
||||
$logofile=$conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND;
|
||||
dol_delete_file($logofile);
|
||||
dolibarr_del_const($db, "MAIN_LOGIN_BACKGROUND",$conf->entity);
|
||||
$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);
|
||||
dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$conf->entity);
|
||||
$mysoc->logo_small='';
|
||||
@ -89,54 +96,58 @@ if ($action == 'update')
|
||||
|
||||
$val=GETPOST('THEME_TOPMENU_DISABLE_IMAGE');
|
||||
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()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_BACKBODY', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_BACKBODY', $val,'chaine',0,'',$conf->entity);
|
||||
|
||||
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1'),array()))));
|
||||
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1'),array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TOPMENU_BACK1', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_TOPMENU_BACK1', $val,'chaine',0,'',$conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_TOPMENU_BACK1', $val,'chaine',0,'',$conf->entity);
|
||||
|
||||
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'),array()))));
|
||||
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_VERMENU_BACK1'),array()))));
|
||||
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);
|
||||
|
||||
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'),array()))));
|
||||
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()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR1', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR1', $val,'chaine',0,'',$conf->entity);
|
||||
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'),array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR2', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR2', $val,'chaine',0,'',$conf->entity);
|
||||
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'),array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR1', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR1', $val,'chaine',0,'',$conf->entity);
|
||||
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'),array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR2', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR2', $val,'chaine',0,'',$conf->entity);
|
||||
|
||||
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'),array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_LINEPAIR1', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_LINEPAIR1', $val,'chaine',0,'',$conf->entity);
|
||||
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'),array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_LINEPAIR2', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_LINEPAIR2', $val,'chaine',0,'',$conf->entity);
|
||||
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'),array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_LINEPAIR1', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_LINEPAIR1', $val,'chaine',0,'',$conf->entity);
|
||||
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'),array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_LINEPAIR2', $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);
|
||||
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);
|
||||
|
||||
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_TEXTLINK'),array()))));
|
||||
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_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_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_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_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_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_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_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_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_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_MOTD", dol_htmlcleanlastbr($_POST["main_motd"]),'chaine',0,'',$conf->entity);
|
||||
@ -147,43 +158,43 @@ if ($action == 'update')
|
||||
$varforimage='imagebackground'; $dirforimage=$conf->mycompany->dir_output.'/logos/';
|
||||
if ($_FILES[$varforimage]["tmp_name"])
|
||||
{
|
||||
if (preg_match('/([^\\/:]+)$/i',$_FILES[$varforimage]["name"],$reg))
|
||||
{
|
||||
$original_file=$reg[1];
|
||||
if (preg_match('/([^\\/:]+)$/i',$_FILES[$varforimage]["name"],$reg))
|
||||
{
|
||||
$original_file=$reg[1];
|
||||
|
||||
$isimage=image_format_supported($original_file);
|
||||
if ($isimage >= 0)
|
||||
{
|
||||
dol_syslog("Move file ".$_FILES[$varforimage]["tmp_name"]." to ".$dirforimage.$original_file);
|
||||
if (! is_dir($dirforimage))
|
||||
{
|
||||
dol_mkdir($dirforimage);
|
||||
}
|
||||
$result=dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"],$dirforimage.$original_file,1,0,$_FILES[$varforimage]['error']);
|
||||
if ($result > 0)
|
||||
{
|
||||
dolibarr_set_const($db, "MAIN_LOGIN_BACKGROUND",$original_file,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
else if (preg_match('/^ErrorFileIsInfectedWithAVirus/',$result))
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$tmparray=explode(':',$result);
|
||||
setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus',$tmparray[1]), null, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
|
||||
}
|
||||
}
|
||||
$isimage=image_format_supported($original_file);
|
||||
if ($isimage >= 0)
|
||||
{
|
||||
dol_syslog("Move file ".$_FILES[$varforimage]["tmp_name"]." to ".$dirforimage.$original_file);
|
||||
if (! is_dir($dirforimage))
|
||||
{
|
||||
dol_mkdir($dirforimage);
|
||||
}
|
||||
$result=dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"],$dirforimage.$original_file,1,0,$_FILES[$varforimage]['error']);
|
||||
if ($result > 0)
|
||||
{
|
||||
dolibarr_set_const($db, "MAIN_LOGIN_BACKGROUND",$original_file,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
else if (preg_match('/^ErrorFileIsInfectedWithAVirus/',$result))
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$tmparray=explode(':',$result);
|
||||
setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus',$tmparray[1]), null, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -214,59 +225,59 @@ print "<br>\n";
|
||||
|
||||
if ($action == 'edit') // Edit
|
||||
{
|
||||
//WYSIWYG Editor
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
//WYSIWYG Editor
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
|
||||
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="action" value="update">';
|
||||
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="action" value="update">';
|
||||
|
||||
clearstatcache();
|
||||
clearstatcache();
|
||||
|
||||
print '<br>';
|
||||
print '<table summary="edit" class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Language").'</td><td></td>';
|
||||
print '<br>';
|
||||
print '<table summary="edit" class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Language").'</td><td></td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Default language
|
||||
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 '</td>';
|
||||
// Default language
|
||||
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 '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Multilingual GUI
|
||||
print '<tr><td class="titlefield">'.$langs->trans("EnableMultilangInterface").'</td><td>';
|
||||
print $form->selectyesno('MAIN_MULTILANGS',$conf->global->MAIN_MULTILANGS,1);
|
||||
print '</td>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("EnableMultilangInterface").'</td><td>';
|
||||
print $form->selectyesno('MAIN_MULTILANGS',$conf->global->MAIN_MULTILANGS,1);
|
||||
print '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table><br>'."\n";
|
||||
|
||||
// Themes and themes options
|
||||
show_theme(null,1);
|
||||
print '<br>';
|
||||
// Themes and themes options
|
||||
show_theme(null,1);
|
||||
print '<br>';
|
||||
|
||||
// Other
|
||||
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>';
|
||||
// Other
|
||||
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 '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// 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 '</tr>';
|
||||
|
||||
// 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 '</tr>';
|
||||
|
||||
// show input border
|
||||
/*
|
||||
// show input border
|
||||
/*
|
||||
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 '</td>';
|
||||
@ -275,38 +286,38 @@ if ($action == 'edit') // Edit
|
||||
*/
|
||||
|
||||
// Disable javascript and ajax
|
||||
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 '</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 '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// First day for weeks
|
||||
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 '</td>';
|
||||
// First day for weeks
|
||||
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 '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// DefaultWorkingDays
|
||||
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 '</td>';
|
||||
// DefaultWorkingDays
|
||||
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 '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// DefaultWorkingHours
|
||||
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 '</td>';
|
||||
// DefaultWorkingHours
|
||||
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 '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// 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"));
|
||||
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 $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 width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -342,27 +353,27 @@ if ($action == 'edit') // Edit
|
||||
print '</tr>';
|
||||
|
||||
// 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 $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK)?$conf->global->MAIN_HELP_DISABLELINK:0,1);
|
||||
print '</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 '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Message of the day on home page
|
||||
$substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount'));
|
||||
complete_substitutions_array($substitutionarray, $langs);
|
||||
$substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount'));
|
||||
complete_substitutions_array($substitutionarray, $langs);
|
||||
|
||||
print '<tr><td class="titlefield">';
|
||||
$texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||
foreach($substitutionarray as $key => $val)
|
||||
{
|
||||
$texthelp.=$key.'<br>';
|
||||
}
|
||||
print $form->textwithpicto($langs->trans("MessageOfDay"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessageofday');
|
||||
print '<tr><td class="titlefield">';
|
||||
$texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||
foreach($substitutionarray as $key => $val)
|
||||
{
|
||||
$texthelp.=$key.'<br>';
|
||||
}
|
||||
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();
|
||||
|
||||
print '</td></tr>'."\n";
|
||||
@ -379,12 +390,12 @@ if ($action == 'edit') // Edit
|
||||
|
||||
// Message on login page
|
||||
$substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount','user'));
|
||||
complete_substitutions_array($substitutionarray, $langs);
|
||||
print '<tr><td>';
|
||||
complete_substitutions_array($substitutionarray, $langs);
|
||||
print '<tr><td>';
|
||||
$texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||
foreach($substitutionarray as $key => $val)
|
||||
{
|
||||
$texthelp.=$key.'<br>';
|
||||
$texthelp.=$key.'<br>';
|
||||
}
|
||||
print $form->textwithpicto($langs->trans("MessageLogin"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessagelogin');
|
||||
print '</td><td colspan="2">';
|
||||
@ -401,16 +412,16 @@ if ($action == 'edit') // Edit
|
||||
|
||||
// Background
|
||||
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">';
|
||||
if (! empty($conf->global->MAIN_LOGIN_BACKGROUND)) {
|
||||
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)) {
|
||||
print ' ';
|
||||
print '<img class="paddingleft valignmiddle" width="100px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('/'.$conf->global->MAIN_LOGIN_BACKGROUND).'">';
|
||||
}
|
||||
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)) {
|
||||
print ' ';
|
||||
print '<img class="paddingleft valignmiddle" width="100px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('/'.$conf->global->MAIN_LOGIN_BACKGROUND).'">';
|
||||
}
|
||||
} 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 '</td></tr>';
|
||||
@ -418,31 +429,31 @@ if ($action == 'edit') // Edit
|
||||
print '</table>'."\n";
|
||||
|
||||
|
||||
print '<br><div class="center">';
|
||||
print '<input class="button" type="submit" name="submit" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</div>';
|
||||
print '<br><div class="center">';
|
||||
print '<input class="button" type="submit" name="submit" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
print '</form>';
|
||||
}
|
||||
else // Show
|
||||
{
|
||||
// Language
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Language").'</td><td></td><td> </td></tr>';
|
||||
// Language
|
||||
print '<table class="noborder" width="100%">';
|
||||
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>';
|
||||
$s=picto_from_langcode($conf->global->MAIN_LANG_DEFAULT);
|
||||
print ($s?$s.' ':'');
|
||||
print ($conf->global->MAIN_LANG_DEFAULT=='auto'?$langs->trans("AutoDetectLang"):$langs->trans("Language_".$conf->global->MAIN_LANG_DEFAULT));
|
||||
print '</td>';
|
||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DefaultLanguage").'</td><td>';
|
||||
$s=picto_from_langcode($conf->global->MAIN_LANG_DEFAULT);
|
||||
print ($s?$s.' ':'');
|
||||
print ($conf->global->MAIN_LANG_DEFAULT=='auto'?$langs->trans("AutoDetectLang"):$langs->trans("Language_".$conf->global->MAIN_LANG_DEFAULT));
|
||||
print '</td>';
|
||||
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 "</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 "</tr>";
|
||||
|
||||
@ -450,19 +461,19 @@ else // Show
|
||||
|
||||
|
||||
// Themes
|
||||
show_theme(null,0);
|
||||
print '<br>';
|
||||
show_theme(null,0);
|
||||
print '<br>';
|
||||
|
||||
|
||||
// Other
|
||||
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>';
|
||||
// Other
|
||||
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="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 "</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 "</tr>";
|
||||
|
||||
@ -473,38 +484,38 @@ else // Show
|
||||
print "</tr>";
|
||||
*/
|
||||
|
||||
// Disable javascript/ajax
|
||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DisableJavascript").'</td><td>';
|
||||
print yn($conf->global->MAIN_DISABLE_JAVASCRIPT)."</td>";
|
||||
print '<td width="20"> </td>';
|
||||
print "</tr>";
|
||||
// Disable javascript/ajax
|
||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DisableJavascript").'</td><td>';
|
||||
print yn($conf->global->MAIN_DISABLE_JAVASCRIPT)."</td>";
|
||||
print '<td width="20"> </td>';
|
||||
print "</tr>";
|
||||
|
||||
// First day for weeks
|
||||
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 '</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 '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// DefaultWorkingDays
|
||||
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 '</td>';
|
||||
// DefaultWorkingDays
|
||||
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 '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// DefaultWorkingHours
|
||||
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 '</td>';
|
||||
// DefaultWorkingHours
|
||||
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 '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Firstname / Name position
|
||||
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"); }
|
||||
else { print $langs->trans("Lastname").' '.$langs->trans("Firstname"); }
|
||||
print '</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"); }
|
||||
else { print $langs->trans("Lastname").' '.$langs->trans("Firstname"); }
|
||||
print '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -513,8 +524,8 @@ else // Show
|
||||
print yn((isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)?$conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED:0),1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Show logo
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("EnableShowLogo").'</td><td>' . yn($conf->global->MAIN_SHOW_LOGO) . '</td>';
|
||||
// Show logo
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("EnableShowLogo").'</td><td>' . yn($conf->global->MAIN_SHOW_LOGO) . '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print "</tr>";
|
||||
|
||||
@ -527,62 +538,62 @@ else // Show
|
||||
print '</tr>';
|
||||
*/
|
||||
|
||||
// Show bugtrack link
|
||||
// Show bugtrack link
|
||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).'</td><td>';
|
||||
print yn($conf->global->MAIN_BUGTRACK_ENABLELINK)."</td>";
|
||||
print '<td width="20"> </td>';
|
||||
print "</tr>";
|
||||
|
||||
// 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 yn((isset($conf->global->MAIN_HELP_DISABLELINK)?$conf->global->MAIN_HELP_DISABLELINK:0),1);
|
||||
print '</td></tr>';
|
||||
// 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 yn((isset($conf->global->MAIN_HELP_DISABLELINK)?$conf->global->MAIN_HELP_DISABLELINK:0),1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Message of the day
|
||||
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);
|
||||
else print ' ';
|
||||
print '</td></tr>'."\n";
|
||||
// Message of the day
|
||||
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);
|
||||
else print ' ';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
print '</table>'."\n";
|
||||
print '</table>'."\n";
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
// Login page
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("LoginPage").'</td><td></td><td> </td></tr>';
|
||||
// Login page
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("LoginPage").'</td><td></td><td> </td></tr>';
|
||||
|
||||
// Message login
|
||||
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);
|
||||
else print ' ';
|
||||
print '</td></tr>'."\n";
|
||||
// Message login
|
||||
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);
|
||||
else print ' ';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Link to help center
|
||||
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 '</td></tr>';
|
||||
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 '</td></tr>';
|
||||
|
||||
// Background login
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("BackgroundImageLogin").'</td><td colspan="2">';
|
||||
print '<div class="centpercent inline-block">';
|
||||
print $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).'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<img class="img_logo paddingleft valignmiddle" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
|
||||
}
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
// Background login
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("BackgroundImageLogin").'</td><td colspan="2">';
|
||||
print '<div class="centpercent inline-block">';
|
||||
print $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).'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<img class="img_logo paddingleft valignmiddle" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
|
||||
}
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>'."\n";
|
||||
print '</table>'."\n";
|
||||
|
||||
print '<div class="tabsAction tabsActionNoBottom">';
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
|
||||
print '</div>';
|
||||
print '<div class="tabsAction tabsActionNoBottom">';
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2005 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -66,8 +66,9 @@ 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_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_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_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_ZIP',GETPOST("fieldzip"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_TOWN',GETPOST("fieldtown"),'chaine',0,'',$conf->entity)) $error++;
|
||||
@ -84,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_AMOUNT', GETPOST("fieldlastsubscriptionamount"),'chaine',0,'',$conf->entity)) $error++;
|
||||
|
||||
// This one must be after the others
|
||||
$valkey='';
|
||||
$key=GETPOST("key");
|
||||
if ($key) $valkey=$conf->global->$key;
|
||||
if (! dolibarr_set_const($db, 'LDAP_KEY_MEMBERS',$valkey,'chaine',0,'',$conf->entity)) $error++;
|
||||
// This one must be after the others
|
||||
$valkey='';
|
||||
$key=GETPOST("key");
|
||||
if ($key) $valkey=$conf->global->$key;
|
||||
if (! dolibarr_set_const($db, 'LDAP_KEY_MEMBERS',$valkey,'chaine',0,'',$conf->entity)) $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -282,6 +283,14 @@ print '</td><td>'.$langs->trans("LDAPFieldFaxExample").'</td>';
|
||||
print '<td align="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Company
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldCompany").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldcompany" value="'.$conf->global->LDAP_MEMBER_FIELD_COMPANY.'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldCompanyExample").'</td>';
|
||||
print '<td align="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Address
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldAddress").'</td><td>';
|
||||
|
||||
@ -63,28 +63,33 @@ 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_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_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_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_ZIP',GETPOST("fieldzip"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_TOWN',GETPOST("fieldtown"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_COUNTRY',GETPOST("fieldcountry"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_DESCRIPTION',GETPOST("fielddescription"),'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++;
|
||||
|
||||
// This one must be after the others
|
||||
$valkey='';
|
||||
$key=GETPOST("key");
|
||||
if ($key) $valkey=$conf->global->$key;
|
||||
if (! dolibarr_set_const($db, 'LDAP_KEY_USERS',$valkey,'chaine',0,'',$conf->entity)) $error++;
|
||||
// This one must be after the others
|
||||
$valkey='';
|
||||
$key=GETPOST("key");
|
||||
if ($key) $valkey=$conf->global->$key;
|
||||
if (! dolibarr_set_const($db, 'LDAP_KEY_USERS',$valkey,'chaine',0,'',$conf->entity)) $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -208,7 +213,7 @@ print '</tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldPasswordNotCrypted").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldpassword" value="'.$conf->global->LDAP_FIELD_PASSWORD.'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldPasswordExample").'</td>';
|
||||
print '<td align="right"><input type="radio" name="key" value="LDAP_FIELD_PASSWORD"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_PASSWORD)?' checked':'')."></td>";
|
||||
print '<td align="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Password crypted
|
||||
@ -216,7 +221,7 @@ print '</tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldPasswordCrypted").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldpasswordcrypted" value="'.$conf->global->LDAP_FIELD_PASSWORD_CRYPTED.'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldPasswordExample").'</td>';
|
||||
print '<td align="right"><input type="radio" name="key" value="LDAP_FIELD_PASSWORD_CRYPTED"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_PASSWORD_CRYPTED)?' checked':'')."></td>";
|
||||
print '<td align="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Mail
|
||||
@ -259,12 +264,52 @@ print '</td><td>'.$langs->trans("LDAPFieldFaxExample").'</td>';
|
||||
print '<td align="right"><input type="radio" name="key" value="LDAP_FIELD_FAX"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_FAX)?' checked':'')."></td>";
|
||||
print '</tr>';
|
||||
|
||||
// Company
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldCompany").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldcompany" value="'.$conf->global->LDAP_FIELD_COMPANY.'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldCompanyExample").'</td>';
|
||||
print '<td align="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Address
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldAddress").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldaddress" value="'.$conf->global->LDAP_FIELD_ADDRESS.'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldAddressExample").'</td>';
|
||||
print '<td align="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// ZIP
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldZip").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldzip" value="'.$conf->global->LDAP_FIELD_ZIP.'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldZipExample").'</td>';
|
||||
print '<td align="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// TOWN
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldTown").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldtown" value="'.$conf->global->LDAP_FIELD_TOWN.'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldTownExample").'</td>';
|
||||
print '<td align="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// COUNTRY
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldCountry").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldcountry" value="'.$conf->global->LDAP_FIELD_COUNTRY.'">';
|
||||
print '</td><td> </td>';
|
||||
print '<td align="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Title
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldTitle").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldtitle" value="'.$conf->global->LDAP_FIELD_TITLE.'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldTitleExample").'</td>';
|
||||
print '<td align="right"><input type="radio" name="key" value="LDAP_FIELD_TITLE"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_TITLE)?' checked':'')."></td>";
|
||||
print '<td align="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Note
|
||||
@ -272,7 +317,7 @@ print '</tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("Note").'</td><td>';
|
||||
print '<input size="25" type="text" name="fielddescription" value="'.$conf->global->LDAP_FIELD_DESCRIPTION.'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldDescriptionExample").'</td>';
|
||||
print '<td align="right"><input type="radio" name="key" value="LDAP_FIELD_DESCRIPTION"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_DESCRIPTION)?' checked':'')."></td>";
|
||||
print '<td align="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Sid
|
||||
@ -385,7 +430,7 @@ if (function_exists("ldap_connect"))
|
||||
{
|
||||
$required_fields = array(
|
||||
$conf->global->LDAP_KEY_USERS,
|
||||
$conf->global->LDAP_FIELD_FULLNAME,
|
||||
$conf->global->LDAP_FIELD_FULLNAME,
|
||||
$conf->global->LDAP_FIELD_NAME,
|
||||
$conf->global->LDAP_FIELD_FIRSTNAME,
|
||||
$conf->global->LDAP_FIELD_LOGIN,
|
||||
@ -394,7 +439,7 @@ if (function_exists("ldap_connect"))
|
||||
$conf->global->LDAP_FIELD_PASSWORD_CRYPTED,
|
||||
$conf->global->LDAP_FIELD_PHONE,
|
||||
$conf->global->LDAP_FIELD_FAX,
|
||||
$conf->global->LDAP_FIELD_SKYPE,
|
||||
$conf->global->LDAP_FIELD_SKYPE,
|
||||
$conf->global->LDAP_FIELD_MOBILE,
|
||||
$conf->global->LDAP_FIELD_MAIL,
|
||||
$conf->global->LDAP_FIELD_TITLE,
|
||||
@ -402,35 +447,35 @@ if (function_exists("ldap_connect"))
|
||||
$conf->global->LDAP_FIELD_SID
|
||||
);
|
||||
|
||||
// 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")));
|
||||
// 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")));
|
||||
|
||||
// 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, '', 1);
|
||||
// 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, '', 1);
|
||||
|
||||
if (is_array($ldapusers))
|
||||
{
|
||||
$liste=array();
|
||||
foreach ($ldapusers as $key => $ldapuser)
|
||||
{
|
||||
// Define the label string for this user
|
||||
$label='';
|
||||
foreach ($required_fields as $value)
|
||||
{
|
||||
if ($value)
|
||||
{
|
||||
$label.=$value."=".$ldapuser[$value]." ";
|
||||
}
|
||||
}
|
||||
$liste[$key] = $label;
|
||||
}
|
||||
if (is_array($ldapusers))
|
||||
{
|
||||
$liste=array();
|
||||
foreach ($ldapusers as $key => $ldapuser)
|
||||
{
|
||||
// Define the label string for this user
|
||||
$label='';
|
||||
foreach ($required_fields as $value)
|
||||
{
|
||||
if ($value)
|
||||
{
|
||||
$label.=$value."=".$ldapuser[$value]." ";
|
||||
}
|
||||
}
|
||||
$liste[$key] = $label;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($ldap->error, $ldap->errors, 'errors');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($ldap->error, $ldap->errors, 'errors');
|
||||
}
|
||||
|
||||
print "<br>\n";
|
||||
print "LDAP search for user:<br>\n";
|
||||
|
||||
@ -69,20 +69,20 @@ complete_substitutions_array($substitutionarrayfortest, $langs);
|
||||
|
||||
if ($action == 'update' && empty($_POST["cancel"]))
|
||||
{
|
||||
dolibarr_set_const($db, "MAIN_DISABLE_ALL_MAILS", GETPOST("MAIN_DISABLE_ALL_MAILS"),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_DISABLE_ALL_MAILS", GETPOST("MAIN_DISABLE_ALL_MAILS"),'chaine',0,'',$conf->entity);
|
||||
// Send mode parameters
|
||||
dolibarr_set_const($db, "MAIN_MAIL_SENDMODE", GETPOST("MAIN_MAIL_SENDMODE"),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_SMTP_PORT", GETPOST("MAIN_MAIL_SMTP_PORT"),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_SMTP_SERVER", GETPOST("MAIN_MAIL_SMTP_SERVER"),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_ID", GETPOST("MAIN_MAIL_SMTPS_ID"), 'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_PW", GETPOST("MAIN_MAIL_SMTPS_PW"), 'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_TLS", GETPOST("MAIN_MAIL_EMAIL_TLS"),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_STARTTLS", GETPOST("MAIN_MAIL_EMAIL_STARTTLS"),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_SENDMODE", GETPOST("MAIN_MAIL_SENDMODE"),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_SMTP_PORT", GETPOST("MAIN_MAIL_SMTP_PORT"),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_SMTP_SERVER", GETPOST("MAIN_MAIL_SMTP_SERVER"),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_ID", GETPOST("MAIN_MAIL_SMTPS_ID"), 'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_PW", GETPOST("MAIN_MAIL_SMTPS_PW"), 'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_TLS", GETPOST("MAIN_MAIL_EMAIL_TLS"),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_STARTTLS", GETPOST("MAIN_MAIL_EMAIL_STARTTLS"),'chaine',0,'',$conf->entity);
|
||||
// Content parameters
|
||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_FROM", GETPOST("MAIN_MAIL_EMAIL_FROM"), 'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_ERRORS_TO", GETPOST("MAIN_MAIL_ERRORS_TO"), 'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_AUTOCOPY_TO", GETPOST("MAIN_MAIL_AUTOCOPY_TO"),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, 'MAIN_MAIL_DEFAULT_FROMTYPE',GETPOST('MAIN_MAIL_DEFAULT_FROMTYPE'),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_FROM", GETPOST("MAIN_MAIL_EMAIL_FROM"), 'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_ERRORS_TO", GETPOST("MAIN_MAIL_ERRORS_TO"), 'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_AUTOCOPY_TO", GETPOST("MAIN_MAIL_AUTOCOPY_TO"),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, 'MAIN_MAIL_DEFAULT_FROMTYPE', GETPOST('MAIN_MAIL_DEFAULT_FROMTYPE'),'chaine',0,'',$conf->entity);
|
||||
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
|
||||
exit;
|
||||
@ -427,13 +427,30 @@ if ($action == 'edit')
|
||||
print '"></td></tr>';
|
||||
|
||||
// Default from type
|
||||
|
||||
$liste = array();
|
||||
$liste['user'] = $langs->trans('UserEmail');
|
||||
$liste['company'] = $langs->trans('CompanyEmail').' ('.(empty($conf->global->MAIN_INFO_SOCIETE_MAIL)?$langs->trans("NotDefined"):$conf->global->MAIN_INFO_SOCIETE_MAIL).')';
|
||||
$liste = array();
|
||||
$liste['user'] = $langs->trans('UserEmail');
|
||||
$liste['company'] = $langs->trans('CompanyEmail').' ('.(empty($conf->global->MAIN_INFO_SOCIETE_MAIL)?$langs->trans("NotDefined"):$conf->global->MAIN_INFO_SOCIETE_MAIL).')';
|
||||
/*
|
||||
$sql='SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile WHERE active = 1';
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i=0;
|
||||
while($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
$liste['senderprofile_'.$obj->rowid] = $obj->label.' <'.$obj->email.'>';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else dol_print_error($db);*/
|
||||
|
||||
print '<tr '.$bc[$var?1:0].'><td>'.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').'</td><td>';
|
||||
print $form->selectarray('MAIN_MAIL_DEFAULT_FROMTYPE',$liste,$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE,0);
|
||||
print $form->selectarray('MAIN_MAIL_DEFAULT_FROMTYPE', $liste, $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE, 0);
|
||||
print '</td></tr>';
|
||||
|
||||
// Separator
|
||||
@ -569,13 +586,46 @@ else
|
||||
print '</td></tr>';
|
||||
|
||||
// Default from type
|
||||
$liste = array();
|
||||
$liste['user'] = $langs->trans('UserEmail');
|
||||
$liste['company'] = $langs->trans('CompanyEmail').' ('.(empty($conf->global->MAIN_INFO_SOCIETE_MAIL)?$langs->trans("NotDefined"):$conf->global->MAIN_INFO_SOCIETE_MAIL).')';
|
||||
$sql='SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile WHERE active = 1';
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i=0;
|
||||
while($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
$liste['senderprofile_'.$obj->rowid] = $obj->label.' <'.$obj->email.'>';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else dol_print_error($db);
|
||||
|
||||
print '<tr '.$bc[$var?1:0].'><td>'.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').'</td>';
|
||||
print '<td>';
|
||||
if($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'user'){
|
||||
if ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'user')
|
||||
{
|
||||
print $langs->trans('UserEmail');
|
||||
} else {
|
||||
print $langs->trans('CompanyEmail');
|
||||
}
|
||||
else if ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'company')
|
||||
{
|
||||
print $langs->trans('CompanyEmail').' '.dol_escape_htmltag('<'.$mysoc->email.'>');
|
||||
}
|
||||
else {
|
||||
$id = preg_replace('/senderprofile_/', '', $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE);
|
||||
if ($id > 0)
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/emailsenderprofile.class.php';
|
||||
$emailsenderprofile = new EmailSenderProfile($db);
|
||||
$emailsenderprofile->fetch($id);
|
||||
print $emailsenderprofile->label.' '.dol_escape_htmltag('<'.$emailsenderprofile->email.'>');
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
@ -53,7 +53,6 @@ $id=GETPOST('id','int');
|
||||
$rowid=GETPOST('rowid','alpha');
|
||||
$search_label=GETPOST('search_label','alpha');
|
||||
$search_type_template=GETPOST('search_type_template','alpha');
|
||||
$search_topic=GETPOST('search_topic','alpha');
|
||||
$search_lang=GETPOST('search_lang','alpha');
|
||||
$search_fk_user=GETPOST('search_fk_user','intcomma');
|
||||
$search_topic=GETPOST('search_topic','alpha');
|
||||
@ -94,26 +93,20 @@ $tabsqlsort[25]="label ASC, lang ASC, position ASC";
|
||||
|
||||
// Nom des champs en resultat de select pour affichage du dictionnaire
|
||||
$tabfield=array();
|
||||
$tabfield[25]= "label,type_template,lang,fk_user,private,position,topic,content";
|
||||
$tabfield[25]= "label,type_template,lang,fk_user,private,position,topic,joinfiles,content";
|
||||
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfield[25].=',content_lines';
|
||||
|
||||
// Nom des champs d'edition pour modification d'un enregistrement
|
||||
$tabfieldvalue=array();
|
||||
$tabfieldvalue[25]= "label,type_template,fk_user,lang,private,position,topic,content";
|
||||
$tabfieldvalue[25]= "label,type_template,fk_user,lang,private,position,topic,joinfiles,content";
|
||||
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfieldvalue[25].=',content_lines';
|
||||
|
||||
// Nom des champs dans la table pour insertion d'un enregistrement
|
||||
$tabfieldinsert=array();
|
||||
$tabfieldinsert[25]= "label,type_template,fk_user,lang,private,position,topic,content";
|
||||
$tabfieldinsert[25]= "label,type_template,fk_user,lang,private,position,topic,joinfiles,content";
|
||||
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfieldinsert[25].=',content_lines';
|
||||
$tabfieldinsert[25].=',entity'; // Must be at end because not into other arrays
|
||||
|
||||
// Nom du rowid si le champ n'est pas de type autoincrement
|
||||
// Example: "" if id field is "rowid" and has autoincrement on
|
||||
// "nameoffield" if id field is not "rowid" or has not autoincrement on
|
||||
$tabrowid=array();
|
||||
$tabrowid[25]= "";
|
||||
|
||||
// Condition to show dictionary in setup page
|
||||
$tabcond=array();
|
||||
$tabcond[25]= true;
|
||||
@ -153,7 +146,7 @@ else
|
||||
|
||||
|
||||
$tabhelp=array();
|
||||
$tabhelp[25] = array('topic'=>$helpsubstit,'content'=>$helpsubstit,'content_lines'=>$helpsubstitforlines,'type_template'=>$langs->trans("TemplateForElement"),'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"), 'position'=>$langs->trans("PositionIntoComboList"));
|
||||
$tabhelp[25] = array('topic'=>$helpsubstit,'joinfiles'=>$langs->trans('AttachMainDocByDefault'), 'content'=>$helpsubstit,'content_lines'=>$helpsubstitforlines,'type_template'=>$langs->trans("TemplateForElement"),'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"), 'position'=>$langs->trans("PositionIntoComboList"));
|
||||
|
||||
// List of check for fields (NOT USED YET)
|
||||
$tabfieldcheck=array();
|
||||
@ -177,6 +170,7 @@ if ($conf->fournisseur->enabled) $elementList['invoice_supplier_send']=$la
|
||||
if ($conf->societe->enabled) $elementList['thirdparty']=$langs->trans('MailToThirdparty');
|
||||
if ($conf->adherent->enabled) $elementList['member']=$langs->trans('MailToMember');
|
||||
if ($conf->contrat->enabled) $elementList['contract']=$langs->trans('MailToSendContract');
|
||||
$elementList['user']=$langs->trans('MailToUser');
|
||||
$elementList['all'] =$langs->trans('VisibleEverywhere');
|
||||
$elementList['none']=$langs->trans('VisibleNowhere');
|
||||
|
||||
@ -229,10 +223,12 @@ if (empty($reshook))
|
||||
$ok=1;
|
||||
foreach ($listfield as $f => $value)
|
||||
{
|
||||
// Not mandatory fields
|
||||
if ($value == 'joinfiles') continue;
|
||||
if ($value == 'content') continue;
|
||||
if ($value == 'content_lines') continue;
|
||||
if ($value == 'content') $value='content-'.$rowid;
|
||||
if ($value == 'content_lines') $value='content_lines-'.$rowid;
|
||||
|
||||
if (GETPOST('actionmodify') && $value == 'topic') $_POST['topic']=$_POST['topic-'.$rowid];
|
||||
|
||||
if ((! isset($_POST[$value]) || $_POST[$value]=='' || $_POST[$value]=='-1') && $value != 'lang' && $value != 'fk_user' && $value != 'position')
|
||||
{
|
||||
@ -256,34 +252,14 @@ if (empty($reshook))
|
||||
// Si verif ok et action add, on ajoute la ligne
|
||||
if ($ok && GETPOST('actionadd'))
|
||||
{
|
||||
if ($tabrowid[$id])
|
||||
{
|
||||
// Recupere id libre pour insertion
|
||||
$newid=0;
|
||||
$sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id];
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$newid=($obj->newid + 1);
|
||||
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// Add new entry
|
||||
$sql = "INSERT INTO ".$tabname[$id]." (";
|
||||
// List of fields
|
||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
|
||||
$sql.= $tabrowid[$id].",";
|
||||
$sql.= $tabfieldinsert[$id];
|
||||
$sql.=",active)";
|
||||
$sql.= " VALUES(";
|
||||
|
||||
// List of values
|
||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
|
||||
$sql.= $newid.",";
|
||||
$i=0;
|
||||
foreach ($listfieldinsert as $f => $value)
|
||||
{
|
||||
@ -322,17 +298,11 @@ if (empty($reshook))
|
||||
// Si verif ok et action modify, on modifie la ligne
|
||||
if ($ok && GETPOST('actionmodify'))
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||
else { $rowidcol="rowid"; }
|
||||
$rowidcol="rowid";
|
||||
|
||||
// Modify entry
|
||||
$sql = "UPDATE ".$tabname[$id]." SET ";
|
||||
// Modifie valeur des champs
|
||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldmodify))
|
||||
{
|
||||
$sql.= $tabrowid[$id]."=";
|
||||
$sql.= "'".$db->escape($rowid)."', ";
|
||||
}
|
||||
$i = 0;
|
||||
foreach ($listfieldmodify as $field)
|
||||
{
|
||||
@ -340,8 +310,10 @@ if (empty($reshook))
|
||||
if ($field == 'lang') $keycode='langcode';
|
||||
|
||||
if ($field == 'fk_user' && ! ($_POST['fk_user'] > 0)) $_POST['fk_user']='';
|
||||
if ($field == 'topic') $_POST['topic']=$_POST['topic-'.$rowid];
|
||||
if ($field == 'joinfiles') $_POST['joinfiles']=$_POST['joinfiles-'.$rowid];
|
||||
if ($field == 'content') $_POST['content']=$_POST['content-'.$rowid];
|
||||
if ($field == 'content_lines') $_POST['content_lines']=$_POST['content_lines-'.$rowid];
|
||||
if ($field == 'content_lines') $_POST['content_lines']=$_POST['content_lines-'.$rowid];
|
||||
if ($field == 'entity') $_POST[$keycode] = $conf->entity;
|
||||
if ($i) $sql.=",";
|
||||
$sql.= $field."=";
|
||||
@ -354,7 +326,11 @@ if (empty($reshook))
|
||||
dol_syslog("actionmodify", LOG_DEBUG);
|
||||
//print $sql;
|
||||
$resql = $db->query($sql);
|
||||
if (! $resql)
|
||||
if ($resql)
|
||||
{
|
||||
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($db->error(), null, 'errors');
|
||||
}
|
||||
@ -363,8 +339,7 @@ if (empty($reshook))
|
||||
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||
else { $rowidcol="rowid"; }
|
||||
$rowidcol="rowid";
|
||||
|
||||
$sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'";
|
||||
|
||||
@ -386,15 +361,9 @@ if (empty($reshook))
|
||||
// activate
|
||||
if ($action == $acts[0])
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||
else { $rowidcol="rowid"; }
|
||||
$rowidcol="rowid";
|
||||
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'";
|
||||
}
|
||||
elseif ($code) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".$code."'";
|
||||
}
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if (!$result)
|
||||
@ -406,15 +375,9 @@ if (empty($reshook))
|
||||
// disable
|
||||
if ($action == $acts[1])
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||
else { $rowidcol="rowid"; }
|
||||
$rowidcol="rowid";
|
||||
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'";
|
||||
}
|
||||
elseif ($code) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".$code."'";
|
||||
}
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if (!$result)
|
||||
@ -475,7 +438,7 @@ if ($action == 'delete')
|
||||
//var_dump($elementList);
|
||||
|
||||
|
||||
$sql="SELECT rowid as rowid, label, type_template, lang, fk_user, private, position, topic, content_lines, content, active";
|
||||
$sql="SELECT rowid as rowid, label, type_template, lang, fk_user, private, position, topic, joinfiles, content_lines, content, active";
|
||||
$sql.=" FROM ".MAIN_DB_PREFIX."c_email_templates";
|
||||
$sql.=" WHERE entity IN (".getEntity('email_template').")";
|
||||
if (! $user->admin)
|
||||
@ -541,11 +504,14 @@ foreach ($fieldlist as $field => $value)
|
||||
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
|
||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); }
|
||||
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
|
||||
if ($fieldlist[$field]=='content') { $valuetoshow=''; }
|
||||
if ($fieldlist[$field]=='content_lines') { $valuetoshow=''; }
|
||||
if ($fieldlist[$field]=='private') { $align='center'; }
|
||||
if ($fieldlist[$field]=='position') { $align='center'; }
|
||||
|
||||
if ($fieldlist[$field]=='topic') { $valuetoshow=''; }
|
||||
if ($fieldlist[$field]=='joinfiles') { $valuetoshow=''; }
|
||||
if ($fieldlist[$field]=='content') { $valuetoshow=''; }
|
||||
if ($fieldlist[$field]=='content_lines') { $valuetoshow=''; }
|
||||
|
||||
if ($valuetoshow != '')
|
||||
{
|
||||
print '<td align="'.$align.'">';
|
||||
@ -560,14 +526,11 @@ foreach ($fieldlist as $field => $value)
|
||||
}
|
||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
|
||||
}
|
||||
print '<td colspan="3">';
|
||||
print '<td>';
|
||||
print '<input type="hidden" name="id" value="' . $id . '">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Line to enter new values (input fields)
|
||||
print "<tr " . $bcnd[$var] . ">";
|
||||
|
||||
$obj = new stdClass();
|
||||
// If data was already input, we define them in obj to populate input fields.
|
||||
if (GETPOST('actionadd'))
|
||||
@ -587,6 +550,10 @@ $reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters,
|
||||
$error = $hookmanager->error;
|
||||
$errors = $hookmanager->errors;
|
||||
|
||||
|
||||
// Line to enter new values (input fields)
|
||||
print "<tr " . $bcnd[$var] . ">";
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($action == 'edit') {
|
||||
@ -596,32 +563,51 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
print '<td align="right" colspan="3">';
|
||||
print '<td align="right">';
|
||||
print '</td>';
|
||||
print "</tr>";
|
||||
|
||||
$fieldsforcontent = array('content');
|
||||
$fieldsforcontent = array('topic', 'joinfiles', 'content');
|
||||
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { $fieldsforcontent = array('content','content_lines'); }
|
||||
foreach ($fieldsforcontent as $tmpfieldlist)
|
||||
{
|
||||
print '<tr class="impair nodrag nodrop nohover"><td colspan="6">';
|
||||
print '<tr class="impair nodrag nodrop nohover"><td colspan="6" class="nobottom">';
|
||||
// Label
|
||||
if ($tmpfieldlist == 'topic')
|
||||
{
|
||||
print '<strong>' . $form->textwithpicto($langs->trans("Topic"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '</strong> ';
|
||||
}
|
||||
if ($tmpfieldlist == 'joinfiles')
|
||||
{
|
||||
print '<strong>' . $form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '</strong> ';
|
||||
}
|
||||
if ($tmpfieldlist == 'content')
|
||||
print '<strong>' . $form->textwithpicto($langs->trans("Content"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '</strong><br>';
|
||||
print '<strong>' . $form->textwithpicto($langs->trans("Content"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '</strong> ';
|
||||
if ($tmpfieldlist == 'content_lines')
|
||||
print '<strong>' . $form->textwithpicto($langs->trans("ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '</strong><br>';
|
||||
|
||||
if ($context != 'hide') {
|
||||
// print '<textarea cols="3" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea>';
|
||||
$okforextended = true;
|
||||
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL))
|
||||
$okforextended = false;
|
||||
$doleditor = new DolEditor($tmpfieldlist, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 120, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_4, '90%');
|
||||
print $doleditor->Create(1);
|
||||
} else
|
||||
print ' ';
|
||||
// Input field
|
||||
if ($tmpfieldlist == 'topic') {
|
||||
print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'" value="' . (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '') . '">';
|
||||
}
|
||||
else if ($tmpfieldlist == 'joinfiles') {
|
||||
print '<input type="text" class="flat maxwidth50" name="'.$tmpfieldlist.'" value="' . (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '') . '">';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($context != 'hide') {
|
||||
// print '<textarea cols="3" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea>';
|
||||
$okforextended = true;
|
||||
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL))
|
||||
$okforextended = false;
|
||||
$doleditor = new DolEditor($tmpfieldlist, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 120, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_4, '90%');
|
||||
print $doleditor->Create(1);
|
||||
}
|
||||
else
|
||||
print ' ';
|
||||
}
|
||||
print '</td>';
|
||||
if ($tmpfieldlist == 'content') {
|
||||
print '<td align="center" colspan="3" rowspan="' . (count($fieldsforcontent)) . '">';
|
||||
if ($tmpfieldlist == 'topic') {
|
||||
print '<td align="center" rowspan="' . (count($fieldsforcontent)) . '">';
|
||||
if ($action != 'edit') {
|
||||
print '<input type="submit" class="button" name="actionadd" value="' . $langs->trans("Add") . '">';
|
||||
}
|
||||
@ -704,7 +690,6 @@ if ($resql)
|
||||
elseif (! in_array($value, array('content', 'content_lines'))) print '<td class="liste_titre"></td>';
|
||||
}
|
||||
if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="right" width="64">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
@ -736,11 +721,13 @@ if ($resql)
|
||||
if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); }
|
||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); }
|
||||
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
|
||||
if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); $showfield=0;}
|
||||
if ($fieldlist[$field]=='content_lines') { $valuetoshow=$langs->trans("ContentLines"); $showfield=0; }
|
||||
if ($fieldlist[$field]=='private') { $align='center'; }
|
||||
if ($fieldlist[$field]=='position') { $align='center'; }
|
||||
|
||||
if ($fieldlist[$field]=='joinfiles') { $valuetoshow=$langs->trans("FilesAttachedToEmail"); $align='center'; }
|
||||
if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); $showfield=0;}
|
||||
if ($fieldlist[$field]=='content_lines') { $valuetoshow=$langs->trans("ContentLines"); $showfield=0; }
|
||||
|
||||
// Affiche nom du champ
|
||||
if ($showfield)
|
||||
{
|
||||
@ -755,7 +742,6 @@ if ($resql)
|
||||
|
||||
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, 'align="center"', $sortfield, $sortorder);
|
||||
print getTitleFieldOfList('');
|
||||
print getTitleFieldOfList('');
|
||||
print '</tr>';
|
||||
|
||||
if ($num)
|
||||
@ -777,7 +763,8 @@ if ($resql)
|
||||
// Show fields
|
||||
if (empty($reshook)) fieldList($fieldlist,$obj,$tabname[$id],'edit');
|
||||
|
||||
print '<td colspan="3" align="center">';
|
||||
print '<td></td><td></td><td></td>';
|
||||
print '<td align="center">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
||||
print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
||||
@ -785,10 +772,10 @@ if ($resql)
|
||||
print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</td>';
|
||||
|
||||
$fieldsforcontent = array('content');
|
||||
$fieldsforcontent = array('topic', 'joinfiles', 'content');
|
||||
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES))
|
||||
{
|
||||
$fieldsforcontent = array('content', 'content_lines');
|
||||
$fieldsforcontent = array('topic', 'joinfiles', 'content', 'content_lines');
|
||||
}
|
||||
foreach ($fieldsforcontent as $tmpfieldlist)
|
||||
{
|
||||
@ -799,17 +786,29 @@ if ($resql)
|
||||
$class = 'tddict';
|
||||
// Show value for field
|
||||
if ($showfield) {
|
||||
|
||||
// Show line for topic, joinfiles and content
|
||||
print '</tr><tr class="oddeven" nohover tr-'.$tmpfieldlist.'-'.$rowid.' ">';
|
||||
print '<td colspan="7">'; // To create an artificial CR for the current tr we are on
|
||||
$okforextended = true;
|
||||
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended = false;
|
||||
$doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%');
|
||||
print $doleditor->Create(1);
|
||||
print '<td colspan="8">';
|
||||
if ($tmpfieldlist == 'topic')
|
||||
{
|
||||
print '<strong>' . $form->textwithpicto($langs->trans("Topic"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '</strong> ';
|
||||
print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'-'.$rowid.'" value="' . (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '') . '">';
|
||||
}
|
||||
if ($tmpfieldlist == 'joinfiles')
|
||||
{
|
||||
print '<strong>' . $form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '</strong> ';
|
||||
print '<input type="text" class="flat maxwidth50" name="'.$tmpfieldlist.'-'.$rowid.'" value="' . (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '') . '">';
|
||||
}
|
||||
if ($tmpfieldlist == 'content')
|
||||
{
|
||||
$okforextended = true;
|
||||
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended = false;
|
||||
$doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%');
|
||||
print $doleditor->Create(1);
|
||||
}
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -856,6 +855,12 @@ if ($resql)
|
||||
{
|
||||
$align="center";
|
||||
}
|
||||
if ($value == 'joinfiles')
|
||||
{
|
||||
$align="center";
|
||||
if ($valuetoshow) $valuetoshow=1;
|
||||
else $valuetoshow='';
|
||||
}
|
||||
|
||||
$class='tddict';
|
||||
// Show value for field
|
||||
@ -880,24 +885,21 @@ if ($resql)
|
||||
if ($param) $url .= '&'.$param;
|
||||
$url.='&';
|
||||
|
||||
// Active
|
||||
// Status / Active
|
||||
print '<td align="center" class="nowrap">';
|
||||
if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
|
||||
print "</td>";
|
||||
|
||||
// Modify link
|
||||
if ($canbemodified) print '<td align="center" width="64"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>';
|
||||
else print '<td></td>';
|
||||
|
||||
// Delete link
|
||||
// Modify link / Delete link
|
||||
print '<td align="center" width="64">';
|
||||
if ($canbemodified) print '<a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a>';
|
||||
if ($iserasable)
|
||||
{
|
||||
print '<td align="center" width="64">';
|
||||
print '<a href="'.$url.'action=delete">'.img_delete().'</a>';
|
||||
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
|
||||
print '</td>';
|
||||
}
|
||||
else print '<td></td>';
|
||||
print '</td>';
|
||||
|
||||
|
||||
/*
|
||||
$fieldsforcontent = array('content');
|
||||
@ -1042,7 +1044,9 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
elseif (in_array($fieldlist[$field], array('content','content_lines'))) continue;
|
||||
elseif ($context == 'add' & in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue;
|
||||
elseif ($context == 'edit' & in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue;
|
||||
elseif ($context == 'hide' & in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue;
|
||||
else
|
||||
{
|
||||
$size=''; $class=''; $classtd='';
|
||||
|
||||
@ -366,7 +366,7 @@ if ($mode == 'desc')
|
||||
if ($mode == 'feature')
|
||||
{
|
||||
$text.='<br><strong>'.$langs->trans("DependsOn").':</strong> ';
|
||||
if (count($objMod->requiredby)) $text.=join(',', $objMod->depends);
|
||||
if (count($objMod->depends)) $text.=join(',', $objMod->depends);
|
||||
else $text.=$langs->trans("None");
|
||||
$text.='<br><strong>'.$langs->trans("RequiredBy").':</strong> ';
|
||||
if (count($objMod->requiredby)) $text.=join(',', $objMod->requiredby);
|
||||
|
||||
@ -623,7 +623,7 @@ if ($mode == 'common')
|
||||
$imginfo="info_black";
|
||||
}
|
||||
|
||||
print '<tr>'."\n";
|
||||
print '<tr class="oddeven">'."\n";
|
||||
|
||||
// Picto + Name of module
|
||||
print ' <td width="200px">';
|
||||
|
||||
@ -54,7 +54,7 @@ if ($action == 'getlastversion')
|
||||
$sfurl = simplexml_load_string($result['content']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -107,19 +107,21 @@ if (function_exists('curl_init'))
|
||||
}
|
||||
|
||||
// Show version
|
||||
print $langs->trans("LastStableVersion").' : <b>'. (($version != '0.0')?$version:$langs->trans("Unknown")) .'</b><br>';
|
||||
print $langs->trans("LastStableVersion").' : <b>'. (($version != '0.0')?$version:$langs->trans("Unknown")) .'</b>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("LastStableVersion").' : <b>' .$langs->trans("UpdateServerOffline").'</b><br>';
|
||||
print $langs->trans("LastStableVersion").' : <b>' .$langs->trans("UpdateServerOffline").'</b>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("LastStableVersion").' : <a href="'.$_SERVER["PHP_SELF"].'?action=getlastversion" class="button">' .$langs->trans("Check").'</a><br>';
|
||||
print $langs->trans("LastStableVersion").' : <a href="'.$_SERVER["PHP_SELF"].'?action=getlastversion" class="button">' .$langs->trans("Check").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
print ' - ';
|
||||
print '<a href="https://raw.githubusercontent.com/Dolibarr/dolibarr/develop/ChangeLog" target="_blank">'.$langs->trans("SeeChangeLog").'</a>';
|
||||
print '</td></tr>'."\n";
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("VersionLastUpgrade").' ('.$langs->trans("Database").')</td><td>'.$conf->global->MAIN_VERSION_LAST_UPGRADE.'</td></tr>'."\n";
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("VersionLastInstall").'</td><td>'.$conf->global->MAIN_VERSION_LAST_INSTALL.'</td></tr>'."\n";
|
||||
@ -343,7 +345,7 @@ foreach($configfileparameters as $key => $value)
|
||||
{
|
||||
$newkey = preg_replace('/^\?/','',$key);
|
||||
|
||||
if (preg_match('/^\?/',$key) && empty(${$newkey}))
|
||||
if (preg_match('/^\?/',$key) && empty(${$newkey}))
|
||||
{
|
||||
if ($newkey != 'multicompany_transverse_mode' || empty($conf->multicompany->enabled))
|
||||
continue; // We discard parameters starting with ?
|
||||
|
||||
@ -23,6 +23,8 @@ use Luracast\Restler\Format\UploadFormat;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
||||
|
||||
/**
|
||||
* API class for receive files
|
||||
@ -33,49 +35,49 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
class Documents extends DolibarrApi
|
||||
{
|
||||
|
||||
/**
|
||||
* @var array $DOCUMENT_FIELDS Mandatory fields, checked when create and update object
|
||||
*/
|
||||
static $DOCUMENT_FIELDS = array(
|
||||
'modulepart'
|
||||
);
|
||||
/**
|
||||
* @var array $DOCUMENT_FIELDS Mandatory fields, checked when create and update object
|
||||
*/
|
||||
static $DOCUMENT_FIELDS = array(
|
||||
'modulepart'
|
||||
);
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
global $db;
|
||||
$this->db = $db;
|
||||
}
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
global $db;
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a document. Note that, this API is similar to using the wrapper link "documents.php" to download
|
||||
* a file (used for internal HTML links of documents into application), but with no need to be into a logged session (no need to post the session cookie).
|
||||
*
|
||||
* @param string $module_part Name of module or area concerned by file download ('facture', ...)
|
||||
* @param string $original_file Relative path with filename, relative to modulepart (for example: IN201701-999/IN201701-999.pdf)
|
||||
* @param int $regeneratedoc If requested document is the main document of an object, setting this to 1 ask API to regenerate document before returning it (supported for some module_part only). It is no effect in other cases.
|
||||
* Also, note that setting this to 1 nead write access on object.
|
||||
* @return array List of documents
|
||||
*
|
||||
* @throws 500
|
||||
* @throws 501
|
||||
* @throws 400
|
||||
* @throws 401
|
||||
* @throws 200
|
||||
*/
|
||||
public function index($module_part, $original_file='', $regeneratedoc=0)
|
||||
{
|
||||
global $conf;
|
||||
/**
|
||||
* Returns a document. Note that, this API is similar to using the wrapper link "documents.php" to download
|
||||
* a file (used for internal HTML links of documents into application), but with no need to be into a logged session (no need to post the session cookie).
|
||||
*
|
||||
* @param string $module_part Name of module or area concerned by file download ('facture', ...)
|
||||
* @param string $original_file Relative path with filename, relative to modulepart (for example: IN201701-999/IN201701-999.pdf)
|
||||
* @param int $regeneratedoc If requested document is the main document of an object, setting this to 1 ask API to regenerate document before returning it (supported for some module_part only). It is no effect in other cases.
|
||||
* Also, note that setting this to 1 nead write access on object.
|
||||
* @return array List of documents
|
||||
*
|
||||
* @throws 500
|
||||
* @throws 501
|
||||
* @throws 400
|
||||
* @throws 401
|
||||
* @throws 200
|
||||
*/
|
||||
public function index($module_part, $original_file='', $regeneratedoc=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
if (empty($module_part)) {
|
||||
throw new RestException(400, 'bad value for parameter modulepart');
|
||||
throw new RestException(400, 'bad value for parameter modulepart');
|
||||
}
|
||||
if (empty($original_file)) {
|
||||
throw new RestException(400, 'bad value for parameter ref or subdir');
|
||||
}
|
||||
if (empty($original_file)) {
|
||||
throw new RestException(400, 'bad value for parameter ref or subdir');
|
||||
}
|
||||
|
||||
//--- Finds and returns the document
|
||||
$entity=$conf->entity;
|
||||
@ -87,94 +89,97 @@ class Documents extends DolibarrApi
|
||||
|
||||
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
|
||||
if ($regeneratedoc)
|
||||
{
|
||||
$hidedetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 0 : 1;
|
||||
$hidedesc = empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 0 : 1;
|
||||
$hideref = empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 0 : 1;
|
||||
// --- Generates the document
|
||||
if ($regeneratedoc)
|
||||
{
|
||||
$hidedetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 0 : 1;
|
||||
$hidedesc = empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 0 : 1;
|
||||
$hideref = empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 0 : 1;
|
||||
|
||||
if ($module_part == 'facture' || $module_part == 'invoice')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
$this->invoice = new Facture($this->db);
|
||||
$result = $this->invoice->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Invoice not found');
|
||||
}
|
||||
$result = $this->invoice->generateDocument($this->invoice->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if( $result <= 0 ) {
|
||||
throw new RestException(500, 'Error generating document');
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($module_part == 'facture' || $module_part == 'invoice')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
$this->invoice = new Facture($this->db);
|
||||
$result = $this->invoice->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Invoice not found');
|
||||
}
|
||||
$result = $this->invoice->generateDocument($this->invoice->modelpdf, $langs, $hidedetails, $hidedesc, $hideref);
|
||||
if( $result <= 0 ) {
|
||||
throw new RestException(500, 'Error generating document');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$filename = basename($original_file);
|
||||
$original_file_osencoded=dol_osencode($original_file); // New file name encoded in OS encoding charset
|
||||
|
||||
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);
|
||||
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.
|
||||
*
|
||||
* @param int $id ID of document
|
||||
* @return array Array with data of file
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
/*
|
||||
/**
|
||||
* Return a document.
|
||||
*
|
||||
* @param int $id ID of document
|
||||
* @return array Array with data of file
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
/*
|
||||
public function get($id) {
|
||||
return array('note'=>'xxx');
|
||||
}*/
|
||||
|
||||
|
||||
/**
|
||||
* Push a file.
|
||||
* 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" }.
|
||||
*
|
||||
* @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 $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 $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 int $overwriteifexists Overwrite file if exists (1 by default)
|
||||
* @return bool State of copy
|
||||
* @throws RestException
|
||||
*/
|
||||
public function post($filename, $modulepart, $ref='', $subdir='', $filecontent='', $fileencoding='', $overwriteifexists=0)
|
||||
{
|
||||
global $db, $conf;
|
||||
/**
|
||||
* Push a file.
|
||||
* 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" }.
|
||||
*
|
||||
* @param string $filename Name of file to create ('FA1705-0123')
|
||||
* @param string $modulepart Name of module or area concerned by file upload ('facture', 'project', 'project_task', ...)
|
||||
* @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 $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 int $overwriteifexists Overwrite file if exists (1 by default)
|
||||
* @return bool State of copy
|
||||
* @throws RestException
|
||||
*/
|
||||
public function post($filename, $modulepart, $ref='', $subdir='', $filecontent='', $fileencoding='', $overwriteifexists=0)
|
||||
{
|
||||
global $db, $conf;
|
||||
|
||||
/*var_dump($modulepart);
|
||||
/*var_dump($modulepart);
|
||||
var_dump($filename);
|
||||
var_dump($filecontent);
|
||||
exit;*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||
if(empty($modulepart))
|
||||
{
|
||||
throw new RestException(400, 'Modulepart not provided.');
|
||||
}
|
||||
|
||||
if (!DolibarrApiAccess::$user->rights->ecm->upload) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
if (!DolibarrApiAccess::$user->rights->ecm->upload) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$newfilecontent = '';
|
||||
if (empty($fileencoding)) $newfilecontent = $filecontent;
|
||||
if ($fileencoding == 'base64') $newfilecontent = base64_decode($filecontent);
|
||||
$newfilecontent = '';
|
||||
if (empty($fileencoding)) $newfilecontent = $filecontent;
|
||||
if ($fileencoding == 'base64') $newfilecontent = base64_decode($filecontent);
|
||||
|
||||
$original_file = dol_sanitizeFileName($filename);
|
||||
|
||||
@ -183,37 +188,81 @@ class Documents extends DolibarrApi
|
||||
$entity = $user->entity;
|
||||
if ($ref)
|
||||
{
|
||||
if ($modulepart == 'facture' || $modulepart == 'invoice')
|
||||
{
|
||||
$modulepart='facture';
|
||||
$object=new Facture($db);
|
||||
$result = $object->fetch('', $ref);
|
||||
}
|
||||
if ($modulepart == 'facture' || $modulepart == 'invoice')
|
||||
{
|
||||
$modulepart='facture';
|
||||
$object = new Facture($this->db);
|
||||
}
|
||||
elseif ($modulepart == 'project')
|
||||
{
|
||||
$object = new Project($this->db);
|
||||
}
|
||||
elseif ($modulepart == 'task' || $modulepart == 'project_task')
|
||||
{
|
||||
$modulepart = 'project_task';
|
||||
$object = new Task($this->db);
|
||||
|
||||
if (! ($object->id > 0))
|
||||
{
|
||||
throw new RestException(500, 'The object '.$modulepart." with ref '".$ref."' was not found.");
|
||||
}
|
||||
$task_result = $object->fetch('', $ref);
|
||||
|
||||
$tmp = dol_check_secure_access_document($modulepart, $tmpreldir.$object->ref, $entity, DolibarrApiAccess::$user, $ref, 'write');
|
||||
$upload_dir = $tmp['original_file'];
|
||||
// Fetching the tasks project is required because its out_dir might be a subdirectory of the project
|
||||
if($task_result > 0)
|
||||
{
|
||||
$project_result = $object->fetch_projet();
|
||||
|
||||
if (empty($upload_dir) || $upload_dir == '/')
|
||||
{
|
||||
throw new RestException(500, 'This value of modulepart does not support yet usage of ref. Check modulepart parameter or try to use subdir parameter instead of ref.');
|
||||
}
|
||||
if($project_result >= 0)
|
||||
{
|
||||
$tmpreldir = dol_sanitizeFileName($object->project->ref).'/';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new RestException(500, 'Error while fetching Task '.$ref);
|
||||
}
|
||||
}
|
||||
// TODO Implement additional moduleparts
|
||||
else
|
||||
{
|
||||
throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.');
|
||||
}
|
||||
|
||||
if(is_object($object))
|
||||
{
|
||||
$result = $object->fetch('', $ref);
|
||||
|
||||
if($result == 0)
|
||||
{
|
||||
throw new RestException(500, "Object with ref '".$ref.'" was not found.');
|
||||
}
|
||||
elseif ($result < 0)
|
||||
{
|
||||
throw new RestException(500, 'Error while fetching object.');
|
||||
}
|
||||
}
|
||||
|
||||
if (! ($object->id > 0))
|
||||
{
|
||||
throw new RestException(500, 'The object '.$modulepart." with ref '".$ref."' was not found.");
|
||||
}
|
||||
|
||||
$tmp = dol_check_secure_access_document($modulepart, $tmpreldir.dol_sanitizeFileName($object->ref), $entity, DolibarrApiAccess::$user, $ref, 'write');
|
||||
$upload_dir = $tmp['original_file'];
|
||||
|
||||
if (empty($upload_dir) || $upload_dir == '/')
|
||||
{
|
||||
throw new RestException(500, 'This value of modulepart does not support yet usage of ref. Check modulepart parameter or try to use subdir parameter instead of ref.');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($modulepart == 'invoice') $modulepart ='facture';
|
||||
if ($modulepart == 'invoice') $modulepart ='facture';
|
||||
|
||||
$tmp = dol_check_secure_access_document($modulepart, $subdir, $entity, DolibarrApiAccess::$user, '', 'write');
|
||||
$upload_dir = $tmp['original_file'];
|
||||
$tmp = dol_check_secure_access_document($modulepart, $subdir, $entity, DolibarrApiAccess::$user, '', 'write');
|
||||
$upload_dir = $tmp['original_file'];
|
||||
|
||||
if (empty($upload_dir) || $upload_dir == '/')
|
||||
{
|
||||
throw new RestException(500, 'This value of modulepart does not support yet usage of ref. Check modulepart parameter or try to use subdir parameter instead of ref.');
|
||||
}
|
||||
if (empty($upload_dir) || $upload_dir == '/')
|
||||
{
|
||||
throw new RestException(500, 'This value of modulepart does not support yet usage of ref. Check modulepart parameter or try to use subdir parameter instead of ref.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -223,46 +272,46 @@ class Documents extends DolibarrApi
|
||||
$destfiletmp = DOL_DATA_ROOT.'/admin/temp/' . $original_file;
|
||||
dol_delete_file($destfiletmp);
|
||||
|
||||
if (!dol_is_dir($upload_dir)) {
|
||||
throw new RestException(401,'Directory not exists : '.$upload_dir);
|
||||
}
|
||||
if (!dol_is_dir($upload_dir)) {
|
||||
throw new RestException(401,'Directory not exists : '.$upload_dir);
|
||||
}
|
||||
|
||||
if (! $overwriteifexists && dol_is_file($destfile))
|
||||
{
|
||||
throw new RestException(500, "File with name '".$original_file."' already exists.");
|
||||
}
|
||||
if (! $overwriteifexists && dol_is_file($destfile))
|
||||
{
|
||||
throw new RestException(500, "File with name '".$original_file."' already exists.");
|
||||
}
|
||||
|
||||
$fhandle = @fopen($destfiletmp, 'w');
|
||||
if ($fhandle)
|
||||
{
|
||||
$nbofbyteswrote = fwrite($fhandle, $newfilecontent);
|
||||
fclose($fhandle);
|
||||
@chmod($destfiletmp, octdec($conf->global->MAIN_UMASK));
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new RestException(500, "Failed to open file '".$destfiletmp."' for write");
|
||||
}
|
||||
$fhandle = @fopen($destfiletmp, 'w');
|
||||
if ($fhandle)
|
||||
{
|
||||
$nbofbyteswrote = fwrite($fhandle, $newfilecontent);
|
||||
fclose($fhandle);
|
||||
@chmod($destfiletmp, octdec($conf->global->MAIN_UMASK));
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new RestException(500, "Failed to open file '".$destfiletmp."' for write");
|
||||
}
|
||||
|
||||
$result = dol_move($destfiletmp, $destfile, 0, $overwriteifexists, 1);
|
||||
$result = dol_move($destfiletmp, $destfile, 0, $overwriteifexists, 1);
|
||||
|
||||
return $result;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate fields before create or update object
|
||||
*
|
||||
* @param array $data Array with data to verify
|
||||
* @return array
|
||||
* @throws RestException
|
||||
*/
|
||||
function _validate_file($data) {
|
||||
$result = array();
|
||||
foreach (Documents::$DOCUMENT_FIELDS as $field) {
|
||||
if (!isset($data[$field]))
|
||||
throw new RestException(400, "$field field missing");
|
||||
$result[$field] = $data[$field];
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
/**
|
||||
* Validate fields before create or update object
|
||||
*
|
||||
* @param array $data Array with data to verify
|
||||
* @return array
|
||||
* @throws RestException
|
||||
*/
|
||||
function _validate_file($data) {
|
||||
$result = array();
|
||||
foreach (Documents::$DOCUMENT_FIELDS as $field) {
|
||||
if (!isset($data[$field]))
|
||||
throw new RestException(400, "$field field missing");
|
||||
$result[$field] = $data[$field];
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update')
|
||||
|
||||
if (GETPOST('cancel','alpha'))
|
||||
{
|
||||
if (empty($backtopage)) $backtopage=($urlsource?$urlsource:((! empty($url))?$url:DOL_URL_ROOT.'/bookmarks/list.php'));
|
||||
if (empty($backtopage)) $backtopage=($urlsource?$urlsource:((! empty($url) && ! preg_match('/^http/i', $url))?$url:DOL_URL_ROOT.'/bookmarks/list.php'));
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
}
|
||||
@ -98,7 +98,7 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update')
|
||||
|
||||
if ($res > 0)
|
||||
{
|
||||
if (empty($backtopage)) $backtopage=($urlsource?$urlsource:((! empty($url))?$url:DOL_URL_ROOT.'/bookmarks/list.php'));
|
||||
if (empty($backtopage)) $backtopage=($urlsource?$urlsource:((! empty($url) && ! preg_match('/^http/i', $url))?$url:DOL_URL_ROOT.'/bookmarks/list.php'));
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ $pagenext = $page + 1;
|
||||
if (! $sortfield) $sortfield='position';
|
||||
if (! $sortorder) $sortorder='ASC';
|
||||
|
||||
$id = GETPOST("bid",'int');
|
||||
$id = GETPOST("id",'int');
|
||||
|
||||
|
||||
/*
|
||||
@ -83,7 +83,7 @@ llxHeader('', $langs->trans("ListOfBookmarks"));
|
||||
|
||||
print load_fiche_titre($langs->trans("ListOfBookmarks"));
|
||||
|
||||
$sql = "SELECT b.fk_soc as rowid, b.dateb, b.rowid as bid, b.fk_user, b.url, b.target, b.title, b.favicon, b.position,";
|
||||
$sql = "SELECT b.rowid, b.dateb, b.fk_user, b.url, b.target, b.title, b.favicon, b.position,";
|
||||
$sql.= " u.login, u.lastname, u.firstname";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bookmark as b LEFT JOIN ".MAIN_DB_PREFIX."user as u ON b.fk_user=u.rowid";
|
||||
$sql.= " WHERE 1=1";
|
||||
@ -107,7 +107,7 @@ if ($resql)
|
||||
|
||||
print "<tr class=\"liste_titre\">";
|
||||
//print "<td> </td>";
|
||||
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"bid","", $param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"rowid","", $param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("Title",$_SERVER["PHP_SELF"],"title","", $param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("Link",'','');
|
||||
print_liste_field_titre("Target",'','','','','align="center"');
|
||||
@ -127,7 +127,7 @@ if ($resql)
|
||||
|
||||
// Id
|
||||
print '<td align="left">';
|
||||
print "<a href=\"card.php?id=".$obj->bid."\">".img_object($langs->trans("ShowBookmark"),"bookmark").' '.$obj->bid."</a>";
|
||||
print "<a href=\"card.php?id=".$obj->rowid."\">".img_object($langs->trans("ShowBookmark"),"bookmark").' '.$obj->rowid."</a>";
|
||||
print '</td>';
|
||||
|
||||
$linkintern=0;
|
||||
@ -136,21 +136,7 @@ if ($resql)
|
||||
|
||||
// Title
|
||||
print "<td>";
|
||||
if ($obj->rowid)
|
||||
{
|
||||
// Lien interne societe
|
||||
$linkintern=1;
|
||||
$link="Dolibarr";
|
||||
if (! $obj->title)
|
||||
{
|
||||
// For compatibility with old Dolibarr bookmarks
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
$societe=new Societe($db);
|
||||
$societe->fetch($obj->rowid);
|
||||
$obj->title=$societe->name;
|
||||
}
|
||||
$title=img_object($langs->trans("ShowCompany"),"company").' '.$obj->title;
|
||||
}
|
||||
$linkintern=1;
|
||||
if ($linkintern) print "<a href=\"".$obj->url."\">";
|
||||
print $title;
|
||||
if ($linkintern) print "</a>";
|
||||
@ -193,11 +179,11 @@ if ($resql)
|
||||
print '<td align="right" class="nowrap">';
|
||||
if ($user->rights->bookmark->creer)
|
||||
{
|
||||
print "<a href=\"".DOL_URL_ROOT."/bookmarks/card.php?action=edit&id=".$obj->bid."&backtopage=".urlencode($_SERVER["PHP_SELF"])."\">".img_edit()."</a> ";
|
||||
print "<a href=\"".DOL_URL_ROOT."/bookmarks/card.php?action=edit&id=".$obj->rowid."&backtopage=".urlencode($_SERVER["PHP_SELF"])."\">".img_edit()."</a> ";
|
||||
}
|
||||
if ($user->rights->bookmark->supprimer)
|
||||
{
|
||||
print "<a href=\"".$_SERVER["PHP_SELF"]."?action=delete&bid=$obj->bid\">".img_delete()."</a>";
|
||||
print "<a href=\"".$_SERVER["PHP_SELF"]."?action=delete&id=$obj->rowid\">".img_delete()."</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -223,7 +209,7 @@ print "<div class=\"tabsAction\">\n";
|
||||
|
||||
if ($user->rights->bookmark->creer)
|
||||
{
|
||||
print '<a class="butAction" href="card.php?action=create">'.$langs->trans("NewBookmark").'</a>';
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/bookmarks/card.php?action=create">'.$langs->trans("NewBookmark").'</a>';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
@ -203,7 +203,7 @@ if (empty($reshook))
|
||||
|
||||
$targetobject = null; // Not defined with mass emailing
|
||||
$parameters=array('mode'=>'emailing');
|
||||
$substitutionarray=getCommonSubstitutionArray($langs, 2, array('object','objectamount'), $targetobject); // Note: On mass emailing, this is null because be don't know object
|
||||
$substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount'), $targetobject); // Note: On mass emailing, this is null because be don't know object
|
||||
|
||||
// Array of possible substitutions (See also file mailing-send.php that should manage same substitutions)
|
||||
$substitutionarray['__ID__'] = $obj->source_id;
|
||||
|
||||
@ -231,8 +231,8 @@ if (empty($reshook))
|
||||
|
||||
// Validation
|
||||
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->propal_advance->validate)))
|
||||
((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)))
|
||||
)
|
||||
{
|
||||
$result = $object->valid($user);
|
||||
@ -294,15 +294,15 @@ if (empty($reshook))
|
||||
$result = $object->set_ref_client($user, GETPOST('ref_client'));
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// Set incoterm
|
||||
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
|
||||
else if ($action == 'add' && $user->rights->propal->creer)
|
||||
@ -346,11 +346,11 @@ if (empty($reshook))
|
||||
$object->availability_id = GETPOST('availability_id');
|
||||
$object->demand_reason_id = GETPOST('demand_reason_id');
|
||||
$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->cond_reglement_id = GETPOST('cond_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_absolue = GETPOST('remise_absolue');
|
||||
$object->socid = GETPOST('socid');
|
||||
@ -377,11 +377,11 @@ if (empty($reshook))
|
||||
$object->availability_id = GETPOST('availability_id');
|
||||
$object->demand_reason_id = GETPOST('demand_reason_id');
|
||||
$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->cond_reglement_id = GETPOST('cond_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->fk_project = GETPOST('projectid');
|
||||
$object->modelpdf = GETPOST('model');
|
||||
@ -527,7 +527,7 @@ if (empty($reshook))
|
||||
// Hooks
|
||||
$parameters = array('objFrom' => $srcobject);
|
||||
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
|
||||
// modified by hook
|
||||
// modified by hook
|
||||
if ($reshook < 0)
|
||||
$error ++;
|
||||
} else {
|
||||
@ -561,23 +561,23 @@ if (empty($reshook))
|
||||
{
|
||||
$db->commit();
|
||||
|
||||
// Define output language
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||
{
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
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 (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$model=$object->modelpdf;
|
||||
// Define output language
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||
{
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
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 (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$model=$object->modelpdf;
|
||||
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
$result=$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if ($result < 0) dol_print_error($db,$result);
|
||||
}
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
$result=$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if ($result < 0) dol_print_error($db,$result);
|
||||
}
|
||||
|
||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id);
|
||||
exit();
|
||||
@ -647,7 +647,7 @@ if (empty($reshook))
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||
|
||||
// Actions to send emails
|
||||
$actiontypecode='AC_OTH_AUTO';
|
||||
$actiontypecode='AC_OTH_AUTO';
|
||||
$trigger_name='PROPAL_SENTBYMAIL';
|
||||
$autocopy='MAIN_MAIL_AUTOCOPY_PROPOSAL_TO';
|
||||
$trackid='pro'.$object->id;
|
||||
@ -756,7 +756,7 @@ if (empty($reshook))
|
||||
|
||||
$db->begin();
|
||||
|
||||
// $tva_tx can be 'x.x (XXX)'
|
||||
// $tva_tx can be 'x.x (XXX)'
|
||||
|
||||
// Ecrase $pu par celui du produit
|
||||
// Ecrase $desc par celui du produit
|
||||
@ -781,7 +781,7 @@ if (empty($reshook))
|
||||
// On defini prix unitaire
|
||||
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];
|
||||
$price_min = $prod->multiprices_min[$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);
|
||||
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) {
|
||||
$pu_ht = price($prodcustprice->lines[0]->price);
|
||||
$pu_ttc = price($prodcustprice->lines[0]->price_ttc);
|
||||
@ -949,18 +949,18 @@ if (empty($reshook))
|
||||
unset($_POST['idprod']);
|
||||
unset($_POST['units']);
|
||||
|
||||
unset($_POST['date_starthour']);
|
||||
unset($_POST['date_startmin']);
|
||||
unset($_POST['date_startsec']);
|
||||
unset($_POST['date_startday']);
|
||||
unset($_POST['date_startmonth']);
|
||||
unset($_POST['date_startyear']);
|
||||
unset($_POST['date_endhour']);
|
||||
unset($_POST['date_endmin']);
|
||||
unset($_POST['date_endsec']);
|
||||
unset($_POST['date_endday']);
|
||||
unset($_POST['date_endmonth']);
|
||||
unset($_POST['date_endyear']);
|
||||
unset($_POST['date_starthour']);
|
||||
unset($_POST['date_startmin']);
|
||||
unset($_POST['date_startsec']);
|
||||
unset($_POST['date_startday']);
|
||||
unset($_POST['date_startmonth']);
|
||||
unset($_POST['date_startyear']);
|
||||
unset($_POST['date_endhour']);
|
||||
unset($_POST['date_endmin']);
|
||||
unset($_POST['date_endsec']);
|
||||
unset($_POST['date_endday']);
|
||||
unset($_POST['date_endmonth']);
|
||||
unset($_POST['date_endyear']);
|
||||
} else {
|
||||
$db->rollback();
|
||||
|
||||
@ -1159,12 +1159,12 @@ if (empty($reshook))
|
||||
|
||||
// bank account
|
||||
else if ($action == 'setbankaccount' && $user->rights->propal->creer) {
|
||||
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
|
||||
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
|
||||
}
|
||||
|
||||
// shipping method
|
||||
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') {
|
||||
@ -1225,10 +1225,10 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
// Actions to build doc
|
||||
$upload_dir = $conf->propal->dir_output;
|
||||
$permissioncreate=$user->rights->propal->creer;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
// Actions to build doc
|
||||
$upload_dir = $conf->propal->dir_output;
|
||||
$permissioncreate=$user->rights->propal->creer;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
|
||||
}
|
||||
|
||||
@ -1252,7 +1252,7 @@ $now = dol_now();
|
||||
// Add new proposal
|
||||
if ($action == 'create')
|
||||
{
|
||||
$currency_code = $conf->currency;
|
||||
$currency_code = $conf->currency;
|
||||
|
||||
print load_fiche_titre($langs->trans("NewProp"));
|
||||
|
||||
@ -1317,14 +1317,14 @@ if ($action == 'create')
|
||||
|
||||
if (!empty($conf->multicurrency->enabled))
|
||||
{
|
||||
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($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;
|
||||
}
|
||||
}
|
||||
}
|
||||
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);
|
||||
@ -1359,9 +1359,9 @@ if ($action == 'create')
|
||||
print $soc->getNomUrl(1);
|
||||
print '<input type="hidden" name="socid" value="' . $soc->id . '">';
|
||||
print '</td>';
|
||||
if (! empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD) && ! empty($soc->shipping_method_id)) {
|
||||
$shipping_method_id = $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;
|
||||
}
|
||||
} else {
|
||||
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');
|
||||
@ -1427,12 +1427,12 @@ if ($action == 'create')
|
||||
$form->select_types_paiements($soc->mode_reglement_id, 'mode_reglement_id');
|
||||
print '</td></tr>';
|
||||
|
||||
// Bank Account
|
||||
if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && ! empty($conf->banque->enabled)) {
|
||||
print '<tr><td>' . $langs->trans('BankAccount') . '</td><td>';
|
||||
$form->select_comptes($fk_account, 'fk_account', 0, '', 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
// Bank Account
|
||||
if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && ! empty($conf->banque->enabled)) {
|
||||
print '<tr><td>' . $langs->trans('BankAccount') . '</td><td>';
|
||||
$form->select_comptes($fk_account, 'fk_account', 0, '', 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// What trigger creation
|
||||
print '<tr><td>' . $langs->trans('Source') . '</td><td>';
|
||||
@ -1444,12 +1444,12 @@ if ($action == 'create')
|
||||
$form->selectAvailabilityDelay('', 'availability_id', '', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Shipping Method
|
||||
if (! empty($conf->expedition->enabled)) {
|
||||
print '<tr><td>' . $langs->trans('SendingMethod') . '</td><td>';
|
||||
print $form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
// Shipping Method
|
||||
if (! empty($conf->expedition->enabled)) {
|
||||
print '<tr><td>' . $langs->trans('SendingMethod') . '</td><td>';
|
||||
print $form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Delivery date (or manufacturing)
|
||||
print '<tr><td>' . $langs->trans("DeliveryDate") . '</td>';
|
||||
@ -1485,8 +1485,8 @@ if ($action == 'create')
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), $soc->libelle_incoterms, 1).'</label></td>';
|
||||
print '<td class="maxwidthonsmartphone">';
|
||||
print $form->select_incoterms((!empty($soc->fk_incoterms) ? $soc->fk_incoterms : ''), (!empty($soc->location_incoterms)?$soc->location_incoterms:''));
|
||||
print '<td class="maxwidthonsmartphone">';
|
||||
print $form->select_incoterms((!empty($soc->fk_incoterms) ? $soc->fk_incoterms : ''), (!empty($soc->location_incoterms)?$soc->location_incoterms:''));
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -1503,8 +1503,8 @@ if ($action == 'create')
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td>'.fieldLabel('Currency','multicurrency_code').'</td>';
|
||||
print '<td class="maxwidthonsmartphone">';
|
||||
print $form->selectMultiCurrency($currency_code, 'multicurrency_code', 0);
|
||||
print '<td class="maxwidthonsmartphone">';
|
||||
print $form->selectMultiCurrency($currency_code, 'multicurrency_code', 0);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -1522,7 +1522,7 @@ if ($action == 'create')
|
||||
print '<tr>';
|
||||
print '<td class="tdtop">' . $langs->trans('NotePrivate') . '</td>';
|
||||
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%');
|
||||
print $doleditor->Create(1);
|
||||
// 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))
|
||||
{
|
||||
print '<br><table>';
|
||||
print '<br><table>';
|
||||
|
||||
// For backward compatibility
|
||||
print '<tr>';
|
||||
@ -1690,7 +1690,15 @@ 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' => 'text', 'name' => 'note_private', 'label' => $langs->trans("Note"),'value' => $object->note_private));
|
||||
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('SetAcceptedRefused'), '', 'setstatut', $formquestion, '', 1, 250);
|
||||
if (! empty($conf->notification->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
|
||||
$notify = new Notify($db);
|
||||
$formquestion = array_merge($formquestion, array(
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
@ -1757,50 +1765,50 @@ if ($action == 'create')
|
||||
// Ref customer
|
||||
$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);
|
||||
// Thirdparty
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||
// Thirdparty
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' (<a href="'.DOL_URL_ROOT.'/comm/propal/list.php?socid='.$object->thirdparty->id.'">'.$langs->trans("OtherProposals").'</a>)';
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->propal->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->propal->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
@ -1933,24 +1941,24 @@ if ($action == 'create')
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Shipping Method
|
||||
if (! empty($conf->expedition->enabled)) {
|
||||
print '<tr><td>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans('SendingMethod');
|
||||
print '</td>';
|
||||
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 '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editshippingmethod') {
|
||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1);
|
||||
} else {
|
||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'none');
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
// Shipping Method
|
||||
if (! empty($conf->expedition->enabled)) {
|
||||
print '<tr><td>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans('SendingMethod');
|
||||
print '</td>';
|
||||
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 '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editshippingmethod') {
|
||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1);
|
||||
} else {
|
||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'none');
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Origin of demand
|
||||
print '<tr><td>';
|
||||
@ -2046,36 +2054,36 @@ if ($action == 'create')
|
||||
|
||||
if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && ! empty($conf->banque->enabled))
|
||||
{
|
||||
// Bank Account
|
||||
print '<tr><td>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans('BankAccount');
|
||||
print '</td>';
|
||||
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 '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editbankaccount') {
|
||||
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
|
||||
} else {
|
||||
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
// Bank Account
|
||||
print '<tr><td>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans('BankAccount');
|
||||
print '</td>';
|
||||
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 '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editbankaccount') {
|
||||
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
|
||||
} else {
|
||||
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Incoterms
|
||||
if (!empty($conf->incoterm->enabled))
|
||||
{
|
||||
print '<tr><td>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans('IncotermLabel');
|
||||
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>';
|
||||
else print ' ';
|
||||
print '</td></tr></table>';
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans('IncotermLabel');
|
||||
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>';
|
||||
else print ' ';
|
||||
print '</td></tr></table>';
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if ($action != 'editincoterm')
|
||||
{
|
||||
print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1);
|
||||
@ -2084,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 '</td></tr>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
@ -2097,25 +2105,25 @@ if ($action == 'create')
|
||||
print '<div class="ficheaddleft">';
|
||||
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))
|
||||
{
|
||||
// Multicurrency Amount HT
|
||||
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 '</tr>';
|
||||
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency))
|
||||
{
|
||||
// Multicurrency Amount HT
|
||||
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 '</tr>';
|
||||
|
||||
// Multicurrency Amount VAT
|
||||
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 '</tr>';
|
||||
// Multicurrency Amount VAT
|
||||
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 '</tr>';
|
||||
|
||||
// Multicurrency Amount TTC
|
||||
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 '</tr>';
|
||||
}
|
||||
// Multicurrency Amount TTC
|
||||
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 '</tr>';
|
||||
}
|
||||
|
||||
// Amount HT
|
||||
print '<tr><td class="titlefieldmiddle">' . $langs->trans('AmountHT') . '</td>';
|
||||
@ -2130,15 +2138,15 @@ if ($action == 'create')
|
||||
// Amount Local Taxes
|
||||
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) // Localtax1
|
||||
{
|
||||
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 '</tr>';
|
||||
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 '</tr>';
|
||||
}
|
||||
if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) // Localtax2
|
||||
{
|
||||
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 '</tr>';
|
||||
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 '</tr>';
|
||||
}
|
||||
|
||||
// Amount TTC
|
||||
@ -2154,7 +2162,7 @@ if ($action == 'create')
|
||||
// Margin Infos
|
||||
if (! empty($conf->margin->enabled))
|
||||
{
|
||||
$formmargin->displayMarginInfos($object);
|
||||
$formmargin->displayMarginInfos($object);
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
@ -2193,7 +2201,7 @@ if ($action == 'create')
|
||||
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%">';
|
||||
|
||||
if (! empty($object->lines))
|
||||
@ -2215,7 +2223,7 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
print "</form>\n";
|
||||
|
||||
@ -2229,7 +2237,7 @@ if ($action == 'create')
|
||||
|
||||
$parameters = array();
|
||||
$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 ($action != 'editline')
|
||||
@ -2237,12 +2245,12 @@ if ($action == 'create')
|
||||
// Validate
|
||||
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))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->propal_advance->validate)))
|
||||
{
|
||||
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)))
|
||||
{
|
||||
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>';
|
||||
}
|
||||
// Create event
|
||||
|
||||
@ -30,502 +30,518 @@ require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
class Proposals extends DolibarrApi
|
||||
{
|
||||
|
||||
/**
|
||||
* @var array $FIELDS Mandatory fields, checked when create and update object
|
||||
*/
|
||||
static $FIELDS = array(
|
||||
'socid'
|
||||
);
|
||||
/**
|
||||
* @var array $FIELDS Mandatory fields, checked when create and update object
|
||||
*/
|
||||
static $FIELDS = array(
|
||||
'socid'
|
||||
);
|
||||
|
||||
/**
|
||||
* @var propal $propal {@type propal}
|
||||
*/
|
||||
public $propal;
|
||||
/**
|
||||
* @var propal $propal {@type propal}
|
||||
*/
|
||||
public $propal;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
global $db, $conf;
|
||||
$this->db = $db;
|
||||
$this->propal = new Propal($this->db);
|
||||
}
|
||||
$this->propal = new Propal($this->db);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
/**
|
||||
* Get properties of a commercial proposal object
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
function get($id)
|
||||
{
|
||||
* Return an array with commercial proposal informations
|
||||
*
|
||||
* @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) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
$result = $this->propal->fetch($id);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$this->propal->fetchObjectLinked();
|
||||
$this->propal->fetchObjectLinked();
|
||||
return $this->_cleanObjectDatas($this->propal);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* List commercial proposals
|
||||
*
|
||||
* Get a list of commercial proposals
|
||||
*
|
||||
* @param string $sortfield Sort field
|
||||
* @param string $sortorder Sort order
|
||||
* @param int $limit Limit for list
|
||||
* @param int $page Page number
|
||||
* @param string $thirdparty_ids Thirdparty ids to filter 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')"
|
||||
* @return array Array of order objects
|
||||
*/
|
||||
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $thirdparty_ids = '', $sqlfilters = '') {
|
||||
global $db, $conf;
|
||||
/**
|
||||
* List commercial proposals
|
||||
*
|
||||
* Get a list of commercial proposals
|
||||
*
|
||||
* @param string $sortfield Sort field
|
||||
* @param string $sortorder Sort order
|
||||
* @param int $limit Limit for list
|
||||
* @param int $page Page number
|
||||
* @param string $thirdparty_ids Thirdparty ids to filter 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')"
|
||||
* @return array Array of order objects
|
||||
*/
|
||||
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $thirdparty_ids = '', $sqlfilters = '') {
|
||||
global $db, $conf;
|
||||
|
||||
$obj_ret = array();
|
||||
$obj_ret = array();
|
||||
|
||||
// case of external user, $thirdparty_ids param is ignored and replaced by user's socid
|
||||
$socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids;
|
||||
// case of external user, $thirdparty_ids param is ignored and replaced by user's socid
|
||||
$socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids;
|
||||
|
||||
// If the internal user must only see his customers, force searching by him
|
||||
$search_sale = 0;
|
||||
if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id;
|
||||
// If the internal user must only see his customers, force searching by him
|
||||
$search_sale = 0;
|
||||
if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id;
|
||||
|
||||
$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)
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."propal as t";
|
||||
$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)
|
||||
$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').')';
|
||||
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 ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
||||
// Insert sale filter
|
||||
if ($search_sale > 0)
|
||||
{
|
||||
$sql .= " AND sc.fk_user = ".$search_sale;
|
||||
}
|
||||
// Add sql filters
|
||||
if ($sqlfilters)
|
||||
{
|
||||
if (! DolibarrApi::_checkFilters($sqlfilters))
|
||||
{
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
$sql.= ' 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 ($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
|
||||
// Insert sale filter
|
||||
if ($search_sale > 0)
|
||||
{
|
||||
$sql .= " AND sc.fk_user = ".$search_sale;
|
||||
}
|
||||
// Add sql filters
|
||||
if ($sqlfilters)
|
||||
{
|
||||
if (! DolibarrApi::_checkFilters($sqlfilters))
|
||||
{
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
if ($page < 0)
|
||||
{
|
||||
$page = 0;
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
if ($page < 0)
|
||||
{
|
||||
$page = 0;
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
|
||||
$sql.= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
$sql.= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
$result = $db->query($sql);
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$min = min($num, ($limit <= 0 ? $num : $limit));
|
||||
while ($i < $min)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$propal_static = new Propal($db);
|
||||
if($propal_static->fetch($obj->rowid)) {
|
||||
$obj_ret[] = $this->_cleanObjectDatas($propal_static);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new RestException(503, 'Error when retrieve propal list : '.$db->lasterror());
|
||||
}
|
||||
if( ! count($obj_ret)) {
|
||||
throw new RestException(404, 'No order found');
|
||||
}
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$min = min($num, ($limit <= 0 ? $num : $limit));
|
||||
while ($i < $min)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$propal_static = new Propal($db);
|
||||
if($propal_static->fetch($obj->rowid)) {
|
||||
$obj_ret[] = $this->_cleanObjectDatas($propal_static);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new RestException(503, 'Error when retrieve propal list : '.$db->lasterror());
|
||||
}
|
||||
if( ! count($obj_ret)) {
|
||||
throw new RestException(404, 'No order found');
|
||||
}
|
||||
return $obj_ret;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create commercial proposal object
|
||||
*
|
||||
* @param array $request_data Request data
|
||||
* @return int ID of propal
|
||||
*/
|
||||
function post($request_data = NULL)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
/**
|
||||
* Create commercial proposal object
|
||||
*
|
||||
* @param array $request_data Request data
|
||||
* @return int ID of propal
|
||||
*/
|
||||
function post($request_data = NULL)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401, "Insuffisant rights");
|
||||
}
|
||||
// Check mandatory fields
|
||||
$result = $this->_validate($request_data);
|
||||
// Check mandatory fields
|
||||
$result = $this->_validate($request_data);
|
||||
|
||||
foreach($request_data as $field => $value) {
|
||||
$this->propal->$field = $value;
|
||||
}
|
||||
/*if (isset($request_data["lines"])) {
|
||||
foreach($request_data as $field => $value) {
|
||||
$this->propal->$field = $value;
|
||||
}
|
||||
/*if (isset($request_data["lines"])) {
|
||||
$lines = array();
|
||||
foreach ($request_data["lines"] as $line) {
|
||||
array_push($lines, (object) $line);
|
||||
}
|
||||
$this->propal->lines = $lines;
|
||||
}*/
|
||||
if ($this->propal->create(DolibarrApiAccess::$user) < 0) {
|
||||
throw new RestException(500, "Error creating order", array_merge(array($this->propal->error), $this->propal->errors));
|
||||
}
|
||||
if ($this->propal->create(DolibarrApiAccess::$user) < 0) {
|
||||
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
|
||||
*
|
||||
* @param int $id Id of commercial proposal
|
||||
*
|
||||
* @url GET {id}/lines
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
function getLines($id) {
|
||||
if(! DolibarrApiAccess::$user->rights->propal->lire) {
|
||||
/**
|
||||
* Get lines of a commercial proposal
|
||||
*
|
||||
* @param int $id Id of commercial proposal
|
||||
*
|
||||
* @url GET {id}/lines
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
function getLines($id) {
|
||||
if(! DolibarrApiAccess::$user->rights->propal->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
$result = $this->propal->fetch($id);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
$this->propal->getLinesArray();
|
||||
$result = array();
|
||||
foreach ($this->propal->lines as $line) {
|
||||
array_push($result,$this->_cleanObjectDatas($line));
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
$this->propal->getLinesArray();
|
||||
$result = array();
|
||||
foreach ($this->propal->lines as $line) {
|
||||
array_push($result,$this->_cleanObjectDatas($line));
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a line to given commercial proposal
|
||||
*
|
||||
* @param int $id Id of commercial proposal to update
|
||||
* @param array $request_data Commercial proposal line data
|
||||
*
|
||||
* @url POST {id}/lines
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
function postLine($id, $request_data = NULL) {
|
||||
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
/**
|
||||
* Add a line to given commercial proposal
|
||||
*
|
||||
* @param int $id Id of commercial proposal to update
|
||||
* @param array $request_data Commercial proposal line data
|
||||
*
|
||||
* @url POST {id}/lines
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
function postLine($id, $request_data = NULL)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
$result = $this->propal->fetch($id);
|
||||
if (! $result) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
$request_data = (object) $request_data;
|
||||
$updateRes = $this->propal->addline(
|
||||
$request_data->desc,
|
||||
$request_data->subprice,
|
||||
$request_data->qty,
|
||||
$request_data->tva_tx,
|
||||
$request_data->localtax1_tx,
|
||||
$request_data->localtax2_tx,
|
||||
$request_data->fk_product,
|
||||
$request_data->remise_percent,
|
||||
'HT',
|
||||
0,
|
||||
$request_data->info_bits,
|
||||
$request_data->product_type,
|
||||
$request_data->rang,
|
||||
$request_data->special_code,
|
||||
$fk_parent_line,
|
||||
$request_data->fk_fournprice,
|
||||
$request_data->pa_ht,
|
||||
$request_data->label,
|
||||
$request_data->date_start,
|
||||
$request_data->date_end,
|
||||
$request_data->array_options,
|
||||
$request_data->fk_unit,
|
||||
$this->element,
|
||||
$request_data->id,
|
||||
$request_data->multicurrency_subprice,
|
||||
$request_data->fk_remise_except
|
||||
);
|
||||
|
||||
if ($updateRes > 0) {
|
||||
return $this->get($id)->line->rowid;
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a line of given commercial proposal
|
||||
*
|
||||
* @param int $id Id of commercial proposal to update
|
||||
* @param int $lineid Id of line to update
|
||||
* @param array $request_data Commercial proposal line data
|
||||
*
|
||||
* @url PUT {id}/lines/{lineid}
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
function putLine($id, $lineid, $request_data = NULL) {
|
||||
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
$request_data = (object) $request_data;
|
||||
$updateRes = $this->propal->updateline(
|
||||
$lineid,
|
||||
$request_data->subprice,
|
||||
$request_data->qty,
|
||||
$request_data->remise_percent,
|
||||
$request_data->tva_tx,
|
||||
$request_data->localtax1_tx,
|
||||
$request_data->localtax2_tx,
|
||||
$request_data->desc,
|
||||
'HT',
|
||||
$request_data->info_bits,
|
||||
$request_data->special_code,
|
||||
$request_data->fk_parent_line,
|
||||
0,
|
||||
$request_data->fk_fournprice,
|
||||
$request_data->pa_ht,
|
||||
$request_data->label,
|
||||
$request_data->product_type,
|
||||
$request_data->date_start,
|
||||
$request_data->date_end,
|
||||
$request_data->array_options,
|
||||
$request_data->fk_unit,
|
||||
$request_data->multicurrency_subprice
|
||||
);
|
||||
|
||||
if ($updateRes > 0) {
|
||||
$result = $this->get($id);
|
||||
unset($result->line);
|
||||
return $this->_cleanObjectDatas($result);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a line of given commercial proposal
|
||||
*
|
||||
*
|
||||
* @param int $id Id of commercial proposal to update
|
||||
* @param int $lineid Id of line to delete
|
||||
*
|
||||
* @url DELETE {id}/lines/{lineid}
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
function delLine($id, $lineid) {
|
||||
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
$request_data = (object) $request_data;
|
||||
$updateRes = $this->propal->deleteline($lineid);
|
||||
if ($updateRes == 1) {
|
||||
return $this->get($id);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update commercial proposal general fields (won't touch lines of commercial proposal)
|
||||
*
|
||||
* @param int $id Id of commercial proposal to update
|
||||
* @param array $request_data Datas
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
function put($id, $request_data = NULL) {
|
||||
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if( ! $result ) {
|
||||
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);
|
||||
}
|
||||
foreach($request_data as $field => $value) {
|
||||
if ($field == 'id') continue;
|
||||
$this->propal->$field = $value;
|
||||
}
|
||||
|
||||
if($this->propal->update($id, DolibarrApiAccess::$user,1,'','','update'))
|
||||
return $this->get($id);
|
||||
$request_data = (object) $request_data;
|
||||
|
||||
return false;
|
||||
}
|
||||
$updateRes = $this->propal->addline(
|
||||
$request_data->desc,
|
||||
$request_data->subprice,
|
||||
$request_data->qty,
|
||||
$request_data->tva_tx,
|
||||
$request_data->localtax1_tx,
|
||||
$request_data->localtax2_tx,
|
||||
$request_data->fk_product,
|
||||
$request_data->remise_percent,
|
||||
'HT',
|
||||
0,
|
||||
$request_data->info_bits,
|
||||
$request_data->product_type,
|
||||
$request_data->rang,
|
||||
$request_data->special_code,
|
||||
$fk_parent_line,
|
||||
$request_data->fk_fournprice,
|
||||
$request_data->pa_ht,
|
||||
$request_data->label,
|
||||
$request_data->date_start,
|
||||
$request_data->date_end,
|
||||
$request_data->array_options,
|
||||
$request_data->fk_unit,
|
||||
$this->element,
|
||||
$request_data->id,
|
||||
$request_data->multicurrency_subprice,
|
||||
$request_data->fk_remise_except
|
||||
);
|
||||
|
||||
/**
|
||||
* Delete commercial proposal
|
||||
*
|
||||
* @param int $id Commercial proposal ID
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function delete($id)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->propal->supprimer) {
|
||||
if ($updateRes > 0) {
|
||||
return $this->get($id)->line->rowid;
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a line of given commercial proposal
|
||||
*
|
||||
* @param int $id Id of commercial proposal to update
|
||||
* @param int $lineid Id of line to update
|
||||
* @param array $request_data Commercial proposal line data
|
||||
*
|
||||
* @url PUT {id}/lines/{lineid}
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
function putLine($id, $lineid, $request_data = NULL)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$result = $this->propal->fetch($id);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if($result <= 0) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$request_data = (object) $request_data;
|
||||
|
||||
$propalline = new PropaleLigne($this->db);
|
||||
$result = $propalline->fetch($lineid);
|
||||
if ($result <= 0) {
|
||||
throw new RestException(404, 'Proposal line not found');
|
||||
}
|
||||
|
||||
$updateRes = $this->propal->updateline(
|
||||
$lineid,
|
||||
isset($request_data->subprice)?$request_data->subprice:$propalline->subprice,
|
||||
isset($request_data->qty)?$request_data->qty:$propalline->qty,
|
||||
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->localtax1_tx)?$request_data->localtax1_tx:$propalline->localtax1_tx,
|
||||
isset($request_data->localtax2_tx)?$request_data->localtax2_tx:$propalline->localtax2_tx,
|
||||
isset($request_data->desc)?$request_data->desc:$propalline->desc,
|
||||
'HT',
|
||||
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->fk_parent_line)?$request_data->fk_parent_line:$propalline->fk_parent_line,
|
||||
0,
|
||||
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->label)?$request_data->label:$propalline->label,
|
||||
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_end)?$request_data->date_end:$propalline->date_end,
|
||||
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->multicurrency_subprice)?$request_data->multicurrency_subprice:$propalline->subprice
|
||||
);
|
||||
|
||||
if ($updateRes > 0) {
|
||||
$result = $this->get($id);
|
||||
unset($result->line);
|
||||
return $this->_cleanObjectDatas($result);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a line of given commercial proposal
|
||||
*
|
||||
*
|
||||
* @param int $id Id of commercial proposal to update
|
||||
* @param int $lineid Id of line to delete
|
||||
*
|
||||
* @url DELETE {id}/lines/{lineid}
|
||||
*
|
||||
* @return int
|
||||
* @throws 401
|
||||
* @throws 404
|
||||
*/
|
||||
function deleteLine($id, $lineid) {
|
||||
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$request_data = (object) $request_data;
|
||||
$updateRes = $this->propal->deleteline($lineid);
|
||||
if ($updateRes > 0) {
|
||||
return $this->get($id);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update commercial proposal general fields (won't touch lines of commercial proposal)
|
||||
*
|
||||
* @param int $id Id of commercial proposal to update
|
||||
* @param array $request_data Datas
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
function put($id, $request_data = NULL) {
|
||||
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
foreach($request_data as $field => $value) {
|
||||
if ($field == 'id') continue;
|
||||
$this->propal->$field = $value;
|
||||
}
|
||||
|
||||
if( ! $this->propal->delete(DolibarrApiAccess::$user)) {
|
||||
throw new RestException(500, 'Error when delete Commercial Proposal : '.$this->propal->error);
|
||||
}
|
||||
if($this->propal->update($id, DolibarrApiAccess::$user,1,'','','update'))
|
||||
return $this->get($id);
|
||||
|
||||
return array(
|
||||
'success' => array(
|
||||
'code' => 200,
|
||||
'message' => 'Commercial Proposal deleted'
|
||||
)
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate a commercial proposal
|
||||
*
|
||||
* @param int $id Commercial proposal ID
|
||||
* @param int $notrigger Use {}
|
||||
*
|
||||
* @url POST {id}/validate
|
||||
*
|
||||
* @return array
|
||||
* FIXME An error 403 is returned if the request has an empty body.
|
||||
* Error message: "Forbidden: Content type `text/plain` is not supported."
|
||||
* Workaround: send this in the body
|
||||
* {
|
||||
* "notrigger": 0
|
||||
* }
|
||||
*/
|
||||
function validate($id, $notrigger=0)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
/**
|
||||
* Delete commercial proposal
|
||||
*
|
||||
* @param int $id Commercial proposal ID
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function delete($id)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->propal->supprimer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$result = $this->propal->fetch($id);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
$result = $this->propal->fetch($id);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$result = $this->propal->valid(DolibarrApiAccess::$user, $notrigger);
|
||||
if ($result == 0) {
|
||||
throw new RestException(500, 'Error nothing done. May be object is already validated');
|
||||
}
|
||||
if ($result < 0) {
|
||||
throw new RestException(500, 'Error when validating Commercial Proposal: '.$this->propal->error);
|
||||
}
|
||||
if( ! $this->propal->delete(DolibarrApiAccess::$user)) {
|
||||
throw new RestException(500, 'Error when delete Commercial Proposal : '.$this->propal->error);
|
||||
}
|
||||
|
||||
return array(
|
||||
'success' => array(
|
||||
'code' => 200,
|
||||
'message' => 'Commercial Proposal validated (Ref='.$this->propal->ref.')'
|
||||
)
|
||||
);
|
||||
}
|
||||
return array(
|
||||
'success' => array(
|
||||
'code' => 200,
|
||||
'message' => 'Commercial Proposal deleted'
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* Validate fields before create or update object
|
||||
*
|
||||
* @param array $data Array with data to verify
|
||||
* @return array
|
||||
* @throws RestException
|
||||
*/
|
||||
function _validate($data)
|
||||
{
|
||||
$propal = array();
|
||||
foreach (Proposals::$FIELDS as $field) {
|
||||
if (!isset($data[$field]))
|
||||
throw new RestException(400, "$field field missing");
|
||||
$propal[$field] = $data[$field];
|
||||
}
|
||||
|
||||
}
|
||||
return $propal;
|
||||
}
|
||||
/**
|
||||
* Validate a commercial proposal
|
||||
*
|
||||
* @param int $id Commercial proposal ID
|
||||
* @param int $notrigger Use {}
|
||||
*
|
||||
* @url POST {id}/validate
|
||||
*
|
||||
* @return array
|
||||
* FIXME An error 403 is returned if the request has an empty body.
|
||||
* Error message: "Forbidden: Content type `text/plain` is not supported."
|
||||
* Workaround: send this in the body
|
||||
* {
|
||||
* "notrigger": 0
|
||||
* }
|
||||
*/
|
||||
function validate($id, $notrigger=0)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$result = $this->propal->fetch($id);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean sensible object datas
|
||||
*
|
||||
* @param object $object Object to clean
|
||||
* @return array Array of cleaned object properties
|
||||
*/
|
||||
function _cleanObjectDatas($object) {
|
||||
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$object = parent::_cleanObjectDatas($object);
|
||||
$result = $this->propal->valid(DolibarrApiAccess::$user, $notrigger);
|
||||
if ($result == 0) {
|
||||
throw new RestException(500, 'Error nothing done. May be object is already validated');
|
||||
}
|
||||
if ($result < 0) {
|
||||
throw new RestException(500, 'Error when validating Commercial Proposal: '.$this->propal->error);
|
||||
}
|
||||
|
||||
unset($object->name);
|
||||
unset($object->lastname);
|
||||
unset($object->firstname);
|
||||
unset($object->civility_id);
|
||||
unset($object->address);
|
||||
return array(
|
||||
'success' => array(
|
||||
'code' => 200,
|
||||
'message' => 'Commercial Proposal validated (Ref='.$this->propal->ref.')'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return $object;
|
||||
}
|
||||
/**
|
||||
* Validate fields before create or update object
|
||||
*
|
||||
* @param array $data Array with data to verify
|
||||
* @return array
|
||||
* @throws RestException
|
||||
*/
|
||||
function _validate($data)
|
||||
{
|
||||
$propal = array();
|
||||
foreach (Proposals::$FIELDS as $field) {
|
||||
if (!isset($data[$field]))
|
||||
throw new RestException(400, "$field field missing");
|
||||
$propal[$field] = $data[$field];
|
||||
|
||||
}
|
||||
return $propal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean sensible object datas
|
||||
*
|
||||
* @param object $object Object to clean
|
||||
* @return array Array of cleaned object properties
|
||||
*/
|
||||
function _cleanObjectDatas($object) {
|
||||
|
||||
$object = parent::_cleanObjectDatas($object);
|
||||
|
||||
unset($object->name);
|
||||
unset($object->lastname);
|
||||
unset($object->firstname);
|
||||
unset($object->civility_id);
|
||||
unset($object->address);
|
||||
|
||||
return $object;
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -866,7 +866,7 @@ if ($resql)
|
||||
if (! empty($arrayfields['p.datec']['checked']))
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
print dol_print_date($db->jdate($obj->date_creation), 'dayhour');
|
||||
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
@ -874,7 +874,7 @@ if ($resql)
|
||||
if (! empty($arrayfields['p.tms']['checked']))
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
print dol_print_date($db->jdate($obj->date_update), 'dayhour');
|
||||
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -2479,7 +2479,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
}
|
||||
|
||||
// Create contract
|
||||
if ($conf->contrat->enabled && ($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_ACCEPTED || $object->statut == Commande::STATUS_CLOSED)) {
|
||||
if ($conf->contrat->enabled && ($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS || $object->statut == Commande::STATUS_CLOSED)) {
|
||||
$langs->load("contracts");
|
||||
|
||||
if ($user->rights->contrat->creer) {
|
||||
@ -2512,7 +2512,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
}
|
||||
|
||||
// Set to shipped
|
||||
if (($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_ACCEPTED) && $user->rights->commande->cloturer) {
|
||||
if (($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS) && $user->rights->commande->cloturer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=shipped">' . $langs->trans('ClassifyShipped') . '</a></div>';
|
||||
}
|
||||
|
||||
|
||||
@ -389,7 +389,7 @@ class CommandeApi extends DolibarrApi
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
function delLine($id, $lineid) {
|
||||
function deleteLine($id, $lineid) {
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
@ -353,14 +353,16 @@ class Orders extends DolibarrApi
|
||||
* Delete a line to given order
|
||||
*
|
||||
*
|
||||
* @param int $id Id of commande to update
|
||||
* @param int $id Id of order to update
|
||||
* @param int $lineid Id of line to delete
|
||||
*
|
||||
* @url DELETE {id}/lines/{lineid}
|
||||
*
|
||||
* @return int
|
||||
* @throws 401
|
||||
* @throws 404
|
||||
*/
|
||||
function delLine($id, $lineid) {
|
||||
function deleteLine($id, $lineid) {
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
@ -373,7 +375,8 @@ class Orders extends DolibarrApi
|
||||
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
$request_data = (object) $request_data;
|
||||
|
||||
$request_data = (object) $request_data;
|
||||
$updateRes = $this->commande->deleteline(DolibarrApiAccess::$user,$lineid);
|
||||
if ($updateRes > 0) {
|
||||
return $this->get($id);
|
||||
|
||||
@ -169,15 +169,13 @@ class Commande extends CommonOrder
|
||||
*/
|
||||
const STATUS_VALIDATED = 1;
|
||||
/**
|
||||
* Accepted (supplier orders)
|
||||
*/
|
||||
const STATUS_ACCEPTED = 2;
|
||||
/**
|
||||
* Shipment on process (customer orders)
|
||||
* Shipment on process
|
||||
*/
|
||||
const STATUS_SHIPMENTONPROCESS = 2;
|
||||
const STATUS_ACCEPTED = 2; // For backward compatibility. Use key STATUS_SHIPMENTONPROCESS instead.
|
||||
|
||||
/**
|
||||
* Closed (Sent/Received, billed or not)
|
||||
* Closed (Sent, billed or not)
|
||||
*/
|
||||
const STATUS_CLOSED = 3;
|
||||
|
||||
@ -3225,7 +3223,7 @@ class Commande extends CommonOrder
|
||||
}
|
||||
$sql.= $clause." c.entity IN (".getEntity('commande').")";
|
||||
//$sql.= " AND c.fk_statut IN (1,2,3) AND c.facture = 0";
|
||||
$sql.= " AND ((c.fk_statut IN (".self::STATUS_VALIDATED.",".self::STATUS_ACCEPTED.")) OR (c.fk_statut = ".self::STATUS_CLOSED." AND c.facture = 0))"; // If status is 2 and facture=1, it must be selected
|
||||
$sql.= " AND ((c.fk_statut IN (".self::STATUS_VALIDATED.",".self::STATUS_SHIPMENTONPROCESS.")) OR (c.fk_statut = ".self::STATUS_CLOSED." AND c.facture = 0))"; // If status is 2 and facture=1, it must be selected
|
||||
if ($user->societe_id) $sql.=" AND c.fk_soc = ".$user->societe_id;
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
@ -3310,7 +3308,7 @@ class Commande extends CommonOrder
|
||||
if ($statut==self::STATUS_CANCELED) return $langs->trans('StatusOrderCanceled');
|
||||
if ($statut==self::STATUS_DRAFT) return $langs->trans('StatusOrderDraft');
|
||||
if ($statut==self::STATUS_VALIDATED) return $langs->trans('StatusOrderValidated').$billedtext;
|
||||
if ($statut==self::STATUS_ACCEPTED) return $langs->trans('StatusOrderSentShort').$billedtext;
|
||||
if ($statut==self::STATUS_SHIPMENTONPROCESS) return $langs->trans('StatusOrderSentShort').$billedtext;
|
||||
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderToBill');
|
||||
if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderProcessed').$billedtext;
|
||||
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderDelivered');
|
||||
@ -3320,7 +3318,7 @@ class Commande extends CommonOrder
|
||||
if ($statut==self::STATUS_CANCELED) return $langs->trans('StatusOrderCanceledShort');
|
||||
if ($statut==self::STATUS_DRAFT) return $langs->trans('StatusOrderDraftShort');
|
||||
if ($statut==self::STATUS_VALIDATED) return $langs->trans('StatusOrderValidatedShort').$billedtext;
|
||||
if ($statut==self::STATUS_ACCEPTED) return $langs->trans('StatusOrderSentShort').$billedtext;
|
||||
if ($statut==self::STATUS_SHIPMENTONPROCESS) return $langs->trans('StatusOrderSentShort').$billedtext;
|
||||
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderToBillShort');
|
||||
if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderProcessed').$billedtext;
|
||||
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderDelivered');
|
||||
@ -3330,7 +3328,7 @@ class Commande extends CommonOrder
|
||||
if ($statut==self::STATUS_CANCELED) return img_picto($langs->trans('StatusOrderCanceled'),'statut5').' '.$langs->trans('StatusOrderCanceledShort');
|
||||
if ($statut==self::STATUS_DRAFT) return img_picto($langs->trans('StatusOrderDraft'),'statut0').' '.$langs->trans('StatusOrderDraftShort');
|
||||
if ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated'),'statut1').' '.$langs->trans('StatusOrderValidatedShort').$billedtext;
|
||||
if ($statut==self::STATUS_ACCEPTED) return img_picto($langs->trans('StatusOrderSent'),'statut3').' '.$langs->trans('StatusOrderSentShort').$billedtext;
|
||||
if ($statut==self::STATUS_SHIPMENTONPROCESS) return img_picto($langs->trans('StatusOrderSent'),'statut3').' '.$langs->trans('StatusOrderSentShort').$billedtext;
|
||||
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'),'statut4').' '.$langs->trans('StatusOrderToBillShort');
|
||||
if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed').$billedtext,'statut6').' '.$langs->trans('StatusOrderProcessed').$billedtext;
|
||||
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderDelivered'),'statut6').' '.$langs->trans('StatusOrderDeliveredShort');
|
||||
@ -3340,7 +3338,7 @@ class Commande extends CommonOrder
|
||||
if ($statut==self::STATUS_CANCELED) return img_picto($langs->trans('StatusOrderCanceled'),'statut5');
|
||||
if ($statut==self::STATUS_DRAFT) return img_picto($langs->trans('StatusOrderDraft'),'statut0');
|
||||
if ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated').$billedtext,'statut1');
|
||||
if ($statut==self::STATUS_ACCEPTED) return img_picto($langs->trans('StatusOrderSentShort').$billedtext,'statut3');
|
||||
if ($statut==self::STATUS_SHIPMENTONPROCESS) return img_picto($langs->trans('StatusOrderSentShort').$billedtext,'statut3');
|
||||
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'),'statut4');
|
||||
if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed').$billedtext,'statut6');
|
||||
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderDelivered'),'statut6');
|
||||
@ -3350,7 +3348,7 @@ class Commande extends CommonOrder
|
||||
if ($statut==self::STATUS_CANCELED) return img_picto($langs->trans('StatusOrderCanceled'),'statut5').' '.$langs->trans('StatusOrderCanceled');
|
||||
if ($statut==self::STATUS_DRAFT) return img_picto($langs->trans('StatusOrderDraft'),'statut0').' '.$langs->trans('StatusOrderDraft');
|
||||
if ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated').$billedtext,'statut1').' '.$langs->trans('StatusOrderValidated').$billedtext;
|
||||
if ($statut==self::STATUS_ACCEPTED) return img_picto($langs->trans('StatusOrderSentShort').$billedtext,'statut3').' '.$langs->trans('StatusOrderSent').$billedtext;
|
||||
if ($statut==self::STATUS_SHIPMENTONPROCESS) return img_picto($langs->trans('StatusOrderSentShort').$billedtext,'statut3').' '.$langs->trans('StatusOrderSent').$billedtext;
|
||||
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'),'statut4').' '.$langs->trans('StatusOrderToBill');
|
||||
if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessedShort').$billedtext,'statut6').' '.$langs->trans('StatusOrderProcessed').$billedtext;
|
||||
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderDelivered'),'statut6').' '.$langs->trans('StatusOrderDelivered');
|
||||
@ -3360,7 +3358,7 @@ class Commande extends CommonOrder
|
||||
if ($statut==self::STATUS_CANCELED) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderCanceledShort').' </span>'.img_picto($langs->trans('StatusOrderCanceled'),'statut5');
|
||||
if ($statut==self::STATUS_DRAFT) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderDraftShort').' </span>'.img_picto($langs->trans('StatusOrderDraft'),'statut0');
|
||||
if ($statut==self::STATUS_VALIDATED) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderValidatedShort').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderValidated').$billedtext,'statut1');
|
||||
if ($statut==self::STATUS_ACCEPTED) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderSentShort').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderSent').$billedtext,'statut3');
|
||||
if ($statut==self::STATUS_SHIPMENTONPROCESS) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderSentShort').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderSent').$billedtext,'statut3');
|
||||
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderToBillShort').' </span>'.img_picto($langs->trans('StatusOrderToBill'),'statut4');
|
||||
if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderProcessedShort').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderProcessed').$billedtext,'statut6');
|
||||
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderDeliveredShort').' </span>'.img_picto($langs->trans('StatusOrderDelivered'),'statut6');
|
||||
|
||||
@ -917,7 +917,7 @@ if ($resql)
|
||||
$liststatus=array(
|
||||
Commande::STATUS_DRAFT=>$langs->trans("StatusOrderDraftShort"),
|
||||
Commande::STATUS_VALIDATED=>$langs->trans("StatusOrderValidated"),
|
||||
Commande::STATUS_ACCEPTED=>$langs->trans("StatusOrderSentShort"),
|
||||
Commande::STATUS_SHIPMENTONPROCESS=>$langs->trans("StatusOrderSentShort"),
|
||||
Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"),
|
||||
-3=>$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort").'+'.$langs->trans("StatusOrderDelivered"),
|
||||
Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceledShort")
|
||||
@ -1307,7 +1307,7 @@ if ($resql)
|
||||
if (! empty($arrayfields['c.datec']['checked']))
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
print dol_print_date($db->jdate($obj->date_creation), 'dayhour');
|
||||
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
@ -1315,7 +1315,7 @@ if ($resql)
|
||||
if (! empty($arrayfields['c.tms']['checked']))
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
print dol_print_date($db->jdate($obj->date_update), 'dayhour');
|
||||
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -280,7 +280,7 @@ if ($mode == 'customer')
|
||||
$liststatus=array(
|
||||
Commande::STATUS_DRAFT=>$langs->trans("StatusOrderDraft"),
|
||||
Commande::STATUS_VALIDATED=>$langs->trans("StatusOrderValidated"),
|
||||
Commande::STATUS_ACCEPTED=>$langs->trans("StatusOrderSent"),
|
||||
Commande::STATUS_SHIPMENTONPROCESS=>$langs->trans("StatusOrderSent"),
|
||||
Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"),
|
||||
Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceled")
|
||||
);
|
||||
|
||||
@ -72,204 +72,204 @@ if ($cancel) $action='';
|
||||
|
||||
if ($action == 'add')
|
||||
{
|
||||
$error=0;
|
||||
$error=0;
|
||||
|
||||
$db->begin();
|
||||
$db->begin();
|
||||
|
||||
// Create account
|
||||
$object = new Account($db);
|
||||
// Create account
|
||||
$object = new Account($db);
|
||||
|
||||
$object->ref = dol_sanitizeFileName(trim($_POST["ref"]));
|
||||
$object->label = trim($_POST["label"]);
|
||||
$object->courant = $_POST["type"];
|
||||
$object->clos = $_POST["clos"];
|
||||
$object->rappro = (isset($_POST["norappro"]) && $_POST["norappro"])?0:1;
|
||||
$object->url = $_POST["url"];
|
||||
$object->ref = dol_sanitizeFileName(trim($_POST["ref"]));
|
||||
$object->label = trim($_POST["label"]);
|
||||
$object->courant = $_POST["type"];
|
||||
$object->clos = $_POST["clos"];
|
||||
$object->rappro = (isset($_POST["norappro"]) && $_POST["norappro"])?0:1;
|
||||
$object->url = $_POST["url"];
|
||||
|
||||
$object->bank = trim($_POST["bank"]);
|
||||
$object->code_banque = trim($_POST["code_banque"]);
|
||||
$object->code_guichet = trim($_POST["code_guichet"]);
|
||||
$object->number = trim($_POST["number"]);
|
||||
$object->cle_rib = trim($_POST["cle_rib"]);
|
||||
$object->bic = trim($_POST["bic"]);
|
||||
$object->iban = trim($_POST["iban"]);
|
||||
$object->domiciliation = trim($_POST["domiciliation"]);
|
||||
$object->code_banque = trim($_POST["code_banque"]);
|
||||
$object->code_guichet = trim($_POST["code_guichet"]);
|
||||
$object->number = trim($_POST["number"]);
|
||||
$object->cle_rib = trim($_POST["cle_rib"]);
|
||||
$object->bic = trim($_POST["bic"]);
|
||||
$object->iban = trim($_POST["iban"]);
|
||||
$object->domiciliation = trim($_POST["domiciliation"]);
|
||||
|
||||
$object->proprio = trim($_POST["proprio"]);
|
||||
$object->owner_address = trim($_POST["owner_address"]);
|
||||
$object->proprio = trim($_POST["proprio"]);
|
||||
$object->owner_address = trim($_POST["owner_address"]);
|
||||
|
||||
$account_number = GETPOST('account_number','alpha');
|
||||
if ($account_number <= 0) { $object->account_number = ''; } else { $object->account_number = $account_number; }
|
||||
$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; }
|
||||
|
||||
$object->solde = $_POST["solde"];
|
||||
$object->date_solde = dol_mktime(12,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]);
|
||||
$object->solde = $_POST["solde"];
|
||||
$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->country_id = $_POST["account_country_id"];
|
||||
$object->state_id = $_POST["account_state_id"];
|
||||
$object->country_id = $_POST["account_country_id"];
|
||||
|
||||
$object->min_allowed = GETPOST("account_min_allowed",'int');
|
||||
$object->min_desired = GETPOST("account_min_desired",'int');
|
||||
$object->comment = trim(GETPOST("account_comment"));
|
||||
$object->min_allowed = GETPOST("account_min_allowed",'int');
|
||||
$object->min_desired = GETPOST("account_min_desired",'int');
|
||||
$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))
|
||||
{
|
||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("AccountancyCode")), null, 'errors');
|
||||
$action='create'; // Force chargement page en mode creation
|
||||
$error++;
|
||||
}
|
||||
if (empty($object->ref))
|
||||
{
|
||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")), null, 'errors');
|
||||
$action='create'; // Force chargement page en mode creation
|
||||
$error++;
|
||||
}
|
||||
if (empty($object->label))
|
||||
{
|
||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("LabelBankCashAccount")), null, 'errors');
|
||||
$action='create'; // Force chargement page en mode creation
|
||||
$error++;
|
||||
}
|
||||
if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($object->account_number))
|
||||
{
|
||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("AccountancyCode")), null, 'errors');
|
||||
$action='create'; // Force chargement page en mode creation
|
||||
$error++;
|
||||
}
|
||||
if (empty($object->ref))
|
||||
{
|
||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")), null, 'errors');
|
||||
$action='create'; // Force chargement page en mode creation
|
||||
$error++;
|
||||
}
|
||||
if (empty($object->label))
|
||||
{
|
||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("LabelBankCashAccount")), null, 'errors');
|
||||
$action='create'; // Force chargement page en mode creation
|
||||
$error++;
|
||||
}
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$id = $object->create($user);
|
||||
if ($id > 0)
|
||||
{
|
||||
// Category association
|
||||
$categories = GETPOST('categories', 'array');
|
||||
$object->setCategories($categories);
|
||||
if (! $error)
|
||||
{
|
||||
$id = $object->create($user);
|
||||
if ($id > 0)
|
||||
{
|
||||
// Category association
|
||||
$categories = GETPOST('categories', 'array');
|
||||
$object->setCategories($categories);
|
||||
|
||||
$_GET["id"]=$id; // Force chargement page en mode visu
|
||||
$_GET["id"]=$id; // Force chargement page en mode visu
|
||||
|
||||
$action='';
|
||||
}
|
||||
else {
|
||||
$error++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action='';
|
||||
}
|
||||
else {
|
||||
$error++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
|
||||
$action='create'; // Force chargement page en mode creation
|
||||
}
|
||||
}
|
||||
$action='create'; // Force chargement page en mode creation
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
}
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'update')
|
||||
{
|
||||
$error=0;
|
||||
$error=0;
|
||||
|
||||
// Update account
|
||||
$object = new Account($db);
|
||||
$object->fetch(GETPOST("id"));
|
||||
// Update account
|
||||
$object = new Account($db);
|
||||
$object->fetch(GETPOST("id"));
|
||||
|
||||
$object->ref = dol_string_nospecial(trim($_POST["ref"]));
|
||||
$object->label = trim($_POST["label"]);
|
||||
$object->courant = $_POST["type"];
|
||||
$object->clos = $_POST["clos"];
|
||||
$object->rappro = (isset($_POST["norappro"]) && $_POST["norappro"])?0:1;
|
||||
$object->url = trim($_POST["url"]);
|
||||
$object->ref = dol_string_nospecial(trim($_POST["ref"]));
|
||||
$object->label = trim($_POST["label"]);
|
||||
$object->courant = $_POST["type"];
|
||||
$object->clos = $_POST["clos"];
|
||||
$object->rappro = (isset($_POST["norappro"]) && $_POST["norappro"])?0:1;
|
||||
$object->url = trim($_POST["url"]);
|
||||
|
||||
$object->bank = trim($_POST["bank"]);
|
||||
$object->code_banque = trim($_POST["code_banque"]);
|
||||
$object->code_guichet = trim($_POST["code_guichet"]);
|
||||
$object->number = trim($_POST["number"]);
|
||||
$object->cle_rib = trim($_POST["cle_rib"]);
|
||||
$object->bic = trim($_POST["bic"]);
|
||||
$object->iban = trim($_POST["iban"]);
|
||||
$object->domiciliation = trim($_POST["domiciliation"]);
|
||||
$object->bank = trim($_POST["bank"]);
|
||||
$object->code_banque = trim($_POST["code_banque"]);
|
||||
$object->code_guichet = trim($_POST["code_guichet"]);
|
||||
$object->number = trim($_POST["number"]);
|
||||
$object->cle_rib = trim($_POST["cle_rib"]);
|
||||
$object->bic = trim($_POST["bic"]);
|
||||
$object->iban = trim($_POST["iban"]);
|
||||
$object->domiciliation = trim($_POST["domiciliation"]);
|
||||
|
||||
$object->proprio = trim($_POST["proprio"]);
|
||||
$object->owner_address = trim($_POST["owner_address"]);
|
||||
$object->proprio = trim($_POST["proprio"]);
|
||||
$object->owner_address = trim($_POST["owner_address"]);
|
||||
|
||||
$account_number = GETPOST('account_number', 'int');
|
||||
if ($account_number <= 0) { $object->account_number = ''; } else { $object->account_number = $account_number; }
|
||||
$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; }
|
||||
|
||||
$object->currency_code = trim($_POST["account_currency_code"]);
|
||||
$object->currency_code = trim($_POST["account_currency_code"]);
|
||||
|
||||
$object->state_id = $_POST["account_state_id"];
|
||||
$object->country_id = $_POST["account_country_id"];
|
||||
$object->state_id = $_POST["account_state_id"];
|
||||
$object->country_id = $_POST["account_country_id"];
|
||||
|
||||
$object->min_allowed = GETPOST("account_min_allowed",'int');
|
||||
$object->min_desired = GETPOST("account_min_desired",'int');
|
||||
$object->comment = trim(GETPOST("account_comment"));
|
||||
$object->min_allowed = GETPOST("account_min_allowed",'int');
|
||||
$object->min_desired = GETPOST("account_min_desired",'int');
|
||||
$object->comment = trim(GETPOST("account_comment"));
|
||||
|
||||
if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($object->account_number))
|
||||
{
|
||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("AccountancyCode")), null, 'error');
|
||||
$action='edit'; // Force chargement page en mode creation
|
||||
$error++;
|
||||
}
|
||||
if (empty($object->ref))
|
||||
{
|
||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")), null, 'errors');
|
||||
$action='edit'; // Force chargement page en mode creation
|
||||
$error++;
|
||||
}
|
||||
if (empty($object->label))
|
||||
{
|
||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("LabelBankCashAccount")), null, 'errors');
|
||||
$action='edit'; // Force chargement page en mode creation
|
||||
$error++;
|
||||
}
|
||||
if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($object->account_number))
|
||||
{
|
||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("AccountancyCode")), null, 'error');
|
||||
$action='edit'; // Force chargement page en mode creation
|
||||
$error++;
|
||||
}
|
||||
if (empty($object->ref))
|
||||
{
|
||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")), null, 'errors');
|
||||
$action='edit'; // Force chargement page en mode creation
|
||||
$error++;
|
||||
}
|
||||
if (empty($object->label))
|
||||
{
|
||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("LabelBankCashAccount")), null, 'errors');
|
||||
$action='edit'; // Force chargement page en mode creation
|
||||
$error++;
|
||||
}
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$result = $object->update($user);
|
||||
if ($result >= 0)
|
||||
{
|
||||
// Category association
|
||||
$categories = GETPOST('categories', 'array');
|
||||
$object->setCategories($categories);
|
||||
if (! $error)
|
||||
{
|
||||
$result = $object->update($user);
|
||||
if ($result >= 0)
|
||||
{
|
||||
// Category association
|
||||
$categories = GETPOST('categories', 'array');
|
||||
$object->setCategories($categories);
|
||||
|
||||
$_GET["id"]=$_POST["id"]; // Force chargement page en mode visu
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action='edit'; // Force chargement page edition
|
||||
}
|
||||
}
|
||||
$_GET["id"]=$_POST["id"]; // Force chargement page en mode visu
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action='edit'; // Force chargement page edition
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights->banque->configurer)
|
||||
{
|
||||
// Delete
|
||||
$object = new Account($db);
|
||||
$object->fetch(GETPOST("id","int"));
|
||||
$result = $object->delete($user);
|
||||
// Delete
|
||||
$object = new Account($db);
|
||||
$object->fetch(GETPOST("id","int"));
|
||||
$result = $object->delete($user);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
|
||||
header("Location: ".DOL_URL_ROOT."/compta/bank/list.php");
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($account->error, $account->errors, 'errors');
|
||||
$action='';
|
||||
}
|
||||
if ($result > 0)
|
||||
{
|
||||
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
|
||||
header("Location: ".DOL_URL_ROOT."/compta/bank/list.php");
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($account->error, $account->errors, 'errors');
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -297,10 +297,10 @@ if ($action == 'create')
|
||||
|
||||
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 'jQuery(document).ready(function () {
|
||||
print 'jQuery(document).ready(function () {
|
||||
jQuery("#selecttype").change(function() {
|
||||
document.formsoc.action.value="create";
|
||||
document.formsoc.submit();
|
||||
@ -310,8 +310,8 @@ if ($action == 'create')
|
||||
document.formsoc.submit();
|
||||
});
|
||||
})';
|
||||
print '</script>'."\n";
|
||||
}
|
||||
print '</script>'."\n";
|
||||
}
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" name="formsoc" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@ -324,11 +324,11 @@ if ($action == 'create')
|
||||
|
||||
// Ref
|
||||
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Ref").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="ref" value="'.(GETPOST("ref")?GETPOST("ref",'alpha'):$object->ref).'" maxlength="12"></td></tr>';
|
||||
print '<td><input size="8" type="text" class="flat" name="ref" value="'.dol_escape_htmltag(GETPOST("ref")?GETPOST("ref",'alpha'):$object->ref).'" maxlength="12" autofocus></td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("LabelBankCashAccount").'</td>';
|
||||
print '<td><input size="30" type="text" class="flat" name="label" value="'.GETPOST("label", 'alpha').'"></td></tr>';
|
||||
print '<td><input size="30" type="text" class="flat" name="label" value="'.dol_escape_htmltag(GETPOST("label", 'alpha')).'"></td></tr>';
|
||||
|
||||
// Type
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>';
|
||||
@ -347,12 +347,12 @@ if ($action == 'create')
|
||||
print '</td></tr>';
|
||||
|
||||
// Status
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
|
||||
print '<td>';
|
||||
print $form->selectarray("clos", $object->status,(isset($_POST["clos"])?$_POST["clos"]:$object->clos));
|
||||
print '</td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
|
||||
print '<td>';
|
||||
print $form->selectarray("clos", $object->status,(GETPOST("clos",'int')!=''?GETPOST("clos",'int'):$object->clos));
|
||||
print '</td></tr>';
|
||||
|
||||
// Country
|
||||
// Country
|
||||
$selectedcode='';
|
||||
if (isset($_POST["account_country_id"]))
|
||||
{
|
||||
@ -383,24 +383,24 @@ if ($action == 'create')
|
||||
print '<tr><td>'.$langs->trans("Web").'</td>';
|
||||
print '<td><input class="minwidth300" type="text" class="flat" name="url" value="'.GETPOST("url").'"></td></tr>';
|
||||
|
||||
// Tags-Categories
|
||||
if ($conf->categorie->enabled)
|
||||
{
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Categories").'</td><td>';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1);
|
||||
$c = new Categorie($db);
|
||||
$cats = $c->containing($object->id,Categorie::TYPE_ACCOUNT);
|
||||
foreach($cats as $cat) {
|
||||
$arrayselected[] = $cat->id;
|
||||
}
|
||||
print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%');
|
||||
print "</td></tr>";
|
||||
}
|
||||
// Tags-Categories
|
||||
if ($conf->categorie->enabled)
|
||||
{
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Categories").'</td><td>';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1);
|
||||
$c = new Categorie($db);
|
||||
$cats = $c->containing($object->id,Categorie::TYPE_ACCOUNT);
|
||||
foreach($cats as $cat) {
|
||||
$arrayselected[] = $cat->id;
|
||||
}
|
||||
print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%');
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
// Comment
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Comment").'</td>';
|
||||
print '<td>';
|
||||
// Editor wysiwyg
|
||||
// Editor wysiwyg
|
||||
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->Create();
|
||||
@ -409,7 +409,7 @@ if ($action == 'create')
|
||||
// Other attributes
|
||||
$parameters=array();
|
||||
$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))
|
||||
{
|
||||
print $object->showOptionals($extrafields,'edit',$parameters);
|
||||
@ -504,7 +504,7 @@ if ($action == 'create')
|
||||
print '<table class="border" width="100%">';
|
||||
// Accountancy code
|
||||
$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))
|
||||
{
|
||||
@ -523,7 +523,7 @@ if ($action == 'create')
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
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 '</td></tr>';
|
||||
}
|
||||
@ -547,7 +547,7 @@ if ($action == 'create')
|
||||
/* ************************************************************************** */
|
||||
else
|
||||
{
|
||||
if (($_GET["id"] || $_GET["ref"]) && $action != 'edit')
|
||||
if (($_GET["id"] || $_GET["ref"]) && $action != 'edit')
|
||||
{
|
||||
$object = new Account($db);
|
||||
if ($_GET["id"])
|
||||
@ -605,7 +605,7 @@ else
|
||||
print '<td>';
|
||||
$conciliate=$object->canBeConciliated();
|
||||
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").')'));
|
||||
print '</td></tr>';
|
||||
|
||||
@ -624,15 +624,15 @@ else
|
||||
|
||||
print $accountingaccount->getNomUrl(0,1,1,'',1);
|
||||
} else {
|
||||
print $object->account_number;
|
||||
print $object->account_number;
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy journal
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>';
|
||||
print '<td>';
|
||||
print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>';
|
||||
print '<td>';
|
||||
|
||||
$accountingjournal = new AccountingJournal($db);
|
||||
$accountingjournal->fetch($object->fk_accountancy_journal);
|
||||
@ -655,12 +655,12 @@ else
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
// Categories
|
||||
if ($conf->categorie->enabled) {
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Categories").'</td><td>';
|
||||
print $form->showCategories($object->id,'bank_account',1);
|
||||
print "</td></tr>";
|
||||
}
|
||||
// Categories
|
||||
if ($conf->categorie->enabled) {
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Categories").'</td><td>';
|
||||
print $form->showCategories($object->id,'bank_account',1);
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
print '<tr><td class="tdtop titlefield">'.$langs->trans("Comment").'</td>';
|
||||
print '<td>'.dol_htmlentitiesbr($object->comment).'</td></tr>';
|
||||
@ -669,11 +669,11 @@ else
|
||||
|
||||
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 '<td>'.$object->bank.'</td></tr>';
|
||||
@ -764,23 +764,23 @@ else
|
||||
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Edition */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Edition */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
if (GETPOST('id','int') && $action == 'edit' && $user->rights->banque->configurer)
|
||||
{
|
||||
$object = new Account($db);
|
||||
$object->fetch(GETPOST('id','int'));
|
||||
if (GETPOST('id','int') && $action == 'edit' && $user->rights->banque->configurer)
|
||||
{
|
||||
$object = new Account($db);
|
||||
$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)
|
||||
{
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
print 'jQuery(document).ready(function () {
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
print 'jQuery(document).ready(function () {
|
||||
jQuery("#selecttype").change(function() {
|
||||
document.formsoc.action.value="edit";
|
||||
document.formsoc.submit();
|
||||
@ -793,33 +793,33 @@ else
|
||||
document.formsoc.submit();
|
||||
});
|
||||
})';
|
||||
print '</script>'."\n";
|
||||
}
|
||||
print '</script>'."\n";
|
||||
}
|
||||
|
||||
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="action" value="update">';
|
||||
print '<input type="hidden" name="id" value="'.$_REQUEST["id"].'">'."\n\n";
|
||||
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="action" value="update">';
|
||||
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
|
||||
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>';
|
||||
|
||||
// Label
|
||||
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 '<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>';
|
||||
|
||||
// Type
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>';
|
||||
print '<td class="maxwidth200onsmartphone">';
|
||||
// Type
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>';
|
||||
print '<td class="maxwidth200onsmartphone">';
|
||||
$formbank->selectTypeOfBankAccount((isset($_POST["type"])?$_POST["type"]:$object->type),"type");
|
||||
print '</td></tr>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Currency
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Currency");
|
||||
@ -834,10 +834,10 @@ else
|
||||
print '</td></tr>';
|
||||
|
||||
// Status
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
|
||||
print '<td class="maxwidth200onsmartphone">';
|
||||
print $form->selectarray("clos", $object->status, (isset($_POST["clos"])?$_POST["clos"]:$object->clos));
|
||||
print '</td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
|
||||
print '<td class="maxwidth200onsmartphone">';
|
||||
print $form->selectarray("clos", $object->status, (isset($_POST["clos"])?$_POST["clos"]:$object->clos));
|
||||
print '</td></tr>';
|
||||
|
||||
// Country
|
||||
$object->country_id=$object->country_id?$object->country_id:$mysoc->country_id;
|
||||
@ -865,15 +865,15 @@ else
|
||||
print '</td></tr>';
|
||||
|
||||
// Conciliable
|
||||
print '<tr><td>'.$langs->trans("Conciliable").'</td>';
|
||||
print '<td>';
|
||||
$conciliate=$object->canBeConciliated();
|
||||
if ($conciliate == -2) print $langs->trans("No").' ('.$langs->trans("CashAccount").')';
|
||||
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");
|
||||
print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Conciliable").'</td>';
|
||||
print '<td>';
|
||||
$conciliate=$object->canBeConciliated();
|
||||
if ($conciliate == -2) print $langs->trans("No").' ('.$langs->trans("CashAccount").')';
|
||||
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");
|
||||
print '</td></tr>';
|
||||
|
||||
// Balance
|
||||
// Balance
|
||||
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>';
|
||||
|
||||
@ -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>';
|
||||
|
||||
// Web
|
||||
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></tr>';
|
||||
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></tr>';
|
||||
|
||||
// Tags-Categories
|
||||
if ($conf->categorie->enabled)
|
||||
{
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Categories").'</td><td>';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1);
|
||||
$c = new Categorie($db);
|
||||
$cats = $c->containing($object->id,Categorie::TYPE_ACCOUNT);
|
||||
foreach($cats as $cat) {
|
||||
$arrayselected[] = $cat->id;
|
||||
}
|
||||
print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%');
|
||||
print "</td></tr>";
|
||||
}
|
||||
// Tags-Categories
|
||||
if ($conf->categorie->enabled)
|
||||
{
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Categories").'</td><td>';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1);
|
||||
$c = new Categorie($db);
|
||||
$cats = $c->containing($object->id,Categorie::TYPE_ACCOUNT);
|
||||
foreach($cats as $cat) {
|
||||
$arrayselected[] = $cat->id;
|
||||
}
|
||||
print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%');
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
// Comment
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Comment").'</td>';
|
||||
print '<td>';
|
||||
// Editor wysiwyg
|
||||
// Editor wysiwyg
|
||||
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->Create();
|
||||
@ -911,7 +911,7 @@ else
|
||||
// Other attributes
|
||||
$parameters=array();
|
||||
$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))
|
||||
{
|
||||
print $object->showOptionals($extrafields,'edit');
|
||||
@ -929,15 +929,15 @@ else
|
||||
$tdextra = ' class="titlefieldcreate"';
|
||||
|
||||
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 '<td>';
|
||||
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 {
|
||||
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>';
|
||||
|
||||
@ -954,9 +954,9 @@ else
|
||||
|
||||
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%">';
|
||||
|
||||
|
||||
@ -414,7 +414,7 @@ class Account extends CommonObject
|
||||
{
|
||||
$sql = "SELECT code FROM ".MAIN_DB_PREFIX."c_paiement";
|
||||
$sql.= " WHERE id=".$oper;
|
||||
$sql.= " AND entity = " . getEntity('c_paiement') . ")";
|
||||
$sql.= " AND entity IN (" . getEntity('c_paiement') . ")";
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -1306,11 +1306,8 @@ class Account extends CommonObject
|
||||
}
|
||||
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
|
||||
if (empty($mode))
|
||||
{
|
||||
$url = DOL_URL_ROOT.'/compta/bank/card.php?id='.$this->id;
|
||||
}
|
||||
else if ($mode == 'transactions')
|
||||
$url = DOL_URL_ROOT.'/compta/bank/card.php?id='.$this->id;
|
||||
if ($mode == 'transactions')
|
||||
{
|
||||
$url = DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$this->id;
|
||||
}
|
||||
@ -1340,7 +1337,7 @@ class Account extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* Return if an account has valid information
|
||||
* Return if an account has valid information for Direct debit payment
|
||||
*
|
||||
* @return int 1 if correct, <=0 if wrong
|
||||
*/
|
||||
@ -1348,12 +1345,20 @@ class Account extends CommonObject
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.lib.php';
|
||||
|
||||
$this->error_number = 0;
|
||||
|
||||
// Call function to check BAN
|
||||
if (! checkBanForAccount($this))
|
||||
|
||||
if (! checkIbanForAccount($this) || ! checkSwiftForAccount($this))
|
||||
{
|
||||
$this->error_number = 12;
|
||||
$this->error_message = 'IBANSWIFTControlError';
|
||||
}
|
||||
/*if (! checkBanForAccount($this))
|
||||
{
|
||||
$this->error_number = 12;
|
||||
$this->error_message = 'RIBControlError';
|
||||
}
|
||||
$this->error_message = 'BANControlError';
|
||||
}*/
|
||||
|
||||
if ($this->error_number == 0)
|
||||
{
|
||||
|
||||
@ -38,6 +38,7 @@
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture-rec.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/modules/facture/modules_facture.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php';
|
||||
@ -3815,18 +3816,21 @@ else if ($id > 0 || ! empty($ref))
|
||||
if ($num > 0) {
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object($result);
|
||||
print '<tr class="oddeven"><td>';
|
||||
|
||||
$paymentstatic->id = $objp->rowid;
|
||||
$paymentstatic->datepaye = $db->jdate($objp->dp);
|
||||
$paymentstatic->ref = $objp->ref;
|
||||
$paymentstatic->num_paiement = $objp->num_paiement;
|
||||
$paymentstatic->payment_code = $objp->payment_code;
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $paymentstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
print '<td>' . dol_print_date($db->jdate($objp->dp), 'day') . '</td>';
|
||||
$label = ($langs->trans("PaymentType" . $objp->payment_code) != ("PaymentType" . $objp->payment_code)) ? $langs->trans("PaymentType" . $objp->payment_code) : $objp->payment_label;
|
||||
print '<td>' . $label . ' ' . $objp->num_paiement . '</td>';
|
||||
if (! empty($conf->banque->enabled)) {
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
$bankaccountstatic->id = $objp->baid;
|
||||
$bankaccountstatic->ref = $objp->baref;
|
||||
$bankaccountstatic->label = $objp->baref;
|
||||
|
||||
@ -305,16 +305,66 @@ class Invoices extends DolibarrApi
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Deletes a line of a given invoice
|
||||
*
|
||||
* @param int $id Id of invoice
|
||||
* @param int $lineid Id of the line to delete
|
||||
*
|
||||
* @url DELETE {id}/lines/{lineid}
|
||||
*
|
||||
* @return array
|
||||
* @throws 400
|
||||
* @throws 401
|
||||
* @throws 404
|
||||
* @throws 405
|
||||
*/
|
||||
function deleteLine($id, $lineid) {
|
||||
|
||||
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
if(empty($lineid)) {
|
||||
throw new RestException(400, 'Line ID is mandatory');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('facture',$id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$result = $this->invoice->fetch($id);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Invoice not found');
|
||||
}
|
||||
|
||||
$result = $this->invoice->deleteline($lineid);
|
||||
if( $result < 0) {
|
||||
throw new RestException(405, $this->invoice->error);
|
||||
}
|
||||
|
||||
$result = $this->invoice->fetch($id);
|
||||
|
||||
$this->invoice->getLinesArray();
|
||||
$result = array();
|
||||
foreach ($this->invoice->lines as $line) {
|
||||
array_push($result,$this->_cleanObjectDatas($line));
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Add a line to a given invoice
|
||||
*
|
||||
* Exemple of POST query : { "desc": "Desc", "subprice": "1.00000000", "qty": "1", "tva_tx": "20.000", "localtax1_tx": "0.000", "localtax2_tx": "0.000", "fk_product": "1", "remise_percent": "0", "date_start": "", "date_end": "", "fk_code_ventilation": 0, "info_bits": "0", "fk_remise_except": null, "product_type": "1", "rang": "-1", "special_code": "0", "fk_parent_line": null, "fk_fournprice": null, "pa_ht": "0.00000000", "label": "", "array_options": [], "situation_percent": "100", "fk_prev_id": null, "fk_unit": null }
|
||||
*
|
||||
* Exemple of POST query : { "desc": "Desc", "subprice": "1.00000000", "qty": "1", "tva_tx": "20.000", "localtax1_tx": "0.000", "localtax2_tx": "0.000", "fk_product": "1", "remise_percent": "0", "date_start": "", "date_end": "", "fk_code_ventilation": 0, "info_bits": "0", "fk_remise_except": null, "product_type": "1", "rang": "-1", "special_code": "0", "fk_parent_line": null, "fk_fournprice": null, "pa_ht": "0.00000000", "label": "", "array_options": [], "situation_percent": "100", "fk_prev_id": null, "fk_unit": null }
|
||||
*
|
||||
* @param int $id Id of invoice
|
||||
* @param array $request_data Invoiceline data
|
||||
*
|
||||
* @url POST {id}/lines
|
||||
* @url POST {id}/addline
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
@ -331,14 +381,14 @@ class Invoices extends DolibarrApi
|
||||
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$request_data = (object) $request_data;
|
||||
|
||||
|
||||
$request_data = (object) $request_data;
|
||||
|
||||
// Reset fk_parent_line for no child products and special product
|
||||
if (($request_data->product_type != 9 && empty($request_data->fk_parent_line)) || $request_data->product_type == 9) {
|
||||
$request_data->fk_parent_line = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$updateRes = $this->invoice->addline(
|
||||
$request_data->desc,
|
||||
$request_data->subprice,
|
||||
@ -386,13 +436,13 @@ class Invoices extends DolibarrApi
|
||||
* @url POST {id}/settodraft
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
*
|
||||
* @throws 200
|
||||
* @throws 304
|
||||
* @throws 401
|
||||
* @throws 404
|
||||
* @throws 500
|
||||
*
|
||||
*
|
||||
*/
|
||||
function settodraft($id, $idwarehouse=-1)
|
||||
{
|
||||
|
||||
@ -823,6 +823,30 @@ class FactureRec extends CommonInvoice
|
||||
return dol_time_plus_duree($this->date_when, $this->frequency, $this->unit_frequency);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return if maximum number of generation is reached
|
||||
*
|
||||
* @return boolean False by default, True if maximum number of generation is reached
|
||||
*/
|
||||
function isMaxNbGenReached()
|
||||
{
|
||||
$ret = false;
|
||||
if ($this->nb_gen_max > 0 && ($this->nb_gen_done >= $this->nb_gen_max)) $ret = true;
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format string to output with by striking the string if max number of generation was reached
|
||||
*
|
||||
* @param string $ret Default value to output
|
||||
* @return boolean False by default, True if maximum number of generation is reached
|
||||
*/
|
||||
function strikeIfMaxNbGenReached($ret)
|
||||
{
|
||||
// Special case to strike the date
|
||||
return ($this->isMaxNbGenReached()?'<strike>':'').$ret.($this->isMaxNbGenReached()?'</strike>':'');
|
||||
}
|
||||
|
||||
/**
|
||||
* Create all recurrents invoices (for all entities if multicompany is used).
|
||||
* A result may also be provided into this->output.
|
||||
|
||||
@ -351,22 +351,19 @@ class Facture extends CommonInvoice
|
||||
}
|
||||
|
||||
// Array of possible substitutions (See also file mailing-send.php that should manage same substitutions)
|
||||
$substitutionarray=array(
|
||||
'__TOTAL_HT__' => price($this->total_ht, 0, $outputlangs, 0, 0, -1, $conf->currency_code),
|
||||
'__TOTAL_TTC__' => price($this->total_ttc, 0, $outputlangs, 0, 0, -1, $conf->currency_code),
|
||||
'__INVOICE_PREVIOUS_MONTH__' => dol_print_date(dol_time_plus_duree($this->date, -1, 'm'), '%m'),
|
||||
'__INVOICE_MONTH__' => dol_print_date($this->date, '%m'),
|
||||
'__INVOICE_NEXT_MONTH__' => dol_print_date(dol_time_plus_duree($this->date, 1, 'm'), '%m'),
|
||||
'__INVOICE_PREVIOUS_MONTH_TEXT__' => dol_print_date(dol_time_plus_duree($this->date, -1, 'm'), '%B'),
|
||||
'__INVOICE_MONTH_TEXT__' => dol_print_date($this->date, '%B'),
|
||||
'__INVOICE_NEXT_MONTH_TEXT__' => dol_print_date(dol_time_plus_duree($this->date, 1, 'm'), '%B'),
|
||||
'__INVOICE_PREVIOUS_YEAR__' => dol_print_date(dol_time_plus_duree($this->date, -1, 'y'), '%Y'),
|
||||
'__INVOICE_YEAR__' => dol_print_date($this->date, '%Y'),
|
||||
'__INVOICE_NEXT_YEAR__' => dol_print_date(dol_time_plus_duree($this->date, 1, 'y'), '%Y'),
|
||||
// Only for tempalte invoice
|
||||
'__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__' => dol_print_date($originaldatewhen, 'dayhour'),
|
||||
'__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__' => dol_print_date(dol_time_plus_duree($originaldatewhen, $_facrec->frequency, $_facrec->unit_frequency), 'dayhour')
|
||||
);
|
||||
$substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $this);
|
||||
$substitutionarray['__INVOICE_PREVIOUS_MONTH__'] = dol_print_date(dol_time_plus_duree($this->date, -1, 'm'), '%m');
|
||||
$substitutionarray['__INVOICE_MONTH__'] = dol_print_date($this->date, '%m');
|
||||
$substitutionarray['__INVOICE_NEXT_MONTH__'] = dol_print_date(dol_time_plus_duree($this->date, 1, 'm'), '%m');
|
||||
$substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = dol_print_date(dol_time_plus_duree($this->date, -1, 'm'), '%B');
|
||||
$substitutionarray['__INVOICE_MONTH_TEXT__'] = dol_print_date($this->date, '%B');
|
||||
$substitutionarray['__INVOICE_NEXT_MONTH_TEXT__'] = dol_print_date(dol_time_plus_duree($this->date, 1, 'm'), '%B');
|
||||
$substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = dol_print_date(dol_time_plus_duree($this->date, -1, 'y'), '%Y');
|
||||
$substitutionarray['__INVOICE_YEAR__'] = dol_print_date($this->date, '%Y');
|
||||
$substitutionarray['__INVOICE_NEXT_YEAR__'] = dol_print_date(dol_time_plus_duree($this->date, 1, 'y'), '%Y');
|
||||
// Only for tempalte invoice
|
||||
$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = dol_print_date($originaldatewhen, 'dayhour');
|
||||
$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = dol_print_date(dol_time_plus_duree($originaldatewhen, $_facrec->frequency, $_facrec->unit_frequency), 'dayhour');
|
||||
|
||||
//var_dump($substitutionarray);exit;
|
||||
|
||||
|
||||
@ -969,26 +969,20 @@ if ($action == 'create')
|
||||
$note_private=GETPOST('note_private','none')?GETPOST('note_private','none'):$object->note_private;
|
||||
|
||||
// Help of substitution key
|
||||
$substitutionarray=array(
|
||||
//'__TOTAL_HT__' => $langs->trans("AmountHT").' ('.$langs->trans("Example").': '.price($object->total_ht).')',
|
||||
//'__TOTAL_TTC__' => $langs->trans("AmountTTC").' ('.$langs->trans("Example").': '.price($object->total_ttc).')',
|
||||
'__AMOUNT_EXCL_TAX__' => $langs->trans("AmountHT").' ('.$langs->trans("Example").': '.price($object->total_ht).')',
|
||||
'__AMOUNT_VAT__' => $langs->trans("AmountVAT").' ('.$langs->trans("Example").': '.price($object->total_tva).')',
|
||||
'__AMOUNT__' => $langs->trans("AmountTTC").' ('.$langs->trans("Example").': '.price($object->total_ttc).')',
|
||||
'__INVOICE_PREVIOUS_MONTH__' => $langs->trans("PreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'm'),'%m').')',
|
||||
'__INVOICE_MONTH__' => $langs->trans("MonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date,'%m').')',
|
||||
'__INVOICE_NEXT_MONTH__' => $langs->trans("NextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'm'),'%m').')',
|
||||
'__INVOICE_PREVIOUS_MONTH_TEXT__' => $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'm'),'%B').')',
|
||||
'__INVOICE_MONTH_TEXT__' => $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date,'%B').')',
|
||||
'__INVOICE_NEXT_MONTH_TEXT__' => $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%B').')',
|
||||
'__INVOICE_PREVIOUS_YEAR__' => $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'y'),'%Y').')',
|
||||
'__INVOICE_YEAR__' => $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date,'%Y').')',
|
||||
'__INVOICE_NEXT_YEAR__' => $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'y'),'%Y').')',
|
||||
// Only on template invoices
|
||||
'__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__' => $langs->trans("DateNextInvoiceBeforeGen").' ('.$langs->trans("Example").': '.dol_print_date($object->date_when, 'dayhour').')',
|
||||
'__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__' => $langs->trans("DateNextInvoiceAfterGen").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date_when, $object->frequency, $object->unit_frequency),'dayhour').')',
|
||||
);
|
||||
$substitutionarray['__(TransKey)__']=$langs->trans("TransKey");
|
||||
$substitutionarray = getCommonSubstitutionArray($langs, 2, null, $object);
|
||||
|
||||
$substitutionarray['__INVOICE_PREVIOUS_MONTH__'] = $langs->trans("PreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'm'),'%m').')';
|
||||
$substitutionarray['__INVOICE_MONTH__'] = $langs->trans("MonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date,'%m').')';
|
||||
$substitutionarray['__INVOICE_NEXT_MONTH__'] = $langs->trans("NextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'm'),'%m').')';
|
||||
$substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'm'),'%B').')';
|
||||
$substitutionarray['__INVOICE_MONTH_TEXT__'] = $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date,'%B').')';
|
||||
$substitutionarray['__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%B').')';
|
||||
$substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'y'),'%Y').')';
|
||||
$substitutionarray['__INVOICE_YEAR__'] = $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date,'%Y').')';
|
||||
$substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'y'),'%Y').')';
|
||||
// Only on template invoices
|
||||
$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans("DateNextInvoiceBeforeGen").' ('.$langs->trans("Example").': '.dol_print_date($object->date_when, 'dayhour').')';
|
||||
$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = $langs->trans("DateNextInvoiceAfterGen").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date_when, $object->frequency, $object->unit_frequency),'dayhour').')';
|
||||
|
||||
$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br>';
|
||||
foreach($substitutionarray as $key => $val)
|
||||
@ -1294,26 +1288,21 @@ else
|
||||
// Help of substitution key
|
||||
$dateexample=dol_now();
|
||||
if (! empty($object->frequency) && ! empty($object->date_when)) $dateexample=$object->date_when;
|
||||
$substitutionarray=array(
|
||||
//'__TOTAL_HT__' => $langs->trans("AmountHT").' ('.$langs->trans("Example").': '.price($object->total_ht).')',
|
||||
//'__TOTAL_TTC__' => $langs->trans("AmountTTC").' ('.$langs->trans("Example").': '.price($object->total_ttc).')',
|
||||
'__AMOUNT_EXCL_TAX__' => $langs->trans("AmountHT").' ('.$langs->trans("Example").': '.price($object->total_ht).')',
|
||||
'__AMOUNT_VAT__' => $langs->trans("AmountVAT").' ('.$langs->trans("Example").': '.price($object->total_tva).')',
|
||||
'__AMOUNT__' => $langs->trans("AmountTTC").' ('.$langs->trans("Example").': '.price($object->total_ttc).')',
|
||||
'__INVOICE_PREVIOUS_MONTH__' => $langs->trans("PreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'),'%m').')',
|
||||
'__INVOICE_MONTH__' => $langs->trans("MonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample,'%m').')',
|
||||
'__INVOICE_NEXT_MONTH__' => $langs->trans("NextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'),'%m').')',
|
||||
'__INVOICE_PREVIOUS_MONTH_TEXT__' => $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'),'%B').')',
|
||||
'__INVOICE_MONTH_TEXT__' => $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample,'%B').')',
|
||||
'__INVOICE_NEXT_MONTH_TEXT__' => $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%B').')',
|
||||
'__INVOICE_PREVIOUS_YEAR__' => $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'),'%Y').')',
|
||||
'__INVOICE_YEAR__' => $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample,'%Y').')',
|
||||
'__INVOICE_NEXT_YEAR__' => $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'),'%Y').')',
|
||||
// Only on template invoices
|
||||
'__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__' => $langs->trans("DateNextInvoiceBeforeGen").' ('.$langs->trans("Example").': '.dol_print_date($object->date_when, 'dayhour').')',
|
||||
'__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__' => $langs->trans("DateNextInvoiceAfterGen").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date_when, $object->frequency, $object->unit_frequency),'dayhour').')',
|
||||
);
|
||||
$substitutionarray['__(TransKey)__']=$langs->trans("TransKey");
|
||||
|
||||
$substitutionarray = getCommonSubstitutionArray($langs, 2, null, $object);
|
||||
|
||||
$substitutionarray['__INVOICE_PREVIOUS_MONTH__'] = $langs->trans("PreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'),'%m').')';
|
||||
$substitutionarray['__INVOICE_MONTH__'] = $langs->trans("MonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample,'%m').')';
|
||||
$substitutionarray['__INVOICE_NEXT_MONTH__'] = $langs->trans("NextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'),'%m').')';
|
||||
$substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'),'%B').')';
|
||||
$substitutionarray['__INVOICE_MONTH_TEXT__'] = $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample,'%B').')';
|
||||
$substitutionarray['__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%B').')';
|
||||
$substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'),'%Y').')';
|
||||
$substitutionarray['__INVOICE_YEAR__'] = $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample,'%Y').')';
|
||||
$substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'),'%Y').')';
|
||||
// Only on template invoices
|
||||
$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans("DateNextInvoiceBeforeGen").' ('.$langs->trans("Example").': '.dol_print_date($object->date_when, 'dayhour').')';
|
||||
$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = $langs->trans("DateNextInvoiceAfterGen").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date_when, $object->frequency, $object->unit_frequency),'dayhour').')';
|
||||
|
||||
$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br>';
|
||||
foreach($substitutionarray as $key => $val)
|
||||
@ -1430,7 +1419,7 @@ else
|
||||
print '</td><td>';
|
||||
if ($action == 'date_when' || $object->frequency > 0)
|
||||
{
|
||||
print $form->editfieldval($langs->trans("NextDateToExecution"), 'date_when', $object->date_when, $object, $user->rights->facture->creer, 'day');
|
||||
print $form->editfieldval($langs->trans("NextDateToExecution"), 'date_when', $object->date_when, $object, $user->rights->facture->creer, 'day', $object->date_when, null, '', '', 0, 'strikeIfMaxNbGenReached');
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -126,7 +126,7 @@ $arrayfields=array(
|
||||
'recurring'=>array('label'=>$langs->trans("RecurringInvoiceTemplate"), 'checked'=>1),
|
||||
'f.frequency'=>array('label'=>$langs->trans("Frequency"), 'checked'=>1),
|
||||
'f.unit_frequency'=>array('label'=>$langs->trans("FrequencyUnit"), 'checked'=>1),
|
||||
'f.nb_gen_done'=>array('label'=>$langs->trans("NbOfGenerationDone"), 'checked'=>1),
|
||||
'f.nb_gen_done'=>array('label'=>$langs->trans("NbOfGenerationDoneShort"), 'checked'=>1),
|
||||
'f.date_last_gen'=>array('label'=>$langs->trans("DateLastGeneration"), 'checked'=>1),
|
||||
'f.date_when'=>array('label'=>$langs->trans("NextDateToExecution"), 'checked'=>1),
|
||||
'status'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>100),
|
||||
@ -520,6 +520,8 @@ if ($resql)
|
||||
$invoicerectmp->frequency=$objp->frequency;
|
||||
$invoicerectmp->suspend=$objp->suspend;
|
||||
$invoicerectmp->unit_frequency=$objp->unit_frequency;
|
||||
$invoicerectmp->nb_gen_max=$objp->nb_gen_max;
|
||||
$invoicerectmp->nb_gen_done=$objp->nb_gen_done;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
@ -603,7 +605,7 @@ if ($resql)
|
||||
if (! empty($arrayfields['f.date_when']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print ($objp->frequency ? dol_print_date($db->jdate($objp->date_when),'day') : '<span class="opacitymedium">'.$langs->trans('NA').'</span>');
|
||||
print ($objp->frequency ? ($invoicerectmp->isMaxNbGenReached()?'<strike>':'').dol_print_date($db->jdate($objp->date_when),'day').($invoicerectmp->isMaxNbGenReached()?'</strike>':'') : '<span class="opacitymedium">'.$langs->trans('NA').'</span>');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -233,7 +233,8 @@ if (empty($reshook))
|
||||
$objectclass='Facture';
|
||||
$objectlabel='Invoices';
|
||||
$permtoread = $user->rights->facture->lire;
|
||||
$permtodelete = $user->rights->facture->supprimer;
|
||||
$permtocreate = $user->rights->facture->creer;
|
||||
$permtodelete = $user->rights->facture->supprimer;
|
||||
$uploaddir = $conf->facture->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
}
|
||||
@ -573,7 +574,8 @@ if ($resql)
|
||||
}
|
||||
|
||||
$arrayofmassactions=array(
|
||||
'presend'=>$langs->trans("SendByMail"),
|
||||
'validate'=>$langs->trans("Validate"),
|
||||
'presend'=>$langs->trans("SendByMail"),
|
||||
'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
if ($conf->prelevement->enabled)
|
||||
@ -1155,7 +1157,7 @@ if ($resql)
|
||||
if (! empty($arrayfields['f.datec']['checked']))
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
print dol_print_date($db->jdate($obj->date_creation), 'dayhour');
|
||||
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
@ -1163,7 +1165,7 @@ if ($resql)
|
||||
if (! empty($arrayfields['f.tms']['checked']))
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
print dol_print_date($db->jdate($obj->date_update), 'dayhour');
|
||||
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ if ($mode == 'customer')
|
||||
if ($mode == 'supplier')
|
||||
{
|
||||
$title=$langs->trans("BillsStatisticsSuppliers");
|
||||
$dir=$conf->fournisseur->dir_output.'/facture/temp';
|
||||
$dir=$conf->fournisseur->facture->dir_temp;
|
||||
}
|
||||
|
||||
print load_fiche_titre($title, $mesg, 'title_accountancy.png');
|
||||
|
||||
@ -60,18 +60,21 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm=='yes
|
||||
|
||||
if (! $_POST["paiementtype"] > 0)
|
||||
{
|
||||
$mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("PaymentMode"));
|
||||
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentities("PaymentMode")), null, 'errors');
|
||||
$error++;
|
||||
$action = 'create';
|
||||
}
|
||||
if ($datepaye == '')
|
||||
{
|
||||
$mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("Date"));
|
||||
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentities("Date")), null, 'errors');
|
||||
$error++;
|
||||
$action = 'create';
|
||||
}
|
||||
if (! empty($conf->banque->enabled) && ! $_POST["accountid"] > 0)
|
||||
{
|
||||
$mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("AccountToCredit"));
|
||||
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentities("AccountToCredit")), null, 'errors');
|
||||
$error++;
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
@ -91,7 +94,8 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm=='yes
|
||||
if (count($amounts) <= 0)
|
||||
{
|
||||
$error++;
|
||||
$errmsg='ErrorNoPaymentDefined';
|
||||
setEventMessages($langs->trans("ErrorNoPaymentDefined"), null, 'errors');
|
||||
$action='create';
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
@ -112,18 +116,20 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm=='yes
|
||||
$paymentid = $paiement->create($user, (GETPOST('closepaidcontrib')=='on'?1:0));
|
||||
if ($paymentid < 0)
|
||||
{
|
||||
$errmsg=$paiement->error;
|
||||
$error++;
|
||||
$error++;
|
||||
setEventMessages($paiement->error, null, 'errors');
|
||||
$action='create';
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$result=$paiement->addPaymentToBank($user,'payment_sc','(SocialContributionPayment)',$_POST['accountid'],'','');
|
||||
if (! $result > 0)
|
||||
$result=$paiement->addPaymentToBank($user,'payment_sc','(SocialContributionPayment)', GETPOST('accountid','int'),'','');
|
||||
if (! ($result > 0))
|
||||
{
|
||||
$errmsg=$paiement->error;
|
||||
$error++;
|
||||
$error++;
|
||||
setEventMessages($paiement->error, null, 'errors');
|
||||
$action='create';
|
||||
}
|
||||
}
|
||||
|
||||
@ -141,7 +147,6 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm=='yes
|
||||
}
|
||||
}
|
||||
|
||||
$_GET["action"]='create';
|
||||
}
|
||||
|
||||
|
||||
@ -266,7 +271,7 @@ if ($action == 'create')
|
||||
{
|
||||
$objp = $charge;
|
||||
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
|
||||
@ -44,10 +44,10 @@ if ($user->societe_id) $socid=$user->societe_id;
|
||||
// TODO ajouter regle pour restreindre acces paiement
|
||||
//$result = restrictedArea($user, 'facture', $id,'');
|
||||
|
||||
$paiement = new PaymentSocialContribution($db);
|
||||
if ($id > 0)
|
||||
$object = new PaymentSocialContribution($db);
|
||||
if ($id > 0)
|
||||
{
|
||||
$result=$paiement->fetch($id);
|
||||
$result=$object->fetch($id);
|
||||
if (! $result) dol_print_error($db,'Failed to get payment id '.$id);
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->tax->char
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$result = $paiement->delete($user);
|
||||
$result = $object->delete($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
$db->commit();
|
||||
@ -70,7 +70,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->tax->char
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($paiement->error, $paiement->errors, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
@ -80,8 +80,8 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->tax->char
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$result=$paiement->valide();
|
||||
|
||||
$result=$object->valide();
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
$db->commit();
|
||||
@ -103,12 +103,12 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->tax->char
|
||||
}
|
||||
}
|
||||
|
||||
header('Location: card.php?id='.$paiement->id);
|
||||
header('Location: card.php?id='.$object->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($paiement->error, $paiement->errors, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
@ -137,15 +137,15 @@ $h++;
|
||||
*/
|
||||
|
||||
|
||||
dol_fiche_head($head, $hselected, $langs->trans("PaymentSocialContribution"), 0, 'payment');
|
||||
dol_fiche_head($head, $hselected, $langs->trans("PaymentSocialContribution"), -1, 'payment');
|
||||
|
||||
/*
|
||||
* Deletion confirmation of payment
|
||||
*/
|
||||
if ($action == 'delete')
|
||||
{
|
||||
print $form->formconfirm('card.php?id='.$paiement->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete','',0,2);
|
||||
|
||||
print $form->formconfirm('card.php?id='.$object->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete','',0,2);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@ -154,41 +154,49 @@ if ($action == 'delete')
|
||||
if ($action == 'valide')
|
||||
{
|
||||
$facid = $_GET['facid'];
|
||||
print $form->formconfirm('card.php?id='.$paiement->id.'&facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide','',0,2);
|
||||
|
||||
print $form->formconfirm('card.php?id='.$object->id.'&facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide','',0,2);
|
||||
|
||||
}
|
||||
|
||||
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/sociales/payments.php">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'id', '');
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td class="titlefield">'.$langs->trans('Ref').'</td>';
|
||||
/*print '<tr><td class="titlefield">'.$langs->trans('Ref').'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $form->showrefnav($paiement,'id','',1,'rowid','id');
|
||||
print '</td></tr>';
|
||||
print $form->showrefnav($object,'id','',1,'rowid','id');
|
||||
print '</td></tr>';*/
|
||||
|
||||
// Date
|
||||
print '<tr><td>'.$langs->trans('Date').'</td><td colspan="3">'.dol_print_date($paiement->datep,'day').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Date').'</td><td colspan="3">'.dol_print_date($object->datep,'day').'</td></tr>';
|
||||
|
||||
// Mode
|
||||
print '<tr><td>'.$langs->trans('Mode').'</td><td colspan="3">'.$langs->trans("PaymentType".$paiement->type_code).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Mode').'</td><td colspan="3">'.$langs->trans("PaymentType".$object->type_code).'</td></tr>';
|
||||
|
||||
// Numero
|
||||
print '<tr><td>'.$langs->trans('Numero').'</td><td colspan="3">'.$paiement->num_paiement.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Numero').'</td><td colspan="3">'.$object->num_paiement.'</td></tr>';
|
||||
|
||||
// Montant
|
||||
print '<tr><td>'.$langs->trans('Amount').'</td><td colspan="3">'.price($paiement->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Amount').'</td><td colspan="3">'.price($object->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).'</td></tr>';
|
||||
|
||||
// Note
|
||||
print '<tr><td>'.$langs->trans('Note').'</td><td colspan="3">'.nl2br($paiement->note).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Note').'</td><td colspan="3">'.nl2br($object->note).'</td></tr>';
|
||||
|
||||
// Bank account
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
if ($paiement->bank_account)
|
||||
if ($object->bank_account)
|
||||
{
|
||||
$bankline=new AccountLine($db);
|
||||
$bankline->fetch($paiement->bank_line);
|
||||
$bankline->fetch($object->bank_line);
|
||||
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('BankTransactionLine').'</td>';
|
||||
@ -201,6 +209,10 @@ if (! empty($conf->banque->enabled))
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
/*
|
||||
* List of social contributions payed
|
||||
@ -211,7 +223,7 @@ $sql = 'SELECT f.rowid as scid, f.libelle, f.paye, f.amount as sc_amount, pf.amo
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiementcharge as pf,'.MAIN_DB_PREFIX.'chargesociales as f, '.MAIN_DB_PREFIX.'c_chargesociales as pc';
|
||||
$sql.= ' WHERE pf.fk_charge = f.rowid AND f.fk_type = pc.id';
|
||||
$sql.= ' AND f.entity = '.$conf->entity;
|
||||
$sql.= ' AND pf.rowid = '.$paiement->id;
|
||||
$sql.= ' AND pf.rowid = '.$object->id;
|
||||
|
||||
dol_syslog("compta/payment_sc/card.php", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
@ -239,7 +251,7 @@ if ($resql)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
// Ref
|
||||
print '<td>';
|
||||
@ -268,7 +280,7 @@ if ($resql)
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
print "</table>\n";
|
||||
$db->free($resql);
|
||||
@ -278,7 +290,6 @@ else
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
/*
|
||||
@ -289,7 +300,7 @@ print '<div class="tabsAction">';
|
||||
/*
|
||||
if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
|
||||
{
|
||||
if ($user->societe_id == 0 && $paiement->statut == 0 && $_GET['action'] == '')
|
||||
if ($user->societe_id == 0 && $object->statut == 0 && $_GET['action'] == '')
|
||||
{
|
||||
if ($user->rights->facture->paiement)
|
||||
{
|
||||
@ -299,7 +310,7 @@ if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
|
||||
}
|
||||
*/
|
||||
|
||||
if ($_GET['action'] == '')
|
||||
if ($action == '')
|
||||
{
|
||||
if ($user->rights->tax->charges->supprimer)
|
||||
{
|
||||
|
||||
@ -60,6 +60,7 @@ class BonPrelevement extends CommonObject
|
||||
var $labelstatut=array();
|
||||
|
||||
var $invoice_in_error=array();
|
||||
var $thirdparty_in_error=array();
|
||||
|
||||
|
||||
/**
|
||||
@ -756,17 +757,20 @@ class BonPrelevement extends CommonObject
|
||||
* @param int $banque dolibarr mysoc bank
|
||||
* @param int $agence dolibarr mysoc bank office (guichet)
|
||||
* @param string $mode real=do action, simu=test only
|
||||
* @param string $format FRST, RCUR or ALL
|
||||
* @return int <0 if KO, nbre of invoice withdrawed if OK
|
||||
*/
|
||||
function Create($banque=0, $agence=0, $mode='real')
|
||||
function Create($banque=0, $agence=0, $mode='real', $format='ALL')
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
dol_syslog(__METHOD__."::Bank=".$banque." Office=".$agence, LOG_DEBUG);
|
||||
dol_syslog(__METHOD__."::Bank=".$banque." Office=".$agence." mode=".$mode." format=".$format, LOG_DEBUG);
|
||||
|
||||
require_once (DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
|
||||
require_once (DOL_DOCUMENT_ROOT."/societe/class/societe.class.php");
|
||||
|
||||
if (empty($format)) return 'ErrorBadParametersForDirectDebitFileCreate';
|
||||
|
||||
$error = 0;
|
||||
|
||||
$datetimeprev = time();
|
||||
@ -776,9 +780,10 @@ class BonPrelevement extends CommonObject
|
||||
|
||||
$puser = new User($this->db, $conf->global->PRELEVEMENT_USER);
|
||||
|
||||
/*
|
||||
* Read invoices
|
||||
*/
|
||||
$this->invoice_in_error = array();
|
||||
$this->thirdparty_in_error = array();
|
||||
|
||||
// Read invoices
|
||||
$factures = array();
|
||||
$factures_prev = array();
|
||||
$factures_result = array();
|
||||
@ -849,10 +854,12 @@ class BonPrelevement extends CommonObject
|
||||
if ($soc->fetch($fact->socid) >= 0)
|
||||
{
|
||||
$bac = new CompanyBankAccount($this->db);
|
||||
$bac->fetch(0,$soc->id);
|
||||
$bac->fetch(0, $soc->id);
|
||||
|
||||
if ($bac->verif() >= 1)
|
||||
//if (true)
|
||||
if ($format == 'FRST' && $bac->frstrecur != 'FRST') continue;
|
||||
if ($format == 'RCUR' && ($bac->frstrecur != 'RCUR' && $bac->frstrecur != 'RECUR')) continue;
|
||||
|
||||
if ($bac->verif() >= 1)
|
||||
{
|
||||
$factures_prev[$i] = $fac;
|
||||
/* second tableau necessaire pour BonPrelevement */
|
||||
@ -861,8 +868,9 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(__METHOD__."::Check RIB Error on default bank number RIB/IBAN for thirdparty reported by verif() ".$fact->socid." ".$soc->name, LOG_ERR);
|
||||
$this->invoice_in_error[$fac[0]]="Error on default bank number RIB/IBAN for invoice ".$fact->getNomUrl(0)." for thirdparty (reported by function verif) ".$soc->getNomUrl(0);
|
||||
dol_syslog(__METHOD__."::Check RIB Error on default bank number IBAN/BIC for thirdparty reported by verif() ".$fact->socid." ".$soc->name, LOG_ERR);
|
||||
$this->invoice_in_error[$fac[0]]="Error on default bank number IBAN/BIC for invoice ".$fact->getNomUrl(0)." for thirdparty ".$soc->getNomUrl(0);
|
||||
$this->thirdparty_in_error[$soc->id]="Error on default bank number IBAN/BIC for invoice ".$fact->getNomUrl(0)." for thirdparty ".$soc->getNomUrl(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -889,6 +897,14 @@ class BonPrelevement extends CommonObject
|
||||
//print $out."\n";
|
||||
dol_syslog($out);
|
||||
|
||||
// Return warning
|
||||
/*$i=0;
|
||||
foreach ($this->thirdparty_in_error as $key => $val)
|
||||
{
|
||||
if ($i < 10) setEventMessages($val, null, 'warnings');
|
||||
else setEventMessages('More error were discarded...', null, 'warnings');
|
||||
$i++;
|
||||
}*/
|
||||
|
||||
if (count($factures_prev) > 0)
|
||||
{
|
||||
@ -1052,7 +1068,7 @@ class BonPrelevement extends CommonObject
|
||||
$this->factures = $factures_prev_id;
|
||||
|
||||
// Generation of SEPA file $this->filename
|
||||
$this->generate();
|
||||
$this->generate($format);
|
||||
}
|
||||
dol_syslog(__METHOD__."::End withdraw receipt, file ".$this->filename, LOG_DEBUG);
|
||||
}
|
||||
@ -1247,14 +1263,16 @@ class BonPrelevement extends CommonObject
|
||||
* - Others countries: Warning message
|
||||
* File is generated with name this->filename
|
||||
*
|
||||
* @return int 0 if OK, <0 if KO
|
||||
* @param string $format FRST, RCUR or ALL
|
||||
* @return int 0 if OK, <0 if KO
|
||||
*/
|
||||
//TODO: Optimize code to read lines in a single function
|
||||
function generate()
|
||||
function generate($format='ALL')
|
||||
{
|
||||
global $conf,$langs,$mysoc;
|
||||
global $conf,$langs,$mysoc;
|
||||
|
||||
$result = 0;
|
||||
//TODO: Optimize code to read lines in a single function
|
||||
|
||||
$result = 0;
|
||||
|
||||
dol_syslog(get_class($this)."::generate build file ".$this->filename);
|
||||
|
||||
@ -1332,7 +1350,7 @@ class BonPrelevement extends CommonObject
|
||||
// Define $fileEmetteurSection. Start of bloc PmtInf. Will contains all DrctDbtTxInf
|
||||
if ($result != -2)
|
||||
{
|
||||
$fileEmetteurSection .= $this->EnregEmetteurSEPA($conf, $date_actu, $nbtotalDrctDbtTxInf, $this->total, $CrLf);
|
||||
$fileEmetteurSection .= $this->EnregEmetteurSEPA($conf, $date_actu, $nbtotalDrctDbtTxInf, $this->total, $CrLf, $format);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1503,7 +1521,7 @@ class BonPrelevement extends CommonObject
|
||||
static function buildRumNumber($row_code_client, $row_datec, $row_drum)
|
||||
{
|
||||
global $langs;
|
||||
$pre = ($row_datec > 1359673200) ? $langs->trans('RUM').'-' : '++R';
|
||||
$pre = $langs->trans('RUM').'-';
|
||||
return $pre.$row_code_client.'-'.$row_drum.'-'.date('U', $row_datec);
|
||||
}
|
||||
|
||||
@ -1516,9 +1534,9 @@ class BonPrelevement extends CommonObject
|
||||
* @param string $row_zip soc.zip
|
||||
* @param string $row_town soc.town
|
||||
* @param string $row_country_code c.code AS country,
|
||||
* @param string $row_cb pl.code_banque AS cb,
|
||||
* @param string $row_cg pl.code_guichet AS cg,
|
||||
* @param string $row_cc pl.number AS cc,
|
||||
* @param string $row_cb pl.code_banque AS cb, Not used for SEPA
|
||||
* @param string $row_cg pl.code_guichet AS cg, Not used for SEPA
|
||||
* @param string $row_cc pl.number AS cc, Not used for SEPA
|
||||
* @param string $row_somme pl.amount AS somme,
|
||||
* @param string $row_facnumber f.facnumber
|
||||
* @param string $row_idfac pf.fk_facture AS idfac,
|
||||
@ -1562,8 +1580,10 @@ class BonPrelevement extends CommonObject
|
||||
$XML_DEBITOR .=' <Nm>'.dolEscapeXML(strtoupper(dol_string_unaccent($row_nom))).'</Nm>'.$CrLf;
|
||||
$XML_DEBITOR .=' <PstlAdr>'.$CrLf;
|
||||
$XML_DEBITOR .=' <Ctry>'.$row_country_code.'</Ctry>'.$CrLf;
|
||||
$XML_DEBITOR .=' <AdrLine>'.dolEscapeXML(dol_trunc(dol_string_unaccent(strtr($row_address, array(CHR(13) => ", ", CHR(10) => ""))),70,'right','UTF-8',true)).'</AdrLine>'.$CrLf;
|
||||
$XML_DEBITOR .=' <AdrLine>'.dolEscapeXML(dol_string_unaccent($row_zip.' '.$row_town)).'</AdrLine>'.$CrLf;
|
||||
$addressline1 = dol_string_unaccent(strtr($row_address, array(CHR(13) => ", ", CHR(10) => "")));
|
||||
$addressline2 = dol_string_unaccent(strtr($row_zip.(($row_zip && $row_town)?' ':''.$row_town)), array(CHR(13) => ", ", CHR(10) => ""));
|
||||
if (trim($addressline1)) $XML_DEBITOR .=' <AdrLine>'.dolEscapeXML(dol_trunc($addressline1,70,'right','UTF-8',true)).'</AdrLine>'.$CrLf;
|
||||
if (trim($addressline2)) $XML_DEBITOR .=' <AdrLine>'.dolEscapeXML(dol_trunc($addressline2,70,'right','UTF-8',true)).'</AdrLine>'.$CrLf;
|
||||
$XML_DEBITOR .=' </PstlAdr>'.$CrLf;
|
||||
$XML_DEBITOR .=' </Dbtr>'.$CrLf;
|
||||
$XML_DEBITOR .=' <DbtrAcct>'.$CrLf;
|
||||
@ -1655,9 +1675,10 @@ class BonPrelevement extends CommonObject
|
||||
* @param int $nombre 0 or 1
|
||||
* @param float $total Total
|
||||
* @param string $CrLf End of line character
|
||||
* @param string $format FRST or RCUR or ALL
|
||||
* @return string String with SEPA Sender
|
||||
*/
|
||||
function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrLf='\n')
|
||||
function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrLf='\n', $format='FRST')
|
||||
{
|
||||
// SEPA INITIALISATION
|
||||
global $conf;
|
||||
@ -1698,7 +1719,7 @@ class BonPrelevement extends CommonObject
|
||||
$country = explode(':', $configuration->global->MAIN_INFO_SOCIETE_COUNTRY);
|
||||
$IdBon = sprintf("%05d", $obj->rowid);
|
||||
$RefBon = $obj->ref;
|
||||
$type = ($nombre == 1) ? 'FRST' : 'RCUR' ;
|
||||
|
||||
// SEPA Paiement Information
|
||||
$XML_SEPA_INFO = '';
|
||||
$XML_SEPA_INFO .= ' <PmtInf>'.$CrLf;
|
||||
@ -1713,15 +1734,17 @@ class BonPrelevement extends CommonObject
|
||||
$XML_SEPA_INFO .= ' <LclInstrm>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <Cd>CORE</Cd>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' </LclInstrm>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <SeqTp>'.$type.'</SeqTp>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <SeqTp>'.$format.'</SeqTp>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' </PmtTpInf>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <ReqdColltnDt>'.$dateTime_ETAD.'</ReqdColltnDt>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <Cdtr>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <Nm>'.strtoupper(dol_string_unaccent($this->raison_sociale)).'</Nm>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <PstlAdr>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <Ctry>'.$country[1].'</Ctry>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <AdrLine>'.strtoupper(dol_string_unaccent($configuration->global->MAIN_INFO_SOCIETE_ADDRESS)).'</AdrLine>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <AdrLine>'.strtoupper(dol_string_unaccent($configuration->global->MAIN_INFO_SOCIETE_ZIP.' '.$configuration->global->MAIN_INFO_SOCIETE_TOWN)).'</AdrLine>'.$CrLf;
|
||||
$addressline1 = dol_string_unaccent(strtr($configuration->global->MAIN_INFO_SOCIETE_ADDRESS, array(CHR(13) => ", ", CHR(10) => "")));
|
||||
$addressline2 = dol_string_unaccent(strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP.(($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' '.$configuration->global->MAIN_INFO_SOCIETE_TOWN)?' ':'').$configuration->global->MAIN_INFO_SOCIETE_TOWN, array(CHR(13) => ", ", CHR(10) => "")));
|
||||
if ($addressline1) $XML_SEPA_INFO .= ' <AdrLine>'.$addressline1.'</AdrLine>'.$CrLf;
|
||||
if ($addressline2) $XML_SEPA_INFO .= ' <AdrLine>'.$addressline2.'</AdrLine>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' </PstlAdr>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' </Cdtr>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <CdtrAcct>'.$CrLf;
|
||||
|
||||
@ -28,6 +28,7 @@ require('../../main.inc.php');
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
@ -44,6 +45,8 @@ $result = restrictedArea($user, 'prelevement', '', '', 'bons');
|
||||
|
||||
// Get supervariables
|
||||
$action = GETPOST('action','alpha');
|
||||
$mode = GETPOST('mode','alpha')?GETPOST('mode','alpha'):'real';
|
||||
$format = GETPOST('format','aZ09');
|
||||
|
||||
|
||||
/*
|
||||
@ -62,7 +65,7 @@ if ($action == 'create')
|
||||
{
|
||||
// $conf->global->PRELEVEMENT_CODE_BANQUE and $conf->global->PRELEVEMENT_CODE_GUICHET should be empty
|
||||
$bprev = new BonPrelevement($db);
|
||||
$result=$bprev->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET);
|
||||
$result=$bprev->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET, $mode, $format);
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($bprev->error, $bprev->errors, 'errors');
|
||||
@ -75,7 +78,7 @@ if ($action == 'create')
|
||||
$mesg.='<br>'."\n";
|
||||
foreach($bprev->invoice_in_error as $key => $val)
|
||||
{
|
||||
$mesg.=$val."<br>\n";
|
||||
$mesg.='<span class="warning">'.$val."</span><br>\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -145,8 +148,30 @@ print "<div class=\"tabsAction\">\n";
|
||||
|
||||
if ($nb)
|
||||
{
|
||||
if ($pricetowithdraw) print '<a class="butAction" href="create.php?action=create">'.$langs->trans("CreateAll")."</a>\n";
|
||||
else print '<a class="butActionRefused" href="#">'.$langs->trans("CreateAll")."</a>\n";
|
||||
if ($pricetowithdraw)
|
||||
{
|
||||
if ($mysoc->isInEEC())
|
||||
{
|
||||
print '<a class="butAction" href="create.php?action=create&format=FRST">'.$langs->trans("CreateForSepaFRST")."</a>\n";
|
||||
print '<a class="butAction" href="create.php?action=create&format=RCUR">'.$langs->trans("CreateForSepaRCUR")."</a>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butAction" href="create.php?action=create&format=ALL">'.$langs->trans("CreateAll")."</a>\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($mysoc->isInEEC())
|
||||
{
|
||||
print '<a class="butActionRefused" href="#">'.$langs->trans("CreateForSepaFRST")."</a>\n";
|
||||
print '<a class="butActionRefused" href="#">'.$langs->trans("CreateForSepaRCUR")."</a>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#">'.$langs->trans("CreateAll")."</a>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -192,7 +217,9 @@ if ($resql)
|
||||
|
||||
if ($num)
|
||||
{
|
||||
$var = True;
|
||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php';
|
||||
$bac = new CompanyBankAccount($db);
|
||||
|
||||
while ($i < $num && $i < 20)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
@ -206,15 +233,19 @@ if ($resql)
|
||||
// Thirdparty
|
||||
print '<td>';
|
||||
$thirdpartystatic->fetch($obj->socid);
|
||||
print $thirdpartystatic->getNomUrl(1,'card');
|
||||
print $thirdpartystatic->getNomUrl(1,'ban');
|
||||
print '</td>';
|
||||
// RIB
|
||||
print '<td>';
|
||||
print $thirdpartystatic->display_rib();
|
||||
$bac->fetch(0, $obj->socid);
|
||||
if ($bac->verif() <= 0) print img_warning('Error on default bank number for IBAN : '.$bac->error_message);
|
||||
print '</td>';
|
||||
// RUM
|
||||
print '<td>';
|
||||
print $thirdpartystatic->display_rib('rum');
|
||||
$format = $thirdpartystatic->display_rib('format');
|
||||
if ($format) print ' ('.$format.')';
|
||||
print '</td>';
|
||||
// Amount
|
||||
print '<td align="right">';
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsocialcontrib.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
|
||||
@ -33,6 +34,9 @@ if (! empty($conf->projet->enabled))
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||
}
|
||||
if (! empty($conf->accounting->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
||||
}
|
||||
|
||||
$langs->load("compta");
|
||||
$langs->load("bills");
|
||||
@ -63,50 +67,50 @@ if ($action == 'confirm_paid' && $user->rights->tax->charges->creer && $confirm
|
||||
}
|
||||
|
||||
if ($action == 'reopen' && $user->rights->tax->charges->creer) {
|
||||
$result = $object->fetch($id);
|
||||
if ($object->paye)
|
||||
{
|
||||
$result = $object->set_unpaid($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id);
|
||||
exit();
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
$result = $object->fetch($id);
|
||||
if ($object->paye)
|
||||
{
|
||||
$result = $object->set_unpaid($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id);
|
||||
exit();
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Link to a project
|
||||
if ($action == 'classin' && $user->rights->tax->charges->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->setProject(GETPOST('projectid'));
|
||||
$object->fetch($id);
|
||||
$object->setProject(GETPOST('projectid'));
|
||||
}
|
||||
|
||||
if ($action == 'setlib' && $user->rights->tax->charges->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->setValueFrom('libelle', GETPOST('lib'), '', '', 'text', '', $user, 'TAX_MODIFY');
|
||||
if ($result < 0)
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$object->fetch($id);
|
||||
$result = $object->setValueFrom('libelle', GETPOST('lib'), '', '', 'text', '', $user, 'TAX_MODIFY');
|
||||
if ($result < 0)
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
// payment mode
|
||||
if ($action == 'setmode' && $user->rights->tax->charges->creer) {
|
||||
$object->fetch($id);
|
||||
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
|
||||
if ($result < 0)
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$object->fetch($id);
|
||||
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
|
||||
if ($result < 0)
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
// bank account
|
||||
if ($action == 'setbankaccount' && $user->rights->tax->charges->creer) {
|
||||
$object->fetch($id);
|
||||
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
$object->fetch($id);
|
||||
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// Delete social contribution
|
||||
@ -131,8 +135,8 @@ if ($action == 'add' && $user->rights->tax->charges->creer)
|
||||
{
|
||||
$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'));
|
||||
$amount=price2num(GETPOST('amount'));
|
||||
$actioncode=GETPOST('actioncode');
|
||||
$amount=price2num(GETPOST('amount'));
|
||||
$actioncode=GETPOST('actioncode');
|
||||
|
||||
if (! $dateech)
|
||||
{
|
||||
@ -166,8 +170,8 @@ if ($action == 'add' && $user->rights->tax->charges->creer)
|
||||
$object->date_ech = $dateech;
|
||||
$object->periode = $dateperiod;
|
||||
$object->amount = $amount;
|
||||
$object->mode_reglement_id = GETPOST('mode_reglement_id');
|
||||
$object->fk_account = GETPOST('fk_account', 'int');
|
||||
$object->mode_reglement_id = GETPOST('mode_reglement_id');
|
||||
$object->fk_account = GETPOST('fk_account', 'int');
|
||||
$object->fk_project = GETPOST('fk_project');
|
||||
|
||||
$id=$object->create($user);
|
||||
@ -182,43 +186,43 @@ if ($action == 'add' && $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'));
|
||||
$dateperiod=dol_mktime(GETPOST('periodhour'),GETPOST('periodmin'),GETPOST('periodsec'),GETPOST('periodmonth'),GETPOST('periodday'),GETPOST('periodyear'));
|
||||
$amount=price2num(GETPOST('amount'));
|
||||
$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'));
|
||||
$amount=price2num(GETPOST('amount'));
|
||||
|
||||
if (! $dateech)
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateDue")), null, 'errors');
|
||||
$action = 'edit';
|
||||
}
|
||||
elseif (! $dateperiod)
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Period")), null, 'errors');
|
||||
$action = 'edit';
|
||||
}
|
||||
elseif (empty($amount))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")), null, 'errors');
|
||||
$action = 'edit';
|
||||
}
|
||||
if (! $dateech)
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateDue")), null, 'errors');
|
||||
$action = 'edit';
|
||||
}
|
||||
elseif (! $dateperiod)
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Period")), null, 'errors');
|
||||
$action = 'edit';
|
||||
}
|
||||
elseif (empty($amount))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")), null, 'errors');
|
||||
$action = 'edit';
|
||||
}
|
||||
elseif (! is_numeric($amount))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldMustBeANumeric",$langs->transnoentities("Amount")), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
$result=$object->fetch($id);
|
||||
$result=$object->fetch($id);
|
||||
|
||||
$object->date_ech = $dateech;
|
||||
$object->periode = $dateperiod;
|
||||
$object->amount = price2num($amount);
|
||||
$object->date_ech = $dateech;
|
||||
$object->periode = $dateperiod;
|
||||
$object->amount = price2num($amount);
|
||||
|
||||
$result=$object->update($user);
|
||||
if ($result <= 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
$result=$object->update($user);
|
||||
if ($result <= 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -281,6 +285,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->tax->char
|
||||
|
||||
$form = new Form($db);
|
||||
$formsocialcontrib = new FormSocialContrib($db);
|
||||
$bankaccountstatic = new Account($db);
|
||||
if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
|
||||
|
||||
$title = $langs->trans("SocialContribution") . ' - ' . $langs->trans("Card");
|
||||
@ -293,51 +298,49 @@ if ($action == 'create')
|
||||
{
|
||||
print load_fiche_titre($langs->trans("NewSocialContribution"));
|
||||
|
||||
$var=false;
|
||||
print '<form name="charge" method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
print '<form name="charge" method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
dol_fiche_head();
|
||||
dol_fiche_head();
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Label
|
||||
print "<tr>";
|
||||
print '<td class="titlefieldcreate fieldrequired">';
|
||||
print $langs->trans("Label");
|
||||
print '</td>';
|
||||
print '<td><input type="text" size="34" name="label" class="flat" value="'.GETPOST('label').'"></td>';
|
||||
print '</tr>';
|
||||
print '<tr>';
|
||||
// Label
|
||||
print "<tr>";
|
||||
print '<td class="titlefieldcreate fieldrequired">';
|
||||
print $langs->trans("Label");
|
||||
print '</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>';
|
||||
|
||||
// Type
|
||||
print '<td class="fieldrequired">';
|
||||
print $langs->trans("Type");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$formsocialcontrib->select_type_socialcontrib(GETPOST("actioncode")?GETPOST("actioncode"):'','actioncode',1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
// Type
|
||||
print '<td class="fieldrequired">';
|
||||
print $langs->trans("Type");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$formsocialcontrib->select_type_socialcontrib(GETPOST("actioncode",'alpha')?GETPOST("actioncode",'alpha'):'','actioncode',1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Date end period
|
||||
print '<tr>';
|
||||
print '<td class="fieldrequired">';
|
||||
print $langs->trans("PeriodEndDate");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print $form->select_date(! empty($dateperiod)?$dateperiod:'-1', 'period', 0, 0, 0, 'charge', 1);
|
||||
print '<tr>';
|
||||
print '<td class="fieldrequired">';
|
||||
print $langs->trans("PeriodEndDate");
|
||||
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
|
||||
print '<tr>';
|
||||
print '<td class="fieldrequired">';
|
||||
print $langs->trans("Amount");
|
||||
print '</td>';
|
||||
print '<td><input type="text" size="6" name="amount" class="flat" value="'.GETPOST('amount').'"></td>';
|
||||
print '</tr>';
|
||||
// Amount
|
||||
print '<tr>';
|
||||
print '<td class="fieldrequired">';
|
||||
print $langs->trans("Amount");
|
||||
print '</td>';
|
||||
print '<td><input type="text" size="6" name="amount" class="flat" value="'.dol_escape_htmltag(GETPOST('amount','alpha')).'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
@ -354,30 +357,30 @@ if ($action == 'create')
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Payment Mode
|
||||
print '<tr><td>' . $langs->trans('PaymentMode') . '</td><td colspan="2">';
|
||||
$form->select_types_paiements($mode_reglement_id, 'mode_reglement_id');
|
||||
print '</td></tr>';
|
||||
// Payment Mode
|
||||
print '<tr><td>' . $langs->trans('PaymentMode') . '</td><td colspan="2">';
|
||||
$form->select_types_paiements($mode_reglement_id, 'mode_reglement_id');
|
||||
print '</td></tr>';
|
||||
|
||||
// Bank Account
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
print '<tr><td>' . $langs->trans('BankAccount') . '</td><td colspan="2">';
|
||||
$form->select_comptes($fk_account, 'fk_account', 0, '', 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
// Bank Account
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
print '<tr><td>' . $langs->trans('BankAccount') . '</td><td colspan="2">';
|
||||
$form->select_comptes($fk_account, 'fk_account', 0, '', 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Date due
|
||||
print '<tr>';
|
||||
print '<td class="fieldrequired">';
|
||||
print $langs->trans("DateDue");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print $form->select_date(! empty($dateech)?$dateech:'-1', 'ech', 0, 0, 0, 'charge', 1);
|
||||
// Date due
|
||||
print '<tr>';
|
||||
print '<td class="fieldrequired">';
|
||||
print $langs->trans("DateDue");
|
||||
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();
|
||||
|
||||
@ -387,7 +390,7 @@ if ($action == 'create')
|
||||
print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
/* *************************************************************************** */
|
||||
@ -398,7 +401,7 @@ if ($action == 'create')
|
||||
if ($id > 0)
|
||||
{
|
||||
$object = new ChargeSociales($db);
|
||||
$result=$object->fetch($id);
|
||||
$result=$object->fetch($id);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
@ -414,7 +417,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
|
||||
@ -445,34 +448,34 @@ if ($id > 0)
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->tax->charges->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects(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.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->tax->charges->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects(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.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
@ -492,7 +495,7 @@ if ($id > 0)
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Type")."</td><td>".$object->type_libelle."</td>";
|
||||
print "</tr>";
|
||||
|
||||
// Period end date
|
||||
// Period end date
|
||||
print "<tr><td>".$langs->trans("PeriodEndDate")."</td>";
|
||||
print "<td>";
|
||||
if ($action == 'edit')
|
||||
@ -517,51 +520,51 @@ if ($id > 0)
|
||||
}
|
||||
|
||||
// Amount
|
||||
if ($action == 'edit')
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("AmountTTC")."</td><td>";
|
||||
print '<input type="text" name="amount" size="12" class="flat" value="'.$object->amount.'">';
|
||||
print "</td></tr>";
|
||||
}
|
||||
else {
|
||||
print '<tr><td>'.$langs->trans("AmountTTC").'</td><td>'.price($object->amount,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
|
||||
}
|
||||
if ($action == 'edit')
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("AmountTTC")."</td><td>";
|
||||
print '<input type="text" name="amount" size="12" class="flat" value="'.$object->amount.'">';
|
||||
print "</td></tr>";
|
||||
}
|
||||
else {
|
||||
print '<tr><td>'.$langs->trans("AmountTTC").'</td><td>'.price($object->amount,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
|
||||
}
|
||||
|
||||
// Mode of payment
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('PaymentMode');
|
||||
print '</td>';
|
||||
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 '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editmode') {
|
||||
$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id');
|
||||
} else {
|
||||
$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'none');
|
||||
}
|
||||
print '</td></tr>';
|
||||
// Mode of payment
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('PaymentMode');
|
||||
print '</td>';
|
||||
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 '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editmode') {
|
||||
$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id');
|
||||
} else {
|
||||
$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'none');
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Bank Account
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('BankAccount');
|
||||
print '<td>';
|
||||
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 '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editbankaccount') {
|
||||
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
|
||||
} else {
|
||||
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
// Bank Account
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('BankAccount');
|
||||
print '<td>';
|
||||
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 '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editbankaccount') {
|
||||
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
|
||||
} else {
|
||||
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -569,12 +572,20 @@ if ($id > 0)
|
||||
print '<div class="fichehalfright">';
|
||||
print '<div class="ficheaddleft">';
|
||||
|
||||
$nbcols = 3;
|
||||
if (! empty($conf->banque->enabled)) {
|
||||
$nbcols ++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Payments
|
||||
*/
|
||||
$sql = "SELECT p.rowid, p.num_paiement, datep as dp, p.amount,";
|
||||
$sql.= "c.code as type_code,c.libelle as paiement_type";
|
||||
$sql.= " c.code as type_code,c.libelle as paiement_type,";
|
||||
$sql.= ' ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.fk_accountancy_journal';
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p";
|
||||
$sql.= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank as b ON p.fk_bank = b.rowid';
|
||||
$sql.= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank_account as ba ON b.fk_account = ba.rowid';
|
||||
$sql.= ", ".MAIN_DB_PREFIX."c_paiement as c ";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
|
||||
$sql.= " WHERE p.fk_charge = ".$id;
|
||||
@ -588,59 +599,79 @@ if ($id > 0)
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$totalpaye = 0;
|
||||
$totalpaye = 0;
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0; $total = 0;
|
||||
print '<table class="noborder paymenttable">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("RefPayment").'</td>';
|
||||
print '<td>'.$langs->trans("Date").'</td>';
|
||||
print '<td>'.$langs->trans("Type").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Amount").'</td>';
|
||||
print '</tr>';
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0; $total = 0;
|
||||
print '<table class="noborder paymenttable">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("RefPayment").'</td>';
|
||||
print '<td>'.$langs->trans("Date").'</td>';
|
||||
print '<td>'.$langs->trans("Type").'</td>';
|
||||
if (! empty($conf->banque->enabled)) {
|
||||
print '<td class="liste_titre" align="right">' . $langs->trans('BankAccount') . '</td>';
|
||||
}
|
||||
print '<td align="right">'.$langs->trans("Amount").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$var=true;
|
||||
if ($num > 0)
|
||||
{
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
if ($num > 0)
|
||||
{
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
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 '<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;
|
||||
print "<td>".$labeltype.' '.$objp->num_paiement."</td>\n";
|
||||
print '<td align="right">'.price($objp->amount)."</td>\n";
|
||||
print "</tr>";
|
||||
$totalpaye += $objp->amount;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr class="oddeven"><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";
|
||||
$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";
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
$bankaccountstatic->id = $objp->baid;
|
||||
$bankaccountstatic->ref = $objp->baref;
|
||||
$bankaccountstatic->label = $objp->baref;
|
||||
$bankaccountstatic->number = $objp->banumber;
|
||||
|
||||
print '<tr class="oddeven"><td colspan="'.$nbcols.'" class="opacitymedium">'.$langs->trans("None").'</td><td></td><td></td><td></td></tr>';
|
||||
}
|
||||
if (! empty($conf->accounting->enabled)) {
|
||||
$bankaccountstatic->account_number = $objp->account_number;
|
||||
|
||||
//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("AmountExpected")." :</td><td align=\"right\">".price($object->amount)."</td></tr>\n";
|
||||
$accountingjournal = new AccountingJournal($db);
|
||||
$accountingjournal->fetch($objp->fk_accountancy_journal);
|
||||
$bankaccountstatic->accountancy_journal = $accountingjournal->getNomUrl(0,1,1,'',1);
|
||||
}
|
||||
|
||||
$resteapayer = $object->amount - $totalpaye;
|
||||
$cssforamountpaymentcomplete = 'amountpaymentcomplete';
|
||||
print '<td align="right">';
|
||||
if ($bankaccountstatic->id)
|
||||
print $bankaccountstatic->getNomUrl(1, 'transactions');
|
||||
print '</td>';
|
||||
}
|
||||
print '<td align="right">'.price($objp->amount)."</td>\n";
|
||||
print "</tr>";
|
||||
$totalpaye += $objp->amount;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
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 "</table>";
|
||||
$db->free($resql);
|
||||
print '<tr class="oddeven"><td colspan="'.$nbcols.'" class="opacitymedium">'.$langs->trans("None").'</td><td></td><td></td><td></td></tr>';
|
||||
}
|
||||
|
||||
print '<tr><td colspan="'.$nbcols.'" align="right">'.$langs->trans("AlreadyPaid")." :</td><td align=\"right\">".price($totalpaye)."</td></tr>\n";
|
||||
print '<tr><td colspan="'.$nbcols.'" align="right">'.$langs->trans("AmountExpected")." :</td><td align=\"right\">".price($object->amount)."</td></tr>\n";
|
||||
|
||||
$resteapayer = $object->amount - $totalpaye;
|
||||
$cssforamountpaymentcomplete = 'amountpaymentcomplete';
|
||||
|
||||
print '<tr><td colspan="'.$nbcols.'" align="right">'.$langs->trans("RemainderToPay")." :</td>";
|
||||
print '<td align="right"'.($resteapayer?' class="amountremaintopay"':(' class="'.$cssforamountpaymentcomplete.'"')).'>'.price($resteapayer)."</td></tr>\n";
|
||||
|
||||
print "</table>";
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
@ -33,6 +33,7 @@ class PaymentSocialContribution extends CommonObject
|
||||
{
|
||||
public $element='paiementcharge'; //!< Id that identify managed objects
|
||||
public $table_element='paiementcharge'; //!< Name of table without prefix where object is stored
|
||||
public $picto = 'payment';
|
||||
|
||||
var $fk_charge;
|
||||
var $datec='';
|
||||
@ -613,6 +614,68 @@ class PaymentSocialContribution extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @return string Libelle
|
||||
*/
|
||||
function getLibStatut($mode=0)
|
||||
{
|
||||
return $this->LibStatut($this->statut,$mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renvoi le libelle d'un statut donne
|
||||
*
|
||||
* @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
|
||||
* @return string Libelle du statut
|
||||
*/
|
||||
function LibStatut($status,$mode=0)
|
||||
{
|
||||
global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage
|
||||
|
||||
$langs->load('compta');
|
||||
/*if ($mode == 0)
|
||||
{
|
||||
if ($status == 0) return $langs->trans('ToValidate');
|
||||
if ($status == 1) return $langs->trans('Validated');
|
||||
}
|
||||
if ($mode == 1)
|
||||
{
|
||||
if ($status == 0) return $langs->trans('ToValidate');
|
||||
if ($status == 1) return $langs->trans('Validated');
|
||||
}
|
||||
if ($mode == 2)
|
||||
{
|
||||
if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate');
|
||||
if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated');
|
||||
}
|
||||
if ($mode == 3)
|
||||
{
|
||||
if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1');
|
||||
if ($status == 1) return img_picto($langs->trans('Validated'),'statut4');
|
||||
}
|
||||
if ($mode == 4)
|
||||
{
|
||||
if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate');
|
||||
if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated');
|
||||
}
|
||||
if ($mode == 5)
|
||||
{
|
||||
if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1');
|
||||
if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4');
|
||||
}
|
||||
if ($mode == 6)
|
||||
{
|
||||
if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1');
|
||||
if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4');
|
||||
}*/
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Return clicable name (with picto eventually)
|
||||
*
|
||||
|
||||
@ -821,7 +821,7 @@ while ($i < min($num,$limit))
|
||||
if (! empty($arrayfields['p.datec']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($obj->date_creation), 'dayhour');
|
||||
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
@ -829,7 +829,7 @@ while ($i < min($num,$limit))
|
||||
if (! empty($arrayfields['p.tms']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($obj->date_update), 'dayhour');
|
||||
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -327,7 +327,7 @@ if (empty($reshook))
|
||||
$label = $lines[$i]->product_label;
|
||||
}
|
||||
|
||||
$desc .= ($lines[$i]->desc && $lines[$i]->desc!=$lines[$i]->libelle)?dol_htmlentitiesbr($lines[$i]->desc):'';
|
||||
$desc = ($lines[$i]->desc && $lines[$i]->desc!=$lines[$i]->libelle)?dol_htmlentitiesbr($lines[$i]->desc):'';
|
||||
}
|
||||
else {
|
||||
$desc = dol_htmlentitiesbr($lines[$i]->desc);
|
||||
@ -440,6 +440,14 @@ if (empty($reshook))
|
||||
$error++;
|
||||
}
|
||||
|
||||
$date_start = dol_mktime(GETPOST('date_start' . $predef . 'hour'), GETPOST('date_start' . $predef . 'min'), GETPOST('date_start' . $predef . 'sec'), GETPOST('date_start' . $predef . 'month'), GETPOST('date_start' . $predef . 'day'), GETPOST('date_start' . $predef . 'year'));
|
||||
$date_end = dol_mktime(GETPOST('date_end' . $predef . 'hour'), GETPOST('date_end' . $predef . 'min'), GETPOST('date_end' . $predef . 'sec'), GETPOST('date_end' . $predef . 'month'), GETPOST('date_end' . $predef . 'day'), GETPOST('date_end' . $predef . 'year'));
|
||||
if (!empty($date_start) && !empty($date_end) && $date_start > $date_end)
|
||||
{
|
||||
setEventMessages($langs->trans("Error").': '.$langs->trans("DateStartPlanned").' > '.$langs->trans("DateEndPlanned"), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
// Extrafields
|
||||
$extrafieldsline = new ExtraFields($db);
|
||||
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
||||
@ -638,90 +646,100 @@ if (empty($reshook))
|
||||
|
||||
else if ($action == 'updateline' && $user->rights->contrat->creer && ! GETPOST('cancel','alpha'))
|
||||
{
|
||||
$objectline = new ContratLigne($db);
|
||||
if ($objectline->fetch(GETPOST('elrowid')))
|
||||
{
|
||||
$db->begin();
|
||||
if (!empty($date_start_update) && !empty($date_end_update) && $date_start_update > $date_end_update)
|
||||
{
|
||||
setEventMessages($langs->trans("Error").': '.$langs->trans("DateStartPlanned").' > '.$langs->trans("DateEndPlanned"), null, 'errors');
|
||||
$action = 'editline';
|
||||
$_GET['rowid'] = GETPOST('elrowid');
|
||||
$error++;
|
||||
}
|
||||
|
||||
if ($date_start_real_update == '') $date_start_real_update=$objectline->date_ouverture;
|
||||
if ($date_end_real_update == '') $date_end_real_update=$objectline->date_cloture;
|
||||
if (!$error) {
|
||||
$objectline = new ContratLigne($db);
|
||||
if ($objectline->fetch(GETPOST('elrowid')))
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$vat_rate = GETPOST('eltva_tx');
|
||||
// Define info_bits
|
||||
$info_bits = 0;
|
||||
if (preg_match('/\*/', $vat_rate))
|
||||
$info_bits |= 0x01;
|
||||
if ($date_start_real_update == '') $date_start_real_update=$objectline->date_ouverture;
|
||||
if ($date_end_real_update == '') $date_end_real_update=$objectline->date_cloture;
|
||||
|
||||
// Define vat_rate
|
||||
$vat_rate = str_replace('*', '', $vat_rate);
|
||||
$localtax1_tx=get_localtax($vat_rate, 1, $object->thirdparty, $mysoc);
|
||||
$localtax2_tx=get_localtax($vat_rate, 2, $object->thirdparty, $mysoc);
|
||||
$vat_rate = GETPOST('eltva_tx');
|
||||
// Define info_bits
|
||||
$info_bits = 0;
|
||||
if (preg_match('/\*/', $vat_rate))
|
||||
$info_bits |= 0x01;
|
||||
|
||||
$txtva = $vat_rate;
|
||||
// Define vat_rate
|
||||
$vat_rate = str_replace('*', '', $vat_rate);
|
||||
$localtax1_tx=get_localtax($vat_rate, 1, $object->thirdparty, $mysoc);
|
||||
$localtax2_tx=get_localtax($vat_rate, 2, $object->thirdparty, $mysoc);
|
||||
|
||||
// Clean vat code
|
||||
$vat_src_code='';
|
||||
if (preg_match('/\((.*)\)/', $txtva, $reg))
|
||||
{
|
||||
$vat_src_code = $reg[1];
|
||||
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
||||
}
|
||||
$txtva = $vat_rate;
|
||||
|
||||
// ajout prix d'achat
|
||||
$fk_fournprice = $_POST['fournprice'];
|
||||
if ( ! empty($_POST['buying_price']) )
|
||||
$pa_ht = $_POST['buying_price'];
|
||||
else
|
||||
$pa_ht = null;
|
||||
// Clean vat code
|
||||
$vat_src_code='';
|
||||
if (preg_match('/\((.*)\)/', $txtva, $reg))
|
||||
{
|
||||
$vat_src_code = $reg[1];
|
||||
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
||||
}
|
||||
|
||||
$fk_unit = GETPOST('unit', 'alpha');
|
||||
// ajout prix d'achat
|
||||
$fk_fournprice = $_POST['fournprice'];
|
||||
if ( ! empty($_POST['buying_price']) )
|
||||
$pa_ht = $_POST['buying_price'];
|
||||
else
|
||||
$pa_ht = null;
|
||||
|
||||
$objectline->description=GETPOST('product_desc','none');
|
||||
$objectline->price_ht=GETPOST('elprice');
|
||||
$objectline->subprice=GETPOST('elprice');
|
||||
$objectline->qty=GETPOST('elqty');
|
||||
$objectline->remise_percent=GETPOST('elremise_percent');
|
||||
$objectline->tva_tx=($txtva?$txtva:0); // Field may be disabled, so we use vat rate 0
|
||||
$objectline->vat_src_code=$vat_src_code;
|
||||
$objectline->localtax1_tx=is_numeric($localtax1_tx)?$localtax1_tx:0;
|
||||
$objectline->localtax2_tx=is_numeric($localtax2_tx)?$localtax2_tx:0;
|
||||
$objectline->date_ouverture_prevue=$date_start_update;
|
||||
$objectline->date_ouverture=$date_start_real_update;
|
||||
$objectline->date_fin_validite=$date_end_update;
|
||||
$objectline->date_cloture=$date_end_real_update;
|
||||
$objectline->fk_user_cloture=$user->id;
|
||||
$objectline->fk_fournprice=$fk_fournprice;
|
||||
$objectline->pa_ht=$pa_ht;
|
||||
$fk_unit = GETPOST('unit', 'alpha');
|
||||
|
||||
if ($fk_unit > 0) {
|
||||
$objectline->fk_unit = GETPOST('unit');
|
||||
} else {
|
||||
$objectline->fk_unit = null;
|
||||
}
|
||||
$objectline->description=GETPOST('product_desc','none');
|
||||
$objectline->price_ht=GETPOST('elprice');
|
||||
$objectline->subprice=GETPOST('elprice');
|
||||
$objectline->qty=GETPOST('elqty');
|
||||
$objectline->remise_percent=GETPOST('elremise_percent');
|
||||
$objectline->tva_tx=($txtva?$txtva:0); // Field may be disabled, so we use vat rate 0
|
||||
$objectline->vat_src_code=$vat_src_code;
|
||||
$objectline->localtax1_tx=is_numeric($localtax1_tx)?$localtax1_tx:0;
|
||||
$objectline->localtax2_tx=is_numeric($localtax2_tx)?$localtax2_tx:0;
|
||||
$objectline->date_ouverture_prevue=$date_start_update;
|
||||
$objectline->date_ouverture=$date_start_real_update;
|
||||
$objectline->date_fin_validite=$date_end_update;
|
||||
$objectline->date_cloture=$date_end_real_update;
|
||||
$objectline->fk_user_cloture=$user->id;
|
||||
$objectline->fk_fournprice=$fk_fournprice;
|
||||
$objectline->pa_ht=$pa_ht;
|
||||
|
||||
// Extrafields
|
||||
$extrafieldsline = new ExtraFields($db);
|
||||
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($objectline->table_element);
|
||||
$array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef);
|
||||
$objectline->array_options=$array_options;
|
||||
if ($fk_unit > 0) {
|
||||
$objectline->fk_unit = GETPOST('unit');
|
||||
} else {
|
||||
$objectline->fk_unit = null;
|
||||
}
|
||||
|
||||
// TODO verifier price_min si fk_product et multiprix
|
||||
// Extrafields
|
||||
$extrafieldsline = new ExtraFields($db);
|
||||
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($objectline->table_element);
|
||||
$array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef);
|
||||
$objectline->array_options=$array_options;
|
||||
|
||||
$result=$objectline->update($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($objectline->error, $objectline->errors, 'errors');
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($objectline->error, $objectline->errors, 'errors');
|
||||
}
|
||||
// TODO verifier price_min si fk_product et multiprix
|
||||
|
||||
$result=$objectline->update($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($objectline->error, $objectline->errors, 'errors');
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($objectline->error, $objectline->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->contrat->creer)
|
||||
|
||||
@ -62,6 +62,9 @@ $socid=GETPOST('socid');
|
||||
$search_user=GETPOST('search_user','int');
|
||||
$search_sale=GETPOST('search_sale','int');
|
||||
$search_product_category=GETPOST('search_product_category','int');
|
||||
$search_dfmonth=GETPOST('search_dfmonth','int');
|
||||
$search_dfyear=GETPOST('search_dfyear','int');
|
||||
$search_op2df=GETPOST('search_op2df');
|
||||
$day=GETPOST("day","int");
|
||||
$year=GETPOST("year","int");
|
||||
$month=GETPOST("month","int");
|
||||
@ -126,6 +129,7 @@ $arrayfields=array(
|
||||
'c.date_contrat'=>array('label'=>$langs->trans("DateContract"), 'checked'=>1),
|
||||
'c.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||
'c.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
||||
'lower_planned_end_date'=>array('label'=>$langs->trans("LowerDateEndPlannedShort"), 'checked'=>1, 'position'=>900),
|
||||
'status'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
||||
);
|
||||
// Extra fields
|
||||
@ -157,6 +161,9 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
||||
$day='';
|
||||
$month='';
|
||||
$year='';
|
||||
$search_dfmonth='';
|
||||
$search_dfyear='';
|
||||
$search_op2df='';
|
||||
$search_name="";
|
||||
$search_email="";
|
||||
$search_town='';
|
||||
@ -205,6 +212,7 @@ $sql.= " c.rowid, c.ref, c.datec as date_creation, c.tms as date_update, c.date_
|
||||
$sql.= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client,';
|
||||
$sql.= " typent.code as typent_code,";
|
||||
$sql.= " state.code_departement as state_code, state.nom as state_name,";
|
||||
$sql.= " MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") as lower_planned_end_date,";
|
||||
$sql.= ' SUM('.$db->ifsql("cd.statut=0",1,0).') as nb_initial,';
|
||||
$sql.= ' SUM('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NULL OR cd.date_fin_validite >= '".$db->idate($now)."')",1,0).') as nb_running,';
|
||||
$sql.= ' SUM('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < '".$db->idate($now)."')",1,0).') as nb_expired,';
|
||||
@ -278,10 +286,16 @@ $parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
|
||||
if ($search_dfyear > 0)
|
||||
{
|
||||
// $sql.= " AND MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") ".$search_op2df."= '".$db->idate(($search_op2df == "<" ? dol_get_last_day($search_dfyear,$search_dfmonth,false) : dol_get_first_day($search_dfyear,$search_dfmonth,false)))."'";
|
||||
}
|
||||
|
||||
$sql.= " GROUP BY c.rowid, c.ref, c.datec, c.tms, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, c.note_private, c.note_public,";
|
||||
$sql.= ' s.rowid, s.nom, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client,';
|
||||
$sql.= " typent.code,";
|
||||
$sql.= " state.code_departement, state.nom";
|
||||
//$sql.= " MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").")";
|
||||
// Add fields from extrafields
|
||||
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key : '');
|
||||
// Add where from hooks
|
||||
@ -289,6 +303,11 @@ $parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
|
||||
if ($search_dfyear > 0)
|
||||
{
|
||||
$sql.= " HAVING MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") ".$search_op2df."= '".$db->idate(($search_op2df == "<" ? dol_get_last_day($search_dfyear,$search_dfmonth,false) : dol_get_first_day($search_dfyear,$search_dfmonth,false)))."'";
|
||||
}
|
||||
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
|
||||
$totalnboflines=0;
|
||||
@ -331,7 +350,12 @@ if ($resql)
|
||||
if ($search_email != '') $param.='&search_email='.urlencode($search_email);
|
||||
if ($search_ref_customer != '') $param.='&search_ref_customer='.urlencode($search_ref_customer);
|
||||
if ($search_ref_supplier != '') $param.='&search_ref_supplier='.urlencode($search_ref_supplier);
|
||||
if ($search_op2df != '') $param.='&search_op2df='.urlencode($search_op2df);
|
||||
if ($search_dfyear != '') $param.='&search_dfyear='.urlencode($search_dfyear);
|
||||
if ($search_dfmonth != '') $param.='&search_dfmonth='.urlencode($search_dfmonth);
|
||||
if ($search_sale != '') $param.='&search_sale=' .urlencode($search_sale);
|
||||
if ($search_user != '') $param.='&search_user=' .urlencode($search_user);
|
||||
if ($search_product_category != '') $param.='&search_product_category=' .urlencode($search_product_category);
|
||||
if ($show_files) $param.='&show_files=' .urlencode($show_files);
|
||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||
// Add $param from extra fields
|
||||
@ -538,6 +562,18 @@ if ($resql)
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
// First end date
|
||||
if (! empty($arrayfields['lower_planned_end_date']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="center">';
|
||||
$arrayofoperators=array('<'=>'<','>'=>'>');
|
||||
print $form->selectarray('search_op2df',$arrayofoperators,$search_op2df,0);
|
||||
print '</br>';
|
||||
print $formother->select_month($search_dfmonth, 'search_dfmonth', 1);
|
||||
print ' ';
|
||||
$formother->select_year($search_dfyear, 'search_dfyear', 1, 20, 5);
|
||||
print '</td>';
|
||||
}
|
||||
// Status
|
||||
if (! empty($arrayfields['status']['checked']))
|
||||
{
|
||||
@ -582,6 +618,7 @@ if ($resql)
|
||||
print $hookmanager->resPrint;
|
||||
if (! empty($arrayfields['c.datec']['checked'])) print_liste_field_titre($arrayfields['c.datec']['label'],$_SERVER["PHP_SELF"],"c.date_creation","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['c.tms']['checked'])) print_liste_field_titre($arrayfields['c.tms']['label'],$_SERVER["PHP_SELF"],"c.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['lower_planned_end_date']['checked'])) print_liste_field_titre($arrayfields['lower_planned_end_date']['label'],$_SERVER["PHP_SELF"],"lower_planned_end_date","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['status']['checked']))
|
||||
{
|
||||
print_liste_field_titre($staticcontratligne->LibStatut(0,3), '', '', '', '', 'width="16"');
|
||||
@ -758,7 +795,7 @@ if ($resql)
|
||||
if (! empty($arrayfields['c.datec']['checked']))
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
print dol_print_date($db->jdate($obj->date_creation), 'dayhour');
|
||||
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
@ -766,7 +803,15 @@ if ($resql)
|
||||
if (! empty($arrayfields['c.tms']['checked']))
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
print dol_print_date($db->jdate($obj->date_update), 'dayhour');
|
||||
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Date lower end date
|
||||
if (! empty($arrayfields['lower_planned_end_date']['checked']))
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
print dol_print_date($db->jdate($obj->lower_planned_end_date), 'day');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -720,7 +720,7 @@ while ($i < min($num,$limit))
|
||||
if (! empty($arrayfields['cd.datec']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($obj->date_creation), 'dayhour');
|
||||
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
@ -728,7 +728,7 @@ while ($i < min($num,$limit))
|
||||
if (! empty($arrayfields['cd.tms']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($obj->date_update), 'dayhour');
|
||||
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -306,6 +306,15 @@ if (! $error && $massaction == 'confirm_presend')
|
||||
$tmp=explode(',', $conf->global->MAIN_INFO_SOCIETE_MAIL_ALIASES);
|
||||
$from = trim($tmp[($reg[1] - 1)]);
|
||||
}
|
||||
elseif (preg_match('/senderprofile_(\d+)_(\d+)/', $fromtype, $reg)) {
|
||||
$sql='SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile WHERE rowid = '.(int) $reg[1];
|
||||
$resql = $db->query($sql);
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
$from = $obj->label.' <'.$obj->email.'>';
|
||||
}
|
||||
}
|
||||
else {
|
||||
$from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>';
|
||||
}
|
||||
@ -654,6 +663,12 @@ if ($action == 'remove_file')
|
||||
// Validate records
|
||||
if (! $error && $massaction == 'validate' && $permtocreate)
|
||||
{
|
||||
if ($object->element == 'invoice' && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_BILL))
|
||||
{
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans('ErrorMassValidationNotAllowedWhenStockIncreaseOnAction'), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if ($object->element == 'invoice_supplier' && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL))
|
||||
{
|
||||
$langs->load("errors");
|
||||
|
||||
@ -113,14 +113,14 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
$result=$object->fetch($id);
|
||||
|
||||
$sendtosocid=0; // Thirdparty on object
|
||||
if (method_exists($object,"fetch_thirdparty") && ! in_array($object->element, array('societe','member')))
|
||||
if (method_exists($object,"fetch_thirdparty") && ! in_array($object->element, array('societe','member','user')))
|
||||
{
|
||||
$result=$object->fetch_thirdparty();
|
||||
if ($object->element == 'user' && $result == 0) $result=1; // Even if not found, we consider ok
|
||||
$thirdparty=$object->thirdparty;
|
||||
$sendtosocid=$thirdparty->id;
|
||||
}
|
||||
else if ($object->element == 'member')
|
||||
else if ($object->element == 'member' || $object->element == 'user')
|
||||
{
|
||||
$thirdparty=$object;
|
||||
if ($thirdparty->id > 0) $sendtosocid=$thirdparty->id;
|
||||
@ -258,6 +258,15 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
$tmp=explode(',', $conf->global->MAIN_INFO_SOCIETE_MAIL_ALIASES);
|
||||
$from = trim($tmp[($reg[1] - 1)]);
|
||||
}
|
||||
elseif (preg_match('/senderprofile_(\d+)_(\d+)/', $fromtype, $reg)) {
|
||||
$sql='SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile WHERE rowid = '.(int) $reg[1];
|
||||
$resql = $db->query($sql);
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
$from = $obj->label.' <'.$obj->email.'>';
|
||||
}
|
||||
}
|
||||
else {
|
||||
$from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>';
|
||||
}
|
||||
|
||||
@ -56,85 +56,85 @@ $arrayresult=array();
|
||||
// Define $searchform
|
||||
if ((( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)) && empty($conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED) && $user->rights->societe->lire)
|
||||
{
|
||||
$arrayresult['searchintothirdparty']=array('img'=>'object_company', 'label'=>$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'text'=>img_picto('','object_company').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/societe/list.php?sall='.urlencode($search_boxvalue));
|
||||
$arrayresult['searchintothirdparty']=array('position'=>10, 'img'=>'object_company', 'label'=>$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'text'=>img_picto('','object_company').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/societe/list.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
|
||||
if (! empty($conf->societe->enabled) && empty($conf->global->MAIN_SEARCHFORM_CONTACT_DISABLED) && $user->rights->societe->lire)
|
||||
{
|
||||
$arrayresult['searchintocontact']=array('img'=>'object_contact', 'label'=>$langs->trans("SearchIntoContacts", $search_boxvalue), 'text'=>img_picto('','object_contact').' '.$langs->trans("SearchIntoContacts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contact/list.php?sall='.urlencode($search_boxvalue));
|
||||
$arrayresult['searchintocontact']=array('position'=>15, 'img'=>'object_contact', 'label'=>$langs->trans("SearchIntoContacts", $search_boxvalue), 'text'=>img_picto('','object_contact').' '.$langs->trans("SearchIntoContacts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contact/list.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
|
||||
if (! empty($conf->adherent->enabled) && empty($conf->global->MAIN_SEARCHFORM_ADHERENT_DISABLED) && $user->rights->adherent->lire)
|
||||
{
|
||||
$arrayresult['searchintomember']=array('position'=>20, 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoMembers", $search_boxvalue), 'text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
|
||||
if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire))
|
||||
&& empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_DISABLED))
|
||||
{
|
||||
$arrayresult['searchintoproduct']=array('img'=>'object_product', 'label'=>$langs->trans("SearchIntoProductsOrServices", $search_boxvalue),'text'=>img_picto('','object_product').' '.$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/list.php?sall='.urlencode($search_boxvalue));
|
||||
$arrayresult['searchintoproduct']=array('position'=>30, 'img'=>'object_product', 'label'=>$langs->trans("SearchIntoProductsOrServices", $search_boxvalue),'text'=>img_picto('','object_product').' '.$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/list.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
|
||||
if (! empty($conf->projet->enabled) && empty($conf->global->MAIN_SEARCHFORM_PROJECT_DISABLED) && $user->rights->projet->lire)
|
||||
{
|
||||
$arrayresult['searchintoprojects']=array('img'=>'object_projectpub', 'label'=>$langs->trans("SearchIntoProjects", $search_boxvalue), 'text'=>img_picto('','object_projectpub').' '.$langs->trans("SearchIntoProjects", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/list.php?search_all='.urlencode($search_boxvalue));
|
||||
$arrayresult['searchintoprojects']=array('position'=>40, 'img'=>'object_projectpub', 'label'=>$langs->trans("SearchIntoProjects", $search_boxvalue), 'text'=>img_picto('','object_projectpub').' '.$langs->trans("SearchIntoProjects", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/list.php?search_all='.urlencode($search_boxvalue));
|
||||
}
|
||||
if (! empty($conf->projet->enabled) && empty($conf->global->MAIN_SEARCHFORM_TASK_DISABLED) && $user->rights->projet->lire)
|
||||
{
|
||||
$arrayresult['searchintotasks']=array('img'=>'object_task', 'label'=>$langs->trans("SearchIntoTasks", $search_boxvalue), 'text'=>img_picto('','object_task').' '.$langs->trans("SearchIntoTasks", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/tasks/list.php?search_all='.urlencode($search_boxvalue));
|
||||
}
|
||||
|
||||
if (! empty($conf->adherent->enabled) && empty($conf->global->MAIN_SEARCHFORM_ADHERENT_DISABLED) && $user->rights->adherent->lire)
|
||||
{
|
||||
$arrayresult['searchintomember']=array('img'=>'object_user', 'label'=>$langs->trans("SearchIntoMembers", $search_boxvalue), 'text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
|
||||
if (! empty($conf->user->enabled) && empty($conf->global->MAIN_SEARCHFORM_USER_DISABLED) && $user->rights->user->user->lire)
|
||||
{
|
||||
$arrayresult['searchintouser']=array('img'=>'object_user', 'label'=>$langs->trans("SearchIntoUsers", $search_boxvalue), 'text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoUsers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/user/index.php?sall='.urlencode($search_boxvalue));
|
||||
$arrayresult['searchintotasks']=array('position'=>45, 'img'=>'object_task', 'label'=>$langs->trans("SearchIntoTasks", $search_boxvalue), 'text'=>img_picto('','object_task').' '.$langs->trans("SearchIntoTasks", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/tasks/list.php?search_all='.urlencode($search_boxvalue));
|
||||
}
|
||||
|
||||
if (! empty($conf->propal->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_PROPAL_DISABLED) && $user->rights->propal->lire)
|
||||
{
|
||||
$arrayresult['searchintopropal']=array('img'=>'object_propal', 'label'=>$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'text'=>img_picto('','object_propal').' '.$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/comm/propal/list.php?sall='.urlencode($search_boxvalue));
|
||||
$arrayresult['searchintopropal']=array('position'=>60, 'img'=>'object_propal', 'label'=>$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'text'=>img_picto('','object_propal').' '.$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/comm/propal/list.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
if (! empty($conf->commande->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_ORDER_DISABLED) && $user->rights->commande->lire)
|
||||
{
|
||||
$arrayresult['searchintoorder']=array('img'=>'object_order', 'label'=>$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'text'=>img_picto('','object_order').' '.$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/commande/list.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
if (! empty($conf->facture->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_INVOICE_DISABLED) && $user->rights->facture->lire)
|
||||
{
|
||||
$arrayresult['searchintoinvoice']=array('img'=>'object_bill', 'label'=>$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'text'=>img_picto('','object_bill').' '.$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/compta/facture/list.php?sall='.urlencode($search_boxvalue));
|
||||
$arrayresult['searchintoorder']=array('position'=>70, 'img'=>'object_order', 'label'=>$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'text'=>img_picto('','object_order').' '.$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/commande/list.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
if (! empty($conf->expedition->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_SHIPMENT_DISABLED) && $user->rights->expedition->lire)
|
||||
{
|
||||
$arrayresult['searchintoshipment']=array('img'=>'object_sending', 'label'=>$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'text'=>img_picto('','object_sending').' '.$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expedition/list.php?sall='.urlencode($search_boxvalue));
|
||||
$arrayresult['searchintoshipment']=array('position'=>80, 'img'=>'object_sending', 'label'=>$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'text'=>img_picto('','object_sending').' '.$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expedition/list.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
if (! empty($conf->facture->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_INVOICE_DISABLED) && $user->rights->facture->lire)
|
||||
{
|
||||
$arrayresult['searchintoinvoice']=array('position'=>90, 'img'=>'object_bill', 'label'=>$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'text'=>img_picto('','object_bill').' '.$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/compta/facture/list.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
|
||||
if (! empty($conf->supplier_proposal->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_PROPAL_DISABLED) && $user->rights->supplier_proposal->lire)
|
||||
{
|
||||
$arrayresult['searchintosupplierpropal']=array('img'=>'object_propal', 'label'=>$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'text'=>img_picto('','object_propal').' '.$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/supplier_proposal/list.php?sall='.urlencode($search_boxvalue));
|
||||
$arrayresult['searchintosupplierpropal']=array('position'=>100, 'img'=>'object_propal', 'label'=>$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'text'=>img_picto('','object_propal').' '.$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/supplier_proposal/list.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
if (! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_ORDER_DISABLED) && $user->rights->fournisseur->commande->lire)
|
||||
{
|
||||
$arrayresult['searchintosupplierorder']=array('img'=>'object_order', 'label'=>$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'text'=>img_picto('','object_order').' '.$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/commande/list.php?search_all='.urlencode($search_boxvalue));
|
||||
$arrayresult['searchintosupplierorder']=array('position'=>110, 'img'=>'object_order', 'label'=>$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'text'=>img_picto('','object_order').' '.$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/commande/list.php?search_all='.urlencode($search_boxvalue));
|
||||
}
|
||||
if (! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_INVOICE_DISABLED) && $user->rights->fournisseur->facture->lire)
|
||||
{
|
||||
$arrayresult['searchintosupplierinvoice']=array('img'=>'object_bill', 'label'=>$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'text'=>img_picto('','object_bill').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/facture/list.php?sall='.urlencode($search_boxvalue));
|
||||
$arrayresult['searchintosupplierinvoice']=array('position'=>120, 'img'=>'object_bill', 'label'=>$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'text'=>img_picto('','object_bill').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/facture/list.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
|
||||
if (! empty($conf->contrat->enabled) && empty($conf->global->MAIN_SEARCHFORM_CONTRACT_DISABLED) && $user->rights->contrat->lire)
|
||||
{
|
||||
$arrayresult['searchintocontract']=array('img'=>'object_contract', 'label'=>$langs->trans("SearchIntoContracts", $search_boxvalue), 'text'=>img_picto('','object_contract').' '.$langs->trans("SearchIntoContracts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contrat/list.php?sall='.urlencode($search_boxvalue));
|
||||
$arrayresult['searchintocontract']=array('position'=>130, 'img'=>'object_contract', 'label'=>$langs->trans("SearchIntoContracts", $search_boxvalue), 'text'=>img_picto('','object_contract').' '.$langs->trans("SearchIntoContracts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contrat/list.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
if (! empty($conf->ficheinter->enabled) && empty($conf->global->MAIN_SEARCHFORM_FICHINTER_DISABLED) && $user->rights->ficheinter->lire)
|
||||
{
|
||||
$arrayresult['searchintointervention']=array('img'=>'object_intervention', 'label'=>$langs->trans("SearchIntoInterventions", $search_boxvalue), 'text'=>img_picto('','object_intervention').' '.$langs->trans("SearchIntoInterventions", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fichinter/list.php?sall='.urlencode($search_boxvalue));
|
||||
$arrayresult['searchintointervention']=array('position'=>140, 'img'=>'object_intervention', 'label'=>$langs->trans("SearchIntoInterventions", $search_boxvalue), 'text'=>img_picto('','object_intervention').' '.$langs->trans("SearchIntoInterventions", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fichinter/list.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
|
||||
// HR
|
||||
if (! empty($conf->user->enabled) && empty($conf->global->MAIN_SEARCHFORM_USER_DISABLED) && $user->rights->user->user->lire)
|
||||
{
|
||||
$arrayresult['searchintouser']=array('position'=>200, 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoUsers", $search_boxvalue), 'text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoUsers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/user/index.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
if (! empty($conf->expensereport->enabled) && empty($conf->global->MAIN_SEARCHFORM_EXPENSEREPORT_DISABLED) && $user->rights->expensereport->lire)
|
||||
{
|
||||
$arrayresult['searchintoexpensereport']=array('img'=>'object_trip', 'label'=>$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'text'=>img_picto('','object_trip').' '.$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&sall='.urlencode($search_boxvalue));
|
||||
$arrayresult['searchintoexpensereport']=array('position'=>210, 'img'=>'object_trip', 'label'=>$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'text'=>img_picto('','object_trip').' '.$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
if (! empty($conf->holiday->enabled) && empty($conf->global->MAIN_SEARCHFORM_HOLIDAY_DISABLED) && $user->rights->holiday->read)
|
||||
{
|
||||
$arrayresult['searchintoleaves']=array('img'=>'object_holiday', 'label'=>$langs->trans("SearchIntoLeaves", $search_boxvalue), 'text'=>img_picto('','object_holiday').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm&sall='.urlencode($search_boxvalue));
|
||||
$arrayresult['searchintoleaves']=array('position'=>220, 'img'=>'object_holiday', 'label'=>$langs->trans("SearchIntoLeaves", $search_boxvalue), 'text'=>img_picto('','object_holiday').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm&sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
|
||||
|
||||
@ -147,7 +147,7 @@ if (! empty($conf->hrm->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_EMPLO
|
||||
*/
|
||||
|
||||
// Execute hook addSearchEntry
|
||||
$parameters=array('search_boxvalue'=>$search_boxvalue);
|
||||
$parameters=array('search_boxvalue'=>$search_boxvalue, 'arrayresult'=>$arrayresult);
|
||||
$reshook=$hookmanager->executeHooks('addSearchEntry',$parameters);
|
||||
if (empty($reshook))
|
||||
{
|
||||
@ -155,6 +155,8 @@ if (empty($reshook))
|
||||
}
|
||||
else $arrayresult=$hookmanager->resArray;
|
||||
|
||||
// Sort on position
|
||||
$arrayresult = dol_sort_array($arrayresult, 'position');
|
||||
|
||||
// Print output if called by ajax or do nothing (var $arrayresult will be used) if called by an include
|
||||
if (! isset($usedbyinclude) || empty($usedbyinclude))
|
||||
|
||||
@ -298,7 +298,7 @@ class Comment extends CommonObject
|
||||
$sql.= " c.rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."comment as c";
|
||||
$sql.= " WHERE c.fk_element = ".$fk_element;
|
||||
$sql.= " AND c.element_type = '".$element_type."'";
|
||||
$sql.= " AND c.element_type = '".$db->escape($element_type)."'";
|
||||
$sql.= " AND c.entity = ".$conf->entity;
|
||||
$sql.= " ORDER BY c.tms DESC";
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
445
htdocs/core/class/emailsenderprofile.class.php
Normal file
445
htdocs/core/class/emailsenderprofile.class.php
Normal file
@ -0,0 +1,445 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) ---Put here your own copyright and developer email---
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file class/emailsenderprofile.class.php
|
||||
* \ingroup monmodule
|
||||
* \brief This file is a CRUD class file for EmailSenderProfile (Create/Read/Update/Delete)
|
||||
*/
|
||||
|
||||
// Put here all includes required by your class file
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
|
||||
//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||
//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||
|
||||
/**
|
||||
* Class for EmailSenderProfile
|
||||
*/
|
||||
class EmailSenderProfile extends CommonObject
|
||||
{
|
||||
/**
|
||||
* @var string ID to identify managed object
|
||||
*/
|
||||
public $element = 'emailsenderprofile';
|
||||
/**
|
||||
* @var string Name of table without prefix where object is stored
|
||||
*/
|
||||
public $table_element = 'c_email_senderprofile';
|
||||
|
||||
/**
|
||||
* @var array Does this field is linked to a thirdparty ?
|
||||
*/
|
||||
protected $isnolinkedbythird = 1;
|
||||
/**
|
||||
* @var array Does emailsenderprofile support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||
*/
|
||||
protected $ismultientitymanaged = 1;
|
||||
/**
|
||||
* @var string String with name of icon for emailsenderprofile
|
||||
*/
|
||||
public $picto = 'emailsenderprofile@monmodule';
|
||||
|
||||
|
||||
/**
|
||||
* 'type' if the field format.
|
||||
* 'label' the translation key.
|
||||
* 'enabled' is a condition when the filed must be managed.
|
||||
* 'visible' says if field is visible in list (-1 means not shown by default but can be added into list to be viewed).
|
||||
* 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
|
||||
* 'index' if we want an index in database.
|
||||
* 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
|
||||
* 'position' is the sort order of field.
|
||||
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
|
||||
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
|
||||
* 'help' is a string visible as a tooltip on field
|
||||
* 'comment' is not used. You can store here any text of your choice.
|
||||
*/
|
||||
|
||||
// BEGIN MODULEBUILDER PROPERTIES
|
||||
/**
|
||||
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
|
||||
*/
|
||||
public $fields=array(
|
||||
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-1, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>'Id',),
|
||||
'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>-1, 'enabled'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,),
|
||||
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>-1),
|
||||
'email' => array('type'=>'varchar(255)', 'label'=>'Email', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1),
|
||||
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
|
||||
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
|
||||
//'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
|
||||
//'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>-1,),
|
||||
'signature' => array('type'=>'text', 'label'=>'Signature', 'visible'=>-1, 'enabled'=>1, 'position'=>1000, 'notnull'=>-1, 'index'=>1,),
|
||||
'position' => array('type'=>'integer', 'label'=>'Position', 'visible'=>-1, 'enabled'=>1, 'position'=>1000, 'notnull'=>-1, 'index'=>1,),
|
||||
'active' => array('type'=>'integer', 'label'=>'Active', 'visible'=>1, 'enabled'=>1, 'position'=>1000, 'notnull'=>-1, 'index'=>1),
|
||||
);
|
||||
public $rowid;
|
||||
public $entity;
|
||||
public $label;
|
||||
public $email;
|
||||
public $date_creation;
|
||||
public $tms;
|
||||
//public $fk_user_creat;
|
||||
//public $fk_user_modif;
|
||||
public $signature;
|
||||
public $position;
|
||||
public $active;
|
||||
// END MODULEBUILDER PROPERTIES
|
||||
|
||||
|
||||
|
||||
// If this object has a subtable with lines
|
||||
|
||||
/**
|
||||
* @var int Name of subtable line
|
||||
*/
|
||||
//public $table_element_line = 'emailsenderprofiledet';
|
||||
/**
|
||||
* @var int Field with ID of parent key if this field has a parent
|
||||
*/
|
||||
//public $fk_element = 'fk_emailsenderprofile';
|
||||
/**
|
||||
* @var int Name of subtable class that manage subtable lines
|
||||
*/
|
||||
//public $class_element_line = 'EmailSenderProfileline';
|
||||
/**
|
||||
* @var array Array of child tables (child tables to delete before deleting a record)
|
||||
*/
|
||||
//protected $childtables=array('emailsenderprofiledet');
|
||||
/**
|
||||
* @var EmailSenderProfileLine[] Array of subtable lines
|
||||
*/
|
||||
//public $lines = array();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDb $db Database handler
|
||||
*/
|
||||
public function __construct(DoliDB $db)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) $this->fields['rowid']['visible']=0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create object into database
|
||||
*
|
||||
* @param User $user User that creates
|
||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||
* @return int <0 if KO, Id of created object if OK
|
||||
*/
|
||||
public function create(User $user, $notrigger = false)
|
||||
{
|
||||
return $this->createCommon($user, $notrigger);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clone and object into another one
|
||||
*
|
||||
* @param User $user User that creates
|
||||
* @param int $fromid Id of object to clone
|
||||
* @return mixed New object created, <0 if KO
|
||||
*/
|
||||
public function createFromClone(User $user, $fromid)
|
||||
{
|
||||
global $hookmanager, $langs;
|
||||
$error = 0;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$object = new self($this->db);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Load source object
|
||||
$object->fetchCommon($fromid);
|
||||
// Reset some properties
|
||||
unset($object->id);
|
||||
unset($object->fk_user_creat);
|
||||
unset($object->import_key);
|
||||
|
||||
// Clear fields
|
||||
$object->ref = "copy_of_".$object->ref;
|
||||
$object->title = $langs->trans("CopyOf")." ".$object->title;
|
||||
// ...
|
||||
|
||||
// Create clone
|
||||
$object->context['createfromclone'] = 'createfromclone';
|
||||
$result = $object->createCommon($user);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
$this->error = $object->error;
|
||||
$this->errors = $object->errors;
|
||||
}
|
||||
|
||||
// End
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
return $object;
|
||||
} else {
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load object in memory from the database
|
||||
*
|
||||
* @param int $id Id object
|
||||
* @param string $ref Ref
|
||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||
*/
|
||||
public function fetch($id, $ref = null)
|
||||
{
|
||||
$result = $this->fetchCommon($id, $ref);
|
||||
if ($result > 0 && ! empty($this->table_element_line)) $this->fetchLines();
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load object lines in memory from the database
|
||||
*
|
||||
* @param int $id Id object
|
||||
* @param string $ref Ref
|
||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||
*/
|
||||
public function fetchLines($id, $ref = null)
|
||||
{
|
||||
$this->lines=array();
|
||||
|
||||
// Load lines with object EmailSenderProfileLine
|
||||
|
||||
return count($this->lines)?1:0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update object into database
|
||||
*
|
||||
* @param User $user User that modifies
|
||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function update(User $user, $notrigger = false)
|
||||
{
|
||||
return $this->updateCommon($user, $notrigger);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete object in database
|
||||
*
|
||||
* @param User $user User that deletes
|
||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function delete(User $user, $notrigger = false)
|
||||
{
|
||||
return $this->deleteCommon($user, $trigger);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a link to the object card (with optionaly the picto)
|
||||
*
|
||||
* @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
|
||||
* @return string String with URL
|
||||
*/
|
||||
function getNomUrl($withpicto=0)
|
||||
{
|
||||
global $db, $conf, $langs;
|
||||
global $dolibarr_main_authentication, $dolibarr_main_demo;
|
||||
global $menumanager;
|
||||
|
||||
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
|
||||
|
||||
$result = '';
|
||||
$companylink = '';
|
||||
|
||||
$url='';
|
||||
//$url = dol_buildpath('/monmodule/emailsenderprofile_card.php',1).'?id='.$this->id;
|
||||
|
||||
$linkstart = '';
|
||||
$linkend='';
|
||||
|
||||
if ($withpicto)
|
||||
{
|
||||
$result.=($linkstart.img_object(($notooltip?'':$label), 'label', ($notooltip?'':'class="classfortooltip"')).$linkend);
|
||||
if ($withpicto != 2) $result.=' ';
|
||||
}
|
||||
$result.= $linkstart . $this->label . $linkend;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return link to download file from a direct external access
|
||||
*
|
||||
* @param int $withpicto Add download picto into link
|
||||
* @return string HTML link to file
|
||||
*/
|
||||
function getDirectExternalLink($withpicto=0)
|
||||
{
|
||||
return 'todo';
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne le libelle du status d'un user (actif, inactif)
|
||||
*
|
||||
* @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 Label of status
|
||||
*/
|
||||
function getLibStatut($mode=0)
|
||||
{
|
||||
return $this->LibStatut($this->status,$mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the status
|
||||
*
|
||||
* @param int $status Id status
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
|
||||
* @return string Label of status
|
||||
*/
|
||||
static function LibStatut($status,$mode=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
$prefix='';
|
||||
if ($status == 1) return $langs->trans('Enabled');
|
||||
if ($status == 0) return $langs->trans('Disabled');
|
||||
}
|
||||
if ($mode == 1)
|
||||
{
|
||||
if ($status == 1) return $langs->trans('Enabled');
|
||||
if ($status == 0) return $langs->trans('Disabled');
|
||||
}
|
||||
if ($mode == 2)
|
||||
{
|
||||
if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
|
||||
if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
|
||||
}
|
||||
if ($mode == 3)
|
||||
{
|
||||
if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4');
|
||||
if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5');
|
||||
}
|
||||
if ($mode == 4)
|
||||
{
|
||||
if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
|
||||
if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
|
||||
}
|
||||
if ($mode == 5)
|
||||
{
|
||||
if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
|
||||
if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
|
||||
}
|
||||
if ($mode == 6)
|
||||
{
|
||||
if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
|
||||
if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Charge les informations d'ordre info dans l'objet commande
|
||||
*
|
||||
* @param int $id Id of order
|
||||
* @return void
|
||||
*/
|
||||
function info($id)
|
||||
{
|
||||
$sql = 'SELECT rowid, date_creation as datec, tms as datem,';
|
||||
$sql.= ' fk_user_creat, fk_user_modif';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
|
||||
$sql.= ' WHERE t.rowid = '.$id;
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($this->db->num_rows($result))
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$this->id = $obj->rowid;
|
||||
if ($obj->fk_user_author)
|
||||
{
|
||||
$cuser = new User($this->db);
|
||||
$cuser->fetch($obj->fk_user_author);
|
||||
$this->user_creation = $cuser;
|
||||
}
|
||||
|
||||
if ($obj->fk_user_valid)
|
||||
{
|
||||
$vuser = new User($this->db);
|
||||
$vuser->fetch($obj->fk_user_valid);
|
||||
$this->user_validation = $vuser;
|
||||
}
|
||||
|
||||
if ($obj->fk_user_cloture)
|
||||
{
|
||||
$cluser = new User($this->db);
|
||||
$cluser->fetch($obj->fk_user_cloture);
|
||||
$this->user_cloture = $cluser;
|
||||
}
|
||||
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_modification = $this->db->jdate($obj->datem);
|
||||
$this->date_validation = $this->db->jdate($obj->datev);
|
||||
}
|
||||
|
||||
$this->db->free($result);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise object with example values
|
||||
* Id must be 0 if object instance is a specimen
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initAsSpecimen()
|
||||
{
|
||||
$this->initAsSpecimenCommon();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Class EmailSenderProfileLine. You can also remove this and generate a CRUD class for lines objects.
|
||||
*/
|
||||
/*
|
||||
class EmailSenderProfileLine
|
||||
{
|
||||
// @var int ID
|
||||
public $id;
|
||||
// @var mixed Sample line property 1
|
||||
public $prop1;
|
||||
// @var mixed Sample line property 2
|
||||
public $prop2;
|
||||
}
|
||||
*/
|
||||
@ -747,7 +747,7 @@ class ExtraFields
|
||||
$this->attribute_pos[$tab->name]=$tab->pos;
|
||||
$this->attribute_alwayseditable[$tab->name]=$tab->alwayseditable;
|
||||
$this->attribute_perms[$tab->name]=$tab->perms;
|
||||
$this->attribute_langfile[$tab->langs]=$tab->langs;
|
||||
$this->attribute_langfile[$tab->name]=$tab->langs;
|
||||
$this->attribute_list[$tab->name]=$tab->list;
|
||||
$this->attribute_hidden[$tab->name]=$tab->ishidden;
|
||||
$this->attribute_entityid[$tab->name]=$tab->entity;
|
||||
@ -1687,7 +1687,7 @@ class ExtraFields
|
||||
*/
|
||||
function showSeparator($key)
|
||||
{
|
||||
$out = '<tr class="liste_titre"><td colspan="4"><strong>'.$this->attribute_label[$key].'</strong></td></tr>';
|
||||
$out = '<tr class="trextrafieldseparator"><td colspan="4"><strong>'.$this->attribute_label[$key].'</strong></td></tr>';
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -271,16 +271,6 @@ class FormMail extends Form
|
||||
|
||||
$disablebademails=1;
|
||||
|
||||
// Define list of attached files
|
||||
$listofpaths=array();
|
||||
$listofnames=array();
|
||||
$listofmimes=array();
|
||||
$keytoavoidconflict = empty($this->trackid)?'':'-'.$this->trackid; // this->trackid must be defined
|
||||
|
||||
if (! empty($_SESSION["listofpaths".$keytoavoidconflict])) $listofpaths=explode(';',$_SESSION["listofpaths".$keytoavoidconflict]);
|
||||
if (! empty($_SESSION["listofnames".$keytoavoidconflict])) $listofnames=explode(';',$_SESSION["listofnames".$keytoavoidconflict]);
|
||||
if (! empty($_SESSION["listofmimes".$keytoavoidconflict])) $listofmimes=explode(';',$_SESSION["listofmimes".$keytoavoidconflict]);
|
||||
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
@ -307,6 +297,30 @@ class FormMail extends Form
|
||||
//var_dump($model_id);
|
||||
//var_dump($arraydefaultmessage);
|
||||
|
||||
|
||||
// Define list of attached files
|
||||
$listofpaths=array();
|
||||
$listofnames=array();
|
||||
$listofmimes=array();
|
||||
$keytoavoidconflict = empty($this->trackid)?'':'-'.$this->trackid; // this->trackid must be defined
|
||||
|
||||
if (GETPOST('mode','alpha') == 'init' || (GETPOST('modelmailselected','alpha') && GETPOST('modelmailselected','alpha') != '-1'))
|
||||
{
|
||||
$this->clear_attached_files();
|
||||
if (! empty($arraydefaultmessage['joinfiles']) && is_array($this->param['fileinit']))
|
||||
{
|
||||
foreach($this->param['fileinit'] as $file)
|
||||
{
|
||||
$this->add_attached_files($file, basename($file), dol_mimetype($file));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($_SESSION["listofpaths".$keytoavoidconflict])) $listofpaths=explode(';',$_SESSION["listofpaths".$keytoavoidconflict]);
|
||||
if (! empty($_SESSION["listofnames".$keytoavoidconflict])) $listofnames=explode(';',$_SESSION["listofnames".$keytoavoidconflict]);
|
||||
if (! empty($_SESSION["listofmimes".$keytoavoidconflict])) $listofmimes=explode(';',$_SESSION["listofmimes".$keytoavoidconflict]);
|
||||
|
||||
|
||||
$out.= "\n".'<!-- Begin form mail type='.$this->param["models"].' --><div id="mailformdiv"></div>'."\n";
|
||||
if ($this->withform == 1)
|
||||
{
|
||||
@ -369,7 +383,7 @@ class FormMail extends Form
|
||||
elseif (! empty($this->param['models']) && in_array($this->param['models'], array(
|
||||
'propal_send','order_send','facture_send',
|
||||
'shipping_send','fichinter_send','supplier_proposal_send','order_supplier_send',
|
||||
'invoice_supplier_send','thirdparty','contract','all'
|
||||
'invoice_supplier_send','thirdparty','contract','user','all'
|
||||
)))
|
||||
{
|
||||
// If list of template is empty
|
||||
@ -412,7 +426,8 @@ class FormMail extends Form
|
||||
if (! ($this->fromtype === 'user' && $this->fromid > 0)
|
||||
&& ! ($this->fromtype === 'company')
|
||||
&& ! preg_match('/user_aliases/', $this->fromtype)
|
||||
&& ! preg_match('/global_aliases/', $this->fromtype))
|
||||
&& ! preg_match('/global_aliases/', $this->fromtype)
|
||||
&& ! preg_match('/senderprofile/', $this->fromtype))
|
||||
{
|
||||
// Use this->fromname and this->frommail or error if not defined
|
||||
$out.= $this->fromname;
|
||||
@ -430,6 +445,8 @@ class FormMail extends Form
|
||||
}
|
||||
} else {
|
||||
$liste = array();
|
||||
|
||||
// Add user email
|
||||
if (empty($user->email))
|
||||
{
|
||||
$langs->load('errors');
|
||||
@ -439,9 +456,32 @@ class FormMail extends Form
|
||||
{
|
||||
$liste['user'] = $user->getFullName($langs) .' <'.$user->email.'>';
|
||||
}
|
||||
|
||||
// Add also company main email
|
||||
$liste['company'] = $conf->global->MAIN_INFO_SOCIETE_NOM .' <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>';
|
||||
// Add also email aliases if there is one
|
||||
|
||||
// Add also email aliases if there is some
|
||||
$listaliases=array('user_aliases'=>$user->email_aliases, 'global_aliases'=>$conf->global->MAIN_INFO_SOCIETE_MAIL_ALIASES);
|
||||
|
||||
// Add also email aliases from the c_email_senderprofile table
|
||||
$sql='SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile WHERE active = 1 ORDER BY position';
|
||||
$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)
|
||||
{
|
||||
$listaliases['senderprofile_'.$obj->rowid] = $obj->label.' <'.$obj->email.'>';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else dol_print_error($db);
|
||||
|
||||
foreach($listaliases as $typealias => $listalias)
|
||||
{
|
||||
$posalias=0;
|
||||
@ -922,7 +962,7 @@ class FormMail extends Form
|
||||
{
|
||||
$ret=array();
|
||||
|
||||
$sql = "SELECT label, topic, content, content_lines, lang";
|
||||
$sql = "SELECT label, topic, joinfiles, content, content_lines, lang";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.'c_email_templates';
|
||||
$sql.= " WHERE (type_template='".$db->escape($type_template)."' OR type_template='all')";
|
||||
$sql.= " AND entity IN (".getEntity('c_email_templates', 0).")";
|
||||
@ -942,10 +982,11 @@ class FormMail extends Form
|
||||
if ($obj)
|
||||
{
|
||||
$ret['label']=$obj->label;
|
||||
$ret['lang']=$obj->lang;
|
||||
$ret['topic']=$obj->topic;
|
||||
$ret['joinfiles']=$obj->joinfiles;
|
||||
$ret['content']=$obj->content;
|
||||
$ret['content_lines']=$obj->content_lines;
|
||||
$ret['lang']=$obj->lang;
|
||||
}
|
||||
else // If there is no template at all
|
||||
{
|
||||
@ -963,10 +1004,11 @@ class FormMail extends Form
|
||||
elseif ($type_template=='user') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentUser"); }
|
||||
|
||||
$ret['label']='default';
|
||||
$ret['lang']=$outputlangs->defaultlang;
|
||||
$ret['topic']='';
|
||||
$ret['joinfiles']=1;
|
||||
$ret['content']=$defaultmessage;
|
||||
$ret['content_lines']='';
|
||||
$ret['lang']=$outputlangs->defaultlang;
|
||||
}
|
||||
|
||||
$db->free($resql);
|
||||
|
||||
@ -92,8 +92,8 @@ class Ldap
|
||||
|
||||
|
||||
/**
|
||||
* The internal LDAP connection handle
|
||||
*/
|
||||
* The internal LDAP connection handle
|
||||
*/
|
||||
var $connection;
|
||||
/**
|
||||
* Result of any connections etc.
|
||||
@ -402,10 +402,10 @@ class Ldap
|
||||
* Add a LDAP entry
|
||||
* Ldap object connect and bind must have been done
|
||||
*
|
||||
* @param string $dn DN entry key
|
||||
* @param array $info Attributes array
|
||||
* @param string $dn DN entry key
|
||||
* @param array $info Attributes array
|
||||
* @param User $user Objet user that create
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function add($dn, $info, $user)
|
||||
{
|
||||
@ -458,7 +458,7 @@ class Ldap
|
||||
*
|
||||
* @param string $dn DN entry key
|
||||
* @param array $info Attributes array
|
||||
* @param string $user Objet user that modify
|
||||
* @param User $user Objet user that modify
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function modify($dn, $info, $user)
|
||||
@ -504,17 +504,69 @@ class Ldap
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename a LDAP entry
|
||||
* Ldap object connect and bind must have been done
|
||||
*
|
||||
* @param string $dn Old DN entry key (uid=qqq,ou=xxx,dc=aaa,dc=bbb) (before update)
|
||||
* @param string $newrdn New RDN entry key (uid=qqq)
|
||||
* @param string $newparent New parent (ou=xxx,dc=aaa,dc=bbb)
|
||||
* @param User $user Objet user that modify
|
||||
* @param bool $deleteoldrdn If TRUE the old RDN value(s) is removed, else the old RDN value(s) is retained as non-distinguished values of the entry.
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function rename($dn, $newrdn, $newparent, $user, $deleteoldrdn = true)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
dol_syslog(get_class($this)."::modify dn=".$dn." newrdn=".$newrdn." newparent=".$newparent." deleteoldrdn=".($deleteoldrdn?1:0));
|
||||
|
||||
// Check parameters
|
||||
if (! $this->connection)
|
||||
{
|
||||
$this->error="NotConnected";
|
||||
return -2;
|
||||
}
|
||||
if (! $this->bind)
|
||||
{
|
||||
$this->error="NotConnected";
|
||||
return -3;
|
||||
}
|
||||
|
||||
// Encode to LDAP page code
|
||||
$dn=$this->convFromOutputCharset($dn,$this->ldapcharset);
|
||||
$newrdn=$this->convFromOutputCharset($newrdn,$this->ldapcharset);
|
||||
$newparent=$this->convFromOutputCharset($newparent,$this->ldapcharset);
|
||||
|
||||
//print_r($info);
|
||||
$result=@ldap_rename($this->connection, $dn, $newrdn, $newparent, $deleteoldrdn);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
dol_syslog(get_class($this)."::rename successfull", LOG_DEBUG);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=@ldap_error($this->connection);
|
||||
dol_syslog(get_class($this)."::rename failed: ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify a LDAP entry (to use if dn != olddn)
|
||||
* Ldap object connect and bind must have been done
|
||||
*
|
||||
* @param string $dn DN entry key
|
||||
* @param array $info Attributes array
|
||||
* @param User $user Objet user that update
|
||||
* @param string $olddn Old DN entry key (before update)
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @param string $dn DN entry key
|
||||
* @param array $info Attributes array
|
||||
* @param User $user Objet user that update
|
||||
* @param string $olddn Old DN entry key (before update)
|
||||
* @param string $newrdn New RDN entry key (uid=qqq) (for ldap_rename)
|
||||
* @param string $newparent New parent (ou=xxx,dc=aaa,dc=bbb) (for ldap_rename)
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function update($dn,$info,$user,$olddn)
|
||||
function update($dn, $info, $user, $olddn, $newrdn=false, $newparent=false)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -534,9 +586,17 @@ class Ldap
|
||||
|
||||
if (! $olddn || $olddn != $dn)
|
||||
{
|
||||
// If change we make is rename the key of LDAP record, we create new one and if ok, we delete old one.
|
||||
$result = $this->add($dn, $info, $user);
|
||||
if ($result > 0 && $olddn && $olddn != $dn) $result = $this->delete($olddn); // If add fails, we do not try to delete old one
|
||||
if (! empty($olddn) && ! empty($newrdn) && ! empty($newparent) && $conf->global->LDAP_SERVER_PROTOCOLVERSION === '3')
|
||||
{
|
||||
// This function currently only works with LDAPv3
|
||||
$result = $this->rename($olddn, $newrdn, $newparent, $user, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// If change we make is rename the key of LDAP record, we create new one and if ok, we delete old one.
|
||||
$result = $this->add($dn, $info, $user);
|
||||
if ($result > 0 && $olddn && $olddn != $dn) $result = $this->delete($olddn); // If add fails, we do not try to delete old one
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -689,7 +749,7 @@ class Ldap
|
||||
|
||||
// Attribute methods -----------------------------------------------------
|
||||
|
||||
/**
|
||||
/**
|
||||
* Add a LDAP attribute in entry
|
||||
* Ldap object connect and bind must have been done
|
||||
*
|
||||
@ -741,7 +801,7 @@ class Ldap
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Update a LDAP attribute in entry
|
||||
* Ldap object connect and bind must have been done
|
||||
*
|
||||
@ -793,7 +853,7 @@ class Ldap
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Delete a LDAP attribute in entry
|
||||
* Ldap object connect and bind must have been done
|
||||
*
|
||||
@ -845,7 +905,7 @@ class Ldap
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns an array containing attributes and values for first record
|
||||
*
|
||||
* @param string $dn DN entry key
|
||||
@ -1202,7 +1262,7 @@ class Ldap
|
||||
$i=0;
|
||||
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);
|
||||
if ($this->result)
|
||||
{
|
||||
@ -1213,9 +1273,9 @@ class Ldap
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error = ldap_errno($this->connection)." ".ldap_error($this->connection);
|
||||
dol_syslog(get_class($this)."::fetch search fails");
|
||||
return -1;
|
||||
$this->error = ldap_errno($this->connection)." ".ldap_error($this->connection);
|
||||
dol_syslog(get_class($this)."::fetch search fails");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (! $result)
|
||||
@ -1241,7 +1301,7 @@ class Ldap
|
||||
$this->firstname = $this->convToOutputCharset($result[0][$this->attr_firstname][0],$this->ldapcharset);
|
||||
$this->login = $this->convToOutputCharset($result[0][$this->attr_login][0],$this->ldapcharset);
|
||||
$this->phone = $this->convToOutputCharset($result[0][$this->attr_phone][0],$this->ldapcharset);
|
||||
$this->skype = $this->convToOutputCharset($result[0][$this->attr_skype][0],$this->ldapcharset);
|
||||
$this->skype = $this->convToOutputCharset($result[0][$this->attr_skype][0],$this->ldapcharset);
|
||||
$this->fax = $this->convToOutputCharset($result[0][$this->attr_fax][0],$this->ldapcharset);
|
||||
$this->mail = $this->convToOutputCharset($result[0][$this->attr_mail][0],$this->ldapcharset);
|
||||
$this->mobile = $this->convToOutputCharset($result[0][$this->attr_mobile][0],$this->ldapcharset);
|
||||
@ -1264,7 +1324,7 @@ class Ldap
|
||||
$this->domainFQDN = $domain;
|
||||
|
||||
// Set ldapUserDn (each user can have a different dn)
|
||||
//var_dump($result[0]);exit;
|
||||
//var_dump($result[0]);exit;
|
||||
$this->ldapUserDN=$result[0]['dn'];
|
||||
|
||||
ldap_free_result($this->result);
|
||||
@ -1290,35 +1350,37 @@ class Ldap
|
||||
}
|
||||
|
||||
/**
|
||||
* UserAccountControl Flgs to more human understandable form...
|
||||
*
|
||||
* @param string $uacf UACF
|
||||
* @return void
|
||||
*/
|
||||
* UserAccountControl Flgs to more human understandable form...
|
||||
*
|
||||
* @param string $uacf UACF
|
||||
* @return void
|
||||
*/
|
||||
function parseUACF($uacf)
|
||||
{
|
||||
//All flags array
|
||||
$flags = array( "TRUSTED_TO_AUTH_FOR_DELEGATION" => 16777216,
|
||||
"PASSWORD_EXPIRED" => 8388608,
|
||||
"DONT_REQ_PREAUTH" => 4194304,
|
||||
"USE_DES_KEY_ONLY" => 2097152,
|
||||
"NOT_DELEGATED" => 1048576,
|
||||
"TRUSTED_FOR_DELEGATION" => 524288,
|
||||
"SMARTCARD_REQUIRED" => 262144,
|
||||
"MNS_LOGON_ACCOUNT" => 131072,
|
||||
"DONT_EXPIRE_PASSWORD" => 65536,
|
||||
"SERVER_TRUST_ACCOUNT" => 8192,
|
||||
"WORKSTATION_TRUST_ACCOUNT" => 4096,
|
||||
"INTERDOMAIN_TRUST_ACCOUNT" => 2048,
|
||||
"NORMAL_ACCOUNT" => 512,
|
||||
"TEMP_DUPLICATE_ACCOUNT" => 256,
|
||||
"ENCRYPTED_TEXT_PWD_ALLOWED" => 128,
|
||||
"PASSWD_CANT_CHANGE" => 64,
|
||||
"PASSWD_NOTREQD" => 32,
|
||||
"LOCKOUT" => 16,
|
||||
"HOMEDIR_REQUIRED" => 8,
|
||||
"ACCOUNTDISABLE" => 2,
|
||||
"SCRIPT" => 1);
|
||||
$flags = array(
|
||||
"TRUSTED_TO_AUTH_FOR_DELEGATION" => 16777216,
|
||||
"PASSWORD_EXPIRED" => 8388608,
|
||||
"DONT_REQ_PREAUTH" => 4194304,
|
||||
"USE_DES_KEY_ONLY" => 2097152,
|
||||
"NOT_DELEGATED" => 1048576,
|
||||
"TRUSTED_FOR_DELEGATION" => 524288,
|
||||
"SMARTCARD_REQUIRED" => 262144,
|
||||
"MNS_LOGON_ACCOUNT" => 131072,
|
||||
"DONT_EXPIRE_PASSWORD" => 65536,
|
||||
"SERVER_TRUST_ACCOUNT" => 8192,
|
||||
"WORKSTATION_TRUST_ACCOUNT" => 4096,
|
||||
"INTERDOMAIN_TRUST_ACCOUNT" => 2048,
|
||||
"NORMAL_ACCOUNT" => 512,
|
||||
"TEMP_DUPLICATE_ACCOUNT" => 256,
|
||||
"ENCRYPTED_TEXT_PWD_ALLOWED" => 128,
|
||||
"PASSWD_CANT_CHANGE" => 64,
|
||||
"PASSWD_NOTREQD" => 32,
|
||||
"LOCKOUT" => 16,
|
||||
"HOMEDIR_REQUIRED" => 8,
|
||||
"ACCOUNTDISABLE" => 2,
|
||||
"SCRIPT" => 1
|
||||
);
|
||||
|
||||
//Parse flags to text
|
||||
$retval = array();
|
||||
@ -1334,20 +1396,22 @@ class Ldap
|
||||
}
|
||||
|
||||
/**
|
||||
* SamAccountType value to text
|
||||
*
|
||||
* @param string $samtype SamType
|
||||
* @return string Sam string
|
||||
*/
|
||||
* SamAccountType value to text
|
||||
*
|
||||
* @param string $samtype SamType
|
||||
* @return string Sam string
|
||||
*/
|
||||
function parseSAT($samtype)
|
||||
{
|
||||
$stypes = array( 805306368 => "NORMAL_ACCOUNT",
|
||||
805306369 => "WORKSTATION_TRUST",
|
||||
805306370 => "INTERDOMAIN_TRUST",
|
||||
268435456 => "SECURITY_GLOBAL_GROUP",
|
||||
268435457 => "DISTRIBUTION_GROUP",
|
||||
536870912 => "SECURITY_LOCAL_GROUP",
|
||||
536870913 => "DISTRIBUTION_LOCAL_GROUP");
|
||||
$stypes = array(
|
||||
805306368 => "NORMAL_ACCOUNT",
|
||||
805306369 => "WORKSTATION_TRUST",
|
||||
805306370 => "INTERDOMAIN_TRUST",
|
||||
268435456 => "SECURITY_GLOBAL_GROUP",
|
||||
268435457 => "DISTRIBUTION_GROUP",
|
||||
536870912 => "SECURITY_LOCAL_GROUP",
|
||||
536870913 => "DISTRIBUTION_LOCAL_GROUP"
|
||||
);
|
||||
|
||||
$retval = "";
|
||||
while (list($sat, $val) = each($stypes)) {
|
||||
@ -1379,7 +1443,7 @@ class Ldap
|
||||
|
||||
/**
|
||||
* Convert a string into output/memory charset
|
||||
*
|
||||
*
|
||||
* @param string $str String to convert
|
||||
* @param string $pagecodefrom Page code of src string
|
||||
* @return string Converted string
|
||||
@ -1394,7 +1458,7 @@ class Ldap
|
||||
|
||||
/**
|
||||
* Convert a string from output/memory charset
|
||||
*
|
||||
*
|
||||
* @param string $str String to convert
|
||||
* @param string $pagecodeto Page code for result string
|
||||
* @return string Converted string
|
||||
@ -1422,7 +1486,7 @@ class Ldap
|
||||
|
||||
$search='('.$conf->global->$keygroup.'=*)';
|
||||
$result = $this->search($this->groups,$search);
|
||||
if($result)
|
||||
if ($result)
|
||||
{
|
||||
$c = $result['count'];
|
||||
$gids = array();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -45,68 +45,68 @@ else header('Cache-Control: no-cache');
|
||||
|
||||
// Define tradMonths javascript array (we define this in datepicker AND in parent page to avoid errors with IE8)
|
||||
$tradMonths=array(
|
||||
dol_escape_js($langs->transnoentitiesnoconv("January")),
|
||||
dol_escape_js($langs->transnoentitiesnoconv("February")),
|
||||
dol_escape_js($langs->transnoentitiesnoconv("March")),
|
||||
dol_escape_js($langs->transnoentitiesnoconv("April")),
|
||||
dol_escape_js($langs->transnoentitiesnoconv("May")),
|
||||
dol_escape_js($langs->transnoentitiesnoconv("June")),
|
||||
dol_escape_js($langs->transnoentitiesnoconv("July")),
|
||||
dol_escape_js($langs->transnoentitiesnoconv("August")),
|
||||
dol_escape_js($langs->transnoentitiesnoconv("September")),
|
||||
dol_escape_js($langs->transnoentitiesnoconv("October")),
|
||||
dol_escape_js($langs->transnoentitiesnoconv("November")),
|
||||
dol_escape_js($langs->transnoentitiesnoconv("December"))
|
||||
dol_escape_js($langs->transnoentitiesnoconv("January")),
|
||||
dol_escape_js($langs->transnoentitiesnoconv("February")),
|
||||
dol_escape_js($langs->transnoentitiesnoconv("March")),
|
||||
dol_escape_js($langs->transnoentitiesnoconv("April")),
|
||||
dol_escape_js($langs->transnoentitiesnoconv("May")),
|
||||
dol_escape_js($langs->transnoentitiesnoconv("June")),
|
||||
dol_escape_js($langs->transnoentitiesnoconv("July")),
|
||||
dol_escape_js($langs->transnoentitiesnoconv("August")),
|
||||
dol_escape_js($langs->transnoentitiesnoconv("September")),
|
||||
dol_escape_js($langs->transnoentitiesnoconv("October")),
|
||||
dol_escape_js($langs->transnoentitiesnoconv("November")),
|
||||
dol_escape_js($langs->transnoentitiesnoconv("December"))
|
||||
);
|
||||
|
||||
$tradMonthsShort=array(
|
||||
$langs->trans("JanuaryMin"),
|
||||
$langs->trans("FebruaryMin"),
|
||||
$langs->trans("MarchMin"),
|
||||
$langs->trans("AprilMin"),
|
||||
$langs->trans("MayMin"),
|
||||
$langs->trans("JuneMin"),
|
||||
$langs->trans("JulyMin"),
|
||||
$langs->trans("AugustMin"),
|
||||
$langs->trans("SeptemberMin"),
|
||||
$langs->trans("OctoberMin"),
|
||||
$langs->trans("NovemberMin"),
|
||||
$langs->trans("DecemberMin")
|
||||
$langs->trans("JanuaryMin"),
|
||||
$langs->trans("FebruaryMin"),
|
||||
$langs->trans("MarchMin"),
|
||||
$langs->trans("AprilMin"),
|
||||
$langs->trans("MayMin"),
|
||||
$langs->trans("JuneMin"),
|
||||
$langs->trans("JulyMin"),
|
||||
$langs->trans("AugustMin"),
|
||||
$langs->trans("SeptemberMin"),
|
||||
$langs->trans("OctoberMin"),
|
||||
$langs->trans("NovemberMin"),
|
||||
$langs->trans("DecemberMin")
|
||||
);
|
||||
|
||||
$tradDays=array(
|
||||
$langs->trans("Sunday"),
|
||||
$langs->trans("Monday"),
|
||||
$langs->trans("Tuesday"),
|
||||
$langs->trans("Wednesday"),
|
||||
$langs->trans("Thursday"),
|
||||
$langs->trans("Friday"),
|
||||
$langs->trans("Saturday")
|
||||
$langs->trans("Sunday"),
|
||||
$langs->trans("Monday"),
|
||||
$langs->trans("Tuesday"),
|
||||
$langs->trans("Wednesday"),
|
||||
$langs->trans("Thursday"),
|
||||
$langs->trans("Friday"),
|
||||
$langs->trans("Saturday")
|
||||
);
|
||||
|
||||
$tradDaysShort=array(
|
||||
$langs->trans("ShortSunday"),
|
||||
$langs->trans("ShortMonday"),
|
||||
$langs->trans("ShortTuesday"),
|
||||
$langs->trans("ShortWednesday"),
|
||||
$langs->trans("ShortThursday"),
|
||||
$langs->trans("ShortFriday"),
|
||||
$langs->trans("ShortSaturday")
|
||||
$langs->trans("ShortSunday"),
|
||||
$langs->trans("ShortMonday"),
|
||||
$langs->trans("ShortTuesday"),
|
||||
$langs->trans("ShortWednesday"),
|
||||
$langs->trans("ShortThursday"),
|
||||
$langs->trans("ShortFriday"),
|
||||
$langs->trans("ShortSaturday")
|
||||
);
|
||||
|
||||
$tradDaysMin=array(
|
||||
$langs->trans("SundayMin"),
|
||||
$langs->trans("MondayMin"),
|
||||
$langs->trans("TuesdayMin"),
|
||||
$langs->trans("WednesdayMin"),
|
||||
$langs->trans("ThursdayMin"),
|
||||
$langs->trans("FridayMin"),
|
||||
$langs->trans("SaturdayMin")
|
||||
$langs->trans("SundayMin"),
|
||||
$langs->trans("MondayMin"),
|
||||
$langs->trans("TuesdayMin"),
|
||||
$langs->trans("WednesdayMin"),
|
||||
$langs->trans("ThursdayMin"),
|
||||
$langs->trans("FridayMin"),
|
||||
$langs->trans("SaturdayMin")
|
||||
);
|
||||
?>
|
||||
|
||||
|
||||
// For eldy and jQuery date picker
|
||||
// For jQuery date picker
|
||||
var tradMonths = <?php echo json_encode($tradMonths) ?>;
|
||||
var tradMonthsShort = <?php echo json_encode($tradMonthsShort) ?>;
|
||||
var tradDays = <?php echo json_encode($tradDays) ?>;
|
||||
@ -140,8 +140,8 @@ jQuery(function($){
|
||||
dateFormat: '<?php echo $langs->trans("FormatDateShortJQuery"); ?>',
|
||||
firstDay: <?php echo (isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:'1'); ?>,
|
||||
isRTL: <?php echo ($langs->trans("DIRECTION")=='rtl'?'true':'false'); ?>,
|
||||
showMonthAfterYear: false, // TODO add specific to country
|
||||
yearSuffix: '' // TODO add specific to country
|
||||
showMonthAfterYear: false, /* TODO add specific to country */
|
||||
yearSuffix: '' /* TODO add specific to country */
|
||||
};
|
||||
$.datepicker.setDefaults($.datepicker.regional['<?php echo $langs->defaultlang ?>']);
|
||||
});
|
||||
|
||||
@ -63,18 +63,15 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
|
||||
var autoselect = '.$autoselect.';
|
||||
var options = '.json_encode($ajaxoptions).';
|
||||
|
||||
/* Remove product id before select another product use keyup instead of change to avoid loosing the product id. This is needed only for select of predefined product */
|
||||
/* TODO Check if we can remove this */
|
||||
$("input#search_'.$htmlname.'").keydown(function() {
|
||||
$("#'.$htmlname.'").val("");
|
||||
/* Remove selected id as soon as we type or delete a char (it means old selection is wrong). Use keyup/down instead of change to avoid loosing the product id. This is needed only for select of predefined product */
|
||||
$("input#search_'.$htmlname.'").keydown(function(e) {
|
||||
if (e.keyCode != 9) /* If not "Tab" key */
|
||||
{
|
||||
console.log("Clear id previously selected for field '.$htmlname.'");
|
||||
$("#'.$htmlname.'").val("");
|
||||
}
|
||||
});
|
||||
|
||||
/* I disable this. A call to trigger is already done later into the select action of the autocomplete code
|
||||
$("input#search_'.$htmlname.'").change(function() {
|
||||
console.log("Call the change trigger on input '.$htmlname.' because of a change on search_'.$htmlname.' was triggered");
|
||||
$("#'.$htmlname.'").trigger("change");
|
||||
});*/
|
||||
|
||||
// Check options for secondary actions when keyup
|
||||
$("input#search_'.$htmlname.'").keyup(function() {
|
||||
if ($(this).val().length == 0)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
*
|
||||
@ -42,7 +42,8 @@ function contact_prepare_head(Contact $object)
|
||||
$head[$tab][2] = 'card';
|
||||
$tab++;
|
||||
|
||||
if (! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_CONTACT_ACTIVE))
|
||||
if ((! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_CONTACT_ACTIVE))
|
||||
&& (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || ! empty($user->admin)))
|
||||
{
|
||||
$langs->load("ldap");
|
||||
|
||||
@ -94,7 +95,7 @@ function contact_prepare_head(Contact $object)
|
||||
}
|
||||
$head[$tab][2] = 'agenda';
|
||||
$tab++;
|
||||
|
||||
|
||||
// Log
|
||||
/*
|
||||
$head[$tab][0] = DOL_URL_ROOT.'/contact/info.php?id='.$object->id;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -240,6 +240,16 @@ function dol_shutdown()
|
||||
dol_syslog("--- End access to ".$_SERVER["PHP_SELF"].(($disconnectdone && $depth)?' (Warn: db disconnection forced, transaction depth was '.$depth.')':''), (($disconnectdone && $depth)?LOG_WARNING:LOG_INFO));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if we are in a context of submitting a parameter
|
||||
*
|
||||
* @param string $paramname Name or parameter to test
|
||||
* @return boolean True if we have just submit a POST or GET request with the parameter provided (even if param is empty)
|
||||
*/
|
||||
function GETPOSTISSET($paramname)
|
||||
{
|
||||
return (isset($_POST[$paramname]) || isset($_GET[$paramname]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return value of a param into GET or POST supervariable.
|
||||
@ -1232,7 +1242,7 @@ function dol_get_fiche_end($notab=0)
|
||||
* @param int $nodbprefix Do not include DB prefix to forge table name
|
||||
* @param string $morehtmlleft More html code to show before ref
|
||||
* @param string $morehtmlstatus More html code to show under navigation arrows
|
||||
* @param int $onlybanner Put this to 1, if the card will contains only a banner (add css 'arearefnobottom' on div)
|
||||
* @param int $onlybanner Put this to 1, if the card will contains only a banner (this add css 'arearefnobottom' on div)
|
||||
* @param string $morehtmlright More html code to show before navigation arrows
|
||||
* @return void
|
||||
*/
|
||||
@ -1589,7 +1599,7 @@ function dol_strftime($fmt, $ts=false, $is_gmt=false)
|
||||
* @param string $tzoutput true or 'gmt' => string is for Greenwich location
|
||||
* false or 'tzserver' => output string is for local PHP server TZ usage
|
||||
* 'tzuser' => output string is for user TZ (current browser TZ with current dst)
|
||||
* 'tzuserrel' => output string is for user TZ (current browser TZ with dst or not, depending on date position)
|
||||
* 'tzuserrel' => output string is for user TZ (current browser TZ with dst or not, depending on date position) (TODO not implemented yet)
|
||||
* @param Translate $outputlangs Object lang that contains language for text translation.
|
||||
* @param boolean $encodetooutput false=no convert into output pagecode
|
||||
* @return string Formated date or '' if time is null
|
||||
@ -1615,7 +1625,7 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e
|
||||
$offsettz=0;
|
||||
$offsetdst=0;
|
||||
}
|
||||
elseif ($tzoutput == 'tzuser')
|
||||
elseif ($tzoutput == 'tzuser' || $tzoutput == 'tzuserrel')
|
||||
{
|
||||
$to_gmt=true;
|
||||
$offsettzstring=(empty($_SESSION['dol_tz_string'])?'UTC':$_SESSION['dol_tz_string']); // Example 'Europe/Berlin' or 'Indian/Reunion'
|
||||
@ -1688,14 +1698,14 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e
|
||||
$ssec = (! empty($reg[6]) ? $reg[6] : '');
|
||||
|
||||
$time=dol_mktime($shour,$smin,$ssec,$smonth,$sday,$syear,true);
|
||||
$ret=adodb_strftime($format,$time+$offsettz+$offsetdst,$to_gmt);
|
||||
$ret=adodb_strftime($format, $time+$offsettz+$offsetdst, $to_gmt); // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
||||
}
|
||||
else
|
||||
{
|
||||
// Date is a timestamps
|
||||
if ($time < 100000000000) // Protection against bad date values
|
||||
{
|
||||
$ret=adodb_strftime($format,$time+$offsettz+$offsetdst,$to_gmt); // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
||||
$ret=adodb_strftime($format, $time+$offsettz+$offsetdst, $to_gmt); // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
||||
}
|
||||
else $ret='Bad value '.$time.' for date';
|
||||
}
|
||||
@ -1703,8 +1713,8 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e
|
||||
if (preg_match('/__b__/i',$format))
|
||||
{
|
||||
// Here ret is string in PHP setup language (strftime was used). Now we convert to $outputlangs.
|
||||
$month=adodb_strftime('%m',$time+$offsettz+$offsetdst); // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
||||
$month=sprintf("%02d", $month); // $month may be return with format '06' on some installation and '6' on other, so we force it to '06'.
|
||||
$month=adodb_strftime('%m', $time+$offsettz+$offsetdst); // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
||||
$month=sprintf("%02d", $month); // $month may be return with format '06' on some installation and '6' on other, so we force it to '06'.
|
||||
if ($encodetooutput)
|
||||
{
|
||||
$monthtext=$outputlangs->transnoentities('Month'.$month);
|
||||
@ -1723,7 +1733,7 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e
|
||||
}
|
||||
if (preg_match('/__a__/i',$format))
|
||||
{
|
||||
$w=adodb_strftime('%w',$time+$offsettz+$offsetdst); // TODO Remove this
|
||||
$w=adodb_strftime('%w', $time+$offsettz+$offsetdst); // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
||||
$dayweek=$outputlangs->transnoentitiesnoconv('Day'.$w);
|
||||
$ret=str_replace('__A__',$dayweek,$ret);
|
||||
$ret=str_replace('__a__',dol_substr($dayweek,0,3),$ret);
|
||||
@ -2184,9 +2194,21 @@ function dol_print_phone($phone,$countrycode='',$cid=0,$socid=0,$addlink='',$sep
|
||||
$titlealt=($withpicto=='fax'?$langs->trans("Fax"):$langs->trans("Phone"));
|
||||
}
|
||||
$rep='';
|
||||
$picto = '';
|
||||
if($withpicto){
|
||||
if($withpicto=='fax'){
|
||||
$picto = 'phoning_fax';
|
||||
}elseif($withpicto=='phone'){
|
||||
$picto = 'phoning';
|
||||
}elseif($withpicto=='mobile'){
|
||||
$picto = 'phoning_mobile';
|
||||
}else{
|
||||
$picto = '';
|
||||
}
|
||||
}
|
||||
if ($adddivfloat) $rep.='<div class="nospan float" style="margin-right: 10px">';
|
||||
else $rep.='<span style="margin-right: 10px;">';
|
||||
$rep.=($withpicto?img_picto($titlealt, 'object_'.($withpicto=='fax'?'phoning_fax':'phoning').'.png').' ':'').$newphone;
|
||||
$rep.=($withpicto?img_picto($titlealt, 'object_'.$picto.'.png').' ':'').$newphone;
|
||||
if ($adddivfloat) $rep.='</div>';
|
||||
else $rep.='</span>';
|
||||
return $rep;
|
||||
@ -3830,7 +3852,7 @@ function vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0)
|
||||
* @param float $amount Amount to format
|
||||
* @param integer $form Type of format, HTML or not (not by default)
|
||||
* @param Translate $outlangs Object langs for output
|
||||
* @param int $trunc 1=Truncate if there is more decimals than MAIN_MAX_DECIMALS_SHOWN (default), 0=Does not truncate. Deprecated because amount are rounded (to unit or total amount accurancy) before inserted into database or after a computation, so this parameter should be useless.
|
||||
* @param int $trunc 1=Truncate if there is more decimals than MAIN_MAX_DECIMALS_SHOWN (default), 0=Does not truncate. Deprecated because amount are rounded (to unit or total amount accurancy) before beeing inserted into database or after a computation, so this parameter should be useless.
|
||||
* @param int $rounding Minimum number of decimal to show. If 0, no change, if -1, we use min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOTAL)
|
||||
* @param int $forcerounding Force the number of decimal to forcerounding decimal (-1=do not force)
|
||||
* @param string $currency_code To add currency symbol (''=add nothing, 'auto'=Use default currency, 'XXX'=add currency symbols for XXX currency)
|
||||
@ -5277,13 +5299,15 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
|
||||
$substitutionarray['__THIRDPARTY_ID__'] = '__THIRDPARTY_ID__';
|
||||
$substitutionarray['__THIRDPARTY_NAME__'] = '__THIRDPARTY_NAME__';
|
||||
|
||||
$substitutionarray['__MEMBER_CIVILITY__'] = '__MEMBER_CIVILITY__';
|
||||
$substitutionarray['__MEMBER_FIRSTNAME__'] = '__MEMBER_FIRSTNAME__';
|
||||
$substitutionarray['__MEMBER_LASTNAME__'] = '__MEMBER_LASTNAME__';
|
||||
|
||||
if (is_object($object) && $object->element == 'shipping')
|
||||
{
|
||||
$substitutionarray['__MEMBER_CIVILITY__'] = '__MEMBER_CIVILITY__';
|
||||
$substitutionarray['__MEMBER_FIRSTNAME__'] = '__MEMBER_FIRSTNAME__';
|
||||
$substitutionarray['__MEMBER_LASTNAME__'] = '__MEMBER_LASTNAME__';
|
||||
}
|
||||
$substitutionarray['__PROJECT_ID__'] = '__PROJECT_ID__';
|
||||
$substitutionarray['__PROJECT_REF__'] = '__PROJECT_REF__';
|
||||
$substitutionarray['__PROJECT_NAME__'] = '__PROJECT_REF__';
|
||||
$substitutionarray['__PROJECT_NAME__'] = '__PROJECT_NAME__';
|
||||
|
||||
$substitutionarray['__CONTRACT_HIGHEST_PLANNED_START_DATE__'] = 'Highest date planned for a service start';
|
||||
$substitutionarray['__CONTRACT_HIGHEST_PLANNED_START_DATETIME__'] = 'Highest date and hour planned for service start';
|
||||
@ -5296,6 +5320,12 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
|
||||
$substitutionarray['__SECUREKEYPAYMENT_ORDER__'] = 'Security key for payment on an order';
|
||||
$substitutionarray['__SECUREKEYPAYMENT_INVOICE__'] = 'Security key for payment on an invoice';
|
||||
$substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__'] = 'Security key for payment on a a service';
|
||||
|
||||
if (is_object($object) && $object->element == 'shipping')
|
||||
{
|
||||
$substitutionarray['__SHIPPINGTRACKNUM__']='Shipping tacking number';
|
||||
$substitutionarray['__SHIPPINGTRACKNUMURL__']='Shipping tracking url';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -5340,15 +5370,10 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
|
||||
$substitutionarray['__PROJECT_NAME__'] = (is_object($object->projet)?$object->projet->title:'');
|
||||
}
|
||||
|
||||
// Create dynamic tags for __EXTRAFIELD_FIELD__
|
||||
if ($object->table_element && $object->id > 0)
|
||||
if (is_object($object) && $object->element == 'shipping')
|
||||
{
|
||||
$extrafieldstmp = new ExtraFields($db);
|
||||
$extralabels = $extrafieldstmp->fetch_name_optionals_label($object->table_element, true);
|
||||
$object->fetch_optionals($object->id, $extralabels);
|
||||
foreach ($extrafieldstmp->attribute_label as $key => $label) {
|
||||
$substitutionarray['__EXTRAFIELD_' . strtoupper($key) . '__'] = $object->array_options['options_' . $key];
|
||||
}
|
||||
$substitutionarray['__SHIPPINGTRACKNUM__']=$object->tracking_number;
|
||||
$substitutionarray['__SHIPPINGTRACKNUMURL__']=$object->tracking_url;
|
||||
}
|
||||
|
||||
if (is_object($object) && $object->element == 'contrat' && is_array($object->lines))
|
||||
@ -5366,6 +5391,17 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
|
||||
$substitutionarray['__CONTRACT_LOWEST_EXPIRATION_DATETIME__'] = dol_print_date($datenextexpiration, 'standard');
|
||||
}
|
||||
|
||||
// Create dynamic tags for __EXTRAFIELD_FIELD__
|
||||
if ($object->table_element && $object->id > 0)
|
||||
{
|
||||
$extrafieldstmp = new ExtraFields($db);
|
||||
$extralabels = $extrafieldstmp->fetch_name_optionals_label($object->table_element, true);
|
||||
$object->fetch_optionals($object->id, $extralabels);
|
||||
foreach ($extrafieldstmp->attribute_label as $key => $label) {
|
||||
$substitutionarray['__EXTRAFIELD_' . strtoupper($key) . '__'] = $object->array_options['options_' . $key];
|
||||
}
|
||||
}
|
||||
|
||||
$substitutionarray['__ONLINE_PAYMENT_URL__'] = 'TODO';
|
||||
}
|
||||
}
|
||||
@ -5376,6 +5412,11 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
|
||||
$substitutionarray['__AMOUNT__'] = is_object($object)?$object->total_ttc:'';
|
||||
$substitutionarray['__AMOUNT_EXCL_TAX__'] = is_object($object)?$object->total_ht:'';
|
||||
$substitutionarray['__AMOUNT_VAT__'] = is_object($object)?($object->total_vat?$object->total_vat:$object->total_tva):'';
|
||||
/* TODO Add key for multicurrency
|
||||
$substitutionarray['__AMOUNT_FORMATED__'] = is_object($object)?price($object->total_ttc, 0, $outputlangs, 0, 0, -1, $conf->currency_code):'';
|
||||
$substitutionarray['__AMOUNT_EXCL_TAX_FORMATED__'] = is_object($object)?price($object->total_ht, 0, $outputlangs, 0, 0, -1, $conf->currency_code):'';
|
||||
$substitutionarray['__AMOUNT_VAT_FORMATED__'] = is_object($object)?($object->total_vat?price($object->total_vat, 0, $outputlangs, 0, 0, -1, $conf->currency_code):price($object->total_tva, 0, $outputlangs, 0, 0, -1, $conf->currency_code)):'';
|
||||
*/
|
||||
// For backward compatibility
|
||||
if ($onlykey != 2)
|
||||
{
|
||||
@ -6078,9 +6119,10 @@ function dol_validElement($element)
|
||||
* Return img flag of country for a language code or country code
|
||||
*
|
||||
* @param string $codelang Language code (en_IN, fr_CA...) or Country code (IN, FR)
|
||||
* @param string $moreatt Add more attribute on img tag (For example 'style="float: right"')
|
||||
* @return string HTML img string with flag.
|
||||
*/
|
||||
function picto_from_langcode($codelang)
|
||||
function picto_from_langcode($codelang, $moreatt = '')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
@ -6090,7 +6132,7 @@ function picto_from_langcode($codelang)
|
||||
|
||||
if ($codelang == 'auto')
|
||||
{
|
||||
return img_picto_common($langs->trans('AutoDetectLang'), 'flags/int.png');
|
||||
return img_picto_common($langs->trans('AutoDetectLang'), 'flags/int.png', $moreatt);
|
||||
}
|
||||
|
||||
$langtocountryflag = array(
|
||||
@ -6108,7 +6150,7 @@ function picto_from_langcode($codelang)
|
||||
$flagImage = empty($tmparray[1]) ? $tmparray[0] : $tmparray[1];
|
||||
}
|
||||
|
||||
return img_picto_common($codelang, 'flags/'.strtolower($flagImage).'.png');
|
||||
return img_picto_common($codelang, 'flags/'.strtolower($flagImage).'.png', $moreatt);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -6378,7 +6420,7 @@ function dolExplodeIntoArray($string, $delimiter = ';', $kv = '=')
|
||||
|
||||
|
||||
/**
|
||||
* Set focus onto field with selector
|
||||
* Set focus onto field with selector (similar behaviour of 'autofocus' HTML5 tag)
|
||||
*
|
||||
* @param string $selector Selector ('#id' or 'input[name="ref"]') to use to find the HTML input field that must get the autofocus. You must use a CSS selector, so unique id preceding with the '#' char.
|
||||
* @return string HTML code to set focus
|
||||
@ -6746,4 +6788,4 @@ function getDictvalue($tablename, $field, $id, $checkentity=false, $rowidfield='
|
||||
if ($id > 0) return $id;
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
/* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -41,7 +42,8 @@ function member_prepare_head(Adherent $object)
|
||||
$head[$h][2] = 'general';
|
||||
$h++;
|
||||
|
||||
if (! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_MEMBER_ACTIVE))
|
||||
if ((! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_MEMBER_ACTIVE))
|
||||
&& (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || ! empty($user->admin)))
|
||||
{
|
||||
$langs->load("ldap");
|
||||
|
||||
@ -124,7 +126,8 @@ function member_type_prepare_head(AdherentType $object)
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
|
||||
if (! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE))
|
||||
if ((! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE))
|
||||
&& (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || ! empty($user->admin)))
|
||||
{
|
||||
$langs->load("ldap");
|
||||
|
||||
|
||||
@ -431,16 +431,16 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset($targetcontact->getFullName($outputlangs,1));
|
||||
|
||||
if (!empty($targetcontact->address)) {
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($targetcontact))."\n";
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($targetcontact));
|
||||
}else {
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($targetcompany))."\n";
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($targetcompany));
|
||||
}
|
||||
// Country
|
||||
if (!empty($targetcontact->country_code) && $targetcontact->country_code != $sourcecompany->country_code) {
|
||||
$stringaddress.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcontact->country_code))."\n";
|
||||
$stringaddress.= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcontact->country_code));
|
||||
}
|
||||
else if (empty($targetcontact->country_code) && !empty($targetcompany->country_code) && ($targetcompany->country_code != $sourcecompany->country_code)) {
|
||||
$stringaddress.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->country_code))."\n";
|
||||
$stringaddress.= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->country_code));
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || preg_match('/targetwithdetails/',$mode))
|
||||
@ -472,9 +472,9 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
|
||||
}
|
||||
else
|
||||
{
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($targetcompany))."\n";
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($targetcompany));
|
||||
// Country
|
||||
if (!empty($targetcompany->country_code) && $targetcompany->country_code != $sourcecompany->country_code) $stringaddress.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->country_code))."\n";
|
||||
if (!empty($targetcompany->country_code) && $targetcompany->country_code != $sourcecompany->country_code) $stringaddress.=($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->country_code));
|
||||
|
||||
if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || preg_match('/targetwithdetails/',$mode))
|
||||
{
|
||||
@ -507,7 +507,7 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
|
||||
// Intra VAT
|
||||
if (empty($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS))
|
||||
{
|
||||
if ($targetcompany->tva_intra) $stringaddress.="\n".$outputlangs->transnoentities("VATIntraShort").': '.$outputlangs->convToOutputCharset($targetcompany->tva_intra);
|
||||
if ($targetcompany->tva_intra) $stringaddress.=($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("VATIntraShort").': '.$outputlangs->convToOutputCharset($targetcompany->tva_intra);
|
||||
}
|
||||
|
||||
// Professionnal Ids
|
||||
@ -515,37 +515,37 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
|
||||
{
|
||||
$tmp=$outputlangs->transcountrynoentities("ProfId1",$targetcompany->country_code);
|
||||
if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1];
|
||||
$stringaddress.="\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof1);
|
||||
$stringaddress.=($stringaddress ? "\n" : '' ).$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof1);
|
||||
}
|
||||
if (! empty($conf->global->MAIN_PROFID2_IN_ADDRESS) && ! empty($targetcompany->idprof2))
|
||||
{
|
||||
$tmp=$outputlangs->transcountrynoentities("ProfId2",$targetcompany->country_code);
|
||||
if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1];
|
||||
$stringaddress.="\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof2);
|
||||
$stringaddress.=($stringaddress ? "\n" : '' ).$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof2);
|
||||
}
|
||||
if (! empty($conf->global->MAIN_PROFID3_IN_ADDRESS) && ! empty($targetcompany->idprof3))
|
||||
{
|
||||
$tmp=$outputlangs->transcountrynoentities("ProfId3",$targetcompany->country_code);
|
||||
if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1];
|
||||
$stringaddress.="\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof3);
|
||||
$stringaddress.=($stringaddress ? "\n" : '' ).$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof3);
|
||||
}
|
||||
if (! empty($conf->global->MAIN_PROFID4_IN_ADDRESS) && ! empty($targetcompany->idprof4))
|
||||
{
|
||||
$tmp=$outputlangs->transcountrynoentities("ProfId4",$targetcompany->country_code);
|
||||
if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1];
|
||||
$stringaddress.="\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof4);
|
||||
$stringaddress.=($stringaddress ? "\n" : '' ).$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof4);
|
||||
}
|
||||
if (! empty($conf->global->MAIN_PROFID5_IN_ADDRESS) && ! empty($targetcompany->idprof5))
|
||||
{
|
||||
$tmp=$outputlangs->transcountrynoentities("ProfId5",$targetcompany->country_code);
|
||||
if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1];
|
||||
$stringaddress.="\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof5);
|
||||
$stringaddress.=($stringaddress ? "\n" : '' ).$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof5);
|
||||
}
|
||||
if (! empty($conf->global->MAIN_PROFID6_IN_ADDRESS) && ! empty($targetcompany->idprof6))
|
||||
{
|
||||
$tmp=$outputlangs->transcountrynoentities("ProfId6",$targetcompany->country_code);
|
||||
if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1];
|
||||
$stringaddress.="\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof6);
|
||||
$stringaddress.=($stringaddress ? "\n" : '' ).$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof6);
|
||||
}
|
||||
|
||||
// Public note
|
||||
@ -553,11 +553,11 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
|
||||
{
|
||||
if ($mode == 'source' && ! empty($sourcecompany->note_public))
|
||||
{
|
||||
$stringaddress.="\n".dol_string_nohtmltag($sourcecompany->note_public);
|
||||
$stringaddress.=($stringaddress ? "\n" : '' ).dol_string_nohtmltag($sourcecompany->note_public);
|
||||
}
|
||||
if (($mode == 'target' || preg_match('/targetwithdetails/',$mode)) && ! empty($targetcompany->note_public))
|
||||
{
|
||||
$stringaddress.="\n".dol_string_nohtmltag($targetcompany->note_public);
|
||||
$stringaddress.=($stringaddress ? "\n" : '' ).dol_string_nohtmltag($targetcompany->note_public);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ function project_prepare_head($object)
|
||||
$head[$h][2] = 'project';
|
||||
$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][1] = $langs->trans("ProjectContact");
|
||||
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))
|
||||
{
|
||||
$nbNote = 0;
|
||||
if(!empty($object->note_private)) $nbNote++;
|
||||
{
|
||||
$nbNote = 0;
|
||||
if(!empty($object->note_private)) $nbNote++;
|
||||
if(!empty($object->note_public)) $nbNote++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/note.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Notes');
|
||||
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||
$head[$h][2] = 'notes';
|
||||
$h++;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
$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][1] = $langs->trans('Documents');
|
||||
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][1].= $langs->trans("Events");
|
||||
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
|
||||
{
|
||||
$head[$h][1].= '/';
|
||||
$head[$h][1].= $langs->trans("Agenda");
|
||||
}
|
||||
$head[$h][1].= $langs->trans("Events");
|
||||
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
|
||||
{
|
||||
$head[$h][1].= '/';
|
||||
$head[$h][1].= $langs->trans("Agenda");
|
||||
}
|
||||
$head[$h][2] = 'agenda';
|
||||
$h++;
|
||||
|
||||
@ -171,8 +171,8 @@ function task_prepare_head($object)
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj) $nbTimeSpent=1;
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj) $nbTimeSpent=1;
|
||||
}
|
||||
else dol_print_error($db);
|
||||
|
||||
@ -189,23 +189,23 @@ function task_prepare_head($object)
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'task');
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||
{
|
||||
$nbNote = 0;
|
||||
if(!empty($object->note_private)) $nbNote++;
|
||||
{
|
||||
$nbNote = 0;
|
||||
if(!empty($object->note_private)) $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][1] = $langs->trans('Notes');
|
||||
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||
$head[$h][2] = 'task_notes';
|
||||
$h++;
|
||||
}
|
||||
}
|
||||
|
||||
$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);
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$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');
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'task_document';
|
||||
@ -467,11 +467,11 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
||||
// Date end
|
||||
print '<td align="center">';
|
||||
$taskstatic->projectstatus = $lines[$i]->projectstatus;
|
||||
$taskstatic->progress = $lines[$i]->progress;
|
||||
$taskstatic->fk_statut = $lines[$i]->status;
|
||||
$taskstatic->datee = $lines[$i]->date_end;
|
||||
print dol_print_date($lines[$i]->date_end,'dayhour');
|
||||
if ($taskstatic->hasDelay()) print img_warning($langs->trans("Late"));
|
||||
$taskstatic->progress = $lines[$i]->progress;
|
||||
$taskstatic->fk_statut = $lines[$i]->status;
|
||||
$taskstatic->datee = $lines[$i]->date_end;
|
||||
print dol_print_date($lines[$i]->date_end,'dayhour');
|
||||
if ($taskstatic->hasDelay()) print img_warning($langs->trans("Late"));
|
||||
print '</td>';
|
||||
|
||||
$plannedworkloadoutputformat='allhourmin';
|
||||
@ -531,9 +531,9 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
||||
|
||||
if ($level >= 0) // Call sublevels
|
||||
{
|
||||
$level++;
|
||||
if ($lines[$i]->id) projectLinesa($inc, $lines[$i]->id, $lines, $level, $var, $showproject, $taskrole, $projectsListId, $addordertick);
|
||||
$level--;
|
||||
$level++;
|
||||
if ($lines[$i]->id) projectLinesa($inc, $lines[$i]->id, $lines, $level, $var, $showproject, $taskrole, $projectsListId, $addordertick);
|
||||
$level--;
|
||||
}
|
||||
|
||||
$total_projectlinesa_spent += $lines[$i]->duration;
|
||||
@ -605,13 +605,15 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
||||
// 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
|
||||
{
|
||||
for ($i = 0 ; $i < $numlines ; $i++)
|
||||
{
|
||||
if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[]=$lines[$i];
|
||||
}
|
||||
for ($i = 0 ; $i < $numlines ; $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));
|
||||
$oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_BREAK_ON_PROJECT)?0:-1); // 0 to start break , -1 no break
|
||||
|
||||
//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++)
|
||||
{
|
||||
if ($parent == 0) $level = 0;
|
||||
@ -621,26 +623,26 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
||||
// If we want all or we have a role on task, we show it
|
||||
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
|
||||
if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
|
||||
{
|
||||
$lastprojectid=$lines[$i]->fk_project;
|
||||
if ($preselectedday)
|
||||
{
|
||||
$projectstatic->id = $lines[$i]->fk_project;
|
||||
}
|
||||
}
|
||||
if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
|
||||
{
|
||||
$lastprojectid=$lines[$i]->fk_project;
|
||||
if ($preselectedday)
|
||||
{
|
||||
$projectstatic->id = $lines[$i]->fk_project;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($workloadforid[$projectstatic->id]))
|
||||
{
|
||||
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
|
||||
$workloadforid[$projectstatic->id]=1;
|
||||
}
|
||||
}
|
||||
if (empty($workloadforid[$projectstatic->id]))
|
||||
{
|
||||
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
|
||||
$workloadforid[$projectstatic->id]=1;
|
||||
}
|
||||
}
|
||||
|
||||
$projectstatic->id=$lines[$i]->fk_project;
|
||||
$projectstatic->ref=$lines[$i]->projectref;
|
||||
@ -648,6 +650,31 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
||||
$projectstatic->public=$lines[$i]->public;
|
||||
|
||||
$taskstatic->id=$lines[$i]->id;
|
||||
$taskstatic->ref=($lines[$i]->ref?$lines[$i]->ref:$lines[$i]->id);
|
||||
$taskstatic->id=$lines[$i]->id;
|
||||
$taskstatic->label=$lines[$i]->label;
|
||||
$taskstatic->date_start=$lines[$i]->date_start;
|
||||
$taskstatic->date_end=$lines[$i]->date_end;
|
||||
|
||||
$thirdpartystatic->id=$lines[$i]->socid;
|
||||
$thirdpartystatic->name=$lines[$i]->thirdparty_name;
|
||||
$thirdpartystatic->email=$lines[$i]->thirdparty_email;
|
||||
|
||||
if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id))
|
||||
{
|
||||
print '<tr class="oddeven trforbreak">'."\n";
|
||||
print '<td colspan="11">';
|
||||
print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]);
|
||||
if ($projectstatic->title)
|
||||
{
|
||||
print ' - ';
|
||||
print $projectstatic->title;
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if ($oldprojectforbreak != -1) $oldprojectforbreak = $projectstatic->id;
|
||||
|
||||
print '<tr class="oddeven">'."\n";
|
||||
|
||||
@ -660,33 +687,23 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
||||
|
||||
// Project
|
||||
print "<td>";
|
||||
print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]);
|
||||
if ($oldprojectforbreak == -1) print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]);
|
||||
print "</td>";
|
||||
|
||||
// Thirdparty
|
||||
print '<td class="tdoverflowmax100">';
|
||||
if ($thirdpartystatic->id > 0) print $thirdpartystatic->getNomUrl(1, 'project', 10);
|
||||
print '</td>';
|
||||
|
||||
// Ref
|
||||
print '<td>';
|
||||
$taskstatic->ref=($lines[$i]->ref?$lines[$i]->ref:$lines[$i]->id);
|
||||
print $taskstatic->getNomUrl(1,'withproject');
|
||||
print '</td>';
|
||||
|
||||
if (! empty($conf->global->PROJECT_LINES_PERDAY_SHOW_THIRDPARTY))
|
||||
{
|
||||
// Thirdparty
|
||||
print '<td class="tdoverflowmax100">';
|
||||
$thirdpartystatic->id=$lines[$i]->socid;
|
||||
$thirdpartystatic->name=$lines[$i]->thirdparty_name;
|
||||
print $thirdpartystatic->getNomUrl(1, 'project', 10);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Label task
|
||||
print "<td>";
|
||||
print '<!-- Task id = '.$lines[$i]->id.' -->';
|
||||
for ($k = 0 ; $k < $level ; $k++) print " ";
|
||||
$taskstatic->id=$lines[$i]->id;
|
||||
$taskstatic->ref=$lines[$i]->label;
|
||||
$taskstatic->date_start=$lines[$i]->date_start;
|
||||
$taskstatic->date_end=$lines[$i]->date_end;
|
||||
print $taskstatic->getNomUrl(0,'withproject');
|
||||
print $taskstatic->getNomUrl(1, 'withproject', 'time');
|
||||
// Label task
|
||||
print '<br>';
|
||||
for ($k = 0 ; $k < $level ; $k++) print " ";
|
||||
print $taskstatic->label;
|
||||
//print "<br>";
|
||||
//for ($k = 0 ; $k < $level ; $k++) print " ";
|
||||
//print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0);
|
||||
@ -753,14 +770,14 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
||||
print '<td align="center" class="duration'.($cssonholiday?' '.$cssonholiday:'').'">';
|
||||
|
||||
$dayWorkLoad = $projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id];
|
||||
$alreadyspent='';
|
||||
if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($dayWorkLoad,'allhourmin');
|
||||
$alreadyspent='';
|
||||
if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($dayWorkLoad,'allhourmin');
|
||||
|
||||
$idw = 0;
|
||||
$idw = 0;
|
||||
|
||||
$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="hideonsmartphone"> + </span>';
|
||||
$tableCell.='<span class="hideonsmartphone"> + </span>';
|
||||
//$tableCell.=' ';
|
||||
$tableCell.=$form->select_duration($lines[$i]->id.'duration','',$disabledtask,'text',0,1);
|
||||
//$tableCell.=' <input type="submit" class="button"'.($disabledtask?' disabled':'').' value="'.$langs->trans("Add").'">';
|
||||
@ -776,7 +793,8 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
||||
|
||||
print '</td>';
|
||||
|
||||
print '<td align="right">';
|
||||
// Note
|
||||
print '<td align="center">';
|
||||
print '<textarea name="'.$lines[$i]->id.'note" rows="'.ROWS_2.'" id="'.$lines[$i]->id.'note"'.($disabledtask?' disabled="disabled"':'').'>';
|
||||
print '</textarea>';
|
||||
print '</td>';
|
||||
@ -800,8 +818,8 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
||||
$level++;
|
||||
if ($lines[$i]->id > 0)
|
||||
{
|
||||
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);
|
||||
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);
|
||||
}
|
||||
$level--;
|
||||
}
|
||||
@ -845,13 +863,15 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
||||
// 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
|
||||
{
|
||||
for ($i = 0 ; $i < $numlines ; $i++)
|
||||
{
|
||||
if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[]=$lines[$i];
|
||||
}
|
||||
for ($i = 0 ; $i < $numlines ; $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));
|
||||
|
||||
$oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_BREAK_ON_PROJECT)?0:-1); // 0 = start break, -1 = never break
|
||||
|
||||
for ($i = 0 ; $i < $numlines ; $i++)
|
||||
{
|
||||
@ -862,20 +882,20 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
||||
// If we want all or we have a role on task, we show it
|
||||
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
|
||||
if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
|
||||
{
|
||||
$lastprojectid=$lines[$i]->fk_project;
|
||||
$projectstatic->id = $lines[$i]->fk_project;
|
||||
}
|
||||
// Break on a new project
|
||||
if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
|
||||
{
|
||||
$lastprojectid=$lines[$i]->fk_project;
|
||||
$projectstatic->id = $lines[$i]->fk_project;
|
||||
}
|
||||
|
||||
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
|
||||
$workloadforid[$projectstatic->id]=1;
|
||||
}
|
||||
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
|
||||
$workloadforid[$projectstatic->id]=1;
|
||||
}
|
||||
|
||||
$projectstatic->id=$lines[$i]->fk_project;
|
||||
$projectstatic->ref=$lines[$i]->projectref;
|
||||
@ -883,6 +903,33 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
||||
$projectstatic->public=$lines[$i]->public;
|
||||
$projectstatic->thirdparty_name=$lines[$i]->thirdparty_name;
|
||||
|
||||
$taskstatic->id=$lines[$i]->id;
|
||||
$taskstatic->ref=($lines[$i]->ref?$lines[$i]->ref:$lines[$i]->id);
|
||||
$taskstatic->id=$lines[$i]->id;
|
||||
$taskstatic->label=$lines[$i]->label;
|
||||
$taskstatic->date_start=$lines[$i]->date_start;
|
||||
$taskstatic->date_end=$lines[$i]->date_end;
|
||||
|
||||
$thirdpartystatic->id=$lines[$i]->thirdparty_id;
|
||||
$thirdpartystatic->name=$lines[$i]->thirdparty_name;
|
||||
$thirdpartystatic->email=$lines[$i]->thirdparty_email;
|
||||
|
||||
if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id))
|
||||
{
|
||||
print '<tr class="oddeven trforbreak">'."\n";
|
||||
print '<td colspan="15">';
|
||||
print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]);
|
||||
if ($projectstatic->title)
|
||||
{
|
||||
print ' - ';
|
||||
print $projectstatic->title;
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if ($oldprojectforbreak != -1) $oldprojectforbreak = $projectstatic->id;
|
||||
|
||||
print '<tr class="oddeven">'."\n";
|
||||
|
||||
// User
|
||||
@ -894,35 +941,24 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
||||
|
||||
// Project
|
||||
print '<td class="nowrap">';
|
||||
print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]);
|
||||
if ($oldprojectforbreak == -1) print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]);
|
||||
print "</td>";
|
||||
|
||||
if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY))
|
||||
{
|
||||
// Thirdparty
|
||||
print '<td class="tdoverflowmax100">';
|
||||
$thirdpartystatic->id=$lines[$i]->thirdparty_id;
|
||||
$thirdpartystatic->name=$lines[$i]->thirdparty_name;
|
||||
print $thirdpartystatic->getNomUrl(1, 'project');
|
||||
print '</td>';
|
||||
}
|
||||
// Thirdparty
|
||||
print '<td class="tdoverflowmax100">';
|
||||
if ($thirdpartystatic->id > 0) print $thirdpartystatic->getNomUrl(1, 'project');
|
||||
print '</td>';
|
||||
|
||||
// Ref
|
||||
print '<td class="nowrap">';
|
||||
$taskstatic->id=$lines[$i]->id;
|
||||
$taskstatic->ref=($lines[$i]->ref?$lines[$i]->ref:$lines[$i]->id);
|
||||
print $taskstatic->getNomUrl(1, 'withproject', 'time');
|
||||
print '</td>';
|
||||
|
||||
// Label task
|
||||
print "<td>";
|
||||
print '<!-- Task id = '.$lines[$i]->id.' -->';
|
||||
for ($k = 0 ; $k < $level ; $k++) print " ";
|
||||
$taskstatic->id=$lines[$i]->id;
|
||||
$taskstatic->ref=$lines[$i]->label;
|
||||
$taskstatic->date_start=$lines[$i]->date_start;
|
||||
$taskstatic->date_end=$lines[$i]->date_end;
|
||||
print $taskstatic->getNomUrl(0, 'withproject', 'time');
|
||||
print $taskstatic->getNomUrl(1, 'withproject', 'time');
|
||||
// Label task
|
||||
print '<br>';
|
||||
for ($k = 0 ; $k < $level ; $k++) print " ";
|
||||
//print $taskstatic->getNomUrl(0, 'withproject', 'time');
|
||||
print $taskstatic->label;
|
||||
//print "<br>";
|
||||
//for ($k = 0 ; $k < $level ; $k++) print " ";
|
||||
//print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0);
|
||||
@ -979,7 +1015,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
||||
// Fields to show current time
|
||||
$tableCell=''; $modeinput='hours';
|
||||
for ($idw = 0; $idw < 7; $idw++)
|
||||
{
|
||||
{
|
||||
$tmpday=dol_time_plus_duree($firstdaytoshow, $idw, 'd');
|
||||
|
||||
$cssonholiday='';
|
||||
@ -988,28 +1024,28 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
||||
elseif (! $isavailable[$tmpday]['afternoon']) $cssonholiday.='onholidayafternoon ';
|
||||
|
||||
$tmparray=dol_getdate($tmpday);
|
||||
$dayWorkLoad = $projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id];
|
||||
$alreadyspent='';
|
||||
if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($dayWorkLoad,'allhourmin');
|
||||
$alttitle=$langs->trans("AddHereTimeSpentForDay",$tmparray['day'],$tmparray['mon']);
|
||||
$dayWorkLoad = $projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id];
|
||||
$alreadyspent='';
|
||||
if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($dayWorkLoad,'allhourmin');
|
||||
$alttitle=$langs->trans("AddHereTimeSpentForDay",$tmparray['day'],$tmparray['mon']);
|
||||
|
||||
$tableCell ='<td align="center" class="hide'.$idw.($cssonholiday?' '.$cssonholiday:'').'">';
|
||||
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>';
|
||||
//$placeholder=' placeholder="00:00"';
|
||||
$placeholder='';
|
||||
//$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.=' onkeypress="return regexEvent(this,event,\'timeChar\')"';
|
||||
$tableCell.=' onkeyup="updateTotal('.$idw.',\''.$modeinput.'\')"';
|
||||
$tableCell.=' onblur="regexEvent(this,event,\''.$modeinput.'\'); updateTotal('.$idw.',\''.$modeinput.'\')" />';
|
||||
$tableCell.='</td>';
|
||||
print $tableCell;
|
||||
}
|
||||
$tableCell ='<td align="center" class="hide'.$idw.($cssonholiday?' '.$cssonholiday:'').'">';
|
||||
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>';
|
||||
//$placeholder=' placeholder="00:00"';
|
||||
$placeholder='';
|
||||
//$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.=' onkeypress="return regexEvent(this,event,\'timeChar\')"';
|
||||
$tableCell.=' onkeyup="updateTotal('.$idw.',\''.$modeinput.'\')"';
|
||||
$tableCell.=' onblur="regexEvent(this,event,\''.$modeinput.'\'); updateTotal('.$idw.',\''.$modeinput.'\')" />';
|
||||
$tableCell.='</td>';
|
||||
print $tableCell;
|
||||
}
|
||||
|
||||
// Warning
|
||||
// Warning
|
||||
print '<td align="right">';
|
||||
if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("UserIsNotContactOfProject"));
|
||||
else if ($disabledtask)
|
||||
@ -1021,7 +1057,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
// Call to show task with a lower level (task under the current task)
|
||||
@ -1029,8 +1065,8 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
||||
$level++;
|
||||
if ($lines[$i]->id > 0)
|
||||
{
|
||||
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);
|
||||
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);
|
||||
}
|
||||
$level--;
|
||||
}
|
||||
@ -1100,7 +1136,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
|
||||
$projectstatic=new Project($db);
|
||||
$thirdpartystatic=new Societe($db);
|
||||
$thirdpartystatic=new Societe($db);
|
||||
|
||||
$sortfield='';
|
||||
$sortorder='';
|
||||
@ -1161,12 +1197,12 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
||||
$resql = $db->query($sql1);
|
||||
if ($resql)
|
||||
{
|
||||
$i=0;
|
||||
$i=0;
|
||||
$num = $db->num_rows($resql);
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
$arrayidofprojects[$objp->projectid]=$objp->projectid;
|
||||
$arrayidofprojects[$objp->projectid]=$objp->projectid;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
@ -1194,22 +1230,22 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
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);
|
||||
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
||||
{
|
||||
print_liste_field_titre("OpportunityAmount","","","","",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("OpportunityStatus","","","","",'align="right"',$sortfield,$sortorder);
|
||||
}
|
||||
if (empty($conf->global->PROJECT_HIDE_TASKS))
|
||||
{
|
||||
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('declaredprogress', $hiddenfields)) print_liste_field_titre("ProgressDeclared","","","","",'align="right"',$sortfield,$sortorder);
|
||||
}
|
||||
print_liste_field_titre("Status","","","","",'align="right"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
print '<tr class="liste_titre">';
|
||||
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);
|
||||
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
||||
{
|
||||
print_liste_field_titre("OpportunityAmount","","","","",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("OpportunityStatus","","","","",'align="right"',$sortfield,$sortorder);
|
||||
}
|
||||
if (empty($conf->global->PROJECT_HIDE_TASKS))
|
||||
{
|
||||
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('declaredprogress', $hiddenfields)) print_liste_field_titre("ProgressDeclared","","","","",'align="right"',$sortfield,$sortorder);
|
||||
}
|
||||
print_liste_field_titre("Status","","","","",'align="right"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
@ -1223,11 +1259,11 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
||||
$userAccess = $projectstatic->restrictedProjectArea($user);
|
||||
if ($userAccess >= 0)
|
||||
{
|
||||
$projectstatic->ref=$objp->ref;
|
||||
$projectstatic->statut = $objp->status;
|
||||
$projectstatic->title = $objp->title;
|
||||
$projectstatic->datee = $db->jdate($objp->datee);
|
||||
$projectstatic->dateo = $db->jdate($objp->dateo);
|
||||
$projectstatic->ref=$objp->ref;
|
||||
$projectstatic->statut = $objp->status;
|
||||
$projectstatic->title = $objp->title;
|
||||
$projectstatic->datee = $db->jdate($objp->datee);
|
||||
$projectstatic->dateo = $db->jdate($objp->dateo);
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
@ -1238,41 +1274,41 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
||||
print '<td>';
|
||||
if ($objp->fk_soc > 0)
|
||||
{
|
||||
$thirdpartystatic->id=$objp->fk_soc;
|
||||
$thirdpartystatic->ref=$objp->socname;
|
||||
$thirdpartystatic->name=$objp->socname;
|
||||
print $thirdpartystatic->getNomUrl(1);
|
||||
$thirdpartystatic->id=$objp->fk_soc;
|
||||
$thirdpartystatic->ref=$objp->socname;
|
||||
$thirdpartystatic->name=$objp->socname;
|
||||
print $thirdpartystatic->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
||||
{
|
||||
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 align="right">';
|
||||
$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>';
|
||||
}
|
||||
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;
|
||||
$total_plannedworkload+=$plannedworkload;
|
||||
if (! in_array('plannedworkload', $hiddenfields))
|
||||
{
|
||||
print '<td align="right">'.($plannedworkload?convertSecondToTime($plannedworkload):'').'</td>';
|
||||
}
|
||||
if (! in_array('declaredprogress', $hiddenfields))
|
||||
{
|
||||
$declaredprogressworkload=$objp->declared_progess_workload;
|
||||
$total_declaredprogressworkload+=$declaredprogressworkload;
|
||||
print '<td align="right">';
|
||||
//print $objp->planned_workload.'-'.$objp->declared_progess_workload."<br>";
|
||||
print ($plannedworkload?round(100*$declaredprogressworkload/$plannedworkload,0).'%':'');
|
||||
print '</td>';
|
||||
}
|
||||
$plannedworkload=$objp->planned_workload;
|
||||
$total_plannedworkload+=$plannedworkload;
|
||||
if (! in_array('plannedworkload', $hiddenfields))
|
||||
{
|
||||
print '<td align="right">'.($plannedworkload?convertSecondToTime($plannedworkload):'').'</td>';
|
||||
}
|
||||
if (! in_array('declaredprogress', $hiddenfields))
|
||||
{
|
||||
$declaredprogressworkload=$objp->declared_progess_workload;
|
||||
$total_declaredprogressworkload+=$declaredprogressworkload;
|
||||
print '<td align="right">';
|
||||
//print $objp->planned_workload.'-'.$objp->declared_progess_workload."<br>";
|
||||
print ($plannedworkload?round(100*$declaredprogressworkload/$plannedworkload,0).'%':'');
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
|
||||
print '<td align="right">'.$projectstatic->getLibStatut(3).'</td>';
|
||||
@ -1295,12 +1331,12 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
||||
}
|
||||
if (empty($conf->global->PROJECT_HIDE_TASKS))
|
||||
{
|
||||
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('declaredprogress', $hiddenfields)) print '<td class="liste_total" align="right">'.($total_plannedworkload?round(100*$total_declaredprogressworkload/$total_plannedworkload,0).'%':'').'</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('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 '</tr>';
|
||||
print '</tr>';
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ function dol_hash($chain,$type=0)
|
||||
if ($type == 1) return sha1($chain);
|
||||
else if ($type == 2) return sha1(md5($chain));
|
||||
else if ($type == 3) return md5($chain);
|
||||
else if ($type == 4) return '{md5}'.base64_encode(mhash(MHASH_MD5,$chain)); // For OpenLdap with md5
|
||||
else if ($type == 4) return '{md5}'.base64_encode(mhash(MHASH_MD5,$chain)); // For OpenLdap with md5 (based on an unencrypted password in base)
|
||||
else if (! empty($conf->global->MAIN_SECURITY_HASH_ALGO) && $conf->global->MAIN_SECURITY_HASH_ALGO == 'sha1') return sha1($chain);
|
||||
else if (! empty($conf->global->MAIN_SECURITY_HASH_ALGO) && $conf->global->MAIN_SECURITY_HASH_ALGO == 'sha1md5') return sha1(md5($chain));
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -31,59 +31,59 @@
|
||||
*/
|
||||
function dolWebsiteOutput($content)
|
||||
{
|
||||
global $db, $langs, $conf, $user;
|
||||
global $dolibarr_main_url_root, $dolibarr_main_data_root;
|
||||
global $db, $langs, $conf, $user;
|
||||
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
|
||||
$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=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||
// Define $urlwithroot
|
||||
$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=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
|
||||
{
|
||||
$symlinktomediaexists=1;
|
||||
if (! defined('USEDOLIBARRSERVER')) // REPLACEMENT OF LINKS When page called from virtual host
|
||||
{
|
||||
$symlinktomediaexists=1;
|
||||
|
||||
// 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" />
|
||||
// become
|
||||
// <img alt="" src="'.$urlwithroot.'/medias/image/ldestailleur_166x166.jpg" style="height:166px; width:166px" />
|
||||
$nbrep=0;
|
||||
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('/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)modulepart=medias([^\)]*)file=([^\)]*)(["\']?\))/', '\1'.$urlwithroot.'/viewimage.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
|
||||
}
|
||||
else
|
||||
{
|
||||
$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);
|
||||
}
|
||||
}
|
||||
else // REPLACEMENT OF LINKS When page called from dolibarr server
|
||||
{
|
||||
global $website;
|
||||
$nbrep=0;
|
||||
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('/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)modulepart=medias([^\)]*)file=([^\)]*)(["\']?\))/', '\1'.$urlwithroot.'/viewimage.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
|
||||
}
|
||||
else
|
||||
{
|
||||
$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);
|
||||
}
|
||||
}
|
||||
else // REPLACEMENT OF LINKS When page called from dolibarr server
|
||||
{
|
||||
global $website;
|
||||
|
||||
// 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);
|
||||
// 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);
|
||||
// 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);
|
||||
// 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);
|
||||
|
||||
// Fix relative link /document.php with correct URL after the DOL_URL_ROOT: ...href="/document.php?modulepart="
|
||||
$content=preg_replace('/(href=")(\/?document\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1'.DOL_URL_ROOT.'\2\3"', $content, -1, $nbrep);
|
||||
// Fix relative link /viewimage.php with correct URL after the DOL_URL_ROOT: ...href="/viewimage.php?modulepart="
|
||||
$content=preg_replace('/(href=")(\/?viewimage\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1'.DOL_URL_ROOT.'\2\3"', $content, -1, $nbrep);
|
||||
// Fix relative link /document.php with correct URL after the DOL_URL_ROOT: ...href="/document.php?modulepart="
|
||||
$content=preg_replace('/(href=")(\/?document\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1'.DOL_URL_ROOT.'\2\3"', $content, -1, $nbrep);
|
||||
// Fix relative link /viewimage.php with correct URL after the DOL_URL_ROOT: ...href="/viewimage.php?modulepart="
|
||||
$content=preg_replace('/(href=")(\/?viewimage\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1'.DOL_URL_ROOT.'\2\3"', $content, -1, $nbrep);
|
||||
|
||||
// Fix relative link into medias with correct URL after the DOL_URL_ROOT: ../url("medias/
|
||||
$content=preg_replace('/url\((["\']?)medias\//', 'url(\1'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
|
||||
}
|
||||
// Fix relative link into medias with correct URL after the DOL_URL_ROOT: ../url("medias/
|
||||
$content=preg_replace('/url\((["\']?)medias\//', 'url(\1'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
|
||||
}
|
||||
|
||||
dol_syslog("dolWebsiteOutput end");
|
||||
dol_syslog("dolWebsiteOutput end");
|
||||
|
||||
print $content;
|
||||
print $content;
|
||||
}
|
||||
|
||||
|
||||
@ -108,7 +108,7 @@ function dolWebsiteReplacementOfLinks($website, $content)
|
||||
$content = preg_replace('/url\((["\']?)medias\//', 'url(\1'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
|
||||
|
||||
// <img src="image.png... => <img src="dolibarr/viewimage.php/modulepart=medias&file=image.png...
|
||||
$content = preg_replace('/(<img.*src=")(?!(http|'.preg_quote(DOL_URL_ROOT,'/').'\/viewimage))/', '\1'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
|
||||
$content = preg_replace('/(<img[^>]*src=")(?!(http|'.preg_quote(DOL_URL_ROOT,'/').'\/viewimage))/', '\1'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
|
||||
|
||||
return $content;
|
||||
}
|
||||
@ -277,3 +277,142 @@ function exportWebSite($website)
|
||||
return $filename;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Download all images found into page content $tmp.
|
||||
* If $modifylinks is set, links to images will be replace with a link to viewimage wrapper.
|
||||
*
|
||||
* @param Website $object Object website
|
||||
* @param WebsitePage $objectpage Object website page
|
||||
* @param string $urltograb URL to grab (exemple: http://www.nltechno.com/ or http://www.nltechno.com/dir1/ or http://www.nltechno.com/dir1/mapage1)
|
||||
* @param string $tmp Content to parse
|
||||
* @param string $action Var $action
|
||||
* @param string $modifylinks 0=Do not modify content, 1=Replace links with a link to viewimage
|
||||
* @return void
|
||||
*/
|
||||
function getAllImages($object, $objectpage, $urltograb, &$tmp, &$action, $modifylinks=0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$error=0;
|
||||
|
||||
$alreadygrabbed=array();
|
||||
|
||||
if (preg_match('/\/$/', $urltograb)) $urltograb.='.';
|
||||
$urltograb = dirname($urltograb); // So urltograb is now http://www.nltechno.com or http://www.nltechno.com/dir1
|
||||
|
||||
preg_match_all('/<img([^\.\/]+)src="([^>"]+)"([^>]*)>/i', $tmp, $regs);
|
||||
|
||||
foreach ($regs[0] as $key => $val)
|
||||
{
|
||||
if (preg_match('/^data:image/i', $regs[2][$key])) continue; // We do nothing for such images
|
||||
|
||||
$urltograbbis = $urltograb.(preg_match('/^\//', $regs[2][$key])?'':'/').$regs[2][$key];
|
||||
$linkwithoutdomain = $regs[2][$key];
|
||||
$filetosave = $conf->medias->multidir_output[$conf->entity].'/image/'.$object->ref.'/'.$objectpage->pageurl.(preg_match('/^\//', $regs[2][$key])?'':'/').$regs[2][$key];
|
||||
if (preg_match('/^http/', $regs[2][$key]))
|
||||
{
|
||||
$urltograbbis = $regs[2][$key];
|
||||
$linkwithoutdomain = preg_replace('/^https?:\/\/[^\/]+\//i', '', $regs[2][$key]);
|
||||
$filetosave = $conf->medias->multidir_output[$conf->entity].'/image/'.$object->ref.'/'.$objectpage->pageurl.(preg_match('/^\//', $linkwithoutdomain)?'':'/').$linkwithoutdomain;
|
||||
}
|
||||
|
||||
$filename = 'image/'.$object->ref.'/'.$objectpage->pageurl.(preg_match('/^\//', $linkwithoutdomain)?'':'/').$linkwithoutdomain;
|
||||
|
||||
// Clean the aa/bb/../cc into aa/cc
|
||||
$filetosave = preg_replace('/\/[^\/]+\/\.\./', '', $filetosave);
|
||||
$filename = preg_replace('/\/[^\/]+\/\.\./', '', $filename);
|
||||
|
||||
//var_dump($filetosave);
|
||||
//var_dump($filename);
|
||||
//exit;
|
||||
|
||||
if (empty($alreadygrabbed[$urltograbbis]))
|
||||
{
|
||||
$tmpgeturl = getURLContent($urltograbbis);
|
||||
if ($tmpgeturl['curl_error_no'])
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($tmpgeturl['curl_error_msg'], null, 'errors');
|
||||
$action='create';
|
||||
}
|
||||
else
|
||||
{
|
||||
$alreadygrabbed[$urltograbbis]=1; // Track that file was alreay grabbed.
|
||||
|
||||
dol_mkdir(dirname($filetosave));
|
||||
|
||||
$fp = fopen($filetosave, "w");
|
||||
fputs($fp, $tmpgeturl['content']);
|
||||
fclose($fp);
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($filetosave, octdec($conf->global->MAIN_UMASK));
|
||||
}
|
||||
}
|
||||
|
||||
if ($modifylinks)
|
||||
{
|
||||
$tmp = preg_replace('/'.preg_quote($regs[0][$key],'/').'/i', '<img'.$regs[1][$key].'src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file='.$filename.'"'.$regs[3][$key].'>', $tmp);
|
||||
}
|
||||
}
|
||||
|
||||
// Search X in "background...url(X)"
|
||||
preg_match_all('/background([^\.\/\(;]+)url\([\"\']?([^\)\"\']*)[\"\']?\)/i', $tmp, $regs);
|
||||
|
||||
foreach ($regs[0] as $key => $val)
|
||||
{
|
||||
if (preg_match('/^data:image/i', $regs[2][$key])) continue; // We do nothing for such images
|
||||
|
||||
$urltograbbis = $urltograb.(preg_match('/^\//', $regs[2][$key])?'':'/').$regs[2][$key];
|
||||
|
||||
$linkwithoutdomain = $regs[2][$key];
|
||||
$filetosave = $conf->medias->multidir_output[$conf->entity].'/image/'.$object->ref.'/'.$objectpage->pageurl.(preg_match('/^\//', $regs[2][$key])?'':'/').$regs[2][$key];
|
||||
|
||||
if (preg_match('/^http/', $regs[2][$key]))
|
||||
{
|
||||
$urltograbbis = $regs[2][$key];
|
||||
$linkwithoutdomain = preg_replace('/^https?:\/\/[^\/]+\//i', '', $regs[2][$key]);
|
||||
$filetosave = $conf->medias->multidir_output[$conf->entity].'/image/'.$object->ref.'/'.$objectpage->pageurl.(preg_match('/^\//', $linkwithoutdomain)?'':'/').$linkwithoutdomain;
|
||||
}
|
||||
|
||||
$filename = 'image/'.$object->ref.'/'.$objectpage->pageurl.(preg_match('/^\//', $linkwithoutdomain)?'':'/').$linkwithoutdomain;
|
||||
|
||||
// Clean the aa/bb/../cc into aa/cc
|
||||
$filetosave = preg_replace('/\/[^\/]+\/\.\./', '', $filetosave);
|
||||
$filename = preg_replace('/\/[^\/]+\/\.\./', '', $filename);
|
||||
|
||||
//var_dump($filetosave);
|
||||
//var_dump($filename);
|
||||
//exit;
|
||||
|
||||
if (empty($alreadygrabbed[$urltograbbis]))
|
||||
{
|
||||
$tmpgeturl = getURLContent($urltograbbis);
|
||||
if ($tmpgeturl['curl_error_no'])
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($tmpgeturl['curl_error_msg'], null, 'errors');
|
||||
$action='create';
|
||||
}
|
||||
else
|
||||
{
|
||||
$alreadygrabbed[$urltograbbis]=1; // Track that file was alreay grabbed.
|
||||
|
||||
dol_mkdir(dirname($filetosave));
|
||||
|
||||
$fp = fopen($filetosave, "w");
|
||||
fputs($fp, $tmpgeturl['content']);
|
||||
fclose($fp);
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($filetosave, octdec($conf->global->MAIN_UMASK));
|
||||
}
|
||||
}
|
||||
|
||||
if ($modifylinks)
|
||||
{
|
||||
$tmp = preg_replace('/'.preg_quote($regs[0][$key],'/').'/i', 'background'.$regs[1][$key].'url("'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file='.$filename.'")', $tmp);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -98,12 +98,12 @@ function check_user_password_ldap($usertotest,$passwordtotest,$entitytotest)
|
||||
$resultFetchLdapUser=0;
|
||||
|
||||
// Define $userSearchFilter
|
||||
$userSearchFilter = "";
|
||||
if (empty($dolibarr_main_auth_ldap_filter)) {
|
||||
$userSearchFilter = "(" . $ldapuserattr . "=" . $usertotest . ")";
|
||||
} else {
|
||||
$userSearchFilter = str_replace('%1%', $usertotest, $dolibarr_main_auth_ldap_filter);
|
||||
}
|
||||
$userSearchFilter = "";
|
||||
if (empty($dolibarr_main_auth_ldap_filter)) {
|
||||
$userSearchFilter = "(" . $ldapuserattr . "=" . $usertotest . ")";
|
||||
} else {
|
||||
$userSearchFilter = str_replace('%1%', $usertotest, $dolibarr_main_auth_ldap_filter);
|
||||
}
|
||||
|
||||
// If admin login provided
|
||||
// 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
|
||||
{
|
||||
if ($ldapdebug) print "DEBUG: ".$ldap->error."<br>\n";
|
||||
if ($ldapdebug) print "DEBUG: ".$ldap->error."<br>\n";
|
||||
}
|
||||
$ldap->close();
|
||||
}
|
||||
@ -135,15 +135,15 @@ function check_user_password_ldap($usertotest,$passwordtotest,$entitytotest)
|
||||
// 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
|
||||
// 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
|
||||
// dn detected into ldapUserDN.
|
||||
if ($resultFetchLdapUser && !empty($ldap->ldapUserDN)) $ldap->searchUser = $ldap->ldapUserDN;
|
||||
$ldap->searchPassword=$passwordtotest;
|
||||
$ldap->searchPassword=$passwordtotest;
|
||||
|
||||
// Test with this->seachUser and this->searchPassword
|
||||
//print $resultFetchLdapUser."-".$ldap->ldapUserDN."-".$ldap->searchUser.'-'.$ldap->searchPassword;exit;
|
||||
$result=$ldap->connect_bind();
|
||||
//print $resultFetchLdapUser."-".$ldap->ldapUserDN."-".$ldap->searchUser.'-'.$ldap->searchPassword;exit;
|
||||
$result=$ldap->connect_bind();
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result == 2) // Connection is ok for user/pass into LDAP
|
||||
@ -214,7 +214,7 @@ function check_user_password_ldap($usertotest,$passwordtotest,$entitytotest)
|
||||
}
|
||||
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 :
|
||||
** (for iPlanet, other servers may differ)
|
||||
** 19 - Account locked out (too many invalid login attempts)
|
||||
@ -222,13 +222,13 @@ function check_user_password_ldap($usertotest,$passwordtotest,$entitytotest)
|
||||
** 49 - Wrong password
|
||||
** 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."'");
|
||||
if (is_resource($ldap->connection)) // If connection ok but bind ko
|
||||
{
|
||||
$ldap->ldapErrorCode = ldap_errno($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 Authentification ko failed to connect to LDAP for '".$usertotest."'");
|
||||
if (is_resource($ldap->connection)) // If connection ok but bind ko
|
||||
{
|
||||
$ldap->ldapErrorCode = ldap_errno($ldap->connection);
|
||||
$ldap->ldapErrorText = ldap_error($ldap->connection);
|
||||
dol_syslog("functions_ldap::check_user_password_ldap ".$ldap->ldapErrorCode." ".$ldap->ldapErrorText);
|
||||
}
|
||||
sleep(2); // Anti brut force protection
|
||||
$langs->load('main');
|
||||
$langs->load('other');
|
||||
|
||||
@ -182,7 +182,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
|
||||
else $classname = 'class="tmenu"';
|
||||
$idsel='accountancy';
|
||||
|
||||
$menu->add('/accountancy/index.php?mainmenu=accountancy&leftmenu=', $langs->trans("Accountancy"), 0, $showmode, $atarget, "accountancy", '', 50, $id, $idsel, $classname);
|
||||
$menu->add('/accountancy/index.php?mainmenu=accountancy&leftmenu=', $langs->trans("Accountancy"), 0, $showmode, $atarget, "accountancy", '', 52, $id, $idsel, $classname);
|
||||
}
|
||||
|
||||
|
||||
|
||||
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
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDb $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
global $conf,$langs;
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDb $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
$this->db = $db;
|
||||
$this->name = "cerfafr";
|
||||
$this->description = $langs->trans('DonationsReceiptModel').' - fr_FR - Cerfa 11580*03';
|
||||
$this->db = $db;
|
||||
$this->name = "cerfafr";
|
||||
$this->description = $langs->trans('DonationsReceiptModel').' - fr_FR - Cerfa 11580*03';
|
||||
|
||||
// Dimension page for size A4
|
||||
$this->type = 'html';
|
||||
}
|
||||
// Dimension page for size A4
|
||||
$this->type = 'html';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -64,16 +64,16 @@ class html_cerfafr extends ModeleDon
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Write the object to document file to disk
|
||||
*
|
||||
* @param Don $don Donation object
|
||||
* @param Translate $outputlangs Lang object for output language
|
||||
/**
|
||||
* Write the object to document file to disk
|
||||
*
|
||||
* @param Don $don Donation object
|
||||
* @param Translate $outputlangs Lang object for output language
|
||||
* @param string $currency Currency code
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function write_file($don,$outputlangs,$currency='')
|
||||
{
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function write_file($don,$outputlangs,$currency='')
|
||||
{
|
||||
global $user,$conf,$langs,$mysoc;
|
||||
|
||||
$now=dol_now();
|
||||
@ -91,13 +91,13 @@ class html_cerfafr extends ModeleDon
|
||||
$currency = !empty($currency) ? $currency : $conf->currency;
|
||||
|
||||
if (! empty($conf->don->dir_output))
|
||||
{
|
||||
{
|
||||
// Definition of the object don (for upward compatibility)
|
||||
if (! is_object($don))
|
||||
{
|
||||
$don = new Don($this->db);
|
||||
$ret=$don->fetch($id);
|
||||
$id=$don->id;
|
||||
if (! is_object($don))
|
||||
{
|
||||
$don = new Don($this->db);
|
||||
$ret=$don->fetch($id);
|
||||
$id=$don->id;
|
||||
}
|
||||
|
||||
// Definition of $dir and $file
|
||||
@ -113,27 +113,27 @@ class html_cerfafr extends ModeleDon
|
||||
$file = $dir . "/" . $donref . ".html";
|
||||
}
|
||||
|
||||
if (! file_exists($dir))
|
||||
{
|
||||
if (dol_mkdir($dir) < 0)
|
||||
{
|
||||
$this->error=$langs->trans("ErrorCanNotCreateDir",$dir);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (! file_exists($dir))
|
||||
{
|
||||
if (dol_mkdir($dir) < 0)
|
||||
{
|
||||
$this->error=$langs->trans("ErrorCanNotCreateDir",$dir);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists($dir))
|
||||
{
|
||||
$formclass = new Form($this->db);
|
||||
if (file_exists($dir))
|
||||
{
|
||||
$formclass = new Form($this->db);
|
||||
|
||||
// This is not the proper way to do it but $formclass->form_modes_reglement
|
||||
// prints the translation instead of returning it
|
||||
if ($don->modepaiementid)
|
||||
{
|
||||
$formclass->load_cache_types_paiements();
|
||||
$paymentmode = $formclass->cache_types_paiements[$don->modepaiementid]['label'];
|
||||
}
|
||||
else $paymentmode = '';
|
||||
// This is not the proper way to do it but $formclass->form_modes_reglement
|
||||
// prints the translation instead of returning it
|
||||
if ($don->modepaiementid)
|
||||
{
|
||||
$formclass->load_cache_types_paiements();
|
||||
$paymentmode = $formclass->cache_types_paiements[$don->modepaiementid]['label'];
|
||||
}
|
||||
else $paymentmode = '';
|
||||
|
||||
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>';
|
||||
@ -160,52 +160,52 @@ class html_cerfafr extends ModeleDon
|
||||
}
|
||||
*/
|
||||
|
||||
// Define contents
|
||||
$donmodel=DOL_DOCUMENT_ROOT ."/core/modules/dons/html_cerfafr.html";
|
||||
$form = implode('', file($donmodel));
|
||||
$form = str_replace('__REF__',$don->id,$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('__AMOUNT__',$don->amount,$form);
|
||||
// Define contents
|
||||
$donmodel=DOL_DOCUMENT_ROOT ."/core/modules/dons/html_cerfafr.html";
|
||||
$form = implode('', file($donmodel));
|
||||
$form = str_replace('__REF__',$don->id,$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('__AMOUNT__',$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('__CURRENCYCODE__',$conf->currency,$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_ZIP__',$mysoc->zip,$form);
|
||||
$form = str_replace('__MAIN_INFO_SOCIETE_TOWN__',$mysoc->town,$form);
|
||||
$form = str_replace('__CURRENCY__',$outputlangs->transnoentitiesnoconv("Currency".$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_ADDRESS__',$mysoc->address,$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_OBJECT__',$mysoc->object,$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_STATUT__',$don->statut,$form);
|
||||
$form = str_replace('__DONATOR_ADDRESS__',$don->address,$form);
|
||||
$form = str_replace('__DONATOR_ZIP__',$don->zip,$form);
|
||||
$form = str_replace('__DONATOR_TOWN__',$don->town,$form);
|
||||
$form = str_replace('__PAYMENTMODE_LIB__ ', $paymentmode,$form);
|
||||
$form = str_replace('__DONATOR_ADDRESS__',$don->address,$form);
|
||||
$form = str_replace('__DONATOR_ZIP__',$don->zip,$form);
|
||||
$form = str_replace('__DONATOR_TOWN__',$don->town,$form);
|
||||
$form = str_replace('__PAYMENTMODE_LIB__ ', $paymentmode,$form);
|
||||
$form = str_replace('__ModePaiement__', $ModePaiement,$form);
|
||||
$form = str_replace('__NOW__',dol_print_date($now,'day',false,$outputlangs),$form);
|
||||
$form = str_replace('__DonationRef__',$outputlangs->trans("DonationRef"),$form);
|
||||
$form = str_replace('__NOW__',dol_print_date($now,'day',false,$outputlangs),$form);
|
||||
$form = str_replace('__DonationRef__',$outputlangs->trans("DonationRef"),$form);
|
||||
$form = str_replace('__DonationTitle__',$outputlangs->trans("DonationTitle"),$form);
|
||||
$form = str_replace('__DonationReceipt__',$outputlangs->trans("DonationReceipt"),$form);
|
||||
$form = str_replace('__DonationRecipient__',$outputlangs->trans("DonationRecipient"),$form);
|
||||
$form = str_replace('__DonationDatePayment__',$outputlangs->trans("DonationDatePayment"),$form);
|
||||
$form = str_replace('__DonationReceipt__',$outputlangs->trans("DonationReceipt"),$form);
|
||||
$form = str_replace('__DonationRecipient__',$outputlangs->trans("DonationRecipient"),$form);
|
||||
$form = str_replace('__DonationDatePayment__',$outputlangs->trans("DonationDatePayment"),$form);
|
||||
$form = str_replace('__PaymentMode__',$outputlangs->trans("PaymentMode"),$form);
|
||||
// $form = str_replace('__CodeDon__',$CodeDon,$form);
|
||||
$form = str_replace('__Name__',$outputlangs->trans("Name"),$form);
|
||||
$form = str_replace('__Address__',$outputlangs->trans("Address"),$form);
|
||||
$form = str_replace('__Zip__',$outputlangs->trans("Zip"),$form);
|
||||
$form = str_replace('__Town__',$outputlangs->trans("Town"),$form);
|
||||
$form = str_replace('__Name__',$outputlangs->trans("Name"),$form);
|
||||
$form = str_replace('__Address__',$outputlangs->trans("Address"),$form);
|
||||
$form = str_replace('__Zip__',$outputlangs->trans("Zip"),$form);
|
||||
$form = str_replace('__Town__',$outputlangs->trans("Town"),$form);
|
||||
$form = str_replace('__Object__',$outputlangs->trans("Object"),$form);
|
||||
$form = str_replace('__Donor__',$outputlangs->trans("Donor"),$form);
|
||||
$form = str_replace('__Date__',$outputlangs->trans("Date"),$form);
|
||||
$form = str_replace('__Signature__',$outputlangs->trans("Signature"),$form);
|
||||
$form = str_replace('__Message__',$outputlangs->trans("Message"),$form);
|
||||
$form = str_replace('__IConfirmDonationReception__',$outputlangs->trans("IConfirmDonationReception"),$form);
|
||||
$form = str_replace('__DonationMessage__',$conf->global->DONATION_MESSAGE,$form);
|
||||
$form = str_replace('__Donor__',$outputlangs->trans("Donor"),$form);
|
||||
$form = str_replace('__Date__',$outputlangs->trans("Date"),$form);
|
||||
$form = str_replace('__Signature__',$outputlangs->trans("Signature"),$form);
|
||||
$form = str_replace('__Message__',$outputlangs->trans("Message"),$form);
|
||||
$form = str_replace('__IConfirmDonationReception__',$outputlangs->trans("IConfirmDonationReception"),$form);
|
||||
$form = str_replace('__DonationMessage__',$conf->global->DONATION_MESSAGE,$form);
|
||||
|
||||
$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);
|
||||
|
||||
$frencheligibility='';
|
||||
@ -252,176 +252,176 @@ class html_cerfafr extends ModeleDon
|
||||
$form = str_replace('__ARTICLE885__',$art885,$form);
|
||||
|
||||
// Save file on disk
|
||||
dol_syslog("html_cerfafr::write_file $file");
|
||||
$handle=fopen($file,"w");
|
||||
fwrite($handle,$form);
|
||||
fclose($handle);
|
||||
dol_syslog("html_cerfafr::write_file $file");
|
||||
$handle=fopen($file,"w");
|
||||
fwrite($handle,$form);
|
||||
fclose($handle);
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
$this->result = array('fullpath'=>$file);
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$langs->trans("ErrorCanNotCreateDir",$dir);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$langs->trans("ErrorConstantNotDefined","DON_OUTPUTDIR");
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$langs->trans("ErrorCanNotCreateDir",$dir);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$langs->trans("ErrorConstantNotDefined","DON_OUTPUTDIR");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function chiffre_en_lettre($montant, $devise1='', $devise2='')
|
||||
{
|
||||
if(empty($devise1)) $dev1='euros';
|
||||
else $dev1=$devise1;
|
||||
if(empty($devise2)) $dev2='centimes';
|
||||
else $dev2=$devise2;
|
||||
$valeur_entiere=intval($montant);
|
||||
$valeur_decimal=intval(round($montant-intval($montant), 2)*100);
|
||||
$dix_c=intval($valeur_decimal%100/10);
|
||||
$cent_c=intval($valeur_decimal%1000/100);
|
||||
$unite[1]=$valeur_entiere%10;
|
||||
$dix[1]=intval($valeur_entiere%100/10);
|
||||
$cent[1]=intval($valeur_entiere%1000/100);
|
||||
$unite[2]=intval($valeur_entiere%10000/1000);
|
||||
$dix[2]=intval($valeur_entiere%100000/10000);
|
||||
$cent[2]=intval($valeur_entiere%1000000/100000);
|
||||
$unite[3]=intval($valeur_entiere%10000000/1000000);
|
||||
$dix[3]=intval($valeur_entiere%100000000/10000000);
|
||||
$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');
|
||||
$secon_c='';
|
||||
$trio_c='';
|
||||
for($i=1; $i<=3; $i++){
|
||||
$prim[$i]='';
|
||||
$secon[$i]='';
|
||||
$trio[$i]='';
|
||||
if($dix[$i]==0){
|
||||
$secon[$i]='';
|
||||
$prim[$i]=$chif[$unite[$i]];
|
||||
}
|
||||
else if($dix[$i]==1){
|
||||
$secon[$i]='';
|
||||
$prim[$i]=$chif[($unite[$i]+10)];
|
||||
}
|
||||
else if($dix[$i]==2){
|
||||
if($unite[$i]==1){
|
||||
$secon[$i]='vingt et';
|
||||
$prim[$i]=$chif[$unite[$i]];
|
||||
}
|
||||
else {
|
||||
$secon[$i]='vingt';
|
||||
$prim[$i]=$chif[$unite[$i]];
|
||||
}
|
||||
}
|
||||
else if($dix[$i]==3){
|
||||
if($unite[$i]==1){
|
||||
$secon[$i]='trente et';
|
||||
$prim[$i]=$chif[$unite[$i]];
|
||||
}
|
||||
else {
|
||||
$secon[$i]='trente';
|
||||
$prim[$i]=$chif[$unite[$i]];
|
||||
}
|
||||
}
|
||||
else if($dix[$i]==4){
|
||||
if($unite[$i]==1){
|
||||
$secon[$i]='quarante et';
|
||||
$prim[$i]=$chif[$unite[$i]];
|
||||
}
|
||||
else {
|
||||
$secon[$i]='quarante';
|
||||
$prim[$i]=$chif[$unite[$i]];
|
||||
}
|
||||
}
|
||||
else if($dix[$i]==5){
|
||||
if($unite[$i]==1){
|
||||
$secon[$i]='cinquante et';
|
||||
$prim[$i]=$chif[$unite[$i]];
|
||||
}
|
||||
else {
|
||||
$secon[$i]='cinquante';
|
||||
$prim[$i]=$chif[$unite[$i]];
|
||||
}
|
||||
}
|
||||
else if($dix[$i]==6){
|
||||
if($unite[$i]==1){
|
||||
$secon[$i]='soixante et';
|
||||
$prim[$i]=$chif[$unite[$i]];
|
||||
}
|
||||
else {
|
||||
$secon[$i]='soixante';
|
||||
$prim[$i]=$chif[$unite[$i]];
|
||||
}
|
||||
}
|
||||
else if($dix[$i]==7){
|
||||
if($unite[$i]==1){
|
||||
$secon[$i]='soixante et';
|
||||
$prim[$i]=$chif[$unite[$i]+10];
|
||||
}
|
||||
else {
|
||||
$secon[$i]='soixante';
|
||||
$prim[$i]=$chif[$unite[$i]+10];
|
||||
}
|
||||
}
|
||||
else if($dix[$i]==8){
|
||||
if($unite[$i]==1){
|
||||
$secon[$i]='quatre-vingts et';
|
||||
$prim[$i]=$chif[$unite[$i]];
|
||||
}
|
||||
else {
|
||||
$secon[$i]='quatre-vingt';
|
||||
$prim[$i]=$chif[$unite[$i]];
|
||||
}
|
||||
}
|
||||
else if($dix[$i]==9){
|
||||
if($unite[$i]==1){
|
||||
$secon[$i]='quatre-vingts et';
|
||||
$prim[$i]=$chif[$unite[$i]+10];
|
||||
}
|
||||
else {
|
||||
$secon[$i]='quatre-vingts';
|
||||
$prim[$i]=$chif[$unite[$i]+10];
|
||||
}
|
||||
}
|
||||
if($cent[$i]==1) $trio[$i]='cent';
|
||||
else if($cent[$i]!=0 || $cent[$i]!='') $trio[$i]=$chif[$cent[$i]] .' cents';
|
||||
}
|
||||
if(empty($devise1)) $dev1='euros';
|
||||
else $dev1=$devise1;
|
||||
if(empty($devise2)) $dev2='centimes';
|
||||
else $dev2=$devise2;
|
||||
$valeur_entiere=intval($montant);
|
||||
$valeur_decimal=intval(round($montant-intval($montant), 2)*100);
|
||||
$dix_c=intval($valeur_decimal%100/10);
|
||||
$cent_c=intval($valeur_decimal%1000/100);
|
||||
$unite[1]=$valeur_entiere%10;
|
||||
$dix[1]=intval($valeur_entiere%100/10);
|
||||
$cent[1]=intval($valeur_entiere%1000/100);
|
||||
$unite[2]=intval($valeur_entiere%10000/1000);
|
||||
$dix[2]=intval($valeur_entiere%100000/10000);
|
||||
$cent[2]=intval($valeur_entiere%1000000/100000);
|
||||
$unite[3]=intval($valeur_entiere%10000000/1000000);
|
||||
$dix[3]=intval($valeur_entiere%100000000/10000000);
|
||||
$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');
|
||||
$secon_c='';
|
||||
$trio_c='';
|
||||
for($i=1; $i<=3; $i++){
|
||||
$prim[$i]='';
|
||||
$secon[$i]='';
|
||||
$trio[$i]='';
|
||||
if($dix[$i]==0){
|
||||
$secon[$i]='';
|
||||
$prim[$i]=$chif[$unite[$i]];
|
||||
}
|
||||
else if($dix[$i]==1){
|
||||
$secon[$i]='';
|
||||
$prim[$i]=$chif[($unite[$i]+10)];
|
||||
}
|
||||
else if($dix[$i]==2){
|
||||
if($unite[$i]==1){
|
||||
$secon[$i]='vingt et';
|
||||
$prim[$i]=$chif[$unite[$i]];
|
||||
}
|
||||
else {
|
||||
$secon[$i]='vingt';
|
||||
$prim[$i]=$chif[$unite[$i]];
|
||||
}
|
||||
}
|
||||
else if($dix[$i]==3){
|
||||
if($unite[$i]==1){
|
||||
$secon[$i]='trente et';
|
||||
$prim[$i]=$chif[$unite[$i]];
|
||||
}
|
||||
else {
|
||||
$secon[$i]='trente';
|
||||
$prim[$i]=$chif[$unite[$i]];
|
||||
}
|
||||
}
|
||||
else if($dix[$i]==4){
|
||||
if($unite[$i]==1){
|
||||
$secon[$i]='quarante et';
|
||||
$prim[$i]=$chif[$unite[$i]];
|
||||
}
|
||||
else {
|
||||
$secon[$i]='quarante';
|
||||
$prim[$i]=$chif[$unite[$i]];
|
||||
}
|
||||
}
|
||||
else if($dix[$i]==5){
|
||||
if($unite[$i]==1){
|
||||
$secon[$i]='cinquante et';
|
||||
$prim[$i]=$chif[$unite[$i]];
|
||||
}
|
||||
else {
|
||||
$secon[$i]='cinquante';
|
||||
$prim[$i]=$chif[$unite[$i]];
|
||||
}
|
||||
}
|
||||
else if($dix[$i]==6){
|
||||
if($unite[$i]==1){
|
||||
$secon[$i]='soixante et';
|
||||
$prim[$i]=$chif[$unite[$i]];
|
||||
}
|
||||
else {
|
||||
$secon[$i]='soixante';
|
||||
$prim[$i]=$chif[$unite[$i]];
|
||||
}
|
||||
}
|
||||
else if($dix[$i]==7){
|
||||
if($unite[$i]==1){
|
||||
$secon[$i]='soixante et';
|
||||
$prim[$i]=$chif[$unite[$i]+10];
|
||||
}
|
||||
else {
|
||||
$secon[$i]='soixante';
|
||||
$prim[$i]=$chif[$unite[$i]+10];
|
||||
}
|
||||
}
|
||||
else if($dix[$i]==8){
|
||||
if($unite[$i]==1){
|
||||
$secon[$i]='quatre-vingts et';
|
||||
$prim[$i]=$chif[$unite[$i]];
|
||||
}
|
||||
else {
|
||||
$secon[$i]='quatre-vingt';
|
||||
$prim[$i]=$chif[$unite[$i]];
|
||||
}
|
||||
}
|
||||
else if($dix[$i]==9){
|
||||
if($unite[$i]==1){
|
||||
$secon[$i]='quatre-vingts et';
|
||||
$prim[$i]=$chif[$unite[$i]+10];
|
||||
}
|
||||
else {
|
||||
$secon[$i]='quatre-vingts';
|
||||
$prim[$i]=$chif[$unite[$i]+10];
|
||||
}
|
||||
}
|
||||
if($cent[$i]==1) $trio[$i]='cent';
|
||||
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');
|
||||
$secon_c=$chif2[$dix_c];
|
||||
if($cent_c==1) $trio_c='cent';
|
||||
else if($cent_c!=0 || $cent_c!='') $trio_c=$chif[$cent_c] .' cents';
|
||||
$secon_c=$chif2[$dix_c];
|
||||
if($cent_c==1) $trio_c='cent';
|
||||
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))
|
||||
$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]!=''))
|
||||
$somme = $trio[3]. ' ' .$secon[3]. ' ' . $prim[3]. ' millions ';
|
||||
else
|
||||
$somme = $trio[3]. ' ' .$secon[3]. ' ' . $prim[3];
|
||||
if(($cent[3]==0 || $cent[3]=='') && ($dix[3]==0 || $dix[3]=='') && ($unite[3]==1))
|
||||
$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]!=''))
|
||||
$somme = $trio[3]. ' ' .$secon[3]. ' ' . $prim[3]. ' millions ';
|
||||
else
|
||||
$somme = $trio[3]. ' ' .$secon[3]. ' ' . $prim[3];
|
||||
|
||||
if(($cent[2]==0 || $cent[2]=='') && ($dix[2]==0 || $dix[2]=='') && ($unite[2]==1))
|
||||
$somme = $somme.' mille ';
|
||||
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 ';
|
||||
else
|
||||
$somme = $somme. $trio[2]. ' ' .$secon[2]. ' ' . $prim[2];
|
||||
if(($cent[2]==0 || $cent[2]=='') && ($dix[2]==0 || $dix[2]=='') && ($unite[2]==1))
|
||||
$somme = $somme.' mille ';
|
||||
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 ';
|
||||
else
|
||||
$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==''))
|
||||
return $somme. ' et zéro '. $dev2;
|
||||
else
|
||||
return $somme. $trio_c. ' ' .$secon_c. ' ' . $dev2;
|
||||
if(($cent_c=='0' || $cent_c=='') && ($dix_c=='0' || $dix_c==''))
|
||||
return $somme. ' et zéro '. $dev2;
|
||||
else
|
||||
return $somme. $trio_c. ' ' .$secon_c. ' ' . $dev2;
|
||||
|
||||
}
|
||||
|
||||
@ -1566,7 +1566,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
if ($object->type == 1) $title=$outputlangs->transnoentities("InvoiceReplacement");
|
||||
if ($object->type == 2) $title=$outputlangs->transnoentities("InvoiceAvoir");
|
||||
if ($object->type == 3) $title=$outputlangs->transnoentities("InvoiceDeposit");
|
||||
if ($object->type == 4) $title=$outputlangs->transnoentities("InvoiceProFormat");
|
||||
if ($object->type == 4) $title=$outputlangs->transnoentities("InvoiceProForma");
|
||||
if ($this->situationinvoice) $title=$outputlangs->transnoentities("InvoiceSituation");
|
||||
$pdf->MultiCell($w, 3, $title, '', 'R');
|
||||
|
||||
|
||||
@ -283,11 +283,11 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1);
|
||||
$nexY = $pdf->GetY();
|
||||
$height_incoterms=$nexY-$tab_top;
|
||||
|
||||
|
||||
// Rect prend une longueur en 3eme param
|
||||
$pdf->SetDrawColor(192,192,192);
|
||||
$pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_incoterms+1);
|
||||
|
||||
|
||||
$tab_top = $nexY+6;
|
||||
$height_incoterms += 4;
|
||||
}
|
||||
@ -567,7 +567,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
$this->result = array('fullpath'=>$file);
|
||||
|
||||
|
||||
return 1; // pas d'erreur
|
||||
}
|
||||
else
|
||||
@ -662,14 +662,14 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
$pdf->line($this->posxqty, $tab_top, $this->posxqty, $tab_top + $tab_height);
|
||||
if (empty($hidetop)) {
|
||||
$pdf->SetXY($this->posxqty, $tab_top+1);
|
||||
$pdf->MultiCell($this->posxremainingqty - $this->posxqty, 2, $outputlangs->transnoentities("QtyShipped"),'','R');
|
||||
$pdf->MultiCell($this->posxremainingqty - $this->posxqty, 2, $outputlangs->transnoentities("QtyShippedShort"),'','R');
|
||||
}
|
||||
|
||||
// Remain to ship
|
||||
$pdf->line($this->posxremainingqty, $tab_top, $this->posxremainingqty, $tab_top + $tab_height);
|
||||
if (empty($hidetop)) {
|
||||
$pdf->SetXY($this->posxremainingqty, $tab_top+1);
|
||||
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->posxremainingqty, 2, $outputlangs->transnoentities("KeepToShip"),'','R');
|
||||
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->posxremainingqty, 2, $outputlangs->transnoentities("KeepToShipShort"),'','R');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -116,7 +116,7 @@ class mailing_advthirdparties extends MailingTargets
|
||||
}
|
||||
}
|
||||
|
||||
if (($type_of_target==1) || ($type_of_target==2)) {
|
||||
if (($type_of_target==1) || ($type_of_target==2) || ($type_of_target==4)) {
|
||||
// Select the third parties from category
|
||||
if (count($socid)>0 || count($contactid)>0)
|
||||
{
|
||||
|
||||
@ -48,8 +48,8 @@ class pdf_standard extends CommonStickerGenerator
|
||||
|
||||
/**
|
||||
* Output a sticker on page at position _COUNTX, _COUNTY (_COUNTX and _COUNTY start from 0)
|
||||
* - %LOGO% is replace with company logo
|
||||
* - %PHOTO% is replace with photo provided as parameter
|
||||
* - __LOGO__ is replace with company logo
|
||||
* - __PHOTO__ is replace with photo provided as parameter
|
||||
*
|
||||
* @param PDF $pdf PDF
|
||||
* @param string $textleft Text left
|
||||
@ -58,7 +58,7 @@ class pdf_standard extends CommonStickerGenerator
|
||||
* @param Translate $outputlangs Output langs
|
||||
* @param string $textright Text right
|
||||
* @param int $idmember Id member
|
||||
* @param string $photo Photo (full path to image file used as replacement for key %PHOTOS% into left, right, header or footer text)
|
||||
* @param string $photo Photo (full path to image file used as replacement for key __PHOTOS__ into left, right, header or footer text)
|
||||
* @return void
|
||||
*/
|
||||
function Add_PDF_card(&$pdf,$textleft,$header,$footer,$outputlangs,$textright='',$idmember=0,$photo='')
|
||||
@ -95,7 +95,7 @@ class pdf_standard extends CommonStickerGenerator
|
||||
$member=new Adherent($db);
|
||||
$member->id = $idmember;
|
||||
$member->ref = $idmember;
|
||||
|
||||
|
||||
// Define photo
|
||||
$dir=$conf->adherent->dir_output;
|
||||
if (! empty($photo))
|
||||
@ -161,8 +161,8 @@ class pdf_standard extends CommonStickerGenerator
|
||||
if ($textright=='') // Only a left part
|
||||
{
|
||||
// Output left area
|
||||
if ($textleft == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$xleft,$_PosY+$ytop,$widthtouse,$heighttouse);
|
||||
else if ($textleft == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$xleft,$_PosY+$ytop,$widthtouse,$heighttouse);
|
||||
if ($textleft == '__LOGO__' && $logo) $pdf->Image($logo,$_PosX+$xleft,$_PosY+$ytop,$widthtouse,$heighttouse);
|
||||
else if ($textleft == '__PHOTO__' && $photo) $pdf->Image($photo,$_PosX+$xleft,$_PosY+$ytop,$widthtouse,$heighttouse);
|
||||
else
|
||||
{
|
||||
$pdf->SetXY($_PosX+$xleft, $_PosY+$ytop);
|
||||
@ -171,17 +171,17 @@ class pdf_standard extends CommonStickerGenerator
|
||||
}
|
||||
else if ($textleft!='' && $textright!='') //
|
||||
{
|
||||
if ($textleft == '%LOGO%' || $textleft == '%PHOTO%')
|
||||
if ($textleft == '__LOGO__' || $textleft == '__PHOTO__')
|
||||
{
|
||||
if ($textleft == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$xleft,$_PosY+$ytop,$widthtouse,$heighttouse);
|
||||
else if ($textleft == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$xleft,$_PosY+$ytop,$widthtouse,$heighttouse);
|
||||
if ($textleft == '__LOGO__' && $logo) $pdf->Image($logo,$_PosX+$xleft,$_PosY+$ytop,$widthtouse,$heighttouse);
|
||||
else if ($textleft == '__PHOTO__' && $photo) $pdf->Image($photo,$_PosX+$xleft,$_PosY+$ytop,$widthtouse,$heighttouse);
|
||||
$pdf->SetXY($_PosX+$xleft+$widthtouse+1, $_PosY+$ytop);
|
||||
$pdf->MultiCell($this->_Width-$xleft-$xleft-$widthtouse-1, $this->_Line_Height, $outputlangs->convToOutputCharset($textright),0,'R');
|
||||
}
|
||||
else if ($textright == '%LOGO%' || $textright == '%PHOTO%')
|
||||
else if ($textright == '__LOGO__' || $textright == '__PHOTO__')
|
||||
{
|
||||
if ($textright == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$this->_Width-$widthtouse-$xleft,$_PosY+$ytop,$widthtouse,$heighttouse);
|
||||
else if ($textright == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$this->_Width-$widthtouse-$xleft,$_PosY+$ytop,$widthtouse,$heighttouse);
|
||||
if ($textright == '__LOGO__' && $logo) $pdf->Image($logo,$_PosX+$this->_Width-$widthtouse-$xleft,$_PosY+$ytop,$widthtouse,$heighttouse);
|
||||
else if ($textright == '__PHOTO__' && $photo) $pdf->Image($photo,$_PosX+$this->_Width-$widthtouse-$xleft,$_PosY+$ytop,$widthtouse,$heighttouse);
|
||||
$pdf->SetXY($_PosX+$xleft, $_PosY+$ytop);
|
||||
$pdf->MultiCell($this->_Width-$widthtouse-$xleft-$xleft-1, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft),0,'L');
|
||||
}
|
||||
@ -196,8 +196,8 @@ class pdf_standard extends CommonStickerGenerator
|
||||
else // Only a right part
|
||||
{
|
||||
// Output right area
|
||||
if ($textright == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$this->_Width-$widthtouse-$xleft,$_PosY+$ytop,$widthtouse,$heighttouse);
|
||||
else if ($textright == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$this->_Width-$widthtouse-$xleft,$_PosY+$ytop,$widthtouse,$heighttouse);
|
||||
if ($textright == '__LOGO__' && $logo) $pdf->Image($logo,$_PosX+$this->_Width-$widthtouse-$xleft,$_PosY+$ytop,$widthtouse,$heighttouse);
|
||||
else if ($textright == '__PHOTO__' && $photo) $pdf->Image($photo,$_PosX+$this->_Width-$widthtouse-$xleft,$_PosY+$ytop,$widthtouse,$heighttouse);
|
||||
else
|
||||
{
|
||||
$pdf->SetXY($_PosX+$xleft, $_PosY+$ytop);
|
||||
@ -247,34 +247,34 @@ class pdf_standard extends CommonStickerGenerator
|
||||
function write_file($object, $outputlangs, $srctemplatepath, $mode='member', $nooutput=0)
|
||||
{
|
||||
global $user,$conf,$langs,$mysoc,$_Avery_Labels;
|
||||
|
||||
|
||||
$this->code=$srctemplatepath;
|
||||
|
||||
|
||||
if (is_object($object))
|
||||
{
|
||||
if ($object->country == '-') $object->country='';
|
||||
|
||||
// List of values to scan for a replacement
|
||||
$substitutionarray = array (
|
||||
'%ID%'=>$object->rowid,
|
||||
'%LOGIN%'=>$object->login,
|
||||
'%FIRSTNAME%'=>$object->firstname,
|
||||
'%LASTNAME%'=>$object->lastname,
|
||||
'%FULLNAME%'=>$object->getFullName($langs),
|
||||
'%COMPANY%'=>$object->company,
|
||||
'%ADDRESS%'=>$object->address,
|
||||
'%ZIP%'=>$object->zip,
|
||||
'%TOWN%'=>$object->town,
|
||||
'%COUNTRY%'=>$object->country,
|
||||
'%COUNTRY_CODE%'=>$object->country_code,
|
||||
'%EMAIL%'=>$object->email,
|
||||
'%BIRTH%'=>dol_print_date($object->birth,'day'),
|
||||
'%TYPE%'=>$object->type,
|
||||
'%YEAR%'=>$year,
|
||||
'%MONTH%'=>$month,
|
||||
'%DAY%'=>$day,
|
||||
'%DOL_MAIN_URL_ROOT%'=>DOL_MAIN_URL_ROOT,
|
||||
'%SERVER%'=>"http://".$_SERVER["SERVER_NAME"]."/"
|
||||
'__ID__'=>$object->rowid,
|
||||
'__LOGIN__'=>$object->login,
|
||||
'__FIRSTNAME__'=>$object->firstname,
|
||||
'__LASTNAME__'=>$object->lastname,
|
||||
'__FULLNAME__'=>$object->getFullName($langs),
|
||||
'__COMPANY__'=>$object->company,
|
||||
'__ADDRESS__'=>$object->address,
|
||||
'__ZIP__'=>$object->zip,
|
||||
'__TOWN__'=>$object->town,
|
||||
'__COUNTRY__'=>$object->country,
|
||||
'__COUNTRY_CODE__'=>$object->country_code,
|
||||
'__EMAIL__'=>$object->email,
|
||||
'__BIRTH__'=>dol_print_date($object->birth,'day'),
|
||||
'__TYPE__'=>$object->type,
|
||||
'__YEAR__'=>$year,
|
||||
'__MONTH__'=>$month,
|
||||
'__DAY__'=>$day,
|
||||
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT,
|
||||
'__SERVER__'=>"http://".$_SERVER["SERVER_NAME"]."/"
|
||||
);
|
||||
complete_substitutions_array($substitutionarray, $langs);
|
||||
|
||||
@ -283,10 +283,10 @@ class pdf_standard extends CommonStickerGenerator
|
||||
$textheader=make_substitutions($conf->global->ADHERENT_CARD_HEADER_TEXT, $substitutionarray);
|
||||
$textfooter=make_substitutions($conf->global->ADHERENT_CARD_FOOTER_TEXT, $substitutionarray);
|
||||
$textright=make_substitutions($conf->global->ADHERENT_CARD_TEXT_RIGHT, $substitutionarray);
|
||||
|
||||
|
||||
$nb = $_Avery_Labels[$this->code]['NX'] * $_Avery_Labels[$this->code]['NY'];
|
||||
if ($nb <= 0) $nb=1; // Protection to avoid empty page
|
||||
|
||||
|
||||
for($j=0;$j<$nb;$j++)
|
||||
{
|
||||
$arrayofmembers[]=array(
|
||||
@ -298,7 +298,7 @@ class pdf_standard extends CommonStickerGenerator
|
||||
'photo'=>$object->photo
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
$arrayofrecords = $arrayofmembers;
|
||||
}
|
||||
else
|
||||
@ -348,7 +348,7 @@ class pdf_standard extends CommonStickerGenerator
|
||||
$dir = $outputdir."/".get_exdir(0, 0, 0, 0, $object, 'member');
|
||||
$file = $dir.'/'.$filename;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
$outputdir = $conf->adherent->dir_temp;
|
||||
$dir = $outputdir;
|
||||
@ -419,28 +419,28 @@ class pdf_standard extends CommonStickerGenerator
|
||||
|
||||
|
||||
$this->result = array('fullpath'=>$file);
|
||||
|
||||
|
||||
// Output to http stream
|
||||
if (empty($nooutput))
|
||||
{
|
||||
clearstatcache();
|
||||
|
||||
|
||||
$attachment=true;
|
||||
if (! empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) $attachment=false;
|
||||
$type=dol_mimetype($filename);
|
||||
|
||||
|
||||
//if ($encoding) header('Content-Encoding: '.$encoding);
|
||||
if ($type) header('Content-Type: '.$type);
|
||||
if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"');
|
||||
else header('Content-Disposition: inline; filename="'.$filename.'"');
|
||||
|
||||
|
||||
// Ajout directives pour resoudre bug IE
|
||||
header('Cache-Control: Public, must-revalidate');
|
||||
header('Pragma: public');
|
||||
|
||||
|
||||
readfile($file);
|
||||
}
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@ -93,7 +93,7 @@ class modAdherent extends DolibarrModules
|
||||
|
||||
$this->const[$r][0] = "ADHERENT_MAIL_VALID";
|
||||
$this->const[$r][1] = "texte";
|
||||
$this->const[$r][2] = "Votre adhésion vient d'être validée. \r\nVoici le rappel de vos coordonnées (toute information erronée entrainera la non validation de votre inscription) :\r\n\r\n%INFOS%\r\n\r\n";
|
||||
$this->const[$r][2] = "Votre adhésion vient d'être validée. \r\nVoici le rappel de vos coordonnées (toute information erronée entrainera la non validation de votre inscription) :\r\n\r\n__INFOS__\r\n\r\n";
|
||||
$this->const[$r][3] = "Mail de validation";
|
||||
$this->const[$r][4] = 0;
|
||||
$r++;
|
||||
@ -121,7 +121,7 @@ class modAdherent extends DolibarrModules
|
||||
|
||||
$this->const[$r][0] = "ADHERENT_MAIL_COTIS";
|
||||
$this->const[$r][1] = "texte";
|
||||
$this->const[$r][2] = "Bonjour %FIRSTNAME%,\r\nCet email confirme que votre cotisation a été reçue\r\net enregistrée";
|
||||
$this->const[$r][2] = "Bonjour __FIRSTNAME__,\r\nCet email confirme que votre cotisation a été reçue\r\net enregistrée";
|
||||
$this->const[$r][3] = "Mail de validation de cotisation";
|
||||
$this->const[$r][4] = 0;
|
||||
$r++;
|
||||
@ -135,21 +135,21 @@ class modAdherent extends DolibarrModules
|
||||
|
||||
$this->const[$r][0] = "ADHERENT_CARD_HEADER_TEXT";
|
||||
$this->const[$r][1] = "chaine";
|
||||
$this->const[$r][2] = "%YEAR%";
|
||||
$this->const[$r][2] = "__YEAR__";
|
||||
$this->const[$r][3] = "Texte imprimé sur le haut de la carte adhérent";
|
||||
$this->const[$r][4] = 0;
|
||||
$r++;
|
||||
|
||||
$this->const[$r][0] = "ADHERENT_CARD_FOOTER_TEXT";
|
||||
$this->const[$r][1] = "chaine";
|
||||
$this->const[$r][2] = "%COMPANY%";
|
||||
$this->const[$r][2] = "__COMPANY__";
|
||||
$this->const[$r][3] = "Texte imprimé sur le bas de la carte adhérent";
|
||||
$this->const[$r][4] = 0;
|
||||
$r++;
|
||||
|
||||
$this->const[$r][0] = "ADHERENT_CARD_TEXT";
|
||||
$this->const[$r][1] = "texte";
|
||||
$this->const[$r][2] = "%FULLNAME%\r\nID: %ID%\r\n%EMAIL%\r\n%ADDRESS%\r\n%ZIP% %TOWN%\r\n%COUNTRY%";
|
||||
$this->const[$r][2] = "__FULLNAME__\r\nID: __ID__\r\n__EMAIL__\r\n__ADDRESS__\r\n__ZIP__ __TOWN__\r\n__COUNTRY__";
|
||||
$this->const[$r][3] = "Text to print on member cards";
|
||||
$this->const[$r][4] = 0;
|
||||
$r++;
|
||||
@ -184,7 +184,7 @@ class modAdherent extends DolibarrModules
|
||||
|
||||
$this->const[$r][0] = "ADHERENT_ETIQUETTE_TEXT";
|
||||
$this->const[$r][1] = "texte";
|
||||
$this->const[$r][2] = "%FULLNAME%\n%ADDRESS%\n%ZIP% %TOWN%\n%COUNTRY%";
|
||||
$this->const[$r][2] = "__FULLNAME__\n__ADDRESS__\n__ZIP__ __TOWN__\n__COUNTRY%";
|
||||
$this->const[$r][3] = "Text to print on member address sheets";
|
||||
$this->const[$r][4] = 0;
|
||||
$r++;
|
||||
@ -324,7 +324,7 @@ class modAdherent extends DolibarrModules
|
||||
// End add extra fields
|
||||
$this->import_fieldshidden_array[$r]=array('extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'adherent'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
|
||||
$this->import_regex_array[$r]=array('a.civility'=>'code@'.MAIN_DB_PREFIX.'c_civility','a.fk_adherent_type'=>'rowid@'.MAIN_DB_PREFIX.'adherent_type','a.morphy'=>'(phy|mor)','a.statut'=>'^[0|1]','a.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','a.datefin'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$');
|
||||
$this->import_examplevalues_array[$r]=array('a.civility'=>"MR",'a.lastname'=>'Smith','a.firstname'=>'John','a.login'=>'jsmith','a.pass'=>'passofjsmith','a.fk_adherent_type'=>'1','a.morphy'=>'"mor" or "phy"','a.societe'=>'JS company','a.address'=>'21 jump street','a.zip'=>'55000','a.town'=>'New York','a.country'=>'1','a.email'=>'jsmith@example.com','a.birth'=>'1972-10-10','a.statut'=>"0 or 1",'a.note_public'=>"This is a public comment on member",'a.note_private'=>"This is private comment on member",'a.datec'=>dol_print_date($now,'%Y-%m-%d'),'a.datefin'=>dol_print_date(dol_time_plus_duree($now, 1, 'y'),'%Y-%m-%d'));
|
||||
$this->import_examplevalues_array[$r]=array('a.civility'=>"MR",'a.lastname'=>'Smith','a.firstname'=>'John','a.login'=>'jsmith','a.pass'=>'passofjsmith','a.fk_adherent_type'=>'1','a.morphy'=>'"mor" or "phy"','a.societe'=>'JS company','a.address'=>'21 jump street','a.zip'=>'55000','a.town'=>'New York','a.country'=>'1','a.email'=>'jsmith@example.com','a.birth'=>'1972-10-10','a.statut'=>"0 or 1",'a.note_public'=>"This is a public comment on member",'a.note_private'=>"This is private comment on member",'a.datec'=>dol_print_date($now,'%Y-%m__%d'),'a.datefin'=>dol_print_date(dol_time_plus_duree($now, 1, 'y'),'%Y-%m-%d'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -157,7 +157,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
$outputlangs->load("bills");
|
||||
$outputlangs->load("products");
|
||||
|
||||
if ($conf->fournisseur->dir_output.'/facture')
|
||||
if ($conf->fournisseur->facture->dir_output)
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
@ -540,7 +540,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
$this->result = array('fullpath'=>$file);
|
||||
|
||||
|
||||
return 1; // Pas d'erreur
|
||||
}
|
||||
else
|
||||
|
||||
@ -168,7 +168,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
$outputlangs->load("orders");
|
||||
|
||||
$nblignes = count($object->lines);
|
||||
|
||||
|
||||
// Loop on each lines to detect if there is at least one image to show
|
||||
$realpatharray=array();
|
||||
if (! empty($conf->global->MAIN_GENERATE_SUPPLIER_ORDER_WITH_PICTURE))
|
||||
@ -190,7 +190,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
$pdir = get_exdir(0,2,0,0,$objphoto,'product') . dol_sanitizeFileName($objphoto->ref).'/';
|
||||
$dir = $conf->product->dir_output.'/'.$pdir;
|
||||
}
|
||||
|
||||
|
||||
$realpath='';
|
||||
foreach ($objphoto->liste_photos($dir,1) as $key => $obj)
|
||||
{
|
||||
@ -205,7 +205,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
}
|
||||
if (count($realpatharray) == 0) $this->posxpicture=$this->posxtva;
|
||||
|
||||
if ($conf->fournisseur->dir_output.'/commande')
|
||||
if ($conf->fournisseur->commande->dir_output)
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
@ -412,11 +412,11 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
$showpricebeforepagebreak=1;
|
||||
|
||||
$pdf->startTransaction();
|
||||
if ($posYAfterImage > 0)
|
||||
if ($posYAfterImage > 0)
|
||||
{
|
||||
$descWidth = $this->posxpicture-$curX;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
$descWidth = $this->posxtva-$curX;
|
||||
}
|
||||
@ -639,7 +639,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
$this->result = array('fullpath'=>$file);
|
||||
|
||||
|
||||
return 1; // Pas d'erreur
|
||||
}
|
||||
else
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -61,39 +61,43 @@ print "</tr>\n";
|
||||
|
||||
if (count($extrafields->attribute_type))
|
||||
{
|
||||
foreach($extrafields->attribute_type as $key => $value)
|
||||
{
|
||||
foreach($extrafields->attribute_type as $key => $value)
|
||||
{
|
||||
// Load language if required
|
||||
if (! empty($extrafields->attribute_langfile[$key])) {
|
||||
$langs->load($extrafields->attribute_langfile[$key]);
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print "<td>".$extrafields->attribute_pos[$key]."</td>\n";
|
||||
print "<td>".$extrafields->attribute_label[$key]."</td>\n";
|
||||
print "<td>".$key."</td>\n";
|
||||
print "<td>".$type2label[$extrafields->attribute_type[$key]]."</td>\n";
|
||||
print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n";
|
||||
print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n";
|
||||
print '<td>'.dol_trunc($extrafields->attribute_computed[$key], 20)."</td>\n";
|
||||
print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n";
|
||||
print '<td align="center">'.yn($extrafields->attribute_alwayseditable[$key])."</td>\n";
|
||||
print '<td align="center">'.$extrafields->attribute_list[$key]."</td>\n";
|
||||
if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) print '<td align="center">'.yn($extrafields->attribute_hidden[$key])."</td>\n"; // Add hidden option on not working feature. Why hide if user can't see it.
|
||||
if ($conf->multicompany->enabled) {
|
||||
print '<td align="center">'.($extrafields->attribute_entityid[$key]==0?$langs->trans("All"):$extrafields->attribute_entitylabel[$key]).'</td>';
|
||||
}
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
|
||||
print " <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
|
||||
print "</tr>";
|
||||
}
|
||||
print '<tr class="oddeven">';
|
||||
print "<td>".$extrafields->attribute_pos[$key]."</td>\n";
|
||||
print "<td>".$extrafields->attribute_label[$key]."</td>\n"; // We don't translate here, we want admin to know what is the key not translated value
|
||||
print "<td>".$key."</td>\n";
|
||||
print "<td>".$type2label[$extrafields->attribute_type[$key]]."</td>\n";
|
||||
print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n";
|
||||
print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n";
|
||||
print '<td>'.dol_trunc($extrafields->attribute_computed[$key], 20)."</td>\n";
|
||||
print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n";
|
||||
print '<td align="center">'.yn($extrafields->attribute_alwayseditable[$key])."</td>\n";
|
||||
print '<td align="center">'.$extrafields->attribute_list[$key]."</td>\n";
|
||||
if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) print '<td align="center">'.yn($extrafields->attribute_hidden[$key])."</td>\n"; // Add hidden option on not working feature. Why hide if user can't see it.
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
print '<td align="center">'.($extrafields->attribute_entityid[$key]==0?$langs->trans("All"):$extrafields->attribute_entitylabel[$key]).'</td>';
|
||||
}
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
|
||||
print " <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
|
||||
print "</tr>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$colspan=9;
|
||||
if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) $colspan++;
|
||||
$colspan=9;
|
||||
if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) $colspan++;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="opacitymedium" colspan="'.$colspan.'">';
|
||||
print $langs->trans("None");
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="opacitymedium" colspan="'.$colspan.'">';
|
||||
print $langs->trans("None");
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
@ -129,7 +129,7 @@ if ($action == 'presend')
|
||||
$liste[$key] = $value;
|
||||
}
|
||||
}
|
||||
elseif ($object->element == 'member')
|
||||
elseif ($object->element == 'user' || $object->element == 'member')
|
||||
{
|
||||
$liste['thirdparty'] = $object->getFullName($langs)." <".$object->email.">";
|
||||
}
|
||||
@ -169,12 +169,15 @@ if ($action == 'presend')
|
||||
$formmail->param['models_id']=GETPOST('modelmailselected','int');
|
||||
$formmail->param['id'] = $object->id;
|
||||
$formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id;
|
||||
$formmail->param['fileinit'] = array($file);
|
||||
|
||||
// Init list of files
|
||||
if (GETPOST("mode") == 'init') {
|
||||
/*if (GETPOST('mode','alpha') == 'init')
|
||||
{
|
||||
$formmail->clear_attached_files();
|
||||
|
||||
$formmail->add_attached_files($file, basename($file), dol_mimetype($file));
|
||||
}
|
||||
}*/
|
||||
|
||||
// Show form
|
||||
print $formmail->get_form();
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
/* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2009-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -63,7 +63,7 @@ class InterfaceLogevents extends DolibarrTriggers
|
||||
if ($action == 'USER_LOGIN')
|
||||
{
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
|
||||
|
||||
$langs->load("users");
|
||||
// Initialisation donnees (date,duree,texte,desc)
|
||||
$text="(UserLogged,".$object->login.")";
|
||||
@ -177,7 +177,7 @@ class InterfaceLogevents extends DolibarrTriggers
|
||||
|
||||
// Add more information into desc from the context property
|
||||
if (! empty($desc) && ! empty($object->context['audit'])) $desc.=' - '.$object->context['audit'];
|
||||
|
||||
|
||||
// Add entry in event table
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php';
|
||||
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2009-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Cedric GROSS <c.gross@kreiz-it.fr>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
|
||||
/* Copyright (C) 2005-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2009-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Cedric GROSS <c.gross@kreiz-it.fr>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -635,8 +635,8 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$langs->load("other");
|
||||
$langs->load("members");
|
||||
|
||||
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberValidatedInDolibarr",($object->newref?$object->newref:$object->ref));
|
||||
$object->actionmsg=$langs->transnoentities("MemberValidatedInDolibarr",($object->newref?$object->newref:$object->ref));
|
||||
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberValidatedInDolibarr",$object->getFullName($langs));
|
||||
$object->actionmsg=$langs->transnoentities("MemberValidatedInDolibarr",$object->getFullName($langs));
|
||||
$object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
|
||||
$object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type;
|
||||
|
||||
@ -648,8 +648,8 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$langs->load("other");
|
||||
$langs->load("members");
|
||||
|
||||
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberModifiedInDolibarr",$object->ref);
|
||||
$object->actionmsg=$langs->transnoentities("MemberModifiedInDolibarr",$object->ref);
|
||||
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberModifiedInDolibarr",$object->getFullName($langs));
|
||||
$object->actionmsg=$langs->transnoentities("MemberModifiedInDolibarr",$object->getFullName($langs));
|
||||
$object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
|
||||
$object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type;
|
||||
|
||||
@ -661,8 +661,8 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$langs->load("other");
|
||||
$langs->load("members");
|
||||
|
||||
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberSubscriptionAddedInDolibarr",$object->ref);
|
||||
$object->actionmsg=$langs->transnoentities("MemberSubscriptionAddedInDolibarr",$object->ref);
|
||||
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberSubscriptionAddedInDolibarr",$object->getFullName($langs));
|
||||
$object->actionmsg=$langs->transnoentities("MemberSubscriptionAddedInDolibarr",$object->getFullName($langs));
|
||||
$object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
|
||||
$object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type;
|
||||
$object->actionmsg.="\n".$langs->transnoentities("Amount").': '.$object->last_subscription_amount;
|
||||
@ -676,8 +676,8 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$langs->load("other");
|
||||
$langs->load("members");
|
||||
|
||||
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberResiliatedInDolibarr",$object->ref);
|
||||
$object->actionmsg=$langs->transnoentities("MemberResiliatedInDolibarr",$object->ref);
|
||||
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberResiliatedInDolibarr",$object->getFullName($langs));
|
||||
$object->actionmsg=$langs->transnoentities("MemberResiliatedInDolibarr",$object->getFullName($langs));
|
||||
$object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
|
||||
$object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type;
|
||||
|
||||
@ -689,8 +689,8 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$langs->load("other");
|
||||
$langs->load("members");
|
||||
|
||||
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberDeletedInDolibarr",$object->ref);
|
||||
$object->actionmsg=$langs->transnoentities("MemberDeletedInDolibarr",$object->ref);
|
||||
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberDeletedInDolibarr",$object->getFullName($langs));
|
||||
$object->actionmsg=$langs->transnoentities("MemberDeletedInDolibarr",$object->getFullName($langs));
|
||||
$object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
|
||||
$object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type;
|
||||
|
||||
|
||||
@ -51,7 +51,8 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
*/
|
||||
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
|
||||
{
|
||||
if (empty($conf->ldap->enabled)) return 0; // Module not active, we do nothing
|
||||
if (empty($conf->ldap->enabled)) return 0; // Module not active, we do nothing
|
||||
if (defined('DISABLE_LDAP_SYNCHRO')) return 0; // If constant defined, we do nothing
|
||||
|
||||
if (! function_exists('ldap_connect'))
|
||||
{
|
||||
@ -111,8 +112,10 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
|
||||
$info=$object->_load_ldap_info();
|
||||
$dn=$object->_load_ldap_dn($info);
|
||||
$newrdn=$object->_load_ldap_dn($info,2);
|
||||
$newparent=$object->_load_ldap_dn($info,1);
|
||||
|
||||
$result=$ldap->update($dn,$info,$user,$olddn);
|
||||
$result=$ldap->update($dn,$info,$user,$olddn,$newrdn,$newparent);
|
||||
}
|
||||
|
||||
if ($result < 0) $this->error="ErrorLDAP ".$ldap->error;
|
||||
@ -544,8 +547,10 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
|
||||
$info=$object->_load_ldap_info();
|
||||
$dn=$object->_load_ldap_dn($info);
|
||||
$newrdn=$object->_load_ldap_dn($info,2);
|
||||
$newparent=$object->_load_ldap_dn($info,1);
|
||||
|
||||
$result=$ldap->update($dn,$info,$user,$olddn);
|
||||
$result=$ldap->update($dn,$info,$user,$olddn,$newrdn,$newparent);
|
||||
|
||||
// For member type
|
||||
if (! empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1')
|
||||
|
||||
@ -35,17 +35,18 @@ class InterfaceNotification extends DolibarrTriggers
|
||||
public $version = self::VERSION_DOLIBARR;
|
||||
public $picto = 'email';
|
||||
|
||||
var $listofmanagedevents=array(
|
||||
'BILL_VALIDATE',
|
||||
'BILL_PAYED',
|
||||
'ORDER_VALIDATE',
|
||||
'PROPAL_VALIDATE',
|
||||
'FICHINTER_VALIDATE',
|
||||
'FICHINTER_ADD_CONTACT',
|
||||
'ORDER_SUPPLIER_VALIDATE',
|
||||
'ORDER_SUPPLIER_APPROVE',
|
||||
'ORDER_SUPPLIER_REFUSE',
|
||||
'SHIPPING_VALIDATE'
|
||||
var $listofmanagedevents=array(
|
||||
'BILL_VALIDATE',
|
||||
'BILL_PAYED',
|
||||
'ORDER_VALIDATE',
|
||||
'PROPAL_VALIDATE',
|
||||
'PROPAL_CLOSE_SIGNED',
|
||||
'FICHINTER_VALIDATE',
|
||||
'FICHINTER_ADD_CONTACT',
|
||||
'ORDER_SUPPLIER_VALIDATE',
|
||||
'ORDER_SUPPLIER_APPROVE',
|
||||
'ORDER_SUPPLIER_REFUSE',
|
||||
'SHIPPING_VALIDATE'
|
||||
);
|
||||
|
||||
/**
|
||||
@ -73,62 +74,62 @@ class InterfaceNotification extends DolibarrTriggers
|
||||
$notify->send($action, $object);
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return list of events managed by notification module
|
||||
*
|
||||
* @return array Array of events managed by notification module
|
||||
*/
|
||||
function getListOfManagedEvents()
|
||||
{
|
||||
global $conf;
|
||||
/**
|
||||
* Return list of events managed by notification module
|
||||
*
|
||||
* @return array Array of events managed by notification module
|
||||
*/
|
||||
function getListOfManagedEvents()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$ret=array();
|
||||
$ret=array();
|
||||
|
||||
$sql = "SELECT rowid, code, label, description, elementtype";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_action_trigger";
|
||||
$sql.= $this->db->order("rang, elementtype, code");
|
||||
dol_syslog("getListOfManagedEvents Get list of notifications", 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);
|
||||
$sql = "SELECT rowid, code, label, description, elementtype";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_action_trigger";
|
||||
$sql.= $this->db->order("rang, elementtype, code");
|
||||
dol_syslog("getListOfManagedEvents Get list of notifications", 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);
|
||||
|
||||
$qualified=0;
|
||||
// Check is this event is supported by notification module
|
||||
if (in_array($obj->code,$this->listofmanagedevents)) $qualified=1;
|
||||
// Check if module for this event is active
|
||||
if ($qualified)
|
||||
{
|
||||
//print 'xx'.$obj->code;
|
||||
$element=$obj->elementtype;
|
||||
$qualified=0;
|
||||
// Check is this event is supported by notification module
|
||||
if (in_array($obj->code,$this->listofmanagedevents)) $qualified=1;
|
||||
// Check if module for this event is active
|
||||
if ($qualified)
|
||||
{
|
||||
//print 'xx'.$obj->code;
|
||||
$element=$obj->elementtype;
|
||||
|
||||
// Exclude events if related module is disabled
|
||||
if ($element == 'order_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 == 'shipping' && empty($conf->expedition->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;
|
||||
}
|
||||
// Exclude events if related module is disabled
|
||||
if ($element == 'order_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 == 'shipping' && empty($conf->expedition->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;
|
||||
}
|
||||
|
||||
if ($qualified)
|
||||
{
|
||||
$ret[]=array('rowid'=>$obj->rowid,'code'=>$obj->code,'label'=>$obj->label,'description'=>$obj->description,'elementtype'=>$obj->elementtype);
|
||||
}
|
||||
if ($qualified)
|
||||
{
|
||||
$ret[]=array('rowid'=>$obj->rowid,'code'=>$obj->code,'label'=>$obj->label,'description'=>$obj->description,'elementtype'=>$obj->elementtype);
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else dol_print_error($this->db);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
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)
|
||||
{
|
||||
global $conf;
|
||||
global $conf;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
@ -140,25 +140,25 @@ class EcmFiles //extends CommonObject
|
||||
if (isset($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
|
||||
$ref = dol_hash($this->filepath.'/'.$this->filename, 3);
|
||||
// If ref not defined
|
||||
$ref = dol_hash($this->filepath.'/'.$this->filename, 3);
|
||||
if (! empty($this->ref)) $ref=$this->ref;
|
||||
|
||||
$maxposition=0;
|
||||
$maxposition=0;
|
||||
if (empty($this->position)) // Get max used
|
||||
{
|
||||
$sql = "SELECT MAX(position) as maxposition FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||
$sql.= " WHERE filepath ='".$this->db->escape($this->filepath)."'";
|
||||
$sql = "SELECT MAX(position) as maxposition FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||
$sql.= " WHERE filepath ='".$this->db->escape($this->filepath)."'";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$maxposition = (int) $obj->maxposition;
|
||||
}
|
||||
else dol_print_error($this->db);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$maxposition = (int) $obj->maxposition;
|
||||
}
|
||||
else dol_print_error($this->db);
|
||||
}
|
||||
$maxposition=$maxposition+1;
|
||||
|
||||
@ -217,7 +217,7 @@ class EcmFiles //extends CommonObject
|
||||
|
||||
if (!$error) {
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
|
||||
$this->position = $maxposition;
|
||||
$this->position = $maxposition;
|
||||
|
||||
if (!$notrigger) {
|
||||
// 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);
|
||||
}
|
||||
if (!empty($limit)) {
|
||||
$sql .= ' ' . $this->db->plimit($limit, $offset);
|
||||
$sql .= ' ' . $this->db->plimit($limit, $offset);
|
||||
}
|
||||
|
||||
$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 string $option On what the link point to
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
* @param int $maxlen Max length of visible user name
|
||||
* @param string $morecss Add more css on link
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
* @param int $maxlen Max length of visible user name
|
||||
* @param string $morecss Add more css on link
|
||||
* @return string String with URL
|
||||
*/
|
||||
function getNomUrl($withpicto=0, $option='', $notooltip=0, $maxlen=24, $morecss='')
|
||||
{
|
||||
global $db, $conf, $langs;
|
||||
global $dolibarr_main_authentication, $dolibarr_main_demo;
|
||||
global $menumanager;
|
||||
global $dolibarr_main_authentication, $dolibarr_main_demo;
|
||||
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 = '';
|
||||
$companylink = '';
|
||||
$result = '';
|
||||
$companylink = '';
|
||||
|
||||
$label = '<u>' . $langs->trans("MyModule") . '</u>';
|
||||
$label.= '<br>';
|
||||
$label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
||||
$label = '<u>' . $langs->trans("MyModule") . '</u>';
|
||||
$label.= '<br>';
|
||||
$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='';
|
||||
if (empty($notooltip))
|
||||
{
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||
{
|
||||
$label=$langs->trans("ShowProject");
|
||||
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||
}
|
||||
$linkclose.=' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
|
||||
}
|
||||
else $linkclose = ($morecss?' class="'.$morecss.'"':'');
|
||||
$linkclose='';
|
||||
if (empty($notooltip))
|
||||
{
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||
{
|
||||
$label=$langs->trans("ShowProject");
|
||||
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||
}
|
||||
$linkclose.=' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
|
||||
}
|
||||
else $linkclose = ($morecss?' class="'.$morecss.'"':'');
|
||||
|
||||
$linkstart = '<a href="'.$url.'"';
|
||||
$linkstart.=$linkclose.'>';
|
||||
$linkend='</a>';
|
||||
|
||||
if ($withpicto)
|
||||
{
|
||||
$result.=($linkstart.img_object(($notooltip?'':$label), 'label', ($notooltip?'':'class="classfortooltip"')).$linkend);
|
||||
if ($withpicto != 2) $result.=' ';
|
||||
if ($withpicto)
|
||||
{
|
||||
$result.=($linkstart.img_object(($notooltip?'':$label), 'label', ($notooltip?'':'class="classfortooltip"')).$linkend);
|
||||
if ($withpicto != 2) $result.=' ';
|
||||
}
|
||||
$result.= $linkstart . $this->ref . $linkend;
|
||||
return $result;
|
||||
@ -793,7 +793,7 @@ class EcmFiles //extends CommonObject
|
||||
*/
|
||||
public function initAsSpecimen()
|
||||
{
|
||||
global $conf,$user;
|
||||
global $conf,$user;
|
||||
|
||||
$this->id = 0;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user