forked from Wavyzz/dolibarr
Fix not initialized variables
This commit is contained in:
@@ -119,19 +119,19 @@ function create_script_table($list)
|
|||||||
global $sortby,$bc,$langs;
|
global $sortby,$bc,$langs;
|
||||||
$var=true;
|
$var=true;
|
||||||
|
|
||||||
if (isset($_GET['order']) && ($_GET['order'] == "asc" || $_GET['order'] =="desc")) {
|
if (GETPOT('order') == "asc" || GETPOST('order') =="desc") {
|
||||||
$order = $_GET['order'];
|
$order = GETPOST('order');
|
||||||
} else {
|
} else {
|
||||||
$order = "asc";
|
$order = "asc";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_GET['sort'])) {
|
if (GETPOST('order')) {
|
||||||
switch ($_GET['sort']) {
|
switch (GETPOST('order')) {
|
||||||
case "mtime":
|
case "mtime":
|
||||||
case "size":
|
case "size":
|
||||||
case "reloads":
|
case "reloads":
|
||||||
case "hits":
|
case "hits":
|
||||||
$sortby = $_GET['sort'];
|
$sortby = GETPOST('sort');
|
||||||
($order == "asc" ? uasort($list, 'compare') : uasort($list, 'revcompare'));
|
($order == "asc" ? uasort($list, 'compare') : uasort($list, 'revcompare'));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -318,7 +318,7 @@ function backup_tables($outputfile, $tables='*')
|
|||||||
$columns = count($row);
|
$columns = count($row);
|
||||||
for($j=0; $j<$columns; $j++) {
|
for($j=0; $j<$columns; $j++) {
|
||||||
// Processing each columns of the row to ensure that we correctly save the value (eg: add quotes for string - in fact we add quotes for everything, it's easier)
|
// Processing each columns of the row to ensure that we correctly save the value (eg: add quotes for string - in fact we add quotes for everything, it's easier)
|
||||||
if ($row[$j] == null and !is_string($row[$j])) {
|
if ($row[$j] == null && !is_string($row[$j])) {
|
||||||
// IMPORTANT: if the field is NULL we set it NULL
|
// IMPORTANT: if the field is NULL we set it NULL
|
||||||
$row[$j] = 'NULL';
|
$row[$j] = 'NULL';
|
||||||
} elseif(is_string($row[$j]) && $row[$j] == '') {
|
} elseif(is_string($row[$j]) && $row[$j] == '') {
|
||||||
|
|||||||
@@ -417,14 +417,7 @@ if ($id)
|
|||||||
|
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
if ($tabname[$id] == MAIN_DB_PREFIX.'c_email_templates' && $action == 'edit')
|
fieldListWebsites($fieldlist,$obj,$tabname[$id],'add');
|
||||||
{
|
|
||||||
fieldList($fieldlist,$obj,$tabname[$id],'hide');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fieldList($fieldlist,$obj,$tabname[$id],'add');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id == 4) print '<td></td>';
|
if ($id == 4) print '<td></td>';
|
||||||
@@ -487,46 +480,9 @@ if ($id)
|
|||||||
*/
|
*/
|
||||||
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
|
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
|
||||||
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
||||||
if ($fieldlist[$field]=='source') { $valuetoshow=$langs->trans("Contact"); }
|
|
||||||
if ($fieldlist[$field]=='price') { $valuetoshow=$langs->trans("PriceUHT"); }
|
|
||||||
if ($fieldlist[$field]=='taux') {
|
|
||||||
if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") $valuetoshow=$langs->trans("Rate");
|
|
||||||
else $valuetoshow=$langs->trans("Amount");
|
|
||||||
$align='right';
|
|
||||||
}
|
|
||||||
if ($fieldlist[$field]=='localtax1_type') { $valuetoshow=$langs->trans("UseLocalTax")." 2"; $align="center"; $sortable=0; }
|
|
||||||
if ($fieldlist[$field]=='localtax1') { $valuetoshow=$langs->trans("Rate")." 2"; $sortable=0; }
|
|
||||||
if ($fieldlist[$field]=='localtax2_type') { $valuetoshow=$langs->trans("UseLocalTax")." 3"; $align="center"; $sortable=0; }
|
|
||||||
if ($fieldlist[$field]=='localtax2') { $valuetoshow=$langs->trans("Rate")." 3"; $sortable=0; }
|
|
||||||
if ($fieldlist[$field]=='organization') { $valuetoshow=$langs->trans("Organization"); }
|
|
||||||
if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); }
|
if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); }
|
||||||
if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); }
|
if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); }
|
||||||
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
|
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
|
||||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label')
|
|
||||||
{
|
|
||||||
$valuetoshow=$langs->trans("Label");
|
|
||||||
if ($id != 25) $valuetoshow.="*";
|
|
||||||
}
|
|
||||||
if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments")."*"; }
|
|
||||||
if ($fieldlist[$field]=='country') { $valuetoshow=$langs->trans("Country"); }
|
|
||||||
if ($fieldlist[$field]=='recuperableonly') { $valuetoshow=$langs->trans("NPR"); $align="center"; }
|
|
||||||
if ($fieldlist[$field]=='nbjour') { $valuetoshow=$langs->trans("NbOfDays"); }
|
|
||||||
if ($fieldlist[$field]=='fdm') { $valuetoshow=$langs->trans("AtEndOfMonth"); }
|
|
||||||
if ($fieldlist[$field]=='decalage') { $valuetoshow=$langs->trans("Offset"); }
|
|
||||||
if ($fieldlist[$field]=='width') { $valuetoshow=$langs->trans("Width"); }
|
|
||||||
if ($fieldlist[$field]=='height') { $valuetoshow=$langs->trans("Height"); }
|
|
||||||
if ($fieldlist[$field]=='unit') { $valuetoshow=$langs->trans("MeasuringUnit"); }
|
|
||||||
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; }
|
|
||||||
if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); }
|
|
||||||
if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); $sortable=0; }
|
|
||||||
if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); $sortable=0; }
|
|
||||||
if ($fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); }
|
|
||||||
if ($fieldlist[$field]=='account_parent') { $valuetoshow=$langs->trans("Accountsparent"); }
|
|
||||||
if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); }
|
|
||||||
if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); }
|
|
||||||
if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); }
|
|
||||||
if ($fieldlist[$field]=='short_label') { $valuetoshow=$langs->trans("ShortLabel"); }
|
|
||||||
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
|
|
||||||
|
|
||||||
// Affiche nom du champ
|
// Affiche nom du champ
|
||||||
if ($showfield)
|
if ($showfield)
|
||||||
@@ -534,8 +490,6 @@ if ($id)
|
|||||||
print getTitleFieldOfList($valuetoshow,0,$_SERVER["PHP_SELF"],($sortable?$fieldlist[$field]:''),($page?'page='.$page.'&':'').'&id='.$id,"","align=".$align,$sortfield,$sortorder);
|
print getTitleFieldOfList($valuetoshow,0,$_SERVER["PHP_SELF"],($sortable?$fieldlist[$field]:''),($page?'page='.$page.'&':'').'&id='.$id,"","align=".$align,$sortfield,$sortorder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Favorite - Only activated on country dictionary
|
|
||||||
if ($id == 4) print getTitleFieldOfList($langs->trans("Favorite"),0,$_SERVER["PHP_SELF"],"favorite",($page?'page='.$page.'&':'').'&id='.$id,"",'align="center"',$sortfield,$sortorder);
|
|
||||||
|
|
||||||
print getTitleFieldOfList($langs->trans("Status"),0,$_SERVER["PHP_SELF"],"status",($page?'page='.$page.'&':'').'&id='.$id,"",'align="center"',$sortfield,$sortorder);
|
print getTitleFieldOfList($langs->trans("Status"),0,$_SERVER["PHP_SELF"],"status",($page?'page='.$page.'&':'').'&id='.$id,"",'align="center"',$sortfield,$sortorder);
|
||||||
print getTitleFieldOfList('');
|
print getTitleFieldOfList('');
|
||||||
@@ -562,7 +516,7 @@ if ($id)
|
|||||||
$reshook=$hookmanager->executeHooks('editDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('editDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||||
|
|
||||||
if (empty($reshook)) fieldList($fieldlist,$obj,$tabname[$id],'edit');
|
if (empty($reshook)) fieldListWebsites($fieldlist,$obj,$tabname[$id],'edit');
|
||||||
|
|
||||||
print '<td colspan="3" align="right"><a name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"> </a><input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
print '<td colspan="3" align="right"><a name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"> </a><input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
||||||
print ' <input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'"></td>';
|
print ' <input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'"></td>';
|
||||||
@@ -582,172 +536,6 @@ if ($id)
|
|||||||
$showfield=1;
|
$showfield=1;
|
||||||
$align="left";
|
$align="left";
|
||||||
$valuetoshow=$obj->$fieldlist[$field];
|
$valuetoshow=$obj->$fieldlist[$field];
|
||||||
if ($value == 'type_template')
|
|
||||||
{
|
|
||||||
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
|
|
||||||
}
|
|
||||||
if ($value == 'element')
|
|
||||||
{
|
|
||||||
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
|
|
||||||
}
|
|
||||||
else if ($value == 'source')
|
|
||||||
{
|
|
||||||
$valuetoshow = isset($sourceList[$valuetoshow])?$sourceList[$valuetoshow]:$valuetoshow;
|
|
||||||
}
|
|
||||||
else if ($valuetoshow=='all') {
|
|
||||||
$valuetoshow=$langs->trans('All');
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='country') {
|
|
||||||
if (empty($obj->country_code))
|
|
||||||
{
|
|
||||||
$valuetoshow='-';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$key=$langs->trans("Country".strtoupper($obj->country_code));
|
|
||||||
$valuetoshow=($key != "Country".strtoupper($obj->country_code)?$obj->country_code." - ".$key:$obj->country);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='recuperableonly' || $fieldlist[$field]=='fdm' || $fieldlist[$field] == 'deductible') {
|
|
||||||
$valuetoshow=yn($valuetoshow);
|
|
||||||
$align="center";
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='price' || preg_match('/^amount/i',$fieldlist[$field])) {
|
|
||||||
$valuetoshow=price($valuetoshow);
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='libelle_facture') {
|
|
||||||
$langs->load("bills");
|
|
||||||
$key=$langs->trans("PaymentCondition".strtoupper($obj->code));
|
|
||||||
$valuetoshow=($obj->code && $key != "PaymentCondition".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
|
||||||
$valuetoshow=nl2br($valuetoshow);
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_country') {
|
|
||||||
$key=$langs->trans("Country".strtoupper($obj->code));
|
|
||||||
$valuetoshow=($obj->code && $key != "Country".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_availability') {
|
|
||||||
$langs->load("propal");
|
|
||||||
$key=$langs->trans("AvailabilityType".strtoupper($obj->code));
|
|
||||||
$valuetoshow=($obj->code && $key != "AvailabilityType".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_actioncomm') {
|
|
||||||
$key=$langs->trans("Action".strtoupper($obj->code));
|
|
||||||
$valuetoshow=($obj->code && $key != "Action".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
|
||||||
}
|
|
||||||
else if (! empty($obj->code_iso) && $fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_currencies') {
|
|
||||||
$key=$langs->trans("Currency".strtoupper($obj->code_iso));
|
|
||||||
$valuetoshow=($obj->code_iso && $key != "Currency".strtoupper($obj->code_iso)?$key:$obj->$fieldlist[$field]);
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_typent') {
|
|
||||||
$key=$langs->trans(strtoupper($obj->code));
|
|
||||||
$valuetoshow=($key != strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_prospectlevel') {
|
|
||||||
$key=$langs->trans(strtoupper($obj->code));
|
|
||||||
$valuetoshow=($key != strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_civility') {
|
|
||||||
$key=$langs->trans("Civility".strtoupper($obj->code));
|
|
||||||
$valuetoshow=($obj->code && $key != "Civility".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_type_contact') {
|
|
||||||
$langs->load('agenda');
|
|
||||||
$key=$langs->trans("TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code));
|
|
||||||
$valuetoshow=($obj->code && $key != "TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_payment_term') {
|
|
||||||
$langs->load("bills");
|
|
||||||
$key=$langs->trans("PaymentConditionShort".strtoupper($obj->code));
|
|
||||||
$valuetoshow=($obj->code && $key != "PaymentConditionShort".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_paiement') {
|
|
||||||
$langs->load("bills");
|
|
||||||
$key=$langs->trans("PaymentType".strtoupper($obj->code));
|
|
||||||
$valuetoshow=($obj->code && $key != "PaymentType".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_input_reason') {
|
|
||||||
$key=$langs->trans("DemandReasonType".strtoupper($obj->code));
|
|
||||||
$valuetoshow=($obj->code && $key != "DemandReasonType".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_input_method') {
|
|
||||||
$langs->load("orders");
|
|
||||||
$key=$langs->trans($obj->code);
|
|
||||||
$valuetoshow=($obj->code && $key != $obj->code)?$key:$obj->$fieldlist[$field];
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_shipment_mode') {
|
|
||||||
$langs->load("sendings");
|
|
||||||
$key=$langs->trans("SendingMethod".strtoupper($obj->code));
|
|
||||||
$valuetoshow=($obj->code && $key != "SendingMethod".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field] == 'libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_paper_format')
|
|
||||||
{
|
|
||||||
$key = $langs->trans('PaperFormat'.strtoupper($obj->code));
|
|
||||||
$valuetoshow = ($obj->code && $key != 'PaperFormat'.strtoupper($obj->code) ? $key : $obj->$fieldlist[$field]);
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_type_fees')
|
|
||||||
{
|
|
||||||
$langs->load('trips');
|
|
||||||
$key = $langs->trans(strtoupper($obj->code));
|
|
||||||
$valuetoshow = ($obj->code && $key != strtoupper($obj->code) ? $key : $obj->$fieldlist[$field]);
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') {
|
|
||||||
$showfield=0;
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='unicode') {
|
|
||||||
$valuetoshow = $langs->getCurrencySymbol($obj->code,1);
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='label' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_units') {
|
|
||||||
$langs->load("products");
|
|
||||||
$valuetoshow=$langs->trans($obj->$fieldlist[$field]);
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='short_label' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_units') {
|
|
||||||
$langs->load("products");
|
|
||||||
$valuetoshow = $langs->trans($obj->$fieldlist[$field]);
|
|
||||||
}
|
|
||||||
else if (($fieldlist[$field] == 'unit') && ($tabname[$id] == MAIN_DB_PREFIX.'c_paper_format'))
|
|
||||||
{
|
|
||||||
$key = $langs->trans('SizeUnit'.strtolower($obj->unit));
|
|
||||||
$valuetoshow = ($obj->code && $key != 'SizeUnit'.strtolower($obj->unit) ? $key : $obj->$fieldlist[$field]);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if ($fieldlist[$field]=='localtax1_type') {
|
|
||||||
if ($obj->localtax1 != 0)
|
|
||||||
$valuetoshow=$localtax_typeList[$valuetoshow];
|
|
||||||
else
|
|
||||||
$valuetoshow = '';
|
|
||||||
$align="center";
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='localtax2_type') {
|
|
||||||
if ($obj->localtax2 != 0)
|
|
||||||
$valuetoshow=$localtax_typeList[$valuetoshow];
|
|
||||||
else
|
|
||||||
$valuetoshow = '';
|
|
||||||
$align="center";
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='localtax1') {
|
|
||||||
$valuetoshow = price($valuetoshow, 0, $langs, 0, 0);
|
|
||||||
if ($obj->localtax1 == 0)
|
|
||||||
$valuetoshow = '';
|
|
||||||
$align="right";
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='localtax2') {
|
|
||||||
$valuetoshow = price($valuetoshow, 0, $langs, 0, 0);
|
|
||||||
if ($obj->localtax2 == 0)
|
|
||||||
$valuetoshow = '';
|
|
||||||
$align="right";
|
|
||||||
}
|
|
||||||
else if (in_array($fieldlist[$field],array('taux','localtax1','localtax2')))
|
|
||||||
{
|
|
||||||
$valuetoshow = price($valuetoshow, 0, $langs, 0, 0);
|
|
||||||
$align="right";
|
|
||||||
}
|
|
||||||
else if (in_array($fieldlist[$field],array('recuperableonly')))
|
|
||||||
{
|
|
||||||
$align="center";
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='accountancy_code' || $fieldlist[$field]=='accountancy_code_sell' || $fieldlist[$field]=='accountancy_code_buy') {
|
|
||||||
$valuetoshow = length_accountg($valuetoshow);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Show value for field
|
// Show value for field
|
||||||
if ($showfield) print '<td align="'.$align.'">'.$valuetoshow.'</td>';
|
if ($showfield) print '<td align="'.$align.'">'.$valuetoshow.'</td>';
|
||||||
@@ -757,16 +545,6 @@ if ($id)
|
|||||||
// Can an entry be erased or disabled ?
|
// Can an entry be erased or disabled ?
|
||||||
$iserasable=1;$isdisable=1; // true by default
|
$iserasable=1;$isdisable=1; // true by default
|
||||||
|
|
||||||
if (isset($obj->code) && $id != 10)
|
|
||||||
{
|
|
||||||
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) { $iserasable = 0; $isdisable = 0; }
|
|
||||||
else if ($obj->code == 'RECEP') { $iserasable = 0; $isdisable = 0; }
|
|
||||||
else if ($obj->code == 'EF0') { $iserasable = 0; $isdisable = 0; }
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($obj->type) && in_array($obj->type, array('system', 'systemauto'))) { $iserasable=0; }
|
|
||||||
if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO')) || in_array($obj->type, array('systemauto'))) { $isdisable=0; $isdisable = 0; }
|
|
||||||
|
|
||||||
$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):'').'&id='.$id.'&';
|
$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):'').'&id='.$id.'&';
|
||||||
|
|
||||||
// Favorite
|
// Favorite
|
||||||
@@ -823,7 +601,7 @@ $db->close();
|
|||||||
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
|
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
function fieldListWebsites($fieldlist, $obj='', $tabname='', $context='')
|
||||||
{
|
{
|
||||||
global $conf,$langs,$db;
|
global $conf,$langs,$db;
|
||||||
global $form;
|
global $form;
|
||||||
|
|||||||
@@ -167,6 +167,8 @@ class DolibarrApiInit extends DolibarrApi
|
|||||||
*/
|
*/
|
||||||
public function login($login, $password, $entity = 0) {
|
public function login($login, $password, $entity = 0) {
|
||||||
|
|
||||||
|
global $conf, $dolibarr_main_authentication, $dolibarr_auto_user;
|
||||||
|
|
||||||
// Authentication mode
|
// Authentication mode
|
||||||
if (empty($dolibarr_main_authentication))
|
if (empty($dolibarr_main_authentication))
|
||||||
$dolibarr_main_authentication = 'http,dolibarr';
|
$dolibarr_main_authentication = 'http,dolibarr';
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ class DolibarrApiAccess implements iAuthenticate
|
|||||||
{
|
{
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
|
$login = '';
|
||||||
$stored_key = '';
|
$stored_key = '';
|
||||||
|
|
||||||
$userClass = Defaults::$userIdentifierClass;
|
$userClass = Defaults::$userIdentifierClass;
|
||||||
@@ -95,11 +96,15 @@ class DolibarrApiAccess implements iAuthenticate
|
|||||||
throw new RestException(503, 'Error when fetching user api_key :'.$db->error_msg);
|
throw new RestException(503, 'Error when fetching user api_key :'.$db->error_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $stored_key != $_GET['api_key']) {
|
if ($stored_key != $_GET['api_key']) {
|
||||||
$userClass::setCacheIdentifier($_GET['api_key']);
|
$userClass::setCacheIdentifier($_GET['api_key']);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! $login)
|
||||||
|
{
|
||||||
|
throw new RestException(503, 'Error when searching logn user fro mapi key');
|
||||||
|
}
|
||||||
$fuser = new User($db);
|
$fuser = new User($db);
|
||||||
if(! $fuser->fetch('',$login)) {
|
if(! $fuser->fetch('',$login)) {
|
||||||
throw new RestException(503, 'Error when fetching user :'.$fuser->error);
|
throw new RestException(503, 'Error when fetching user :'.$fuser->error);
|
||||||
|
|||||||
Reference in New Issue
Block a user