Scrutinizer Auto-Fixes

This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
This commit is contained in:
Scrutinizer Auto-Fixer 2020-03-23 14:54:02 +00:00
parent 0905b3a6b2
commit e8083e2a65
113 changed files with 2079 additions and 2079 deletions

View File

@ -230,7 +230,7 @@ class Lettering extends BookKeeping
*
* @param array $ids ids array
* @param boolean $notrigger no trigger
* @return number
* @return number
*/
public function updateLettering($ids = array(), $notrigger = false)
{

View File

@ -100,7 +100,7 @@ if ($action == 'create')
print "<br>";
print load_fiche_titre($langs->trans('NewAttribute'));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
}
/* ************************************************************************** */
@ -113,7 +113,7 @@ if ($action == 'edit' && ! empty($attrname))
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
}
// End of page

View File

@ -76,18 +76,18 @@ if ($action == 'set_BANK_CHEQUERECEIPT_FREE_TEXT')
{
$freetext = GETPOST('BANK_CHEQUERECEIPT_FREE_TEXT', 'none'); // No alpha here, we want exact string
$res = dolibarr_set_const($db, "BANK_CHEQUERECEIPT_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "BANK_CHEQUERECEIPT_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessages($langs->trans("Error"), null, 'errors');
}
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
/*
@ -258,13 +258,13 @@ print $form->textwithpicto($langs->trans("FreeLegalTextOnChequeReceipts"), $lang
$variablename='BANK_CHEQUERECEIPT_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
}
else
{
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create();
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create();
}
print '</td><td class="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';

View File

@ -89,9 +89,9 @@ dol_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit')
{
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
}
@ -103,10 +103,10 @@ if ($action != 'create' && $action != 'edit')
if ($action == 'create')
{
print "<br>";
print load_fiche_titre($langs->trans('NewAttribute'));
print "<br>";
print load_fiche_titre($langs->trans('NewAttribute'));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
}
/* ************************************************************************** */
@ -116,10 +116,10 @@ if ($action == 'create')
/* ************************************************************************** */
if ($action == 'edit' && ! empty($attrname))
{
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
}
llxFooter();

View File

@ -45,8 +45,8 @@ $action=GETPOST('action', 'alpha');
// Shipment note
if (! empty($conf->expedition->enabled) && empty($conf->global->MAIN_SUBMODULE_EXPEDITION))
{
// This option should always be set to on when module is on.
dolibarr_set_const($db, "MAIN_SUBMODULE_EXPEDITION", "1", 'chaine', 0, '', $conf->entity);
// This option should always be set to on when module is on.
dolibarr_set_const($db, "MAIN_SUBMODULE_EXPEDITION", "1", 'chaine', 0, '', $conf->entity);
}
/*
if ($action == 'activate_sending')
@ -66,16 +66,16 @@ if ($action == 'disable_sending')
// Delivery note
if ($action == 'activate_delivery')
{
dolibarr_set_const($db, "MAIN_SUBMODULE_EXPEDITION", "1", 'chaine', 0, '', $conf->entity); // We must also enable this
dolibarr_set_const($db, "MAIN_SUBMODULE_LIVRAISON", "1", 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_SUBMODULE_EXPEDITION", "1", 'chaine', 0, '', $conf->entity); // We must also enable this
dolibarr_set_const($db, "MAIN_SUBMODULE_LIVRAISON", "1", 'chaine', 0, '', $conf->entity);
header("Location: confexped.php");
exit;
}
elseif ($action == 'disable_delivery')
{
dolibarr_del_const($db, "MAIN_SUBMODULE_LIVRAISON", $conf->entity);
header("Location: confexped.php");
exit;
header("Location: confexped.php");
exit;
}

View File

@ -40,19 +40,19 @@ $id_image = GETPOST('id_image', 'int');
$quality = GETPOST('quality', 'alpha');
try {
$url = $conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'/api/images/products/'.$id_product.'/'.$id_image.'/'.$quality;
$api = new PrestaShopWebservice(
$conf->global->MAIN_MODULE_DOLISTORE_API_SRV,
$conf->global->MAIN_MODULE_DOLISTORE_API_KEY, $dolistore->debug_api
);
//echo $url;
$request = $api->executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'GET'));
header('Content-type:image');
print $request['response'];
$url = $conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'/api/images/products/'.$id_product.'/'.$id_image.'/'.$quality;
$api = new PrestaShopWebservice(
$conf->global->MAIN_MODULE_DOLISTORE_API_SRV,
$conf->global->MAIN_MODULE_DOLISTORE_API_KEY, $dolistore->debug_api
);
//echo $url;
$request = $api->executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'GET'));
header('Content-type:image');
print $request['response'];
} catch (PrestaShopWebserviceException $e) {
// Here we are dealing with errors
$trace = $e->getTrace();
if ($trace[0]['args'][0] == 404) die('Bad ID');
elseif ($trace[0]['args'][0] == 401) die('Bad auth key');
else die('Can not access to '.$conf->global->MAIN_MODULE_DOLISTORE_API_SRV);
// Here we are dealing with errors
$trace = $e->getTrace();
if ($trace[0]['args'][0] == 404) die('Bad ID');
elseif ($trace[0]['args'][0] == 401) die('Bad auth key');
else die('Can not access to '.$conf->global->MAIN_MODULE_DOLISTORE_API_SRV);
}

View File

@ -36,30 +36,30 @@ if (! $user->admin) accessforbidden();
*/
if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg))
{
$code=$reg[1];
if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0)
{
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
else
{
dol_print_error($db);
}
$code=$reg[1];
if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0)
{
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
else
{
dol_print_error($db);
}
}
if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg))
{
$code=$reg[1];
if (dolibarr_del_const($db, $code, $conf->entity) > 0)
{
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
else
{
dol_print_error($db);
}
$code=$reg[1];
if (dolibarr_del_const($db, $code, $conf->entity) > 0)
{
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
else
{
dol_print_error($db);
}
}

View File

@ -86,9 +86,9 @@ dol_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit')
{
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
}
@ -101,9 +101,9 @@ if ($action != 'create' && $action != 'edit')
if ($action == 'create')
{
print '<br><div id="newattrib"></div>';
print load_fiche_titre($langs->trans('NewAttribute'));
print load_fiche_titre($langs->trans('NewAttribute'));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
}
/* ************************************************************************** */
@ -113,10 +113,10 @@ if ($action == 'create')
/* ************************************************************************** */
if ($action == 'edit' && ! empty($attrname))
{
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
}
// End of page

View File

@ -80,9 +80,9 @@ dol_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit')
{
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
}
@ -95,9 +95,9 @@ if ($action != 'create' && $action != 'edit')
if ($action == 'create')
{
print '<br><div id="newattrib"></div>';
print load_fiche_titre($langs->trans('NewAttribute'));
print load_fiche_titre($langs->trans('NewAttribute'));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
}
/* ************************************************************************** */
@ -107,10 +107,10 @@ if ($action == 'create')
/* ************************************************************************** */
if ($action == 'edit' && ! empty($attrname))
{
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
}
// End of page

View File

@ -68,22 +68,22 @@ if ($action == 'setvalue' && $user->admin)
if (! dolibarr_set_const($db, 'LDAP_CONTACT_FIELD_TOWN', GETPOST("fieldtown"), 'chaine', 0, '', $conf->entity)) $error++;
if (! dolibarr_set_const($db, 'LDAP_CONTACT_FIELD_COUNTRY', GETPOST("fieldcountry"), '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_CONTACTS', $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_CONTACTS', $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);
}
}

View File

@ -86,9 +86,9 @@ dol_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit')
{
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
}
@ -101,9 +101,9 @@ if ($action != 'create' && $action != 'edit')
if ($action == 'create')
{
print '<br><div id="newattrib"></div>';
print load_fiche_titre($langs->trans('NewAttribute'));
print load_fiche_titre($langs->trans('NewAttribute'));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
}
/* ************************************************************************** */
@ -113,10 +113,10 @@ if ($action == 'create')
/* ************************************************************************** */
if ($action == 'edit' && ! empty($attrname))
{
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
}
// End of page

View File

@ -48,7 +48,7 @@ if ($action == 'setvalue')
$mailerror = GETPOST('MAILING_EMAIL_ERRORSTO', 'alpha');
$checkread = GETPOST('value', 'alpha');
$checkread_key = GETPOST('MAILING_EMAIL_UNSUBSCRIBE_KEY', 'alpha');
$mailingdelay = GETPOST('MAILING_DELAY', 'int');
$mailingdelay = GETPOST('MAILING_DELAY', 'int');
$res=dolibarr_set_const($db, "MAILING_EMAIL_FROM", $mailfrom, 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++;
@ -61,16 +61,16 @@ if ($action == 'setvalue')
$res=dolibarr_set_const($db, "MAILING_EMAIL_UNSUBSCRIBE_KEY", $checkread_key, 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
$db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
$db->rollback();
setEventMessages($langs->trans("Error"), null, 'errors');
}
if (! $error)
{
$db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
$db->rollback();
setEventMessages($langs->trans("Error"), null, 'errors');
}
}

View File

@ -41,8 +41,8 @@ $dirsmartphone = array();
$dirmenus=array_merge(array("/core/menus/"), (array) $conf->modules_parts['menus']);
foreach($dirmenus as $dirmenu)
{
$dirstandard[]=$dirmenu.'standard';
$dirsmartphone[]=$dirmenu.'smartphone';
$dirstandard[]=$dirmenu.'standard';
$dirsmartphone[]=$dirmenu.'smartphone';
}
$error=0;
@ -85,8 +85,8 @@ if ($action == 'update' && ! $cancel)
foreach($dirmenus as $dirmenu)
{
$file='init_menu_'.$key.'.sql';
$fullpath=dol_buildpath($dirmenu.$file);
//print 'action='.$action.' Search menu into fullpath='.$fullpath.'<br>';exit;
$fullpath=dol_buildpath($dirmenu.$file);
//print 'action='.$action.' Search menu into fullpath='.$fullpath.'<br>';exit;
if (file_exists($fullpath))
{

View File

@ -46,15 +46,15 @@ $type = 'paymentorder';
if ($action == "set")
{
$db->begin();
$db->begin();
$id=GETPOST('PRELEVEMENT_ID_BANKACCOUNT', 'int');
$account = new Account($db);
if($account->fetch($id)>0)
{
$res = dolibarr_set_const($db, "PRELEVEMENT_ID_BANKACCOUNT", $id, 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++;
/*
$id=GETPOST('PRELEVEMENT_ID_BANKACCOUNT', 'int');
$account = new Account($db);
if($account->fetch($id)>0)
{
$res = dolibarr_set_const($db, "PRELEVEMENT_ID_BANKACCOUNT", $id, 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++;
/*
$res = dolibarr_set_const($db, "PRELEVEMENT_CODE_BANQUE", $account->code_banque,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, "PRELEVEMENT_CODE_GUICHET", $account->code_guichet,'chaine',0,'',$conf->entity);
@ -70,33 +70,33 @@ if ($action == "set")
$res = dolibarr_set_const($db, "PRELEVEMENT_RAISON_SOCIALE", $account->proprio,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
*/
}
else $error++;
}
else $error++;
$res = dolibarr_set_const($db, "PRELEVEMENT_ICS", GETPOST("PRELEVEMENT_ICS"), 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, "PRELEVEMENT_ICS", GETPOST("PRELEVEMENT_ICS"), 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++;
if (GETPOST("PRELEVEMENT_USER") > 0)
{
$res = dolibarr_set_const($db, "PRELEVEMENT_USER", GETPOST("PRELEVEMENT_USER"), 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++;
}
if (GETPOST("PRELEVEMENT_END_TO_END") || GETPOST("PRELEVEMENT_END_TO_END")=="")
{
$res = dolibarr_set_const($db, "PRELEVEMENT_END_TO_END", GETPOST("PRELEVEMENT_END_TO_END"), 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++;
}
if (GETPOST("PRELEVEMENT_USTRD") || GETPOST("PRELEVEMENT_USTRD")=="")
{
$res = dolibarr_set_const($db, "PRELEVEMENT_USTRD", GETPOST("PRELEVEMENT_USTRD"), 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++;
}
if (GETPOST("PRELEVEMENT_USER") > 0)
{
$res = dolibarr_set_const($db, "PRELEVEMENT_USER", GETPOST("PRELEVEMENT_USER"), 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++;
}
if (GETPOST("PRELEVEMENT_END_TO_END") || GETPOST("PRELEVEMENT_END_TO_END")=="")
{
$res = dolibarr_set_const($db, "PRELEVEMENT_END_TO_END", GETPOST("PRELEVEMENT_END_TO_END"), 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++;
}
if (GETPOST("PRELEVEMENT_USTRD") || GETPOST("PRELEVEMENT_USTRD")=="")
{
$res = dolibarr_set_const($db, "PRELEVEMENT_USTRD", GETPOST("PRELEVEMENT_USTRD"), 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++;
}
if (GETPOST("PRELEVEMENT_ADDDAYS") || GETPOST("PRELEVEMENT_ADDDAYS")=="")
{
$res = dolibarr_set_const($db, "PRELEVEMENT_ADDDAYS", GETPOST("PRELEVEMENT_ADDDAYS"), 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++;
} elseif (! $error)
if (GETPOST("PRELEVEMENT_ADDDAYS") || GETPOST("PRELEVEMENT_ADDDAYS")=="")
{
$res = dolibarr_set_const($db, "PRELEVEMENT_ADDDAYS", GETPOST("PRELEVEMENT_ADDDAYS"), 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++;
} elseif (! $error)
{
$db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
@ -110,20 +110,20 @@ if ($action == "set")
if ($action == "addnotif")
{
$bon = new BonPrelevement($db);
$bon->AddNotification($db, GETPOST('user', 'int'), $action);
$bon = new BonPrelevement($db);
$bon->AddNotification($db, GETPOST('user', 'int'), $action);
header("Location: prelevement.php");
exit;
header("Location: prelevement.php");
exit;
}
if ($action == "deletenotif")
{
$bon = new BonPrelevement($db);
$bon->DeleteNotificationById(GETPOST('notif', 'int'));
$bon = new BonPrelevement($db);
$bon->DeleteNotificationById(GETPOST('notif', 'int'));
header("Location: prelevement.php");
exit;
header("Location: prelevement.php");
exit;
}
/*

View File

@ -40,34 +40,34 @@ $upload_dir=$conf->admin->dir_temp;
if (GETPOST('action', 'aZ09') == 'set_proxy')
{
if (GETPOST("MAIN_USE_CONNECT_TIMEOUT") && ! is_numeric(GETPOST("MAIN_USE_CONNECT_TIMEOUT")))
{
setEventMessages($langs->trans("ErrorValueMustBeInteger"), null, 'errors');
$error++;
}
if (GETPOST("MAIN_USE_RESPONSE_TIMEOUT") && ! is_numeric(GETPOST("MAIN_USE_RESPONSE_TIMEOUT")))
{
setEventMessages($langs->trans("ErrorValueMustBeInteger"), null, 'errors');
$error++;
}
if (GETPOST("MAIN_USE_CONNECT_TIMEOUT") && ! is_numeric(GETPOST("MAIN_USE_CONNECT_TIMEOUT")))
{
setEventMessages($langs->trans("ErrorValueMustBeInteger"), null, 'errors');
$error++;
}
if (GETPOST("MAIN_USE_RESPONSE_TIMEOUT") && ! is_numeric(GETPOST("MAIN_USE_RESPONSE_TIMEOUT")))
{
setEventMessages($langs->trans("ErrorValueMustBeInteger"), null, 'errors');
$error++;
}
if (! $error)
{
$result=0;
$result+=dolibarr_set_const($db, 'MAIN_USE_CONNECT_TIMEOUT', GETPOST("MAIN_USE_CONNECT_TIMEOUT"), 'chaine', 0, '', $conf->entity);
$result+=dolibarr_set_const($db, 'MAIN_USE_RESPONSE_TIMEOUT', GETPOST("MAIN_USE_RESPONSE_TIMEOUT"), 'chaine', 0, '', $conf->entity);
$result+=dolibarr_set_const($db, 'MAIN_PROXY_USE', GETPOST("MAIN_PROXY_USE"), 'chaine', 0, '', $conf->entity);
$result+=dolibarr_set_const($db, 'MAIN_PROXY_HOST', GETPOST("MAIN_PROXY_HOST"), 'chaine', 0, '', $conf->entity);
$result+=dolibarr_set_const($db, 'MAIN_PROXY_PORT', GETPOST("MAIN_PROXY_PORT"), 'chaine', 0, '', $conf->entity);
$result+=dolibarr_set_const($db, 'MAIN_PROXY_USER', GETPOST("MAIN_PROXY_USER"), 'chaine', 0, '', $conf->entity);
$result+=dolibarr_set_const($db, 'MAIN_PROXY_PASS', GETPOST("MAIN_PROXY_PASS"), 'chaine', 0, '', $conf->entity);
if ($result < 5) dol_print_error($db);
}
if (! $error)
{
$result=0;
$result+=dolibarr_set_const($db, 'MAIN_USE_CONNECT_TIMEOUT', GETPOST("MAIN_USE_CONNECT_TIMEOUT"), 'chaine', 0, '', $conf->entity);
$result+=dolibarr_set_const($db, 'MAIN_USE_RESPONSE_TIMEOUT', GETPOST("MAIN_USE_RESPONSE_TIMEOUT"), 'chaine', 0, '', $conf->entity);
$result+=dolibarr_set_const($db, 'MAIN_PROXY_USE', GETPOST("MAIN_PROXY_USE"), 'chaine', 0, '', $conf->entity);
$result+=dolibarr_set_const($db, 'MAIN_PROXY_HOST', GETPOST("MAIN_PROXY_HOST"), 'chaine', 0, '', $conf->entity);
$result+=dolibarr_set_const($db, 'MAIN_PROXY_PORT', GETPOST("MAIN_PROXY_PORT"), 'chaine', 0, '', $conf->entity);
$result+=dolibarr_set_const($db, 'MAIN_PROXY_USER', GETPOST("MAIN_PROXY_USER"), 'chaine', 0, '', $conf->entity);
$result+=dolibarr_set_const($db, 'MAIN_PROXY_PASS', GETPOST("MAIN_PROXY_PASS"), 'chaine', 0, '', $conf->entity);
if ($result < 5) dol_print_error($db);
}
if (! $error)
{
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
}
if (! $error)
{
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
}
}
@ -99,8 +99,8 @@ dol_fiche_head($head, 'proxy', $langs->trans("Security"), -1);
if ($conf->use_javascript_ajax)
{
print "\n".'<script type="text/javascript" language="javascript">';
print 'jQuery(document).ready(function () {
print "\n".'<script type="text/javascript" language="javascript">';
print 'jQuery(document).ready(function () {
function initfields()
{
if (jQuery("#MAIN_PROXY_USE").val()==\'1\')
@ -117,7 +117,7 @@ if ($conf->use_javascript_ajax)
initfields();
});
})';
print '</script>'."\n";
print '</script>'."\n";
}

View File

@ -89,9 +89,9 @@ dol_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit')
{
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
}
@ -103,10 +103,10 @@ if ($action != 'create' && $action != 'edit')
if ($action == 'create')
{
print "<br>";
print load_fiche_titre($langs->trans('NewAttribute'));
print "<br>";
print load_fiche_titre($langs->trans('NewAttribute'));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
}
/* ************************************************************************** */
@ -116,10 +116,10 @@ if ($action == 'create')
/* ************************************************************************** */
if ($action == 'edit' && ! empty($attrname))
{
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
}
llxFooter();

View File

@ -35,7 +35,7 @@ $langs->loadLangs(array("admin","resource"));
// Security check
if (!$user->admin)
accessforbidden();
accessforbidden();
$action = GETPOST('action', 'alpha');

View File

@ -86,9 +86,9 @@ dol_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit')
{
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
}
@ -101,9 +101,9 @@ if ($action != 'create' && $action != 'edit')
if ($action == 'create')
{
print '<br><div id="newattrib"></div>';
print load_fiche_titre($langs->trans('NewAttribute'));
print load_fiche_titre($langs->trans('NewAttribute'));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
}
/* ************************************************************************** */
@ -113,10 +113,10 @@ if ($action == 'create')
/* ************************************************************************** */
if ($action == 'edit' && ! empty($attrname))
{
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
}
// End of page

View File

@ -84,9 +84,9 @@ dol_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit')
{
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
}
@ -99,9 +99,9 @@ if ($action != 'create' && $action != 'edit')
if ($action == 'create')
{
print '<br><div id="newattrib"></div>';
print load_fiche_titre($langs->trans('NewAttribute'));
print load_fiche_titre($langs->trans('NewAttribute'));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
}
/* ************************************************************************** */
@ -111,10 +111,10 @@ if ($action == 'create')
/* ************************************************************************** */
if ($action == 'edit' && ! empty($attrname))
{
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
}
// End of page

View File

@ -70,27 +70,27 @@ $configfileparameters=array(
'?dolibarr_main_auth_ldap_admin_login',
'?dolibarr_main_auth_ldap_admin_pass',
'?dolibarr_main_auth_ldap_debug',
'separator',
'?dolibarr_lib_ADODB_PATH',
'separator',
'?dolibarr_lib_ADODB_PATH',
'?dolibarr_lib_FPDF_PATH',
'?dolibarr_lib_TCPDF_PATH',
'?dolibarr_lib_TCPDF_PATH',
'?dolibarr_lib_FPDI_PATH',
'?dolibarr_lib_TCPDI_PATH',
'?dolibarr_lib_TCPDI_PATH',
'?dolibarr_lib_NUSOAP_PATH',
'?dolibarr_lib_PHPEXCEL_PATH',
'?dolibarr_lib_GEOIP_PATH',
'?dolibarr_lib_PHPEXCEL_PATH',
'?dolibarr_lib_GEOIP_PATH',
'?dolibarr_lib_ODTPHP_PATH',
'?dolibarr_lib_ODTPHP_PATHTOPCLZIP',
'?dolibarr_js_CKEDITOR',
'?dolibarr_js_JQUERY',
'?dolibarr_js_JQUERY_UI',
'?dolibarr_js_JQUERY_FLOT',
'?dolibarr_lib_ODTPHP_PATHTOPCLZIP',
'?dolibarr_js_CKEDITOR',
'?dolibarr_js_JQUERY',
'?dolibarr_js_JQUERY_UI',
'?dolibarr_js_JQUERY_FLOT',
'?dolibarr_font_DOL_DEFAULT_TTF',
'?dolibarr_font_DOL_DEFAULT_TTF_BOLD',
'?dolibarr_font_DOL_DEFAULT_TTF_BOLD',
'separator',
'?dolibarr_mailing_limit_sendbyweb',
'?dolibarr_mailing_limit_sendbycli',
'?dolibarr_strict_mode'
'?dolibarr_strict_mode'
);
$configfilelib=array(
// 'separator',
@ -121,20 +121,20 @@ $configfilelib=array(
'dolibarr_main_auth_ldap_admin_pass',
'dolibarr_main_auth_ldap_debug',
'separator',
'dolibarr_lib_ADODB_PATH',
'dolibarr_lib_TCPDF_PATH',
'dolibarr_lib_FPDI_PATH',
'dolibarr_lib_ADODB_PATH',
'dolibarr_lib_TCPDF_PATH',
'dolibarr_lib_FPDI_PATH',
'dolibarr_lib_NUSOAP_PATH',
'dolibarr_lib_PHPEXCEL_PATH',
'dolibarr_lib_GEOIP_PATH',
'dolibarr_lib_PHPEXCEL_PATH',
'dolibarr_lib_GEOIP_PATH',
'dolibarr_lib_ODTPHP_PATH',
'dolibarr_lib_ODTPHP_PATHTOPCLZIP',
'dolibarr_js_CKEDITOR',
'dolibarr_js_JQUERY',
'dolibarr_js_JQUERY_UI',
'dolibarr_js_JQUERY_FLOT',
'dolibarr_lib_ODTPHP_PATHTOPCLZIP',
'dolibarr_js_CKEDITOR',
'dolibarr_js_JQUERY',
'dolibarr_js_JQUERY_UI',
'dolibarr_js_JQUERY_FLOT',
'dolibarr_font_DOL_DEFAULT_TTF',
'dolibarr_font_DOL_DEFAULT_TTF_BOLD',
'dolibarr_font_DOL_DEFAULT_TTF_BOLD',
'separator',
'Limit nb of email sent by page',
'Strict mode is on/off'
@ -155,19 +155,19 @@ foreach($configfileparameters as $key)
if (empty($ignore))
{
$newkey = preg_replace('/^\?/', '', $key);
$newkey = preg_replace('/^\?/', '', $key);
if (preg_match('/^\?/', $key) && empty(${$newkey}))
{
$i++;
continue; // We discard parametes starting with ?
}
if (preg_match('/^\?/', $key) && empty(${$newkey}))
{
$i++;
continue; // We discard parametes starting with ?
}
if ($newkey == 'separator' && $lastkeyshown == 'separator')
{
$i++;
continue;
}
if ($newkey == 'separator' && $lastkeyshown == 'separator')
{
$i++;
continue;
}
print '<tr class="oddeven">';
if ($newkey == 'separator')
@ -233,17 +233,17 @@ if ($resql)
$i = 0;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
print '<td>'.$obj->name.'</td>'."\n";
print '<td>'.$obj->value.'</td>'."\n";
if (empty($conf->multicompany->enabled) || !$user->entity) print '<td>'.$obj->entity.'</td>'."\n"; // If superadmin or multicompany disabled
print "</tr>\n";
print '<tr class="oddeven">';
print '<td>'.$obj->name.'</td>'."\n";
print '<td>'.$obj->value.'</td>'."\n";
if (empty($conf->multicompany->enabled) || !$user->entity) print '<td>'.$obj->entity.'</td>'."\n"; // If superadmin or multicompany disabled
print "</tr>\n";
$i++;
}
$i++;
}
}
print '</table>';

View File

@ -54,17 +54,17 @@ $i=0;
foreach($modulesdir as $dir)
{
$handle=@opendir(dol_osencode($dir));
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php')
{
$modName = substr($file, 0, dol_strlen($file) - 10);
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php')
{
$modName = substr($file, 0, dol_strlen($file) - 10);
if ($modName)
{
//print 'xx'.$dir.$file.'<br>';
if ($modName)
{
//print 'xx'.$dir.$file.'<br>';
if (in_array($file, $modules_files))
{
// File duplicate
@ -77,13 +77,13 @@ foreach($modulesdir as $dir)
if (class_exists($modName))
{
try {
$objMod = new $modName($db);
$objMod = new $modName($db);
$modules[$objMod->numero]=$objMod;
$modules_names[$objMod->numero]=$objMod->name;
$modules_files[$objMod->numero]=$file;
$modules_fullpath[$file]=$dir.$file;
$picto[$objMod->numero]=(isset($objMod->picto) && $objMod->picto)?$objMod->picto:'generic';
$modules[$objMod->numero]=$objMod;
$modules_names[$objMod->numero]=$objMod->name;
$modules_files[$objMod->numero]=$file;
$modules_fullpath[$file]=$dir.$file;
$picto[$objMod->numero]=(isset($objMod->picto) && $objMod->picto)?$objMod->picto:'generic';
}
catch(Exception $e)
{
@ -95,11 +95,11 @@ foreach($modulesdir as $dir)
print "Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file)<br>";
}
}
}
}
}
closedir($handle);
}
}
}
}
closedir($handle);
}
}
print '<div class="div-table-responsive-no-min">';
@ -120,15 +120,15 @@ foreach($sortorder as $numero=>$name)
// Module
print '<tr class="oddeven"><td width="300" class="nowrap">';
$alt=$name.' - '.$modules_files[$numero];
if (! empty($picto[$numero]))
{
if (preg_match('/^\//', $picto[$numero])) print img_picto($alt, $picto[$numero], 'width="14px"', 1);
else print img_object($alt, $picto[$numero], 'width="14px"');
}
else
{
print img_object($alt, $picto[$numero], 'width="14px"');
}
if (! empty($picto[$numero]))
{
if (preg_match('/^\//', $picto[$numero])) print img_picto($alt, $picto[$numero], 'width="14px"', 1);
else print img_object($alt, $picto[$numero], 'width="14px"');
}
else
{
print img_object($alt, $picto[$numero], 'width="14px"');
}
print ' '.$modules[$numero]->getName();
print "</td>";
// Version

View File

@ -41,54 +41,54 @@ print "<br>\n";
if (!function_exists('xdebug_is_enabled'))
{
print 'XDebug seems to be not installed. Function xdebug_is_enabled not found.';
llxFooter();
exit;
print 'XDebug seems to be not installed. Function xdebug_is_enabled not found.';
llxFooter();
exit;
}
if (function_exists('socket_create'))
{
$address = ini_get('xdebug.remote_host')?ini_get('xdebug.remote_host'):'127.0.0.1';
$port = ini_get('xdebug.remote_port')?ini_get('xdebug.remote_port'):9000;
$address = ini_get('xdebug.remote_host')?ini_get('xdebug.remote_host'):'127.0.0.1';
$port = ini_get('xdebug.remote_port')?ini_get('xdebug.remote_port'):9000;
print "<strong>Current xdebug setup:</strong><br>\n";
print "* Remote debug setup:<br>\n";
print 'xdebug.remote_enable = '.ini_get('xdebug.remote_enable')."<br>\n";
print 'xdebug.remote_host = '.$address."<br>\n";
print 'xdebug.remote_port = '.$port."<br>\n";
print "* Profiler setup ";
if (function_exists('xdebug_get_profiler_filename')) print xdebug_get_profiler_filename()?"(currently on into file ".xdebug_get_profiler_filename().")":"(currently off)";
else print "(currenlty not available)";
print ":<br>\n";
print 'xdebug.profiler_enable = '.ini_get('xdebug.profiler_enable')."<br>\n";
print 'xdebug.profiler_enable_trigger = '.ini_get('xdebug.profiler_enable_trigger')."<br>\n";
print 'xdebug.profiler_output_dir = '.ini_get('xdebug.profiler_output_dir')."<br>\n";
print 'xdebug.profiler_output_name = '.ini_get('xdebug.profiler_output_name')."<br>\n";
print 'xdebug.profiler_append = '.ini_get('xdebug.profiler_append')."<br>\n";
print "<br>\n";
print "<strong>Current xdebug setup:</strong><br>\n";
print "* Remote debug setup:<br>\n";
print 'xdebug.remote_enable = '.ini_get('xdebug.remote_enable')."<br>\n";
print 'xdebug.remote_host = '.$address."<br>\n";
print 'xdebug.remote_port = '.$port."<br>\n";
print "* Profiler setup ";
if (function_exists('xdebug_get_profiler_filename')) print xdebug_get_profiler_filename()?"(currently on into file ".xdebug_get_profiler_filename().")":"(currently off)";
else print "(currenlty not available)";
print ":<br>\n";
print 'xdebug.profiler_enable = '.ini_get('xdebug.profiler_enable')."<br>\n";
print 'xdebug.profiler_enable_trigger = '.ini_get('xdebug.profiler_enable_trigger')."<br>\n";
print 'xdebug.profiler_output_dir = '.ini_get('xdebug.profiler_output_dir')."<br>\n";
print 'xdebug.profiler_output_name = '.ini_get('xdebug.profiler_output_name')."<br>\n";
print 'xdebug.profiler_append = '.ini_get('xdebug.profiler_append')."<br>\n";
print "<br>\n";
echo "To run a debug session, add parameter<br>";
echo "* XDEBUG_SESSION_START=aname on your URL. To stop, remove cookie XDEBUG_SESSION_START.<br>\n";
echo "To run a profiler session (when xdebug.profiler_enable_trigger=1), add parameter<br>\n";
echo "* XDEBUG_PROFILE=aname on each URL.<br>";
print "<br>";
echo "To run a debug session, add parameter<br>";
echo "* XDEBUG_SESSION_START=aname on your URL. To stop, remove cookie XDEBUG_SESSION_START.<br>\n";
echo "To run a profiler session (when xdebug.profiler_enable_trigger=1), add parameter<br>\n";
echo "* XDEBUG_PROFILE=aname on each URL.<br>";
print "<br>";
print "<strong>Test debugger server (Eclipse for example):</strong><br>\n";
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if (empty($socket)) die('Unable to prepare a socket');
//socket_bind($sock, $address, $port) or die('Unable to bind on address='.$address.' port='.$port);
//socket_listen($sock);
//$client = socket_accept($sock);
$client=socket_connect($socket, $address, $port);
if ($client)
{
echo "Connection established: ".$client." - address=".$address." port=".$port."<br>\n";
echo "There is a Remote debug server at this address.<br>\n";
echo "<br>\n";
echo "To be sure this debugger accepts input from your PHP server and xdebug, be sure to have\n";
echo "your php.ini file with this :<br>\n";
echo '<textarea cols="80" rows="16">'."xdebug.remote_enable=on
print "<strong>Test debugger server (Eclipse for example):</strong><br>\n";
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if (empty($socket)) die('Unable to prepare a socket');
//socket_bind($sock, $address, $port) or die('Unable to bind on address='.$address.' port='.$port);
//socket_listen($sock);
//$client = socket_accept($sock);
$client=socket_connect($socket, $address, $port);
if ($client)
{
echo "Connection established: ".$client." - address=".$address." port=".$port."<br>\n";
echo "There is a Remote debug server at this address.<br>\n";
echo "<br>\n";
echo "To be sure this debugger accepts input from your PHP server and xdebug, be sure to have\n";
echo "your php.ini file with this :<br>\n";
echo '<textarea cols="80" rows="16">'."xdebug.remote_enable=on
xdebug.remote_handle=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
@ -103,23 +103,23 @@ xdebug.show_mem_delta=1
xdebug.trace_output_dir=/tmp/trace
xdebug.auto_trace=0
</textarea>\n";
print "<br><br>\n";
echo 'Then check in your debug server (Eclipse), you have setup:<br>
print "<br><br>\n";
echo 'Then check in your debug server (Eclipse), you have setup:<br>
XDebug with same port than in php.ini<br>
Allow Remote debug=yes or prompt<br>'."\n";
print "<br>\n";
}
else
{
print socket_strerror(socket_last_error());
echo "Failed to connect to address=".$address." port=".$port."<br>\n";
echo "There is no Remote debug server at this address.\n";
}
socket_close($socket);
print "<br>\n";
}
else
{
print socket_strerror(socket_last_error());
echo "Failed to connect to address=".$address." port=".$port."<br>\n";
echo "There is no Remote debug server at this address.\n";
}
socket_close($socket);
}
else
{
print "Can't test if PHPDebug is OK as PHP socket functions are not enabled.";
print "Can't test if PHPDebug is OK as PHP socket functions are not enabled.";
}

View File

@ -36,7 +36,7 @@ $form = new Form($db);
$tmptype2label = ExtraFields::$type2label;
$type2label = array('');
foreach ($tmptype2label as $key => $val) {
$type2label[$key] = $langs->trans($val);
$type2label[$key] = $langs->trans($val);
}
$action = GETPOST('action', 'alpha');
@ -44,7 +44,7 @@ $attrname = GETPOST('attrname', 'alpha');
$elementtype = 'ticket'; //Must be the $table_element of the class that manage extrafield
if (!$user->admin) {
accessforbidden();
accessforbidden();
}
@ -79,9 +79,9 @@ dol_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '<div class="tabsAction">';
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . "?action=create\">" . $langs->trans("NewAttribute") . '</a></div>';
print "</div>";
print '<div class="tabsAction">';
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . "?action=create\">" . $langs->trans("NewAttribute") . '</a></div>';
print "</div>";
}
/* ************************************************************************** */
@ -91,10 +91,10 @@ if ($action != 'create' && $action != 'edit') {
/* ************************************************************************** */
if ($action == 'create') {
print "<br>";
print load_fiche_titre($langs->trans('NewAttribute'));
print "<br>";
print load_fiche_titre($langs->trans('NewAttribute'));
include DOL_DOCUMENT_ROOT . '/core/tpl/admin_extrafields_add.tpl.php';
include DOL_DOCUMENT_ROOT . '/core/tpl/admin_extrafields_add.tpl.php';
}
/* ************************************************************************** */
@ -103,10 +103,10 @@ if ($action == 'create') {
/* */
/* ************************************************************************** */
if ($action == 'edit' && !empty($attrname)) {
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
include DOL_DOCUMENT_ROOT . '/core/tpl/admin_extrafields_edit.tpl.php';
include DOL_DOCUMENT_ROOT . '/core/tpl/admin_extrafields_edit.tpl.php';
}
// End of page

View File

@ -54,9 +54,9 @@ $version='0.0';
if ($action == 'getlastversion')
{
$result = getURLContent('http://sourceforge.net/projects/dolibarr/rss');
//var_dump($result['content']);
$sfurl = simplexml_load_string($result['content']);
$result = getURLContent('http://sourceforge.net/projects/dolibarr/rss');
//var_dump($result['content']);
$sfurl = simplexml_load_string($result['content']);
}
@ -75,39 +75,39 @@ print $langs->trans("CurrentVersion").' : <strong>'.DOL_VERSION.'</strong><br>';
if (function_exists('curl_init'))
{
$conf->global->MAIN_USE_RESPONSE_TIMEOUT = 10;
$conf->global->MAIN_USE_RESPONSE_TIMEOUT = 10;
if ($action == 'getlastversion')
{
if ($sfurl)
{
$i=0;
while (! empty($sfurl->channel[0]->item[$i]->title) && $i < 10000)
{
$title=$sfurl->channel[0]->item[$i]->title;
if (preg_match('/([0-9]+\.([0-9\.]+))/', $title, $reg))
{
$newversion=$reg[1];
$newversionarray=explode('.', $newversion);
$versionarray=explode('.', $version);
//var_dump($newversionarray);var_dump($versionarray);
if (versioncompare($newversionarray, $versionarray) > 0) $version=$newversion;
}
$i++;
}
if ($action == 'getlastversion')
{
if ($sfurl)
{
$i=0;
while (! empty($sfurl->channel[0]->item[$i]->title) && $i < 10000)
{
$title=$sfurl->channel[0]->item[$i]->title;
if (preg_match('/([0-9]+\.([0-9\.]+))/', $title, $reg))
{
$newversion=$reg[1];
$newversionarray=explode('.', $newversion);
$versionarray=explode('.', $version);
//var_dump($newversionarray);var_dump($versionarray);
if (versioncompare($newversionarray, $versionarray) > 0) $version=$newversion;
}
$i++;
}
// Show version
print $langs->trans("LastStableVersion").' : <b>'. (($version != '0.0')?$version:$langs->trans("Unknown")) .'</b><br>';
}
else
{
print $langs->trans("LastStableVersion").' : <b>' .$langs->trans("UpdateServerOffline").'</b><br>';
}
}
else
{
print $langs->trans("LastStableVersion").' : <a href="'.$_SERVER["PHP_SELF"].'?action=getlastversion" class="button">' .$langs->trans("Check").'</a><br>';
}
// Show version
print $langs->trans("LastStableVersion").' : <b>'. (($version != '0.0')?$version:$langs->trans("Unknown")) .'</b><br>';
}
else
{
print $langs->trans("LastStableVersion").' : <b>' .$langs->trans("UpdateServerOffline").'</b><br>';
}
}
else
{
print $langs->trans("LastStableVersion").' : <a href="'.$_SERVER["PHP_SELF"].'?action=getlastversion" class="button">' .$langs->trans("Check").'</a><br>';
}
}
print '<br>';

View File

@ -76,9 +76,9 @@ dol_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit')
{
print '<div class="tabsAction">';
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=create">'.$langs->trans("NewAttribute").'</a></div>';
print "</div>";
print '<div class="tabsAction">';
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=create">'.$langs->trans("NewAttribute").'</a></div>';
print "</div>";
}
@ -90,10 +90,10 @@ if ($action != 'create' && $action != 'edit')
if ($action == 'create')
{
print "<br>";
print load_fiche_titre($langs->trans('NewAttribute'));
print "<br>";
print load_fiche_titre($langs->trans('NewAttribute'));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
}
/* ************************************************************************** */
@ -103,10 +103,10 @@ if ($action == 'create')
/* ************************************************************************** */
if ($action == 'edit' && ! empty($attrname))
{
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
}
// End of page

View File

@ -61,28 +61,28 @@ if (! empty($conf->global->BARCODE_PRODUCT_ADDON_NUM))
$dir = dol_buildpath($dirroot, 0);
$handle = @opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (preg_match('/^mod_barcode_product_.*php$/', $file))
{
$file = substr($file, 0, dol_strlen($file)-4);
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (preg_match('/^mod_barcode_product_.*php$/', $file))
{
$file = substr($file, 0, dol_strlen($file)-4);
try {
dol_include_once($dirroot.$file.'.php');
}
catch(Exception $e)
{
dol_syslog($e->getMessage(), LOG_ERR);
}
try {
dol_include_once($dirroot.$file.'.php');
}
catch(Exception $e)
{
dol_syslog($e->getMessage(), LOG_ERR);
}
$modBarCodeProduct = new $file();
break;
}
}
closedir($handle);
}
$modBarCodeProduct = new $file();
break;
}
}
closedir($handle);
}
}
}

View File

@ -37,8 +37,8 @@ $element = GETPOST('element', 'alpha');
$action = GETPOST('action', 'alpha');
if ($element === 'facture') {
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$facture = new Facture($db);
if($facture->fetch($id)>0) {

View File

@ -53,13 +53,13 @@ function blockedlogadmin_prepare_head()
$object=new stdClass();
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'blockedlog');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'blockedlog', 'remove');
return $head;
return $head;
}

View File

@ -74,11 +74,11 @@ if (is_array($hookmanager->resArray) && ! empty($hookmanager->resArray)) {
<?php
if (! empty($mysoc->logo_small))
{
print '<img class="logopos" alt="Logo company" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small).'">';
print '<img class="logopos" alt="Logo company" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small).'">';
}
else
{
print '<div class="logopos">'.$mysoc->name.'</div>';
print '<div class="logopos">'.$mysoc->name.'</div>';
}
?>
</div>

View File

@ -143,19 +143,19 @@ if ($object->id > 0)
// Project
if (! empty($conf->projet->enabled))
{
$langs->load("projects");
//$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
$morehtmlref.=$langs->trans('Project') . ': ';
if (! empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
$morehtmlref.=$proj->ref;
$morehtmlref.='</a>';
if ($proj->title) $morehtmlref.=' - '.$proj->title;
} else {
$morehtmlref.='';
}
$langs->load("projects");
//$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
$morehtmlref.=$langs->trans('Project') . ': ';
if (! empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
$morehtmlref.=$proj->ref;
$morehtmlref.='</a>';
if ($proj->title) $morehtmlref.=' - '.$proj->title;
} else {
$morehtmlref.='';
}
}
$morehtmlref.='</div>';
@ -253,9 +253,9 @@ if ($object->id > 0)
print '</table>';
print '</div>';
print '</div>';
dol_fiche_end();
dol_fiche_end();
$modulepart = 'actions';

View File

@ -85,9 +85,9 @@ dol_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit')
{
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
}
@ -100,9 +100,9 @@ if ($action != 'create' && $action != 'edit')
if ($action == 'create')
{
print '<br><div id="newattrib"></div>';
print load_fiche_titre($langs->trans('NewAttribute'));
print load_fiche_titre($langs->trans('NewAttribute'));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
}
/* ************************************************************************** */
@ -112,10 +112,10 @@ if ($action == 'create')
/* ************************************************************************** */
if ($action == 'edit' && ! empty($attrname))
{
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
}
// End of page

View File

@ -162,13 +162,13 @@ if ($resql)
print '<tr class="oddeven">';
print '<td>';
$result='';
$link=$linkend='';
$link = '<a href="'.dol_buildpath('/commande/orderstoinvoice.php', 1).'?socid='.$obj->rowid.'">';
$linkend='</a>';
$name=$obj->name;
$result.=($link.img_object($langs->trans("ShowCompany").': '.$name, 'company').$linkend);
$result.=$link.(dol_trunc($name, $maxlen)).$linkend;
$result='';
$link=$linkend='';
$link = '<a href="'.dol_buildpath('/commande/orderstoinvoice.php', 1).'?socid='.$obj->rowid.'">';
$linkend='</a>';
$name=$obj->name;
$result.=($link.img_object($langs->trans("ShowCompany").': '.$name, 'company').$linkend);
$result.=$link.(dol_trunc($name, $maxlen)).$linkend;
print $result;
print '</td>';

View File

@ -54,15 +54,15 @@ $sql.= " AND pb.entity = ".$conf->entity;
$resql=$db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
$num = $db->num_rows($resql);
$i = 0;
if ( $num > 0 )
{
$row = $db->fetch_row($resql);
$total = $row[0];
$nbtotal = $row[1];
}
if ( $num > 0 )
{
$row = $db->fetch_row($resql);
$total = $row[0];
$nbtotal = $row[1];
}
}
@ -150,15 +150,15 @@ $sql.= " AND pl.statut = 3";
$resql=$db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
$num = $db->num_rows($resql);
$i = 0;
if ( $num > 0 )
{
$row = $db->fetch_row($resql);
$total = $row[0];
$nbtotal = $row[1];
}
if ( $num > 0 )
{
$row = $db->fetch_row($resql);
$total = $row[0];
$nbtotal = $row[1];
}
}
/*

View File

@ -27,8 +27,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
if (! empty($conf->projet->enabled))
{
include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
}
// Load translation files required by the page
@ -51,10 +51,10 @@ $object = new ChargeSociales($db);
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');
}
@ -84,17 +84,17 @@ $morehtmlref.=$form->editfieldval("Label", 'lib', $object->label, $object, $user
// Project
if (! empty($conf->projet->enabled))
{
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' : ';
if (! empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
$morehtmlref.=$proj->ref;
$morehtmlref.='</a>';
} else {
$morehtmlref.='';
}
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' : ';
if (! empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
$morehtmlref.=$proj->ref;
$morehtmlref.='</a>';
} else {
$morehtmlref.='';
}
}
$morehtmlref.='</div>';

View File

@ -80,9 +80,9 @@ dol_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit')
{
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
}
@ -95,9 +95,9 @@ if ($action != 'create' && $action != 'edit')
if ($action == 'create')
{
print '<br><div name="topofform" id="newattrib"></div>';
print load_fiche_titre($langs->trans('NewAttribute'));
print load_fiche_titre($langs->trans('NewAttribute'));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
}
/* ************************************************************************** */
@ -108,9 +108,9 @@ if ($action == 'create')
if ($action == 'edit' && ! empty($attrname))
{
print '<div name="topofform"></div><br>';
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
}
llxFooter();

View File

@ -80,9 +80,9 @@ dol_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit')
{
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
}
@ -97,7 +97,7 @@ if ($action == 'create')
print '<br><div id="newattrib"></div>';
print load_fiche_titre($langs->trans('NewAttribute'));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
}
/* ************************************************************************** */
@ -107,10 +107,10 @@ if ($action == 'create')
/* ************************************************************************** */
if ($action == 'edit' && ! empty($attrname))
{
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
}
llxFooter();

View File

@ -32,9 +32,9 @@ $addlinkid = GETPOST('idtolinkto', 'int');
// Link invoice to order
if ($action == 'addlink' && ! empty($permissiondellink) && ! GETPOST('cancel', 'alpha') && $id > 0 && $addlinkid > 0)
{
$object->fetch($id);
$object->fetch_thirdparty();
$result = $object->add_object_linked(GETPOST('addlink', 'alpha'), $addlinkid);
$object->fetch($id);
$object->fetch_thirdparty();
$result = $object->add_object_linked(GETPOST('addlink', 'alpha'), $addlinkid);
}
// Delete link

View File

@ -29,63 +29,63 @@
// Print file
if ($action == 'print_file' && $user->rights->printing->read) {
$langs->load("printing");
require_once DOL_DOCUMENT_ROOT . '/core/modules/printing/modules_printing.php';
$objectprint = new PrintingDriver($db);
$list = $objectprint->listDrivers($db, 10);
if (! empty($list)) {
$errorprint=0;
$printerfound=0;
foreach ($list as $driver) {
require_once DOL_DOCUMENT_ROOT.'/core/modules/printing/'.$driver.'.modules.php';
$langs->load($driver);
$classname = 'printing_'.$driver;
$printer = new $classname($db);
//print '<pre>'.print_r($printer, true).'</pre>';
$langs->load("printing");
require_once DOL_DOCUMENT_ROOT . '/core/modules/printing/modules_printing.php';
$objectprint = new PrintingDriver($db);
$list = $objectprint->listDrivers($db, 10);
if (! empty($list)) {
$errorprint=0;
$printerfound=0;
foreach ($list as $driver) {
require_once DOL_DOCUMENT_ROOT.'/core/modules/printing/'.$driver.'.modules.php';
$langs->load($driver);
$classname = 'printing_'.$driver;
$printer = new $classname($db);
//print '<pre>'.print_r($printer, true).'</pre>';
if (! empty($conf->global->{$printer->active}))
{
$printerfound++;
if (! empty($conf->global->{$printer->active}))
{
$printerfound++;
$subdir='';
$module = GETPOST('printer', 'alpha');
switch ($module )
{
case 'livraison' :
$subdir = 'receipt';
$module = 'expedition';
break;
case 'expedition' :
$subdir = 'sending';
break;
case 'commande_fournisseur' :
$module = 'fournisseur';
$subdir = 'commande';
break;
}
try {
$ret = $printer->printFile(GETPOST('file', 'alpha'), $module, $subdir);
if ($ret > 0) {
//print '<pre>'.print_r($printer->errors, true).'</pre>';
setEventMessages($printer->error, $printer->errors, 'errors');
}
if ($ret==0)
{
//print '<pre>'.print_r($printer->errors, true).'</pre>';
setEventMessages($printer->error, $printer->errors);
setEventMessages($langs->transnoentitiesnoconv("FileWasSentToPrinter", basename(GETPOST('file', 'alpha'))).' '.$langs->transnoentitiesnoconv("ViaModule").' '.$printer->name, null);
}
}
catch(Exception $e)
{
$ret = 1;
setEventMessages($e->getMessage(), null, 'errors');
}
}
}
if ($printerfound==0) setEventMessages($langs->trans("NoActivePrintingModuleFound", $langs->transnoentities("Module64000Name")), null, 'warnings');
} else {
setEventMessages($langs->trans("NoModuleFound"), null, 'warnings');
}
$action = '';
$subdir='';
$module = GETPOST('printer', 'alpha');
switch ($module )
{
case 'livraison' :
$subdir = 'receipt';
$module = 'expedition';
break;
case 'expedition' :
$subdir = 'sending';
break;
case 'commande_fournisseur' :
$module = 'fournisseur';
$subdir = 'commande';
break;
}
try {
$ret = $printer->printFile(GETPOST('file', 'alpha'), $module, $subdir);
if ($ret > 0) {
//print '<pre>'.print_r($printer->errors, true).'</pre>';
setEventMessages($printer->error, $printer->errors, 'errors');
}
if ($ret==0)
{
//print '<pre>'.print_r($printer->errors, true).'</pre>';
setEventMessages($printer->error, $printer->errors);
setEventMessages($langs->transnoentitiesnoconv("FileWasSentToPrinter", basename(GETPOST('file', 'alpha'))).' '.$langs->transnoentitiesnoconv("ViaModule").' '.$printer->name, null);
}
}
catch(Exception $e)
{
$ret = 1;
setEventMessages($e->getMessage(), null, 'errors');
}
}
}
if ($printerfound==0) setEventMessages($langs->trans("NoActivePrintingModuleFound", $langs->transnoentities("Module64000Name")), null, 'warnings');
} else {
setEventMessages($langs->trans("NoModuleFound"), null, 'warnings');
}
$action = '';
}

View File

@ -60,8 +60,8 @@ if ($action == 'setnote_public' && ! empty($permissionnote) && ! GETPOST('cancel
}
}
} elseif ($action == 'setnote_private' && ! empty($permissionnote) && ! GETPOST('cancel', 'alpha')) {
// Set public note
if (empty($action) || ! is_object($object) || empty($id)) dol_print_error('', 'Include of actions_setnotes.inc.php was done but required variable was not set before');
// Set public note
if (empty($action) || ! is_object($object) || empty($id)) dol_print_error('', 'Include of actions_setnotes.inc.php was done but required variable was not set before');
if (empty($object->id)) $object->fetch($id); // Fetch may not be already done
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_private', 'none'), ENT_QUOTES), '_private');
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');

View File

@ -51,46 +51,46 @@ if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $
{
// Increase date
$al = new AccountLine($db);
$al->datev_next(GETPOST('rowid', 'int'));
$al->fetch(GETPOST('rowid', 'int'));
$al->datev_next(GETPOST('rowid', 'int'));
$al->fetch(GETPOST('rowid', 'int'));
print '<span>'.dol_print_date($db->jdate($al->datev), "day").'</span>';
print '<span>'.dol_print_date($db->jdate($al->datev), "day").'</span>';
exit;
exit;
}
if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $action == 'dvprev')
{
// Decrease date
$al =new AccountLine($db);
$al->datev_previous(GETPOST('rowid', 'int'));
$al->fetch(GETPOST('rowid', 'int'));
$al->datev_previous(GETPOST('rowid', 'int'));
$al->fetch(GETPOST('rowid', 'int'));
print '<span>'.dol_print_date($db->jdate($al->datev), "day").'</span>';
print '<span>'.dol_print_date($db->jdate($al->datev), "day").'</span>';
exit;
exit;
}
if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $action == 'donext')
{
// Increase date
$al = new AccountLine($db);
$al->dateo_next(GETPOST('rowid', 'int'));
$al->fetch(GETPOST('rowid', 'int'));
$al->dateo_next(GETPOST('rowid', 'int'));
$al->fetch(GETPOST('rowid', 'int'));
print '<span>'.dol_print_date($db->jdate($al->dateo), "day").'</span>';
print '<span>'.dol_print_date($db->jdate($al->dateo), "day").'</span>';
exit;
exit;
}
if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $action == 'doprev')
{
// Decrease date
$al =new AccountLine($db);
$al->dateo_previous(GETPOST('rowid', 'int'));
$al->fetch(GETPOST('rowid', 'int'));
$al->dateo_previous(GETPOST('rowid', 'int'));
$al->fetch(GETPOST('rowid', 'int'));
print '<span>'.dol_print_date($db->jdate($al->dateo), "day").'</span>';
print '<span>'.dol_print_date($db->jdate($al->dateo), "day").'</span>';
exit;
exit;
}

View File

@ -53,23 +53,23 @@ header('Access-Control-Allow-Headers: X-File-Name, X-File-Type, X-File-Size');
switch ($_SERVER['REQUEST_METHOD']) {
case 'OPTIONS':
break;
case 'HEAD':
case 'GET':
$upload_handler->get();
break;
case 'POST':
if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') {
$upload_handler->delete();
} else {
$upload_handler->post();
}
break;
case 'DELETE':
$upload_handler->delete();
break;
default:
header('HTTP/1.0 405 Method Not Allowed');
exit;
case 'HEAD':
case 'GET':
$upload_handler->get();
break;
case 'POST':
if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') {
$upload_handler->delete();
} else {
$upload_handler->post();
}
break;
case 'DELETE':
$upload_handler->delete();
break;
default:
header('HTTP/1.0 405 Method Not Allowed');
exit;
}
$db->close();

View File

@ -68,4 +68,4 @@ else
// Registering new values
if (($action == 'set') && ! empty($id))
$object->setValueFrom($field, $value, $element, $id);
$object->setValueFrom($field, $value, $element, $id);

View File

@ -44,8 +44,8 @@ if (isset($_GET['action']) && ! empty($_GET['action']))
{
if ($_GET['action'] == 'getrandompassword' && $user->admin)
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
$generic = $_GET['generic'] ? true : false;
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
$generic = $_GET['generic'] ? true : false;
echo getRandomPassword($generic);
}
}

View File

@ -62,36 +62,36 @@ if (! empty($_GET['zipcode']) || ! empty($_GET['town']))
if (! empty($conf->global->MAIN_USE_ZIPTOWN_DICTIONNARY)) // Use zip-town table
{
$sql = "SELECT z.rowid, z.zip, z.town, z.fk_county, z.fk_pays as fk_country";
$sql.= ", c.rowid as fk_country, c.code as country_code, c.label as country";
$sql.= ", d.rowid as fk_county, d.code_departement as county_code, d.nom as county";
$sql.= " FROM ".MAIN_DB_PREFIX."c_ziptown as z";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX ."c_departements as d ON z.fk_county = d.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r ON d.fk_region = r.code_region,";
$sql.= " ".MAIN_DB_PREFIX."c_country as c";
$sql.= " WHERE z.fk_pays = c.rowid";
$sql.= " AND z.active = 1 AND c.active = 1";
if ($zipcode) $sql.=" AND z.zip LIKE '" . $db->escape($zipcode) . "%'";
if ($town) $sql.=" AND z.town LIKE '%" . $db->escape($town) . "%'";
$sql.= " ORDER BY z.zip, z.town";
$sql.= $db->plimit(100); // Avoid pb with bad criteria
$sql = "SELECT z.rowid, z.zip, z.town, z.fk_county, z.fk_pays as fk_country";
$sql.= ", c.rowid as fk_country, c.code as country_code, c.label as country";
$sql.= ", d.rowid as fk_county, d.code_departement as county_code, d.nom as county";
$sql.= " FROM ".MAIN_DB_PREFIX."c_ziptown as z";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX ."c_departements as d ON z.fk_county = d.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r ON d.fk_region = r.code_region,";
$sql.= " ".MAIN_DB_PREFIX."c_country as c";
$sql.= " WHERE z.fk_pays = c.rowid";
$sql.= " AND z.active = 1 AND c.active = 1";
if ($zipcode) $sql.=" AND z.zip LIKE '" . $db->escape($zipcode) . "%'";
if ($town) $sql.=" AND z.town LIKE '%" . $db->escape($town) . "%'";
$sql.= " ORDER BY z.zip, z.town";
$sql.= $db->plimit(100); // Avoid pb with bad criteria
}
else // Use table of third parties
{
$sql = "SELECT DISTINCT s.zip, s.town, s.fk_departement as fk_county, s.fk_pays as fk_country";
$sql.= ", c.code as country_code, c.label as country";
$sql.= ", d.code_departement as county_code , d.nom as county";
$sql.= " FROM ".MAIN_DB_PREFIX.'societe as s';
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX ."c_departements as d ON s.fk_departement = d.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid';
$sql.= " WHERE";
if ($zipcode) $sql.= " s.zip LIKE '".$db->escape($zipcode)."%'";
if ($town) $sql.= " s.town LIKE '%" . $db->escape($town) . "%'";
$sql.= " ORDER BY s.fk_pays, s.zip, s.town";
$sql.= $db->plimit(100); // Avoid pb with bad criteria
$sql = "SELECT DISTINCT s.zip, s.town, s.fk_departement as fk_county, s.fk_pays as fk_country";
$sql.= ", c.code as country_code, c.label as country";
$sql.= ", d.code_departement as county_code , d.nom as county";
$sql.= " FROM ".MAIN_DB_PREFIX.'societe as s';
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX ."c_departements as d ON s.fk_departement = d.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid';
$sql.= " WHERE";
if ($zipcode) $sql.= " s.zip LIKE '".$db->escape($zipcode)."%'";
if ($town) $sql.= " s.town LIKE '%" . $db->escape($town) . "%'";
$sql.= " ORDER BY s.fk_pays, s.zip, s.town";
$sql.= $db->plimit(100); // Avoid pb with bad criteria
}
//print $sql;
//print $sql;
$resql=$db->query($sql);
//var_dump($db);
if ($resql)
@ -103,11 +103,11 @@ if (! empty($_GET['zipcode']) || ! empty($_GET['town']))
$row_array['label'] = $row['zip'].' '.$row['town'];
$row_array['label'] .= ($county || $country)?' (':'';
$row_array['label'] .= $county;
$row_array['label'] .= $county;
$row_array['label'] .= ($county && $country?' - ':'');
$row_array['label'] .= $country;
$row_array['label'] .= ($county || $country)?')':'';
if ($zipcode)
$row_array['label'] .= $country;
$row_array['label'] .= ($county || $country)?')':'';
if ($zipcode)
{
$row_array['value'] = $row['zip'];
$row_array['town'] = $row['town'];

View File

@ -43,7 +43,7 @@ $number = strlen($letters);
$string = '';
for($i = 0; $i < $length; $i++)
{
$string .= $letters{mt_rand(0, $number - 1)};
$string .= $letters{mt_rand(0, $number - 1)};
}
//print $string;
@ -54,8 +54,8 @@ $_SESSION[$sessionkey]=$string;
$img = imagecreate(80, 32);
if (empty($img))
{
dol_print_error('', "Problem with GD creation");
exit;
dol_print_error('', "Problem with GD creation");
exit;
}
// Define mime type

View File

@ -50,13 +50,13 @@ abstract class CommonObjectLine extends CommonObject
public $fk_unit;
/**
* Returns the translation key from units dictionary.
* A langs->trans() must be called on result to get translated value.
*
* @param string $type Label type (long or short)
* @return string|int <0 if ko, label if ok
*/
/**
* Returns the translation key from units dictionary.
* A langs->trans() must be called on result to get translated value.
*
* @param string $type Label type (long or short)
* @return string|int <0 if ko, label if ok
*/
public function getLabelOfUnit($type = 'long')
{
global $langs;

View File

@ -67,18 +67,18 @@ else
// Define tradMonths javascript array (we define this in datapicker AND in parent page to avoid errors with IE8)
$tradTemp=array(
$langs->trans("January"),
$langs->trans("February"),
$langs->trans("March"),
$langs->trans("April"),
$langs->trans("May"),
$langs->trans("June"),
$langs->trans("July"),
$langs->trans("August"),
$langs->trans("September"),
$langs->trans("October"),
$langs->trans("November"),
$langs->trans("December")
$langs->trans("January"),
$langs->trans("February"),
$langs->trans("March"),
$langs->trans("April"),
$langs->trans("May"),
$langs->trans("June"),
$langs->trans("July"),
$langs->trans("August"),
$langs->trans("September"),
$langs->trans("October"),
$langs->trans("November"),
$langs->trans("December")
);
print '<script type="text/javascript">';
print 'var tradMonths = [';
@ -236,8 +236,8 @@ function displayBox($selectedDate, $month, $year)
if ($langs->trans("FormatDateShortJavaInput")=="FormatDateShortJavaInput")
{
print "ERROR FormatDateShortJavaInput not defined for language ".$langs->defaultlang;
exit;
print "ERROR FormatDateShortJavaInput not defined for language ".$langs->defaultlang;
exit;
}
// Sur click dans calendrier, appelle fonction dpClickDay

View File

@ -57,7 +57,7 @@ if (! IsAllowedCommand($sCommand))
// Check if it is an allowed type.
if (! IsAllowedType($sType))
SendUploadResults(1, '', '', 'Invalid type specified');
SendUploadResults(1, '', '', 'Invalid type specified');
// @CHANGE

View File

@ -209,24 +209,24 @@ function IsImageValid($filePath, $extension)
}
$imageCheckExtensions = array(
'gif',
'jpeg',
'jpg',
'png',
'swf',
'psd',
'bmp',
'iff',
'tiff',
'tif',
'swc',
'jpc',
'jp2',
'jpx',
'jb2',
'xbm',
'wbmp'
);
'gif',
'jpeg',
'jpg',
'png',
'swf',
'psd',
'bmp',
'iff',
'tiff',
'tif',
'swc',
'jpc',
'jp2',
'jpx',
'jb2',
'xbm',
'wbmp'
);
if (!in_array($extension, $imageCheckExtensions) ) {
return true;

View File

@ -74,10 +74,10 @@ if (! ($_SERVER['HTTP_REFERER'] === $dolibarr_main_url_root . '/' || $_SERVER['H
if (arr.length > 0) {
var audio = null;
<?php
if (! empty($conf->global->AGENDA_REMINDER_BROWSER_SOUND)) {
print 'audio = new Audio(\''.DOL_URL_ROOT.'/theme/common/sound/notification_agenda.wav'.'\');';
}
?>
if (! empty($conf->global->AGENDA_REMINDER_BROWSER_SOUND)) {
print 'audio = new Audio(\''.DOL_URL_ROOT.'/theme/common/sound/notification_agenda.wav'.'\');';
}
?>
$.each(arr, function (index, value) {
var url="notdefined";

View File

@ -34,7 +34,7 @@ function categories_prepare_head($object, $type)
global $langs, $conf, $user;
// Load translation files required by the page
$langs->loadLangs(array('categories', 'products'));
$langs->loadLangs(array('categories', 'products'));
$h = 0;
$head = array();
@ -51,19 +51,19 @@ function categories_prepare_head($object, $type)
if (! empty($conf->global->MAIN_MULTILANGS))
{
$head[$h][0] = DOL_URL_ROOT.'/categories/traduction.php?id='.$object->id.'&amp;type='.$type;
$head[$h][1] = $langs->trans("Translation");
$head[$h][2] = 'translation';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/categories/traduction.php?id='.$object->id.'&amp;type='.$type;
$head[$h][1] = $langs->trans("Translation");
$head[$h][2] = 'translation';
$h++;
}
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'categories_'.$type);
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'categories_'.$type);
complete_head_from_modules($conf, $langs, $object, $head, $h, 'categories_'.$type, 'remove');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'categories_'.$type, 'remove');
return $head;
}

View File

@ -78,12 +78,12 @@ function doc_getlinedesc($line, $outputlangs, $hideref = 0, $hidedesc = 0, $issu
}
elseif ($desc == '(DEPOSIT)' && $line->fk_remise_except)
{
$discount=new DiscountAbsolute($db);
$discount->fetch($line->fk_remise_except);
$sourceref=!empty($discount->discount_type)?$discount->ref_invoive_supplier_source:$discount->ref_facture_source;
$libelleproduitservice=$outputlangs->transnoentitiesnoconv("DiscountFromDeposit", $sourceref);
// Add date of deposit
if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) $libelleproduitservice.=' ('.dol_print_date($discount->datec, 'day', '', $outputlangs).')';
$discount=new DiscountAbsolute($db);
$discount->fetch($line->fk_remise_except);
$sourceref=!empty($discount->discount_type)?$discount->ref_invoive_supplier_source:$discount->ref_facture_source;
$libelleproduitservice=$outputlangs->transnoentitiesnoconv("DiscountFromDeposit", $sourceref);
// Add date of deposit
if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) $libelleproduitservice.=' ('.dol_print_date($discount->datec, 'day', '', $outputlangs).')';
}
elseif ($desc == '(EXCESS RECEIVED)' && $line->fk_remise_except)
{

View File

@ -36,8 +36,8 @@ function ecm_prepare_dasboard_head($object)
$h = 0;
$head = array();
$helptext =$langs->trans("ECMAreaDesc").'<br>';
$helptext.=$langs->trans("ECMAreaDesc2");
$helptext =$langs->trans("ECMAreaDesc").'<br>';
$helptext.=$langs->trans("ECMAreaDesc2");
$head[$h][0] = DOL_URL_ROOT.'/ecm/index.php';
$head[$h][1] = $langs->trans("ECMSectionsManual").$form->textwithpicto('', $helptext, 1, 'info', '', 0, 3);
@ -52,13 +52,13 @@ function ecm_prepare_dasboard_head($object)
$h++;
}
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'ecm');
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'ecm');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'ecm', 'remove');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'ecm', 'remove');
return $head;
}
@ -104,16 +104,16 @@ function ecm_prepare_head($object, $module = 'ecm', $section = '')
*/
function ecm_file_prepare_head($object)
{
global $langs, $conf, $user;
$h = 0;
$head = array();
global $langs, $conf, $user;
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/ecm/file_card.php?section='.$object->section_id.'&urlfile='.urlencode($object->label);
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/ecm/file_card.php?section='.$object->section_id.'&urlfile='.urlencode($object->label);
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h++;
return $head;
return $head;
}
/**

View File

@ -43,11 +43,11 @@ function import_prepare_head($param, $maxstep = 0)
$i=1;
while($i <= $maxstep)
{
$head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step='.$i.$param;
$head[$h][1] = $langs->trans("Step")." ".$i;
$head[$h][2] = 'step'.$i;
$h++;
$i++;
$head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step='.$i.$param;
$head[$h][1] = $langs->trans("Step")." ".$i;
$head[$h][2] = 'step'.$i;
$h++;
$i++;
}
return $head;

View File

@ -97,33 +97,33 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
}
if (in_array('nodeposit', $filter))
{
if (empty($sqlwhere)) $sqlwhere=' WHERE ';
else $sqlwhere.=" AND";
$sqlwhere.=' type <> 3';
if (empty($sqlwhere)) $sqlwhere=' WHERE ';
else $sqlwhere.=" AND";
$sqlwhere.=' type <> 3';
}
if (in_array('noreplacement', $filter))
{
if (empty($sqlwhere)) $sqlwhere=' WHERE ';
else $sqlwhere.=" AND";
$sqlwhere.=' type <> 1';
if (empty($sqlwhere)) $sqlwhere=' WHERE ';
else $sqlwhere.=" AND";
$sqlwhere.=' type <> 1';
}
if (in_array('nocreditnote', $filter))
{
if (empty($sqlwhere)) $sqlwhere=' WHERE ';
else $sqlwhere.=" AND";
$sqlwhere.=' type <> 2';
if (empty($sqlwhere)) $sqlwhere=' WHERE ';
else $sqlwhere.=" AND";
$sqlwhere.=' type <> 2';
}
if (in_array('excludethirdparties', $filter) && is_array($thirdpartiesid))
{
if (empty($sqlwhere)) $sqlwhere=' WHERE ';
else $sqlwhere.=" AND";
$sqlwhere.=' f.fk_soc NOT IN ('.join(',', $thirdpartiesid).')';
if (empty($sqlwhere)) $sqlwhere=' WHERE ';
else $sqlwhere.=" AND";
$sqlwhere.=' f.fk_soc NOT IN ('.join(',', $thirdpartiesid).')';
}
if (in_array('onlythirdparties', $filter) && is_array($thirdpartiesid))
{
if (empty($sqlwhere)) $sqlwhere=' WHERE ';
else $sqlwhere.=" AND";
$sqlwhere.=' f.fk_soc IN ('.join(',', $thirdpartiesid).')';
if (empty($sqlwhere)) $sqlwhere=' WHERE ';
else $sqlwhere.=" AND";
$sqlwhere.=' f.fk_soc IN ('.join(',', $thirdpartiesid).')';
}
if ($sqlwhere) $sql.=$sqlwhere;
if ($sqlorder) $sql.=$sqlorder;
@ -143,20 +143,20 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
dol_syslog("scripts/invoices/rebuild_merge.php", LOG_DEBUG);
if ( $resql=$db->query($sql) )
{
$num = $db->num_rows($resql);
$cpt = 0;
$oldemail = '';
$message = '';
$total = '';
$num = $db->num_rows($resql);
$cpt = 0;
$oldemail = '';
$message = '';
$total = '';
if ($num)
{
// First loop on each resultset to build PDF
// -----------------------------------------
if ($num)
{
// First loop on each resultset to build PDF
// -----------------------------------------
while ($cpt < $num)
{
$obj = $db->fetch_object($resql);
while ($cpt < $num)
{
$obj = $db->fetch_object($resql);
$fac = new Facture($db);
$result=$fac->fetch($obj->rowid);
@ -174,11 +174,11 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
$filename=$conf->facture->dir_output.'/'.$fac->ref.'/'.$fac->ref.'.pdf';
if ($regenerate || ! dol_is_file($filename))
{
if ($usestdout) print "Build PDF for invoice ".$obj->ref." - Lang = ".$outputlangs->defaultlang."\n";
$result= $fac->generateDocument($regenerate?$regenerate:$fac->modelpdf, $outputlangs);
if ($usestdout) print "Build PDF for invoice ".$obj->ref." - Lang = ".$outputlangs->defaultlang."\n";
$result= $fac->generateDocument($regenerate?$regenerate:$fac->modelpdf, $outputlangs);
}
else {
if ($usestdout) print "PDF for invoice ".$obj->ref." already exists\n";
if ($usestdout) print "PDF for invoice ".$obj->ref." already exists\n";
}
// Add file into files array
@ -192,50 +192,50 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
else dol_syslog("Failed to build PDF for invoice ".($fac->ref?$fac->ref:' id '.$obj->rowid), LOG_ERR);
}
$cpt++;
}
$cpt++;
}
// Define format of output PDF
$formatarray=pdf_getFormat($langs);
$page_largeur = $formatarray['width'];
$page_hauteur = $formatarray['height'];
$format = array($page_largeur,$page_hauteur);
// Define format of output PDF
$formatarray=pdf_getFormat($langs);
$page_largeur = $formatarray['width'];
$page_hauteur = $formatarray['height'];
$format = array($page_largeur,$page_hauteur);
if ($usestdout) print "Using output PDF format ".join('x', $format)."\n";
else dol_syslog("Using output PDF format ".join('x', $format), LOG_ERR);
if ($usestdout) print "Using output PDF format ".join('x', $format)."\n";
else dol_syslog("Using output PDF format ".join('x', $format), LOG_ERR);
// Now, build a merged files with all files in $files array
// Now, build a merged files with all files in $files array
//---------------------------------------------------------
// Create empty PDF
$pdf=pdf_getInstance($format);
if (class_exists('TCPDF'))
{
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
}
$pdf->SetFont(pdf_getPDFFont($langs));
// Create empty PDF
$pdf=pdf_getInstance($format);
if (class_exists('TCPDF'))
{
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
}
$pdf->SetFont(pdf_getPDFFont($langs));
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
//$pdf->SetCompression(false);
// Add all others
foreach($files as $file)
{
if ($usestdout) print "Merge PDF file for invoice ".$file."\n";
else dol_syslog("Merge PDF file for invoice ".$file);
if ($usestdout) print "Merge PDF file for invoice ".$file."\n";
else dol_syslog("Merge PDF file for invoice ".$file);
// Charge un document PDF depuis un fichier.
$pagecount = $pdf->setSourceFile($file);
for ($i = 1; $i <= $pagecount; $i++)
{
$tplidx = $pdf->importPage($i);
$s = $pdf->getTemplatesize($tplidx);
$pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
$pdf->useTemplate($tplidx);
}
{
$tplidx = $pdf->importPage($i);
$s = $pdf->getTemplatesize($tplidx);
$pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
$pdf->useTemplate($tplidx);
}
}
// Create output dir if not exists
@ -261,19 +261,19 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
}
$result = 1;
}
else
{
if ($usestdout) print "No invoices found for criteria.\n";
else dol_syslog("No invoices found for criteria");
$result = 0;
}
}
else
{
if ($usestdout) print "No invoices found for criteria.\n";
else dol_syslog("No invoices found for criteria");
$result = 0;
}
}
else
{
dol_print_error($db);
dol_syslog("scripts/invoices/rebuild_merge.php: Error");
$error++;
dol_print_error($db);
dol_syslog("scripts/invoices/rebuild_merge.php: Error");
$error++;
}
if ($error) return -1;

View File

@ -28,18 +28,18 @@
*/
function mailmanspip_admin_prepare_head()
{
global $langs;
global $langs;
return array(
array(
DOL_URL_ROOT.'/admin/mailman.php',
$langs->trans('Mailman'),
'mailman'
),
array(
DOL_URL_ROOT.'/admin/spip.php',
$langs->trans('SPIP'),
'spip'
)
);
return array(
array(
DOL_URL_ROOT.'/admin/mailman.php',
$langs->trans('Mailman'),
'mailman'
),
array(
DOL_URL_ROOT.'/admin/spip.php',
$langs->trans('SPIP'),
'spip'
)
);
}

View File

@ -59,15 +59,15 @@ function prelevement_prepare_head(BonPrelevement $object)
$head[$h][2] = 'statistics';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'prelevement');
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'prelevement');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'prelevement', 'remove');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'prelevement', 'remove');
return $head;
return $head;
}
/**
@ -80,6 +80,6 @@ function prelevement_check_config()
global $conf;
if(empty($conf->global->PRELEVEMENT_ID_BANKACCOUNT)) return -1;
if(empty($conf->global->PRELEVEMENT_ICS)) return -1;
if(empty($conf->global->PRELEVEMENT_USER)) return -1;
if(empty($conf->global->PRELEVEMENT_USER)) return -1;
return 0;
}

View File

@ -32,39 +32,39 @@
*/
function receiptprinteradmin_prepare_head($mode)
{
global $langs, $conf;
global $langs, $conf;
$h = 0;
$head = array();
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT."/admin/receiptprinter.php?mode=config";
$head[$h][1] = $langs->trans("ListPrinters");
$head[$h][2] = 'config';
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/receiptprinter.php?mode=config";
$head[$h][1] = $langs->trans("ListPrinters");
$head[$h][2] = 'config';
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/receiptprinter.php?mode=template";
$head[$h][1] = $langs->trans("SetupReceiptTemplate");
$head[$h][2] = 'template';
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/receiptprinter.php?mode=template";
$head[$h][1] = $langs->trans("SetupReceiptTemplate");
$head[$h][2] = 'template';
$h++;
if ($mode == 'test')
{
$head[$h][0] = DOL_URL_ROOT."/admin/receiptprinter.php?mode=test";
$head[$h][1] = $langs->trans("TargetedPrinter");
$head[$h][2] = 'test';
$h++;
}
if ($mode == 'test')
{
$head[$h][0] = DOL_URL_ROOT."/admin/receiptprinter.php?mode=test";
$head[$h][1] = $langs->trans("TargetedPrinter");
$head[$h][2] = 'test';
$h++;
}
//$object=new stdClass();
//$object=new stdClass();
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
//complete_head_from_modules($conf,$langs,$object,$head,$h,'printingadmin');
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
//complete_head_from_modules($conf,$langs,$object,$head,$h,'printingadmin');
//complete_head_from_modules($conf,$langs,$object,$head,$h,'printing','remove');
//complete_head_from_modules($conf,$langs,$object,$head,$h,'printing','remove');
return $head;
return $head;
}

View File

@ -41,8 +41,8 @@ function trip_prepare_head(Deplacement $object)
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'trip');
$head[$h][0] = DOL_URL_ROOT.'/compta/deplacement/document.php?id='.$object->id;

View File

@ -38,9 +38,9 @@ class modDav extends DolibarrModules
*/
public function __construct($db)
{
global $langs,$conf;
global $langs,$conf;
$this->db = $db;
$this->db = $db;
// Id for module (must be unique).
// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
@ -116,13 +116,13 @@ class modDav extends DolibarrModules
// Array to add new pages in new tabs
$this->tabs = array();
$this->tabs = array();
// Example:
// $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@dav:$user->rights->dav->read:/dav/mynewtab1.php?id=__ID__'); // To add a new tab identified by code tabname1
// $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@dav:$user->rights->othermodule->read:/dav/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key.
// $this->tabs[] = array('data'=>'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname
//
// Where objecttype can be
// $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@dav:$user->rights->othermodule->read:/dav/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key.
// $this->tabs[] = array('data'=>'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname
//
// Where objecttype can be
// 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
// 'contact' to add a tab in contact view
// 'contract' to add a tab in contract view
@ -144,9 +144,9 @@ class modDav extends DolibarrModules
// 'user' to add a tab in user view
// Dictionaries
// Dictionaries
$this->dictionaries=array();
/* Example:
/* Example:
$this->dictionaries=array(
'langs'=>'mylangfile@dav',
'tabname'=>array(MAIN_DB_PREFIX."table1",MAIN_DB_PREFIX."table2",MAIN_DB_PREFIX."table3"), // List of tables we want to see into dictonnary editor
@ -162,13 +162,13 @@ class modDav extends DolibarrModules
*/
// Boxes/Widgets
// Boxes/Widgets
// Add here list of php file(s) stored in dav/core/boxes that contains class to show a widget.
$this->boxes = array(
//0=>array('file'=>'davwidget1.php@dav','note'=>'Widget provided by dav','enabledbydefaulton'=>'Home'),
//1=>array('file'=>'davwidget2.php@dav','note'=>'Widget provided by dav'),
//2=>array('file'=>'davwidget3.php@dav','note'=>'Widget provided by dav')
);
$this->boxes = array(
//0=>array('file'=>'davwidget1.php@dav','note'=>'Widget provided by dav','enabledbydefaulton'=>'Home'),
//1=>array('file'=>'davwidget2.php@dav','note'=>'Widget provided by dav'),
//2=>array('file'=>'davwidget3.php@dav','note'=>'Widget provided by dav')
);
// Cronjobs (List of cron jobs entries to add when module is enabled)
@ -262,7 +262,7 @@ class modDav extends DolibarrModules
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'noboxes')
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
public function init($options = '')

View File

@ -45,7 +45,7 @@ class modExport extends DolibarrModules
$this->family = "technic";
$this->module_position = '72';
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i', '', get_class($this));
$this->description = "Outils d'exports de donnees Dolibarr (via un assistant)";
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version

View File

@ -51,7 +51,7 @@ class modHRM extends DolibarrModules
$this->version = 'development';
$this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
// Name of image file used for this module.
// Name of image file used for this module.
// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
$this->picto='generic';

View File

@ -44,8 +44,8 @@ class modImport extends DolibarrModules
$this->numero = 250;
$this->family = "technic";
$this->module_position = '70';
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->module_position = '70';
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i', '', get_class($this));
$this->description = "Outils d'imports de donnees Dolibarr (via un assistant)";
// Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version

View File

@ -105,17 +105,17 @@ class modMargin extends DolibarrModules
// left menu entry
$this->menu[$r]=array(
'fk_menu'=>'fk_mainmenu=billing', // Put 0 if this is a top menu
'type'=>'left', // This is a Top menu entry
'titre'=>'Margins',
'mainmenu'=>'billing',
'leftmenu'=>'margins',
'url'=>'/margin/index.php',
'langs'=>'margins', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>100,
'enabled'=>'$conf->margin->enabled', // Define condition to show or hide menu entry. Use '$conf->monmodule->enabled' if entry must be visible if module is enabled.
'perms'=>'$user->rights->margins->liretous', // Use 'perms'=>'$user->rights->monmodule->level1->level2' if you want your menu with a permission rules
'target'=>'',
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
'type'=>'left', // This is a Top menu entry
'titre'=>'Margins',
'mainmenu'=>'billing',
'leftmenu'=>'margins',
'url'=>'/margin/index.php',
'langs'=>'margins', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>100,
'enabled'=>'$conf->margin->enabled', // Define condition to show or hide menu entry. Use '$conf->monmodule->enabled' if entry must be visible if module is enabled.
'perms'=>'$user->rights->margins->liretous', // Use 'perms'=>'$user->rights->monmodule->level1->level2' if you want your menu with a permission rules
'target'=>'',
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
$r++;
// Permissions

View File

@ -65,9 +65,9 @@ $storage = new DoliStorage($db, $conf);
// Setup the credentials for the requests
$credentials = new Credentials(
$conf->global->OAUTH_STRIPE_TEST_ID,
$conf->global->OAUTH_STRIPE_TEST_ID,
$conf->global->STRIPE_TEST_SECRET_KEY,
$currentUri->getAbsoluteUri()
$currentUri->getAbsoluteUri()
);
$requestedpermissionsarray=array();
@ -99,12 +99,12 @@ $langs->load("oauth");
if ($action == 'delete')
{
$storage->clearToken('StripeTest');
$storage->clearToken('StripeTest');
setEventMessages($langs->trans('TokenDeleted'), null, 'mesgs');
setEventMessages($langs->trans('TokenDeleted'), null, 'mesgs');
header('Location: ' . $backtourl);
exit();
header('Location: ' . $backtourl);
exit();
}
if (! empty($_GET['code'])) // We are coming from oauth provider page
@ -113,60 +113,60 @@ if (! empty($_GET['code'])) // We are coming from oauth provider page
//$_GET=array('code' => string 'aaaaaaaaaaaaaa' (length=20), 'state' => string 'user,public_repo' (length=16))
dol_syslog("We are coming from the oauth provider page");
//llxHeader('',$langs->trans("OAuthSetup"));
//llxHeader('',$langs->trans("OAuthSetup"));
//$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
//print load_fiche_titre($langs->trans("OAuthSetup"),$linkback,'title_setup');
//$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
//print load_fiche_titre($langs->trans("OAuthSetup"),$linkback,'title_setup');
//dol_fiche_head();
// retrieve the CSRF state parameter
$state = isset($_GET['state']) ? $_GET['state'] : null;
//print '<table>';
//dol_fiche_head();
// retrieve the CSRF state parameter
$state = isset($_GET['state']) ? $_GET['state'] : null;
//print '<table>';
// This was a callback request from service, get the token
try {
//var_dump($_GET['code']);
//var_dump($state);
//var_dump($apiService); // OAuth\OAuth2\Service\GitHub
// This was a callback request from service, get the token
try {
//var_dump($_GET['code']);
//var_dump($state);
//var_dump($apiService); // OAuth\OAuth2\Service\GitHub
//$token = $apiService->requestAccessToken($_GET['code'], $state);
$token = $apiService->requestAccessToken($_GET['code']);
// Github is a service that does not need state to be stored.
// Into constructor of GitHub, the call
// parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri)
// has not the ending parameter to true like the Google class constructor.
//$token = $apiService->requestAccessToken($_GET['code'], $state);
$token = $apiService->requestAccessToken($_GET['code']);
// Github is a service that does not need state to be stored.
// Into constructor of GitHub, the call
// parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri)
// has not the ending parameter to true like the Google class constructor.
setEventMessages($langs->trans('NewTokenStored'), null, 'mesgs'); // Stored into object managed by class DoliStorage so into table oauth_token
setEventMessages($langs->trans('NewTokenStored'), null, 'mesgs'); // Stored into object managed by class DoliStorage so into table oauth_token
$backtourl = $_SESSION["backtourlsavedbeforeoauthjump"];
unset($_SESSION["backtourlsavedbeforeoauthjump"]);
$backtourl = $_SESSION["backtourlsavedbeforeoauthjump"];
unset($_SESSION["backtourlsavedbeforeoauthjump"]);
header('Location: ' . $backtourl);
exit();
} catch (Exception $e) {
print $e->getMessage();
}
header('Location: ' . $backtourl);
exit();
} catch (Exception $e) {
print $e->getMessage();
}
}
else // If entry on page with no parameter, we arrive here
{
$_SESSION["backtourlsavedbeforeoauthjump"]=$backtourl;
$_SESSION["backtourlsavedbeforeoauthjump"]=$backtourl;
// This may create record into oauth_state before the header redirect.
// Creation of record with state in this tables depend on the Provider used (see its constructor).
if (GETPOST('state'))
{
$url = $apiService->getAuthorizationUri(array('state'=>GETPOST('state')));
}
else
{
//$url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated
//https://connect.stripe.com/oauth/authorize?response_type=code&client_id=ca_AX27ut70tJ1j6eyFCV3ObEXhNOo2jY6V&scope=read_write
$url = 'https://connect.stripe.com/oauth/authorize?response_type=code&client_id='.$conf->global->OAUTH_STRIPE_TEST_ID.'&scope=read_write';
}
// This may create record into oauth_state before the header redirect.
// Creation of record with state in this tables depend on the Provider used (see its constructor).
if (GETPOST('state'))
{
$url = $apiService->getAuthorizationUri(array('state'=>GETPOST('state')));
}
else
{
//$url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated
//https://connect.stripe.com/oauth/authorize?response_type=code&client_id=ca_AX27ut70tJ1j6eyFCV3ObEXhNOo2jY6V&scope=read_write
$url = 'https://connect.stripe.com/oauth/authorize?response_type=code&client_id='.$conf->global->OAUTH_STRIPE_TEST_ID.'&scope=read_write';
}
// we go on oauth provider authorization page
header('Location: ' . $url);
exit();
// we go on oauth provider authorization page
header('Location: ' . $url);
exit();
}

View File

@ -90,7 +90,7 @@ class LogHandler
/**
* Set current ident.
*
* @param int $ident 1=Increase ident of 1, -1=Decrease ident of 1
* @param int $ident 1=Increase ident of 1, -1=Decrease ident of 1
* @return void
*/
public function setIdent($ident)

View File

@ -125,19 +125,19 @@ if (GETPOST('search_project') != '')
}
if (GETPOST('search_task') != '')
{
header("Location: ".DOL_URL_ROOT.'/projet/tasks/list.php?mode=search&search_all='.urlencode(GETPOST('search_task')));
exit;
header("Location: ".DOL_URL_ROOT.'/projet/tasks/list.php?mode=search&search_all='.urlencode(GETPOST('search_task')));
exit;
}
if (GETPOST('search_user') != '')
{
header("Location: ".DOL_URL_ROOT.'/user/list.php?mode=search&sall='.urlencode(GETPOST('search_user')));
exit;
header("Location: ".DOL_URL_ROOT.'/user/list.php?mode=search&sall='.urlencode(GETPOST('search_user')));
exit;
}
if (GETPOST('search_group') != '')
{
header("Location: ".DOL_URL_ROOT.'/user/group/list.php?mode=search&sall='.urlencode(GETPOST('search_group')));
exit;
header("Location: ".DOL_URL_ROOT.'/user/group/list.php?mode=search&sall='.urlencode(GETPOST('search_group')));
exit;
}

View File

@ -71,34 +71,34 @@ $searchform = '';
if ($conf->use_javascript_ajax && 1 == 2) // select2 is ko with jmobile
{
if (! is_object($form)) $form=new Form($db);
$selected=-1;
$searchform.='<br><br>'.$form->selectArrayAjax('searchselectcombo', DOL_URL_ROOT.'/core/ajax/selectsearchbox.php', $selected, '', '', 0, 1, 'minwidth300', 1, $langs->trans("Search"), 0);
if (! is_object($form)) $form=new Form($db);
$selected=-1;
$searchform.='<br><br>'.$form->selectArrayAjax('searchselectcombo', DOL_URL_ROOT.'/core/ajax/selectsearchbox.php', $selected, '', '', 0, 1, 'minwidth300', 1, $langs->trans("Search"), 0);
}
else
{
$usedbyinclude = 1; // Used into next include
$usedbyinclude = 1; // Used into next include
$showtitlebefore = GETPOST('showtitlebefore', 'int');
include DOL_DOCUMENT_ROOT.'/core/ajax/selectsearchbox.php';
$i=0;
$accesskeyalreadyassigned=array();
foreach($arrayresult as $key => $val)
{
$tmp=explode('?', $val['url']);
$urlaction=$tmp[0];
$keysearch='search_all';
$accesskeyalreadyassigned=array();
foreach($arrayresult as $key => $val)
{
$tmp=explode('?', $val['url']);
$urlaction=$tmp[0];
$keysearch='search_all';
$accesskey='';
if (! $accesskeyalreadyassigned[$val['label'][0]])
{
$accesskey=$val['label'][0];
$accesskeyalreadyassigned[$accesskey]=$accesskey;
}
$searchform.=printSearchForm($urlaction, $urlaction, $val['label'], 'minwidth200', $keysearch, $accesskey, $key, img_picto('', $val['img'], '', 0, 1), $showtitlebefore, ($i>0?0:1));
$accesskey='';
if (! $accesskeyalreadyassigned[$val['label'][0]])
{
$accesskey=$val['label'][0];
$accesskeyalreadyassigned[$accesskey]=$accesskey;
}
$searchform.=printSearchForm($urlaction, $urlaction, $val['label'], 'minwidth200', $keysearch, $accesskey, $key, img_picto('', $val['img'], '', 0, 1), $showtitlebefore, ($i>0?0:1));
$i++;
}
$i++;
}
}
// Execute hook printSearchForm

View File

@ -34,13 +34,13 @@ $backtopage = GETPOST('backtopage', 'alpha');
$formadmin = new FormAdmin($db);
if (GETPOST('l')) {
$l = GETPOST('l');
$l = GETPOST('l');
} else {
$l = $langs->defaultlang;
$l = $langs->defaultlang;
}
// Access control
if (!$user->admin)
accessforbidden();
accessforbidden();
/*
* Actions
@ -49,28 +49,28 @@ if (!$user->admin)
include DOL_DOCUMENT_ROOT . '/core/actions_setmoduleoptions.inc.php';
if ($action == 'setvalue' && $user->admin) {
$db->begin();
$sub = "DATAPOLICIESSUBJECT_" . $l;
$result = dolibarr_set_const($db, $sub, GETPOST($sub), 'chaine', 0, '', $conf->entity);
$cont = "DATAPOLICIESCONTENT_" . $l;
$result = dolibarr_set_const($db, $cont, GETPOST($cont), 'chaine', 0, '', $conf->entity);
$cont = "TXTLINKDATAPOLICIESACCEPT_" . $l;
$result = dolibarr_set_const($db, $cont, GETPOST($cont), 'chaine', 0, '', $conf->entity);
$cont = "TXTLINKDATAPOLICIESREFUSE_" . $l;
$result = dolibarr_set_const($db, $cont, GETPOST($cont), 'chaine', 0, '', $conf->entity);
$sub = "DATAPOLICIESACCEPT_" . $l;
$result = dolibarr_set_const($db, $sub, GETPOST($sub), 'chaine', 0, '', $conf->entity);
$sub = "DATAPOLICIESREFUSE_" . $l;
$result = dolibarr_set_const($db, $sub, GETPOST($sub), 'chaine', 0, '', $conf->entity);
if (!$result > 0)
$error++;
if (!$error) {
$db->commit();
setEventMessage($langs->trans("SetupSaved"));
} else {
$db->rollback();
dol_print_error($db);
}
$db->begin();
$sub = "DATAPOLICIESSUBJECT_" . $l;
$result = dolibarr_set_const($db, $sub, GETPOST($sub), 'chaine', 0, '', $conf->entity);
$cont = "DATAPOLICIESCONTENT_" . $l;
$result = dolibarr_set_const($db, $cont, GETPOST($cont), 'chaine', 0, '', $conf->entity);
$cont = "TXTLINKDATAPOLICIESACCEPT_" . $l;
$result = dolibarr_set_const($db, $cont, GETPOST($cont), 'chaine', 0, '', $conf->entity);
$cont = "TXTLINKDATAPOLICIESREFUSE_" . $l;
$result = dolibarr_set_const($db, $cont, GETPOST($cont), 'chaine', 0, '', $conf->entity);
$sub = "DATAPOLICIESACCEPT_" . $l;
$result = dolibarr_set_const($db, $sub, GETPOST($sub), 'chaine', 0, '', $conf->entity);
$sub = "DATAPOLICIESREFUSE_" . $l;
$result = dolibarr_set_const($db, $sub, GETPOST($sub), 'chaine', 0, '', $conf->entity);
if (!$result > 0)
$error++;
if (!$error) {
$db->commit();
setEventMessage($langs->trans("SetupSaved"));
} else {
$db->rollback();
dol_print_error($db);
}
}
@ -105,9 +105,9 @@ print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'
print '<input type="hidden" name="action" value="setvalue">';
print '<table>';
if ($conf->global->MAIN_MULTILANGS) {
print '<tr><td>' . $form->editfieldkey('DefaultLang', 'default_lang', '', null, 0) . '</td><td colspan="3" class="maxwidthonsmartphone">' . "\n";
print $formadmin->select_language((GETPOST('l') ? GETPOST('l') : $langs->defaultlang), 'default_lang', 0, 0, 1, 0, 0, 'maxwidth200onsmartphone');
print '</tr>';
print '<tr><td>' . $form->editfieldkey('DefaultLang', 'default_lang', '', null, 0) . '</td><td colspan="3" class="maxwidthonsmartphone">' . "\n";
print $formadmin->select_language((GETPOST('l') ? GETPOST('l') : $langs->defaultlang), 'default_lang', 0, 0, 1, 0, 0, 'maxwidth200onsmartphone');
print '</tr>';
}
$subject = 'DATAPOLICIESSUBJECT_' . $l;
$linka = 'TXTLINKDATAPOLICIESACCEPT_' . $l;

View File

@ -76,9 +76,9 @@ dol_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit')
{
print '<div class="tabsAction">';
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=create">'.$langs->trans("NewAttribute").'</a></div>';
print "</div>";
print '<div class="tabsAction">';
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=create">'.$langs->trans("NewAttribute").'</a></div>';
print "</div>";
}
@ -90,10 +90,10 @@ if ($action != 'create' && $action != 'edit')
if ($action == 'create')
{
print "<br>";
print load_fiche_titre($langs->trans('NewAttribute'));
print "<br>";
print load_fiche_titre($langs->trans('NewAttribute'));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
}
/* ************************************************************************** */
@ -103,10 +103,10 @@ if ($action == 'create')
/* ************************************************************************** */
if ($action == 'edit' && ! empty($attrname))
{
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
}
llxFooter();

View File

@ -162,10 +162,10 @@ if (isset($action) && ! empty($action))
}
}
// Loop now on each sql tree to check if dir exists
foreach($sqltree as $dirdesc) // Loop on each sqltree to check dir is on disk
{
$dirtotest=$conf->$element->dir_output.'/'.$dirdesc['fullrelativename'];
// Loop now on each sql tree to check if dir exists
foreach($sqltree as $dirdesc) // Loop on each sqltree to check dir is on disk
{
$dirtotest=$conf->$element->dir_output.'/'.$dirdesc['fullrelativename'];
if (! dol_is_dir($dirtotest))
{
$mesg.=$dirtotest." not found onto disk. We delete from database dir with id=".$dirdesc['id']."<br>\n";
@ -173,7 +173,7 @@ if (isset($action) && ! empty($action))
$ecmdirtmp->delete($user, 'databaseonly');
//exit;
}
}
}
$sql="UPDATE ".MAIN_DB_PREFIX."ecm_directories set cachenbofdoc = -1 WHERE cachenbofdoc < 0"; // If pb into cahce counting, we set to value -1 = "unknown"
dol_syslog("sql = ".$sql);

View File

@ -108,27 +108,27 @@ if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC))
$resupload = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . dol_unescapefile($_FILES['userfile']['name']), 0, 0, $_FILES['userfile']['error']);
if (is_numeric($resupload) && $resupload > 0)
{
$result=$ecmdir->changeNbOfFiles('+');
}
else
{
$result=$ecmdir->changeNbOfFiles('+');
}
else
{
$langs->load("errors");
if ($resupload < 0) // Unknown error
{
setEventMessages($langs->trans("ErrorFileNotUploaded"), null, 'errors');
} elseif (preg_match('/ErrorFileIsInfectedWithAVirus/', $resupload)) {
// Files infected by a virus
// Files infected by a virus
setEventMessages($langs->trans("ErrorFileIsInfectedWithAVirus"), null, 'errors');
}
else // Known error
{
setEventMessages($langs->trans($resupload), null, 'errors');
}
}
}
}
else
{
// Failed transfer (exceeding the limit file?)
// Failed transfer (exceeding the limit file?)
$langs->load("errors");
setEventMessages($langs->trans("ErrorFailToCreateDir", $upload_dir), null, 'errors');
}
@ -137,13 +137,13 @@ if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC))
// Remove file
if ($action == 'confirm_deletefile' && $confirm == 'yes')
{
$langs->load("other");
$file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
$ret=dol_delete_file($file);
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
$langs->load("other");
$file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
$ret=dol_delete_file($file);
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
$result=$ecmdir->changeNbOfFiles('-');
$result=$ecmdir->changeNbOfFiles('-');
}
// Remove dir
@ -197,21 +197,21 @@ if ($action == 'update' && ! GETPOST('cancel', 'alpha'))
{
$error=0;
if ($module == 'ecm')
{
$oldlabel=$ecmdir->label;
if ($module == 'ecm')
{
$oldlabel=$ecmdir->label;
$olddir=$ecmdir->getRelativePath(0);
$olddir=$conf->ecm->dir_output.'/'.$olddir;
}
else
{
$olddir=GETPOST('section', 'alpha');
$olddir=$conf->medias->multidir_output[$conf->entity].'/'.$relativepath;
}
}
else
{
$olddir=GETPOST('section', 'alpha');
$olddir=$conf->medias->multidir_output[$conf->entity].'/'.$relativepath;
}
if ($module == 'ecm')
{
$db->begin();
if ($module == 'ecm')
{
$db->begin();
// Fetch was already done
$ecmdir->label = dol_sanitizeFileName(GETPOST("label"));
@ -252,27 +252,27 @@ if ($action == 'update' && ! GETPOST('cancel', 'alpha'))
$db->rollback();
setEventMessages($ecmdir->error, $ecmdir->errors, 'errors');
}
}
else
{
$newdir = $conf->medias->multidir_output[$conf->entity].'/'.GETPOST('oldrelparentdir', 'alpha').'/'.GETPOST('label', 'alpha');
}
else
{
$newdir = $conf->medias->multidir_output[$conf->entity].'/'.GETPOST('oldrelparentdir', 'alpha').'/'.GETPOST('label', 'alpha');
$result=@rename($olddir, $newdir);
if (! $result)
{
$langs->load('errors');
setEventMessages($langs->trans('ErrorFailToRenameDir', $olddir, $newdir), null, 'errors');
$error++;
}
$result=@rename($olddir, $newdir);
if (! $result)
{
$langs->load('errors');
setEventMessages($langs->trans('ErrorFailToRenameDir', $olddir, $newdir), null, 'errors');
$error++;
}
if (! $error)
{
// Set new value after renaming
$relativepath=GETPOST('oldrelparentdir', 'alpha').'/'.GETPOST('label', 'alpha');
$upload_dir = $conf->medias->multidir_output[$conf->entity].'/'.$relativepath;
$section = $relativepath;
}
}
if (! $error)
{
// Set new value after renaming
$relativepath=GETPOST('oldrelparentdir', 'alpha').'/'.GETPOST('label', 'alpha');
$upload_dir = $conf->medias->multidir_output[$conf->entity].'/'.$relativepath;
$section = $relativepath;
}
}
}
@ -435,7 +435,7 @@ if ($ecmdir->id > 0)
// Test if nb is same than in cache
if ($nbofiles != $ecmdir->cachenbofdoc)
{
$ecmdir->changeNbOfFiles((string) $nbofiles);
$ecmdir->changeNbOfFiles((string) $nbofiles);
}
}
print '</td></tr>';

View File

@ -60,7 +60,7 @@ if ($id > 0 || ! empty($ref))
$linkback = '<a href="'.DOL_URL_ROOT.'/expensereport/list.php?restore_lastsearch_values=1'.(! empty($socid)?'&socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">';
$morehtmlref.='</div>';
$morehtmlref.='</div>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
@ -71,12 +71,12 @@ if ($id > 0 || ! empty($ref))
print '<br>';
print '<table width="100%"><tr><td>';
dol_print_object_info($object);
print '</td></tr></table>';
dol_print_object_info($object);
print '</td></tr></table>';
print '</div>';
print '</div>';
dol_fiche_end();
dol_fiche_end();
}
// End of page

View File

@ -81,13 +81,13 @@ if ($id > 0 || ! empty($ref))
$linkback = '<a href="'.DOL_URL_ROOT.'/expensereport/list.php?restore_lastsearch_values=1'.(! empty($socid)?'&socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">';
$morehtmlref.='</div>';
$morehtmlref.='</div>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
$cssclass="titlefield";
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';

View File

@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
if (!$user->admin)
accessforbidden();
accessforbidden();
// Load translation files required by the page
$langs->loadLangs(array('admin', 'other', 'externalsite'));
@ -45,26 +45,26 @@ $action = GETPOST('action', 'alpha');
// Sauvegardes parametres
if ($action == 'update')
{
$i=0;
$i=0;
$db->begin();
$db->begin();
$label = GETPOST('EXTERNALSITE_LABEL', 'alpha');
$exturl = GETPOST('EXTERNALSITE_URL', 'none');
$exturl = GETPOST('EXTERNALSITE_URL', 'none');
$i+=dolibarr_set_const($db, 'EXTERNALSITE_LABEL', trim($label), 'chaine', 0, '', $conf->entity);
$i+=dolibarr_set_const($db, 'EXTERNALSITE_URL', trim($exturl), 'chaine', 0, '', $conf->entity);
$i+=dolibarr_set_const($db, 'EXTERNALSITE_LABEL', trim($label), 'chaine', 0, '', $conf->entity);
$i+=dolibarr_set_const($db, 'EXTERNALSITE_URL', trim($exturl), 'chaine', 0, '', $conf->entity);
if ($i >= 2)
{
$db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
$db->rollback();
setEventMessages($db->lasterror(), null, 'errors');
}
if ($i >= 2)
{
$db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
$db->rollback();
setEventMessages($db->lasterror(), null, 'errors');
}
}

View File

@ -129,7 +129,7 @@ else
<frame name=\"barre\" src=\"frametop.php?mainmenu=".$mainmenu."&leftmenu=".$leftmenu."&idmenu=".$idmenu.($theme?'&theme='.$theme:'').($codelang?'&lang='.$codelang:'')."&nobackground=1\" noresize scrolling=\"NO\" noborder>
";
print '<frame name="main" src="';
print $conf->global->EXTERNALSITE_URL;
print $conf->global->EXTERNALSITE_URL;
print '">';
print "
<noframes>

View File

@ -79,9 +79,9 @@ dol_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit')
{
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
}
@ -96,7 +96,7 @@ if ($action == 'create')
print '<br><div id="newattrib"></div>';
print load_fiche_titre($langs->trans('NewAttribute'));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
}
/* ************************************************************************** */
@ -106,10 +106,10 @@ if ($action == 'create')
/* ************************************************************************** */
if ($action == 'edit' && ! empty($attrname))
{
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
}
llxFooter();

View File

@ -47,8 +47,8 @@ $object = new Fichinter($db);
if (! $object->fetch($id, $ref) > 0)
{
dol_print_error($db);
exit;
dol_print_error($db);
exit;
}

View File

@ -47,18 +47,18 @@ $sql.=" WHERE name like 'FTP_SERVER_%'";
$result=$db->query($sql);
if ($result)
{
$obj = $db->fetch_object($result);
preg_match('/([0-9]+)$/i', $obj->name, $reg);
$obj = $db->fetch_object($result);
preg_match('/([0-9]+)$/i', $obj->name, $reg);
if ($reg[1]) $lastftpentry = $reg[1];
}
else
{
dol_print_error($db);
dol_print_error($db);
}
if ($action == 'add' || GETPOST('modify', 'alpha'))
{
$ftp_name = "FTP_NAME_" . $entry;// $_POST["numero_entry"];
$ftp_name = "FTP_NAME_" . $entry;// $_POST["numero_entry"];
$ftp_server = "FTP_SERVER_" . $entry; //$_POST["numero_entry"];
$error=0;
@ -75,14 +75,14 @@ if ($action == 'add' || GETPOST('modify', 'alpha'))
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Server")), null, 'errors');
}
if (! $error)
{
$ftp_port = "FTP_PORT_" . $entry;
$ftp_user = "FTP_USER_" . $entry;
$ftp_password = "FTP_PASSWORD_" . $entry;
$ftp_passive = "FTP_PASSIVE_" . $entry;
if (! $error)
{
$ftp_port = "FTP_PORT_" . $entry;
$ftp_user = "FTP_USER_" . $entry;
$ftp_password = "FTP_PASSWORD_" . $entry;
$ftp_passive = "FTP_PASSIVE_" . $entry;
$db->begin();
$db->begin();
$result1=dolibarr_set_const($db, "FTP_PORT_" . $entry, GETPOST($ftp_port, 'alpha'), 'chaine', 0, '', $conf->entity);
if ($result1) $result2=dolibarr_set_const($db, "FTP_SERVER_" . $entry, GETPOST($ftp_server, 'alpha'), 'chaine', 0, '', $conf->entity);
@ -91,25 +91,25 @@ if ($action == 'add' || GETPOST('modify', 'alpha'))
if ($result4) $result5=dolibarr_set_const($db, "FTP_NAME_" . $entry, GETPOST($ftp_name, 'alpha'), 'chaine', 0, '', $conf->entity);
if ($result5) $result6=dolibarr_set_const($db, "FTP_PASSIVE_" . $entry, GETPOST($ftp_passive, 'alpha'), 'chaine', 0, '', $conf->entity);
if ($result1 && $result2 && $result3 && $result4 && $result5 && $result6)
{
$db->commit();
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
else
{
$db->rollback();
dol_print_error($db);
}
}
if ($result1 && $result2 && $result3 && $result4 && $result5 && $result6)
{
$db->commit();
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
else
{
$db->rollback();
dol_print_error($db);
}
}
}
if (GETPOST('delete', 'alpha'))
{
if($entry)
{
$db->begin();
if($entry)
{
$db->begin();
$result1=dolibarr_del_const($db, "FTP_PORT_" . $entry, $conf->entity);
if ($result1) $result2=dolibarr_del_const($db, "FTP_SERVER_" . $entry, $conf->entity);
@ -228,7 +228,7 @@ else
{
$obj = $db->fetch_object($resql);
preg_match('/([0-9]+)$/i', $obj->name, $reg);
preg_match('/([0-9]+)$/i', $obj->name, $reg);
$idrss = $reg[0];
//print "x".join(',',$reg)."=".$obj->name."=".$idrss;

View File

@ -46,11 +46,11 @@ if ($id)
dol_fiche_head($head, 'info', $langs->trans("Establishment"), -1, 'building');
print '<table width="100%"><tr><td>';
dol_print_object_info($object);
print '</td></tr></table>';
print '<table width="100%"><tr><td>';
dol_print_object_info($object);
print '</td></tr></table>';
print '</div>';
print '</div>';
}
// End of page

View File

@ -34,8 +34,8 @@ $err = 0;
// If the config file exists and is filled, we're not on first install so we skip the language selection page
if (file_exists($conffile) && isset($dolibarr_main_url_root))
{
header("Location: check.php?testget=ok");
exit;
header("Location: check.php?testget=ok");
exit;
}
$langs->load("admin");

View File

@ -44,12 +44,12 @@ $action=GETPOST('action', 'alpha')?GETPOST('action', 'alpha'):(empty($argv[4])?'
$targetversion=DOL_VERSION; // If it's latest upgrade
if (! empty($action) && preg_match('/upgrade/i', $action)) // If it's an old upgrade
{
$tmp=explode('_', $action, 2);
if ($tmp[0]=='upgrade')
{
if (! empty($tmp[1])) $targetversion=$tmp[1]; // if $action = 'upgrade_6.0.0-beta', we use '6.0.0-beta'
else $targetversion=DOL_VERSION; // if $action = 'upgrade', we use DOL_VERSION
}
$tmp=explode('_', $action, 2);
if ($tmp[0]=='upgrade')
{
if (! empty($tmp[1])) $targetversion=$tmp[1]; // if $action = 'upgrade_6.0.0-beta', we use '6.0.0-beta'
else $targetversion=DOL_VERSION; // if $action = 'upgrade', we use DOL_VERSION
}
}
$langs->loadLangs(array("admin", "install"));
@ -112,241 +112,241 @@ print '<br>';
// Test if we can run a first install process
if (empty($versionfrom) && empty($versionto) && ! is_writable($conffile))
{
print $langs->trans("ConfFileIsNotWritable", $conffiletoshow);
pFooter(1, $setuplang, 'jscheckparam');
exit;
print $langs->trans("ConfFileIsNotWritable", $conffiletoshow);
pFooter(1, $setuplang, 'jscheckparam');
exit;
}
if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action))
{
$error=0;
$error=0;
// If password is encoded, we decode it
if (preg_match('/crypted:/i', $dolibarr_main_db_pass) || ! empty($dolibarr_main_db_encrypted_pass))
{
require_once $dolibarr_main_document_root.'/core/lib/security.lib.php';
if (preg_match('/crypted:/i', $dolibarr_main_db_pass))
{
$dolibarr_main_db_pass = preg_replace('/crypted:/i', '', $dolibarr_main_db_pass);
$dolibarr_main_db_pass = dol_decode($dolibarr_main_db_pass);
$dolibarr_main_db_encrypted_pass = $dolibarr_main_db_pass; // We need to set this as it is used to know the password was initially crypted
}
else $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass);
}
// If password is encoded, we decode it
if (preg_match('/crypted:/i', $dolibarr_main_db_pass) || ! empty($dolibarr_main_db_encrypted_pass))
{
require_once $dolibarr_main_document_root.'/core/lib/security.lib.php';
if (preg_match('/crypted:/i', $dolibarr_main_db_pass))
{
$dolibarr_main_db_pass = preg_replace('/crypted:/i', '', $dolibarr_main_db_pass);
$dolibarr_main_db_pass = dol_decode($dolibarr_main_db_pass);
$dolibarr_main_db_encrypted_pass = $dolibarr_main_db_pass; // We need to set this as it is used to know the password was initially crypted
}
else $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass);
}
$conf->db->type = $dolibarr_main_db_type;
$conf->db->host = $dolibarr_main_db_host;
$conf->db->port = $dolibarr_main_db_port;
$conf->db->name = $dolibarr_main_db_name;
$conf->db->user = $dolibarr_main_db_user;
$conf->db->pass = $dolibarr_main_db_pass;
$conf->db->dolibarr_main_db_encryption = isset($dolibarr_main_db_encryption)?$dolibarr_main_db_encryption:'';
$conf->db->dolibarr_main_db_cryptkey = isset($dolibarr_main_db_cryptkey)?$dolibarr_main_db_cryptkey:'';
$conf->db->type = $dolibarr_main_db_type;
$conf->db->host = $dolibarr_main_db_host;
$conf->db->port = $dolibarr_main_db_port;
$conf->db->name = $dolibarr_main_db_name;
$conf->db->user = $dolibarr_main_db_user;
$conf->db->pass = $dolibarr_main_db_pass;
$conf->db->dolibarr_main_db_encryption = isset($dolibarr_main_db_encryption)?$dolibarr_main_db_encryption:'';
$conf->db->dolibarr_main_db_cryptkey = isset($dolibarr_main_db_cryptkey)?$dolibarr_main_db_cryptkey:'';
$db=getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, $conf->db->port);
$db=getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, $conf->db->port);
// Create the global $hookmanager object
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($db);
// Create the global $hookmanager object
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($db);
$ok = 0;
$ok = 0;
// If first install
if ($action == "set")
{
// Active module user
$modName='modUser';
$file = $modName . ".class.php";
dolibarr_install_syslog('step5: load module user ' . DOL_DOCUMENT_ROOT . "/core/modules/" . $file, LOG_INFO);
include_once DOL_DOCUMENT_ROOT ."/core/modules/".$file;
$objMod = new $modName($db);
$result=$objMod->init();
if (! $result) print 'ERROR in activating module file='.$file;
// If first install
if ($action == "set")
{
// Active module user
$modName='modUser';
$file = $modName . ".class.php";
dolibarr_install_syslog('step5: load module user ' . DOL_DOCUMENT_ROOT . "/core/modules/" . $file, LOG_INFO);
include_once DOL_DOCUMENT_ROOT ."/core/modules/".$file;
$objMod = new $modName($db);
$result=$objMod->init();
if (! $result) print 'ERROR in activating module file='.$file;
if ($db->connected)
{
$conf->setValues($db);
// Reset forced setup after the setValues
if (defined('SYSLOG_FILE')) $conf->global->SYSLOG_FILE=constant('SYSLOG_FILE');
$conf->global->MAIN_ENABLE_LOG_TO_HTML = 1;
if ($db->connected)
{
$conf->setValues($db);
// Reset forced setup after the setValues
if (defined('SYSLOG_FILE')) $conf->global->SYSLOG_FILE=constant('SYSLOG_FILE');
$conf->global->MAIN_ENABLE_LOG_TO_HTML = 1;
// Create admin user
include_once DOL_DOCUMENT_ROOT .'/user/class/user.class.php';
// Create admin user
include_once DOL_DOCUMENT_ROOT .'/user/class/user.class.php';
// Set default encryption to yes, generate a salt and set default encryption algorythm (but only if there is no user yet into database)
$sql = "SELECT u.rowid, u.pass, u.pass_crypted";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
$resql=$db->query($sql);
if ($resql)
{
$numrows=$db->num_rows($resql);
if ($numrows == 0)
{
// Define default setup for password encryption
dolibarr_set_const($db, "DATABASE_PWD_ENCRYPTED", "1", 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_SECURITY_SALT", dol_print_date(dol_now(), 'dayhourlog'), 'chaine', 0, '', 0); // All entities
if (function_exists('password_hash'))
dolibarr_set_const($db, "MAIN_SECURITY_HASH_ALGO", 'password_hash', 'chaine', 0, '', 0); // All entities
else
dolibarr_set_const($db, "MAIN_SECURITY_HASH_ALGO", 'sha1md5', 'chaine', 0, '', 0); // All entities
}
// Set default encryption to yes, generate a salt and set default encryption algorythm (but only if there is no user yet into database)
$sql = "SELECT u.rowid, u.pass, u.pass_crypted";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
$resql=$db->query($sql);
if ($resql)
{
$numrows=$db->num_rows($resql);
if ($numrows == 0)
{
// Define default setup for password encryption
dolibarr_set_const($db, "DATABASE_PWD_ENCRYPTED", "1", 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_SECURITY_SALT", dol_print_date(dol_now(), 'dayhourlog'), 'chaine', 0, '', 0); // All entities
if (function_exists('password_hash'))
dolibarr_set_const($db, "MAIN_SECURITY_HASH_ALGO", 'password_hash', 'chaine', 0, '', 0); // All entities
else
dolibarr_set_const($db, "MAIN_SECURITY_HASH_ALGO", 'sha1md5', 'chaine', 0, '', 0); // All entities
}
dolibarr_install_syslog('step5: DATABASE_PWD_ENCRYPTED = '.$conf->global->DATABASE_PWD_ENCRYPTED.' MAIN_SECURITY_HASH_ALGO = '.$conf->global->MAIN_SECURITY_HASH_ALGO, LOG_INFO);
}
dolibarr_install_syslog('step5: DATABASE_PWD_ENCRYPTED = '.$conf->global->DATABASE_PWD_ENCRYPTED.' MAIN_SECURITY_HASH_ALGO = '.$conf->global->MAIN_SECURITY_HASH_ALGO, LOG_INFO);
}
// Create user used to create the admin user
$createuser=new User($db);
$createuser->id=0;
$createuser->admin=1;
// Create user used to create the admin user
$createuser=new User($db);
$createuser->id=0;
$createuser->admin=1;
// Set admin user
$newuser = new User($db);
$newuser->lastname='SuperAdmin';
$newuser->firstname='';
$newuser->login = $login;
$newuser->pass = $pass;
$newuser->admin=1;
$newuser->entity=0;
// Set admin user
$newuser = new User($db);
$newuser->lastname='SuperAdmin';
$newuser->firstname='';
$newuser->login = $login;
$newuser->pass = $pass;
$newuser->admin=1;
$newuser->entity=0;
$conf->global->USER_MAIL_REQUIRED=0; // Force global option to be sure to create a new user with no email
$result=$newuser->create($createuser, 1);
if ($result > 0)
{
print $langs->trans("AdminLoginCreatedSuccessfuly", $login) . "<br>";
$success = 1;
}
else
{
if ($newuser->error == 'ErrorLoginAlreadyExists')
{
dolibarr_install_syslog('step5: AdminLoginAlreadyExists', LOG_WARNING);
print '<br><div class="warning">' . $langs->trans("AdminLoginAlreadyExists", $login) . "</div><br>";
$success = 1;
}
else
{
dolibarr_install_syslog('step5: FailedToCreateAdminLogin ' . $newuser->error, LOG_ERR);
print '<br><div class="error">'.$langs->trans("FailedToCreateAdminLogin").' '.$newuser->error.'</div><br><br>';
}
}
$conf->global->USER_MAIL_REQUIRED=0; // Force global option to be sure to create a new user with no email
$result=$newuser->create($createuser, 1);
if ($result > 0)
{
print $langs->trans("AdminLoginCreatedSuccessfuly", $login) . "<br>";
$success = 1;
}
else
{
if ($newuser->error == 'ErrorLoginAlreadyExists')
{
dolibarr_install_syslog('step5: AdminLoginAlreadyExists', LOG_WARNING);
print '<br><div class="warning">' . $langs->trans("AdminLoginAlreadyExists", $login) . "</div><br>";
$success = 1;
}
else
{
dolibarr_install_syslog('step5: FailedToCreateAdminLogin ' . $newuser->error, LOG_ERR);
print '<br><div class="error">'.$langs->trans("FailedToCreateAdminLogin").' '.$newuser->error.'</div><br><br>';
}
}
if ($success)
{
// Insert MAIN_VERSION_FIRST_INSTALL in a dedicated transaction. So if it fails (when first install was already done), we can do other following requests.
$db->begin();
dolibarr_install_syslog('step5: set MAIN_VERSION_FIRST_INSTALL const to ' . $targetversion, LOG_DEBUG);
$resql=$db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_VERSION_FIRST_INSTALL', 1).",".$db->encrypt($targetversion, 1).",'chaine',0,'Dolibarr version when first install',0)");
if ($resql)
{
$conf->global->MAIN_VERSION_FIRST_INSTALL=$targetversion;
$db->commit();
}
else
{
//if (! $resql) dol_print_error($db,'Error in setup program'); // We ignore errors. Key may already exists
$db->commit();
}
if ($success)
{
// Insert MAIN_VERSION_FIRST_INSTALL in a dedicated transaction. So if it fails (when first install was already done), we can do other following requests.
$db->begin();
dolibarr_install_syslog('step5: set MAIN_VERSION_FIRST_INSTALL const to ' . $targetversion, LOG_DEBUG);
$resql=$db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_VERSION_FIRST_INSTALL', 1).",".$db->encrypt($targetversion, 1).",'chaine',0,'Dolibarr version when first install',0)");
if ($resql)
{
$conf->global->MAIN_VERSION_FIRST_INSTALL=$targetversion;
$db->commit();
}
else
{
//if (! $resql) dol_print_error($db,'Error in setup program'); // We ignore errors. Key may already exists
$db->commit();
}
$db->begin();
$db->begin();
dolibarr_install_syslog('step5: set MAIN_VERSION_LAST_INSTALL const to ' . $targetversion, LOG_DEBUG);
$resql=$db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_VERSION_LAST_INSTALL'");
if (! $resql) dol_print_error($db, 'Error in setup program');
$resql=$db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_VERSION_LAST_INSTALL', 1).",".$db->encrypt($targetversion, 1).",'chaine',0,'Dolibarr version when last install',0)");
if (! $resql) dol_print_error($db, 'Error in setup program');
$conf->global->MAIN_VERSION_LAST_INSTALL=$targetversion;
dolibarr_install_syslog('step5: set MAIN_VERSION_LAST_INSTALL const to ' . $targetversion, LOG_DEBUG);
$resql=$db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_VERSION_LAST_INSTALL'");
if (! $resql) dol_print_error($db, 'Error in setup program');
$resql=$db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_VERSION_LAST_INSTALL', 1).",".$db->encrypt($targetversion, 1).",'chaine',0,'Dolibarr version when last install',0)");
if (! $resql) dol_print_error($db, 'Error in setup program');
$conf->global->MAIN_VERSION_LAST_INSTALL=$targetversion;
if ($useforcedwizard)
{
dolibarr_install_syslog('step5: set MAIN_REMOVE_INSTALL_WARNING const to 1', LOG_DEBUG);
$resql=$db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_REMOVE_INSTALL_WARNING'");
if (! $resql) dol_print_error($db, 'Error in setup program');
$resql=$db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_REMOVE_INSTALL_WARNING', 1).",".$db->encrypt(1, 1).",'chaine',1,'Disable install warnings',0)");
if (! $resql) dol_print_error($db, 'Error in setup program');
$conf->global->MAIN_REMOVE_INSTALL_WARNING=1;
}
if ($useforcedwizard)
{
dolibarr_install_syslog('step5: set MAIN_REMOVE_INSTALL_WARNING const to 1', LOG_DEBUG);
$resql=$db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_REMOVE_INSTALL_WARNING'");
if (! $resql) dol_print_error($db, 'Error in setup program');
$resql=$db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_REMOVE_INSTALL_WARNING', 1).",".$db->encrypt(1, 1).",'chaine',1,'Disable install warnings',0)");
if (! $resql) dol_print_error($db, 'Error in setup program');
$conf->global->MAIN_REMOVE_INSTALL_WARNING=1;
}
// If we ask to force some modules to be enabled
if (! empty($force_install_module))
{
if (! defined('DOL_DOCUMENT_ROOT') && ! empty($dolibarr_main_document_root)) define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root);
// If we ask to force some modules to be enabled
if (! empty($force_install_module))
{
if (! defined('DOL_DOCUMENT_ROOT') && ! empty($dolibarr_main_document_root)) define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root);
$tmparray=explode(',', $force_install_module);
foreach ($tmparray as $modtoactivate)
{
$modtoactivatenew=preg_replace('/\.class\.php$/i', '', $modtoactivate);
print $langs->trans("ActivateModule", $modtoactivatenew).'<br>';
$tmparray=explode(',', $force_install_module);
foreach ($tmparray as $modtoactivate)
{
$modtoactivatenew=preg_replace('/\.class\.php$/i', '', $modtoactivate);
print $langs->trans("ActivateModule", $modtoactivatenew).'<br>';
$file=$modtoactivatenew.'.class.php';
dolibarr_install_syslog('step5: activate module file=' . $file);
$res=dol_include_once("/core/modules/".$file);
$file=$modtoactivatenew.'.class.php';
dolibarr_install_syslog('step5: activate module file=' . $file);
$res=dol_include_once("/core/modules/".$file);
$res=activateModule($modtoactivatenew, 1);
if (! empty($res['errors'])) print 'ERROR in activating module file='.$file;
}
}
$res=activateModule($modtoactivatenew, 1);
if (! empty($res['errors'])) print 'ERROR in activating module file='.$file;
}
}
dolibarr_install_syslog('step5: remove MAIN_NOT_INSTALLED const');
$resql=$db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_NOT_INSTALLED'");
if (! $resql) dol_print_error($db, 'Error in setup program');
dolibarr_install_syslog('step5: remove MAIN_NOT_INSTALLED const');
$resql=$db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_NOT_INSTALLED'");
if (! $resql) dol_print_error($db, 'Error in setup program');
$db->commit();
}
}
else
{
print $langs->trans("ErrorFailedToConnect")."<br>";
}
}
// If upgrade
elseif (empty($action) || preg_match('/upgrade/i', $action))
{
if ($db->connected)
{
$conf->setValues($db);
// Reset forced setup after the setValues
if (defined('SYSLOG_FILE')) $conf->global->SYSLOG_FILE=constant('SYSLOG_FILE');
$conf->global->MAIN_ENABLE_LOG_TO_HTML = 1;
$db->commit();
}
}
else
{
print $langs->trans("ErrorFailedToConnect")."<br>";
}
}
// If upgrade
elseif (empty($action) || preg_match('/upgrade/i', $action))
{
if ($db->connected)
{
$conf->setValues($db);
// Reset forced setup after the setValues
if (defined('SYSLOG_FILE')) $conf->global->SYSLOG_FILE=constant('SYSLOG_FILE');
$conf->global->MAIN_ENABLE_LOG_TO_HTML = 1;
// Define if we need to update the MAIN_VERSION_LAST_UPGRADE value in database
$tagdatabase=false;
if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE)) $tagdatabase=true; // We don't know what it was before, so now we consider we are version choosed.
else
{
$mainversionlastupgradearray=preg_split('/[.-]/', $conf->global->MAIN_VERSION_LAST_UPGRADE);
$targetversionarray=preg_split('/[.-]/', $targetversion);
if (versioncompare($targetversionarray, $mainversionlastupgradearray) > 0) $tagdatabase=true;
}
// Define if we need to update the MAIN_VERSION_LAST_UPGRADE value in database
$tagdatabase=false;
if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE)) $tagdatabase=true; // We don't know what it was before, so now we consider we are version choosed.
else
{
$mainversionlastupgradearray=preg_split('/[.-]/', $conf->global->MAIN_VERSION_LAST_UPGRADE);
$targetversionarray=preg_split('/[.-]/', $targetversion);
if (versioncompare($targetversionarray, $mainversionlastupgradearray) > 0) $tagdatabase=true;
}
if ($tagdatabase)
{
dolibarr_install_syslog('step5: set MAIN_VERSION_LAST_UPGRADE const to value ' . $targetversion);
$resql=$db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_VERSION_LAST_UPGRADE'");
if (! $resql) dol_print_error($db, 'Error in setup program');
$resql=$db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) VALUES (".$db->encrypt('MAIN_VERSION_LAST_UPGRADE', 1).",".$db->encrypt($targetversion, 1).",'chaine',0,'Dolibarr version for last upgrade',0)");
if (! $resql) dol_print_error($db, 'Error in setup program');
$conf->global->MAIN_VERSION_LAST_UPGRADE=$targetversion;
}
else
{
dolibarr_install_syslog('step5: we run an upgrade to version ' . $targetversion . ' but database was already upgraded to ' . $conf->global->MAIN_VERSION_LAST_UPGRADE . '. We keep MAIN_VERSION_LAST_UPGRADE as it is.');
}
}
else
{
print $langs->trans("ErrorFailedToConnect")."<br>";
}
}
else
{
dol_print_error('', 'step5.php: unknown choice of action');
}
if ($tagdatabase)
{
dolibarr_install_syslog('step5: set MAIN_VERSION_LAST_UPGRADE const to value ' . $targetversion);
$resql=$db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_VERSION_LAST_UPGRADE'");
if (! $resql) dol_print_error($db, 'Error in setup program');
$resql=$db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) VALUES (".$db->encrypt('MAIN_VERSION_LAST_UPGRADE', 1).",".$db->encrypt($targetversion, 1).",'chaine',0,'Dolibarr version for last upgrade',0)");
if (! $resql) dol_print_error($db, 'Error in setup program');
$conf->global->MAIN_VERSION_LAST_UPGRADE=$targetversion;
}
else
{
dolibarr_install_syslog('step5: we run an upgrade to version ' . $targetversion . ' but database was already upgraded to ' . $conf->global->MAIN_VERSION_LAST_UPGRADE . '. We keep MAIN_VERSION_LAST_UPGRADE as it is.');
}
}
else
{
print $langs->trans("ErrorFailedToConnect")."<br>";
}
}
else
{
dol_print_error('', 'step5.php: unknown choice of action');
}
// May fail if parameter already defined
$resql=$db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) VALUES (".$db->encrypt('MAIN_LANG_DEFAULT', 1).",".$db->encrypt($setuplang, 1).",'chaine',0,'Default language',1)");
//if (! $resql) dol_print_error($db,'Error in setup program');
// May fail if parameter already defined
$resql=$db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) VALUES (".$db->encrypt('MAIN_LANG_DEFAULT', 1).",".$db->encrypt($setuplang, 1).",'chaine',0,'Default language',1)");
//if (! $resql) dol_print_error($db,'Error in setup program');
$db->close();
$db->close();
}
@ -356,104 +356,104 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action))
// If first install
if ($action == "set" && $success)
{
if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ($conf->global->MAIN_VERSION_LAST_UPGRADE == DOL_VERSION))
{
// Install is finished
print $langs->trans("SystemIsInstalled")."<br>";
if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ($conf->global->MAIN_VERSION_LAST_UPGRADE == DOL_VERSION))
{
// Install is finished
print $langs->trans("SystemIsInstalled")."<br>";
$createlock=0;
$createlock=0;
if (! empty($force_install_lockinstall) || ! empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE))
{
// Install is finished, we create the lock file
$lockfile=DOL_DATA_ROOT.'/install.lock';
$fp = @fopen($lockfile, "w");
if ($fp)
{
if (empty($force_install_lockinstall) || $force_install_lockinstall == 1) $force_install_lockinstall=444; // For backward compatibility
fwrite($fp, "This is a lock file to prevent use of install pages (set with permission ".$force_install_lockinstall.")");
fclose($fp);
@chmod($lockfile, octdec($force_install_lockinstall));
$createlock=1;
}
}
if (empty($createlock))
{
print '<div class="warning">'.$langs->trans("WarningRemoveInstallDir")."</div>";
}
if (! empty($force_install_lockinstall) || ! empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE))
{
// Install is finished, we create the lock file
$lockfile=DOL_DATA_ROOT.'/install.lock';
$fp = @fopen($lockfile, "w");
if ($fp)
{
if (empty($force_install_lockinstall) || $force_install_lockinstall == 1) $force_install_lockinstall=444; // For backward compatibility
fwrite($fp, "This is a lock file to prevent use of install pages (set with permission ".$force_install_lockinstall.")");
fclose($fp);
@chmod($lockfile, octdec($force_install_lockinstall));
$createlock=1;
}
}
if (empty($createlock))
{
print '<div class="warning">'.$langs->trans("WarningRemoveInstallDir")."</div>";
}
print "<br>";
print "<br>";
print $langs->trans("YouNeedToPersonalizeSetup")."<br><br>";
print $langs->trans("YouNeedToPersonalizeSetup")."<br><br>";
print '<div class="center"><a href="../admin/index.php?mainmenu=home&leftmenu=setup' . (isset($login) ? '&username=' . urlencode($login) : '') . '">';
print $langs->trans("GoToSetupArea");
print '</a></div>';
}
else
{
// If here MAIN_VERSION_LAST_UPGRADE is not empty
print $langs->trans("VersionLastUpgrade").': <b><span class="ok">'.$conf->global->MAIN_VERSION_LAST_UPGRADE.'</span></b><br>';
print $langs->trans("VersionProgram").': <b><span class="ok">'.DOL_VERSION.'</span></b><br>';
print $langs->trans("MigrationNotFinished").'<br>';
print "<br>";
print '<div class="center"><a href="../admin/index.php?mainmenu=home&leftmenu=setup' . (isset($login) ? '&username=' . urlencode($login) : '') . '">';
print $langs->trans("GoToSetupArea");
print '</a></div>';
}
else
{
// If here MAIN_VERSION_LAST_UPGRADE is not empty
print $langs->trans("VersionLastUpgrade").': <b><span class="ok">'.$conf->global->MAIN_VERSION_LAST_UPGRADE.'</span></b><br>';
print $langs->trans("VersionProgram").': <b><span class="ok">'.DOL_VERSION.'</span></b><br>';
print $langs->trans("MigrationNotFinished").'<br>';
print "<br>";
print '<div class="center"><a href="'.$dolibarr_main_url_root .'/install/index.php">';
print $langs->trans("GoToUpgradePage");
print '</a></div>';
}
print '<div class="center"><a href="'.$dolibarr_main_url_root .'/install/index.php">';
print $langs->trans("GoToUpgradePage");
print '</a></div>';
}
}
// If upgrade
elseif (empty($action) || preg_match('/upgrade/i', $action))
{
if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ($conf->global->MAIN_VERSION_LAST_UPGRADE == DOL_VERSION))
{
// Upgrade is finished
print $langs->trans("SystemIsUpgraded")."<br>";
if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ($conf->global->MAIN_VERSION_LAST_UPGRADE == DOL_VERSION))
{
// Upgrade is finished
print $langs->trans("SystemIsUpgraded")."<br>";
$createlock=0;
$createlock=0;
if (! empty($force_install_lockinstall) || ! empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE))
{
// Upgrade is finished, we create the lock file
$lockfile=DOL_DATA_ROOT.'/install.lock';
$fp = @fopen($lockfile, "w");
if ($fp)
{
if (empty($force_install_lockinstall) || $force_install_lockinstall == 1) $force_install_lockinstall=444; // For backward compatibility
fwrite($fp, "This is a lock file to prevent use of install pages (set with permission ".$force_install_lockinstall.")");
fclose($fp);
@chmod($lockfile, octdec($force_install_lockinstall));
$createlock=1;
}
}
if (empty($createlock))
{
print '<br><div class="warning">'.$langs->trans("WarningRemoveInstallDir")."</div>";
}
if (! empty($force_install_lockinstall) || ! empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE))
{
// Upgrade is finished, we create the lock file
$lockfile=DOL_DATA_ROOT.'/install.lock';
$fp = @fopen($lockfile, "w");
if ($fp)
{
if (empty($force_install_lockinstall) || $force_install_lockinstall == 1) $force_install_lockinstall=444; // For backward compatibility
fwrite($fp, "This is a lock file to prevent use of install pages (set with permission ".$force_install_lockinstall.")");
fclose($fp);
@chmod($lockfile, octdec($force_install_lockinstall));
$createlock=1;
}
}
if (empty($createlock))
{
print '<br><div class="warning">'.$langs->trans("WarningRemoveInstallDir")."</div>";
}
print "<br><br>";
print "<br><br>";
print '<div class="center"><a href="../index.php?mainmenu=home' . (isset($login) ? '&username=' . urlencode($login) : '') . '">';
print $langs->trans("GoToDolibarr").'...';
print '</a></div><br>';
}
else
{
// If here MAIN_VERSION_LAST_UPGRADE is not empty
print $langs->trans("VersionLastUpgrade").': <b><span class="ok">'.$conf->global->MAIN_VERSION_LAST_UPGRADE.'</span></b><br>';
print $langs->trans("VersionProgram").': <b><span class="ok">'.DOL_VERSION.'</span></b>';
print '<div class="center"><a href="../index.php?mainmenu=home' . (isset($login) ? '&username=' . urlencode($login) : '') . '">';
print $langs->trans("GoToDolibarr").'...';
print '</a></div><br>';
}
else
{
// If here MAIN_VERSION_LAST_UPGRADE is not empty
print $langs->trans("VersionLastUpgrade").': <b><span class="ok">'.$conf->global->MAIN_VERSION_LAST_UPGRADE.'</span></b><br>';
print $langs->trans("VersionProgram").': <b><span class="ok">'.DOL_VERSION.'</span></b>';
print "<br>";
print "<br>";
print '<div class="center"><a href="../install/index.php">';
print $langs->trans("GoToUpgradePage");
print '</a></div>';
}
print '<div class="center"><a href="../install/index.php">';
print $langs->trans("GoToUpgradePage");
print '</a></div>';
}
}
else
{
dol_print_error('', 'step5.php: unknown choice of action');
dol_print_error('', 'step5.php: unknown choice of action');
}
// Clear cache files

View File

@ -41,66 +41,66 @@ $action=GETPOST('action', 'alpha');
*/
if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg))
{
$code=$reg[1];
if (dolibarr_set_const($db, $code, 1, 'yesno', 0, '', $conf->entity) > 0)
{
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
else
{
dol_print_error($db);
}
$code=$reg[1];
if (dolibarr_set_const($db, $code, 1, 'yesno', 0, '', $conf->entity) > 0)
{
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
else
{
dol_print_error($db);
}
}
if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg))
{
$code=$reg[1];
if (dolibarr_del_const($db, $code, $conf->entity) > 0)
{
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
else
{
dol_print_error($db);
}
$code=$reg[1];
if (dolibarr_del_const($db, $code, $conf->entity) > 0)
{
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
else
{
dol_print_error($db);
}
}
if ($action == 'remises')
{
if (dolibarr_set_const($db, 'MARGIN_METHODE_FOR_DISCOUNT', $_POST['MARGIN_METHODE_FOR_DISCOUNT'], 'chaine', 0, '', $conf->entity) > 0)
{
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
}
else
{
dol_print_error($db);
}
if (dolibarr_set_const($db, 'MARGIN_METHODE_FOR_DISCOUNT', $_POST['MARGIN_METHODE_FOR_DISCOUNT'], 'chaine', 0, '', $conf->entity) > 0)
{
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
}
else
{
dol_print_error($db);
}
}
if ($action == 'typemarges')
{
if (dolibarr_set_const($db, 'MARGIN_TYPE', $_POST['MARGIN_TYPE'], 'chaine', 0, '', $conf->entity) > 0)
{
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
}
else
{
dol_print_error($db);
}
if (dolibarr_set_const($db, 'MARGIN_TYPE', $_POST['MARGIN_TYPE'], 'chaine', 0, '', $conf->entity) > 0)
{
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
}
else
{
dol_print_error($db);
}
}
if ($action == 'contact')
{
if (dolibarr_set_const($db, 'AGENT_CONTACT_TYPE', $_POST['AGENT_CONTACT_TYPE'], 'chaine', 0, '', $conf->entity) > 0)
{
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
}
else
{
dol_print_error($db);
}
if (dolibarr_set_const($db, 'AGENT_CONTACT_TYPE', $_POST['AGENT_CONTACT_TYPE'], 'chaine', 0, '', $conf->entity) > 0)
{
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
}
else
{
dol_print_error($db);
}
}
/*

View File

@ -32,7 +32,7 @@ class MyObjectTest extends \PHPUnit_Framework_TestCase
{
/**
* Global test setup
* @return void
* @return void
*/
public static function setUpBeforeClass()
{
@ -41,7 +41,7 @@ class MyObjectTest extends \PHPUnit_Framework_TestCase
/**
* Unit test setup
* @return void
* @return void
*/
protected function setUp()
{
@ -50,7 +50,7 @@ class MyObjectTest extends \PHPUnit_Framework_TestCase
/**
* Verify pre conditions
* @return void
* @return void
*/
protected function assertPreConditions()
{
@ -59,7 +59,7 @@ class MyObjectTest extends \PHPUnit_Framework_TestCase
/**
* A sample test
* @return bool
* @return bool
*/
public function testSomething()
{
@ -70,7 +70,7 @@ class MyObjectTest extends \PHPUnit_Framework_TestCase
/**
* Verify post conditions
* @return void
* @return void
*/
protected function assertPostConditions()
{
@ -79,7 +79,7 @@ class MyObjectTest extends \PHPUnit_Framework_TestCase
/**
* Unit test teardown
* @return void
* @return void
*/
protected function tearDown()
{
@ -88,7 +88,7 @@ class MyObjectTest extends \PHPUnit_Framework_TestCase
/**
* Global test teardown
* @return void
* @return void
*/
public static function tearDownAfterClass()
{
@ -99,7 +99,7 @@ class MyObjectTest extends \PHPUnit_Framework_TestCase
* Unsuccessful test
*
* @param Exception $e Exception
* @return void
* @return void
* @throws Exception
*/
protected function onNotSuccessfulTest(Exception $e)

View File

@ -47,11 +47,11 @@ function opensurvey_prepare_head(Opensurveysondage $object)
$head[1][2] = 'preview';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'opensurveypoll');
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'opensurveypoll');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'opensurveypoll', 'remove');

View File

@ -52,17 +52,17 @@ if ($action == 'setvalue' && $user->admin)
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "PAYBOX_PBX_IDENTIFIANT", GETPOST('PAYBOX_PBX_IDENTIFIANT', 'alpha'), 'chaine', 0, '', $conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_CREDITOR", GETPOST('ONLINE_PAYMENT_CREDITOR', 'alpha'), 'chaine', 0, '', $conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "PAYBOX_BANK_ACCOUNT_FOR_PAYMENTS", GETPOST('PAYBOX_BANK_ACCOUNT_FOR_PAYMENTS', 'int'), 'chaine', 0, '', $conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_CREDITOR", GETPOST('ONLINE_PAYMENT_CREDITOR', 'alpha'), 'chaine', 0, '', $conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "PAYBOX_BANK_ACCOUNT_FOR_PAYMENTS", GETPOST('PAYBOX_BANK_ACCOUNT_FOR_PAYMENTS', 'int'), 'chaine', 0, '', $conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_CSS_URL", GETPOST('ONLINE_PAYMENT_CSS_URL', 'alpha'), 'chaine', 0, '', $conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_FORM", GETPOST('ONLINE_PAYMENT_MESSAGE_FORM', 'alpha'), 'chaine', 0, '', $conf->entity);
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_FORM", GETPOST('ONLINE_PAYMENT_MESSAGE_FORM', 'alpha'), 'chaine', 0, '', $conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_OK", GETPOST('ONLINE_PAYMENT_MESSAGE_OK', 'alpha'), 'chaine', 0, '', $conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_KO", GETPOST('ONLINE_PAYMENT_MESSAGE_KO', 'alpha'), 'chaine', 0, '', $conf->entity);
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_OK", GETPOST('ONLINE_PAYMENT_MESSAGE_OK', 'alpha'), 'chaine', 0, '', $conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_KO", GETPOST('ONLINE_PAYMENT_MESSAGE_KO', 'alpha'), 'chaine', 0, '', $conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_SENDEMAIL", GETPOST('ONLINE_PAYMENT_SENDEMAIL'), 'chaine', 0, '', $conf->entity);
if (! $result > 0) $error++;

View File

@ -24,14 +24,14 @@
if (session_id() == "")
{
session_start();
if (ini_get('register_globals')) // To solve bug in using $_SESSION
{
foreach ($_SESSION as $key=>$value)
{
if (isset($GLOBALS[$key])) unset($GLOBALS[$key]);
}
}
session_start();
if (ini_get('register_globals')) // To solve bug in using $_SESSION
{
foreach ($_SESSION as $key=>$value)
{
if (isset($GLOBALS[$key])) unset($GLOBALS[$key]);
}
}
}
// ==================================
@ -50,13 +50,13 @@ $API_version="56";
*/
if (! empty($conf->global->PAYPAL_API_SANDBOX) || GETPOST('forcesandbox', 'alpha')) // We can force sand box with param 'forcesandbox'
{
$API_Endpoint = "https://api-3t.sandbox.paypal.com/nvp";
$API_Url = "https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token=";
$API_Endpoint = "https://api-3t.sandbox.paypal.com/nvp";
$API_Url = "https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token=";
}
else
{
$API_Endpoint = "https://api-3t.paypal.com/nvp";
$API_Url = "https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=";
$API_Endpoint = "https://api-3t.paypal.com/nvp";
$API_Url = "https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=";
}
// Clean parameters

View File

@ -50,19 +50,19 @@ print $langs->trans("DirectPrintingJobsDesc").'<br><br>';
$object = new PrintingDriver($db);
$result = $object->listDrivers($db, 10);
foreach ($result as $driver) {
require_once DOL_DOCUMENT_ROOT.'/core/modules/printing/'.$driver.'.modules.php';
$classname = 'printing_'.$driver;
$langs->load($driver);
$printer = new $classname($db);
if ($conf->global->{$printer->active}) {
//$printer->listJobs('commande');
$result = $printer->listJobs();
print $printer->resprint;
require_once DOL_DOCUMENT_ROOT.'/core/modules/printing/'.$driver.'.modules.php';
$classname = 'printing_'.$driver;
$langs->load($driver);
$printer = new $classname($db);
if ($conf->global->{$printer->active}) {
//$printer->listJobs('commande');
$result = $printer->listJobs();
print $printer->resprint;
if ($result > 0) {
setEventMessages($printer->error, $printer->errors, 'errors');
}
}
if ($result > 0) {
setEventMessages($printer->error, $printer->errors, 'errors');
}
}
}
// End of page

View File

@ -32,46 +32,46 @@
*/
function printingAdminPrepareHead($mode)
{
global $langs, $conf;
global $langs, $conf;
$h = 0;
$head = array();
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT."/printing/admin/printing.php?mode=config";
$head[$h][1] = $langs->trans("ListDrivers");
$head[$h][2] = 'config';
$h++;
$head[$h][0] = DOL_URL_ROOT."/printing/admin/printing.php?mode=config";
$head[$h][1] = $langs->trans("ListDrivers");
$head[$h][2] = 'config';
$h++;
if ($mode == 'setup') {
$head[$h][0] = DOL_URL_ROOT."/printing/admin/printing.php?mode=setup&driver=".GETPOST('driver', 'alpha');
$head[$h][1] = $langs->trans("SetupDriver");
$head[$h][2] = 'setup';
$h++;
}
if ($mode == 'setup') {
$head[$h][0] = DOL_URL_ROOT."/printing/admin/printing.php?mode=setup&driver=".GETPOST('driver', 'alpha');
$head[$h][1] = $langs->trans("SetupDriver");
$head[$h][2] = 'setup';
$h++;
}
if ($mode == 'test') {
$head[$h][0] = DOL_URL_ROOT."/printing/admin/printing.php?mode=test&driver=".GETPOST('driver', 'alpha');
$head[$h][1] = $langs->trans("TargetedPrinter");
$head[$h][2] = 'test';
$h++;
}
if ($mode == 'test') {
$head[$h][0] = DOL_URL_ROOT."/printing/admin/printing.php?mode=test&driver=".GETPOST('driver', 'alpha');
$head[$h][1] = $langs->trans("TargetedPrinter");
$head[$h][2] = 'test';
$h++;
}
/** TODO This feature seem to be not ready yet.
/** TODO This feature seem to be not ready yet.
$head[$h][0] = DOL_URL_ROOT."/printing/admin/printing.php?mode=userconf";
$head[$h][1] = $langs->trans("UserConf");
$head[$h][2] = 'userconf';
$h++;
*/
*/
//$object=new stdClass();
//$object=new stdClass();
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
//complete_head_from_modules($conf,$langs,$object,$head,$h,'printingadmin');
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
//complete_head_from_modules($conf,$langs,$object,$head,$h,'printingadmin');
//complete_head_from_modules($conf,$langs,$object,$head,$h,'printing','remove');
//complete_head_from_modules($conf,$langs,$object,$head,$h,'printing','remove');
return $head;
return $head;
}

View File

@ -201,7 +201,7 @@ if ($action == 'convert')
{
$obj = $db->fetch_object($resql);
$objectstatic2 = new ProductFournisseur($db); // Object init must be into loop to avoid to get value of previous step
$objectstatic2 = new ProductFournisseur($db); // Object init must be into loop to avoid to get value of previous step
$ret=$objectstatic2->fetch_product_fournisseur_price($obj->rowid);
if ($ret > 0)
{

View File

@ -73,9 +73,9 @@ if ($action == 'add')
if ($result == 0) //No existing entry found with title, ok
{
//Check the expression validity by parsing it
$priceparser = new PriceParser($db);
$price_result = $priceparser->testExpression($id, $expression);
if ($price_result < 0) { //Expression is not valid
$priceparser = new PriceParser($db);
$price_result = $priceparser->testExpression($id, $expression);
if ($price_result < 0) { //Expression is not valid
setEventMessages($priceparser->translatedError(), null, 'errors');
}
else
@ -113,9 +113,9 @@ if ($action == 'update')
if ($result == 0 || $result == $eid) //No existing entry found with title or existing one is the current one, ok
{
//Check the expression validity by parsing it
$priceparser = new PriceParser($db);
$price_result = $priceparser->testExpression($id, $expression);
if ($price_result < 0) { //Expression is not valid
$priceparser = new PriceParser($db);
$price_result = $priceparser->testExpression($id, $expression);
if ($price_result < 0) { //Expression is not valid
setEventMessages($priceparser->translatedError(), null, 'errors');
}
else
@ -149,7 +149,7 @@ if ($action == 'delete')
{
if ($eid != 0)
{
$price_expression->fetch($eid);
$price_expression->fetch($eid);
$result = $price_expression->delete($user);
if ($result < 0)
{
@ -200,7 +200,7 @@ $help_text.= '<br><br>'.$langs->trans("PriceExpressionEditorHelp3");
$help_text.= '<br><br>'.$langs->trans("PriceExpressionEditorHelp4");
$help_text.= '<br><br>'.$langs->trans("PriceExpressionEditorHelp5");
foreach ($price_globals->listGlobalVariables() as $entry) {
$help_text.= '<br><b>#globals_'.$entry->code.'#</b> '.$entry->description.' = '.$entry->value;
$help_text.= '<br><b>#globals_'.$entry->code.'#</b> '.$entry->description.' = '.$entry->value;
}
//Price expression editor

View File

@ -61,15 +61,15 @@ $staticproduct=new Product($db);
$helpurl='';
if ($type == '0')
{
$helpurl='EN:Module_Products|FR:Module_Produits|ES:M&oacute;dulo_Productos';
$helpurl='EN:Module_Products|FR:Module_Produits|ES:M&oacute;dulo_Productos';
}
elseif ($type == '1')
{
$helpurl='EN:Module_Services_En|FR:Module_Services|ES:M&oacute;dulo_Servicios';
$helpurl='EN:Module_Services_En|FR:Module_Services|ES:M&oacute;dulo_Servicios';
}
else
{
$helpurl='EN:Module_Services_En|FR:Module_Services|ES:M&oacute;dulo_Servicios';
$helpurl='EN:Module_Services_En|FR:Module_Services|ES:M&oacute;dulo_Servicios';
}
$title=$langs->trans("Statistics");
@ -130,7 +130,7 @@ $sql.= " GROUP BY p.rowid, p.label, p.ref, p.fk_product_type";
$result=$db->query($sql);
if ($result)
{
$totalnboflines = $db->num_rows($result);
$totalnboflines = $db->num_rows($result);
}
$sql.= $db->order($sortfield, $sortorder);
@ -139,23 +139,23 @@ $sql.= $db->plimit($limit+1, $offset);
$resql=$db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$objp = $db->fetch_object($resql);
while ($i < $num)
{
$objp = $db->fetch_object($resql);
$infoprod[$objp->rowid]=array('type'=>$objp->type, 'ref'=>$objp->ref, 'label'=>$objp->label);
$infoprod[$objp->rowid]['nblineproposal']=$objp->c;
$infoprod[$objp->rowid]=array('type'=>$objp->type, 'ref'=>$objp->ref, 'label'=>$objp->label);
$infoprod[$objp->rowid]['nblineproposal']=$objp->c;
$i++;
}
$db->free($resql);
$i++;
}
$db->free($resql);
}
else
{
dol_print_error($db);
dol_print_error($db);
}
//var_dump($infoprod);

View File

@ -32,45 +32,45 @@ require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php';
*/
function dolDispatchToDo($order_id)
{
global $db;
global $db;
$dispatched = array();
$ordered = array();
$dispatched = array();
$ordered = array();
// Count nb of quantity dispatched per product
$sql = 'SELECT fk_product, SUM(qty) FROM ' . MAIN_DB_PREFIX . 'commande_fournisseur_dispatch';
$sql.= ' WHERE fk_commande = ' . $order_id;
$sql.= ' GROUP BY fk_product';
$sql.= ' ORDER by fk_product';
$resql = $db->query($sql);
if ($resql && $db->num_rows($resql))
{
while ($obj = $db->fetch_object($resql))
$dispatched[$obj->fk_product] = $obj;
}
// Count nb of quantity dispatched per product
$sql = 'SELECT fk_product, SUM(qty) FROM ' . MAIN_DB_PREFIX . 'commande_fournisseur_dispatch';
$sql.= ' WHERE fk_commande = ' . $order_id;
$sql.= ' GROUP BY fk_product';
$sql.= ' ORDER by fk_product';
$resql = $db->query($sql);
if ($resql && $db->num_rows($resql))
{
while ($obj = $db->fetch_object($resql))
$dispatched[$obj->fk_product] = $obj;
}
// Count nb of quantity to dispatch per product
$sql = 'SELECT fk_product, SUM(qty) FROM ' . MAIN_DB_PREFIX . 'commande_fournisseurdet';
$sql.= ' WHERE fk_commande = ' . $order_id;
$sql.= ' AND fk_product > 0';
if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) $sql.= ' AND product_type = 0';
$sql.= ' GROUP BY fk_product';
$sql.= ' ORDER by fk_product';
$resql = $db->query($sql);
if ($resql && $db->num_rows($resql))
{
while ($obj = $db->fetch_object($resql))
$ordered[$obj->fk_product] = $obj;
}
// Count nb of quantity to dispatch per product
$sql = 'SELECT fk_product, SUM(qty) FROM ' . MAIN_DB_PREFIX . 'commande_fournisseurdet';
$sql.= ' WHERE fk_commande = ' . $order_id;
$sql.= ' AND fk_product > 0';
if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) $sql.= ' AND product_type = 0';
$sql.= ' GROUP BY fk_product';
$sql.= ' ORDER by fk_product';
$resql = $db->query($sql);
if ($resql && $db->num_rows($resql))
{
while ($obj = $db->fetch_object($resql))
$ordered[$obj->fk_product] = $obj;
}
$todispatch=0;
foreach ($ordered as $key => $val)
{
$todispatch=0;
foreach ($ordered as $key => $val)
{
if ($ordered[$key] > $dispatched[$key]) $todispatch++;
}
}
return ($todispatch ? true : false);
//return true;
return ($todispatch ? true : false);
//return true;
}
/**
@ -80,30 +80,30 @@ function dolDispatchToDo($order_id)
*/
function dispatchedOrders()
{
global $db;
global $db;
$sql = 'SELECT rowid FROM ' . MAIN_DB_PREFIX . 'commande_fournisseur';
$resql = $db->query($sql);
$resarray = array();
if ($resql && $db->num_rows($resql) > 0)
{
while ($obj = $db->fetch_object($resql))
{
if (! dolDispatchToDo($obj->rowid))
{
$resarray[] = $obj->rowid;
}
}
}
$sql = 'SELECT rowid FROM ' . MAIN_DB_PREFIX . 'commande_fournisseur';
$resql = $db->query($sql);
$resarray = array();
if ($resql && $db->num_rows($resql) > 0)
{
while ($obj = $db->fetch_object($resql))
{
if (! dolDispatchToDo($obj->rowid))
{
$resarray[] = $obj->rowid;
}
}
}
if (count($resarray))
{
$res = '(' . implode(',', $resarray) . ')';
} else {
//hack to make sure ordered SQL request won't syntax error
$res = '(0)';
}
return $res;
if (count($resarray))
{
$res = '(' . implode(',', $resarray) . ')';
} else {
//hack to make sure ordered SQL request won't syntax error
$res = '(0)';
}
return $res;
}
/**
@ -159,16 +159,16 @@ function ordered($product_id)
*/
function getProducts($order_id)
{
global $db;
$order = new CommandeFournisseur($db);
$f = $order->fetch($order_id);
$products = array();
if($f) {
foreach($order->lines as $line) {
if (!in_array($line->fk_product, $products)) {
$products[] = $line->fk_product;
}
}
}
return $products;
global $db;
$order = new CommandeFournisseur($db);
$f = $order->fetch($order_id);
$products = array();
if($f) {
foreach($order->lines as $line) {
if (!in_array($line->fk_product, $products)) {
$products[] = $line->fk_product;
}
}
}
return $products;
}

View File

@ -51,7 +51,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments();
if ($id > 0 || ! empty($ref)) {
$upload_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->ref);
$upload_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->ref);
}
// Get parameters
@ -94,11 +94,11 @@ if ($object->id > 0)
{
$upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($object->ref);
// To verify role of users
//$userAccess = $object->restrictedProjectArea($user,'read');
$userWrite = $object->restrictedProjectArea($user, 'write');
//$userDelete = $object->restrictedProjectArea($user,'delete');
//print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete;
// To verify role of users
//$userAccess = $object->restrictedProjectArea($user,'read');
$userWrite = $object->restrictedProjectArea($user, 'write');
//$userDelete = $object->restrictedProjectArea($user,'delete');
//print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete;
$head = project_prepare_head($object);
dol_fiche_head($head, 'document', $langs->trans("Project"), -1, ($object->public?'projectpub':'project'));
@ -122,15 +122,15 @@ if ($object->id > 0)
// Thirdparty
if ($object->thirdparty->id > 0)
{
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1, 'project');
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1, 'project');
}
$morehtmlref.='</div>';
// Define a complementary filter for search of next/prev ref.
if (! $user->rights->projet->all->lire)
{
$objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
$object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',', array_keys($objectsListId)):'0').")";
$objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
$object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',', array_keys($objectsListId)):'0').")";
}
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);

View File

@ -171,58 +171,58 @@ else
function constructGanttLine($tarr, $task, $task_dependencies, $level = 0, $project_id = null)
{
global $langs;
global $dateformatinput2;
global $dateformatinput2;
$start_date = $task["task_start_date"];
$end_date = $task["task_end_date"];
if (!$end_date) $end_date = $start_date;
$start_date = dol_print_date($start_date, $dateformatinput2);
$end_date = dol_print_date($end_date, $dateformatinput2);
// Resources
$resources = $task["task_resources"];
// Define depend (ex: "", "4,13", ...)
$depend = '';
$count = 0;
foreach ($task_dependencies as $value) {
// Not yet used project_dependencies = array(array(0=>idtask,1=>idtasktofinishfisrt))
if ($value[0] == $task['task_id']) {
$depend.=($count>0?",":"").$value[1];
$count ++;
}
}
// $depend .= "\"";
// Define parent
if ($project_id && $level < 0)
{
$parent = '-'.$project_id;
}
else
{
$parent = $task["task_parent_alternate_id"];
//$parent = $task["task_parent"];
}
// Define percent
$percent = $task['task_percent_complete']?$task['task_percent_complete']:0;
// Link (more information)
if ($task["task_id"] < 0)
{
//$link=DOL_URL_ROOT.'/projet/tasks.php?withproject=1&id='.abs($task["task_id"]);
$link='';
}
else
{
$link=DOL_URL_ROOT.'/projet/tasks/contact.php?withproject=1&id='.$task["task_id"];
}
$start_date = $task["task_start_date"];
$end_date = $task["task_end_date"];
if (!$end_date) $end_date = $start_date;
$start_date = dol_print_date($start_date, $dateformatinput2);
$end_date = dol_print_date($end_date, $dateformatinput2);
// Resources
$resources = $task["task_resources"];
// Define depend (ex: "", "4,13", ...)
$depend = '';
$count = 0;
foreach ($task_dependencies as $value) {
// Not yet used project_dependencies = array(array(0=>idtask,1=>idtasktofinishfisrt))
if ($value[0] == $task['task_id']) {
$depend.=($count>0?",":"").$value[1];
$count ++;
}
}
// $depend .= "\"";
// Define parent
if ($project_id && $level < 0)
{
$parent = '-'.$project_id;
}
else
{
$parent = $task["task_parent_alternate_id"];
//$parent = $task["task_parent"];
}
// Define percent
$percent = $task['task_percent_complete']?$task['task_percent_complete']:0;
// Link (more information)
if ($task["task_id"] < 0)
{
//$link=DOL_URL_ROOT.'/projet/tasks.php?withproject=1&id='.abs($task["task_id"]);
$link='';
}
else
{
$link=DOL_URL_ROOT.'/projet/tasks/contact.php?withproject=1&id='.$task["task_id"];
}
// Name
//$name='<a href="'.DOL_URL_ROOT.'/projet/task/tasks.php?id='.$task['task_id'].'">'.$task['task_name'].'</a>';
$name=$task['task_name'];
// Name
//$name='<a href="'.DOL_URL_ROOT.'/projet/task/tasks.php?id='.$task['task_id'].'">'.$task['task_name'].'</a>';
$name=$task['task_name'];
/*for($i=0; $i < $level; $i++) {
/*for($i=0; $i < $level; $i++) {
$name=' - '.$name;
}*/
// Add line to gantt
/*
// Add line to gantt
/*
g.AddTaskItem(new JSGantt.TaskItem(1, 'Define Chart API','', '', 'ggroupblack','', 0, 'Brian', 0, 1,0,1,'','','Some Notes text',g));
g.AddTaskItem(new JSGantt.TaskItem(11,'Chart Object', '2014-02-20','2014-02-20','gmilestone', '', 1, 'Shlomy',100,0,1,1,'','','',g));
</pre>
@ -247,30 +247,30 @@ function constructGanttLine($tarr, $task, $task_dependencies, $level = 0, $proje
<dt>pGantt</dt><dd>(required) javascript JSGantt.GanttChart object from which to take settings. Defaults to &quot;g&quot; for backwards compatibility</dd>
*/
//$note="";
//$note="";
$s = "\n// Add task level = ".$level." id=".$task["task_id"]." parent_id=".$task["task_parent"]." aternate_id=".$task["task_alternate_id"]." parent_aternate_id=".$task["task_parent_alternate_id"]."\n";
$s = "\n// Add task level = ".$level." id=".$task["task_id"]." parent_id=".$task["task_parent"]." aternate_id=".$task["task_alternate_id"]." parent_aternate_id=".$task["task_parent_alternate_id"]."\n";
//$task["task_is_group"]=1; // When task_is_group is 1, content will be autocalculated from sum of all low tasks
//$task["task_is_group"]=1; // When task_is_group is 1, content will be autocalculated from sum of all low tasks
// For JSGanttImproved
$css = $task['task_css'];
$line_is_auto_group = $task["task_is_group"];
//$line_is_auto_group=0;
//if ($line_is_auto_group) $css = 'ggroupblack';
//$dependency = ($depend?$depend:$parent."SS");
$dependency = '';
//$name = str_repeat("..", $level).$name;
// For JSGanttImproved
$css = $task['task_css'];
$line_is_auto_group = $task["task_is_group"];
//$line_is_auto_group=0;
//if ($line_is_auto_group) $css = 'ggroupblack';
//$dependency = ($depend?$depend:$parent."SS");
$dependency = '';
//$name = str_repeat("..", $level).$name;
$taskid = $task["task_alternate_id"];
//$taskid = $task['task_id'];
$taskid = $task["task_alternate_id"];
//$taskid = $task['task_id'];
$note = $task['note'];
$note = $task['note'];
$note = dol_concatdesc($note, $langs->trans("Workload").' : '.($task['task_planned_workload'] ? convertSecondToTime($task['task_planned_workload'], 'allhourmin') : ''));
$note = dol_concatdesc($note, $langs->trans("Workload").' : '.($task['task_planned_workload'] ? convertSecondToTime($task['task_planned_workload'], 'allhourmin') : ''));
$s.= "g.AddTaskItem(new JSGantt.TaskItem('".$taskid."', '".dol_escape_js(trim($name))."', '".$start_date."', '".$end_date."', '".$css."', '".$link."', ".$task['task_milestone'].", '".dol_escape_js($resources)."', ".($percent >= 0 ? $percent : 0).", ".$line_is_auto_group.", '".$parent."', 1, '".$dependency."', '".(empty($task["task_is_group"]) ? (($percent >= 0 && $percent != '') ? $percent.'%' : '') : '')."', '".dol_escape_js($note)."', g));";
echo $s;
$s.= "g.AddTaskItem(new JSGantt.TaskItem('".$taskid."', '".dol_escape_js(trim($name))."', '".$start_date."', '".$end_date."', '".$css."', '".$link."', ".$task['task_milestone'].", '".dol_escape_js($resources)."', ".($percent >= 0 ? $percent : 0).", ".$line_is_auto_group.", '".$parent."', 1, '".$dependency."', '".(empty($task["task_is_group"]) ? (($percent >= 0 && $percent != '') ? $percent.'%' : '') : '')."', '".dol_escape_js($note)."', g));";
echo $s;
}
/**
@ -284,15 +284,15 @@ function constructGanttLine($tarr, $task, $task_dependencies, $level = 0, $proje
*/
function findChildGanttLine($tarr, $parent, $task_dependencies, $level)
{
$n=count($tarr);
$n=count($tarr);
$old_parent_id = 0;
for ($x=0; $x < $n; $x++)
{
if($tarr[$x]["task_parent"] == $parent && $tarr[$x]["task_parent"] != $tarr[$x]["task_id"])
{
// Create a grouping parent task for the new level
/*if (empty($old_parent_id) || $old_parent_id != $tarr[$x]['task_project_id'])
$old_parent_id = 0;
for ($x=0; $x < $n; $x++)
{
if($tarr[$x]["task_parent"] == $parent && $tarr[$x]["task_parent"] != $tarr[$x]["task_id"])
{
// Create a grouping parent task for the new level
/*if (empty($old_parent_id) || $old_parent_id != $tarr[$x]['task_project_id'])
{
$tmpt = array(
'task_id'=> -98, 'task_name'=>'Level '.$level, 'task_resources'=>'', 'task_start_date'=>'', 'task_end_date'=>'',
@ -301,9 +301,9 @@ function findChildGanttLine($tarr, $parent, $task_dependencies, $level)
$old_parent_id = $tarr[$x]['task_project_id'];
}*/
constructGanttLine($tarr, $tarr[$x], $task_dependencies, $level, null);
findChildGanttLine($tarr, $tarr[$x]["task_id"], $task_dependencies, $level+1);
}
}
constructGanttLine($tarr, $tarr[$x], $task_dependencies, $level, null);
findChildGanttLine($tarr, $tarr[$x]["task_id"], $task_dependencies, $level+1);
}
}
}

View File

@ -46,7 +46,7 @@ if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defi
*/
function llxHeaderVierge()
{
print '<html><title>Export agenda cal</title><body>';
print '<html><title>Export agenda cal</title><body>';
}
/**
* Footer function
@ -55,7 +55,7 @@ function llxHeaderVierge()
*/
function llxFooterVierge()
{
print '</body></html>';
print '</body></html>';
}
require '../../main.inc.php';
@ -129,12 +129,12 @@ $filename=$shortfilename;
// Complete long filename
foreach ($filters as $key => $value)
{
//if ($key == 'notolderthan') $filename.='-notolderthan'.$value; This filter key is already added before and does not need to be in filename
//if ($key == 'notolderthan') $filename.='-notolderthan'.$value; This filter key is already added before and does not need to be in filename
if ($key == 'year') $filename.='-year'.$value;
if ($key == 'id') $filename.='-id'.$value;
if ($key == 'idfrom') $filename.='-idfrom'.$value;
if ($key == 'idto') $filename.='-idto'.$value;
if ($key == 'project') $filename.='-project'.$value;
if ($key == 'id') $filename.='-id'.$value;
if ($key == 'idfrom') $filename.='-idfrom'.$value;
if ($key == 'idto') $filename.='-idto'.$value;
if ($key == 'project') $filename.='-project'.$value;
if ($key == 'logina') $filename.='-logina'.$value; // Author
if ($key == 'logint') $filename.='-logint'.$value; // Assigned to
if ($key == 'notactiontype') $filename.='-notactiontype'.$value;
@ -149,7 +149,7 @@ if ($shortfilename=='dolibarrcalendar')
$langs->load("main");
$langs->load("errors");
llxHeaderVierge();
print '<div class="error">'.$langs->trans("ErrorWrongValueForParameterX", 'format').'</div>';
print '<div class="error">'.$langs->trans("ErrorWrongValueForParameterX", 'format').'</div>';
llxFooterVierge();
exit;
}
@ -186,7 +186,7 @@ if ($format == 'ical' || $format == 'vcal')
$result=readfile($outputfile);
if (! $result) print 'File '.$outputfile.' was empty.';
//header("Location: ".DOL_URL_ROOT.'/document.php?modulepart=agenda&file='.urlencode($filename));
//header("Location: ".DOL_URL_ROOT.'/document.php?modulepart=agenda&file='.urlencode($filename));
exit;
}
else

View File

@ -81,7 +81,7 @@ if (! empty($tag))
$resql=$db->query($sql);
//Update status communication of contact prospect
//Update status communication of contact prospect
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=3 WHERE fk_stcomm != -1 AND rowid IN (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."socpeople AS sc INNER JOIN ".MAIN_DB_PREFIX."mailing_cibles AS mc ON mc.tag = '".$db->escape($tag)."' AND mc.source_type = 'contact' AND mc.source_id = sc.rowid)";
dol_syslog("public/emailing/mailing-read.php : Mail read contact : ".$sql, LOG_DEBUG);

View File

@ -152,7 +152,7 @@ function llxHeaderVierge($title, $head = "")
*/
function llxFooterVierge()
{
printCommonFooter('public');
printCommonFooter('public');
print "</body>\n";
print "</html>\n";

View File

@ -56,10 +56,10 @@ function llxHeaderVierge($title, $head = "")
header("Content-type: text/html; charset=".$conf->file->character_set_client);
print "<html>\n";
print "<head>\n";
print "<title>".$title."</title>\n";
if ($head) print $head."\n";
print "</head>\n";
print "<head>\n";
print "<title>".$title."</title>\n";
if ($head) print $head."\n";
print "</head>\n";
print '<body class="public_body">'."\n";
}
@ -70,9 +70,9 @@ function llxHeaderVierge($title, $head = "")
*/
function llxFooterVierge()
{
printCommonFooter('public');
printCommonFooter('public');
print "</body>\n";
print "</body>\n";
print "</html>\n";
}

View File

@ -36,14 +36,14 @@ require '../main.inc.php';
if (! GETPOST('transkey', 'alphanohtml') && ! GETPOST('transphrase', 'alphanohtml'))
{
print 'Sorry, it seems your internet connexion is off.<br>';
print 'You need to be connected to network to use this software.<br>';
print 'Sorry, it seems your internet connexion is off.<br>';
print 'You need to be connected to network to use this software.<br>';
}
else
{
$langs->load("error");
$langs->load("other");
$langs->load("error");
$langs->load("other");
if (GETPOST('transphrase', 'alphanohtml')) print GETPOST('transphrase', 'alphanohtml');
if (GETPOST('transkey', 'alphanohtml')) print $langs->trans(GETPOST('transkey', 'alphanohtml'));
if (GETPOST('transphrase', 'alphanohtml')) print GETPOST('transphrase', 'alphanohtml');
if (GETPOST('transkey', 'alphanohtml')) print $langs->trans(GETPOST('transkey', 'alphanohtml'));
}

Some files were not shown because too many files have changed in this diff Show More