commit
2e4483f7f4
@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
|
||||
dol_include_once('/emailcollector/class/emailcollector.class.php');
|
||||
require_once DOL_DOCUMENT_ROOT.'/emailcollector/class/emailcollector.class.php';
|
||||
|
||||
// Load translation files required by page
|
||||
$langs->loadLangs(array("admin", "other"));
|
||||
@ -50,7 +50,7 @@ $mode = GETPOST('mode', 'aZ');
|
||||
$id = GETPOST('id', 'int');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
|
||||
@ -24,19 +24,7 @@
|
||||
*/
|
||||
|
||||
// Load Dolibarr environment
|
||||
$res = 0;
|
||||
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
|
||||
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
|
||||
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
|
||||
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
|
||||
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; }
|
||||
if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
|
||||
if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
|
||||
// Try main.inc.php using relative path
|
||||
if (!$res && file_exists("../main.inc.php")) $res = @include "../main.inc.php";
|
||||
if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php";
|
||||
if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php";
|
||||
if (!$res) die("Include of main fails");
|
||||
require '../main.inc.php';
|
||||
|
||||
global $langs, $user;
|
||||
|
||||
@ -56,6 +44,8 @@ $action = GETPOST('action', 'alpha');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
||||
$value = GETPOST('value', 'alpha');
|
||||
$label = GETPOST('label', 'alpha');
|
||||
$scandir = GETPOST('scan_dir', 'alpha');
|
||||
|
||||
$arrayofparameters = array(
|
||||
'STOCKTRANSFER_MYPARAM1'=>array('css'=>'minwidth200', 'enabled'=>1),
|
||||
@ -70,9 +60,8 @@ $setupnotempty = 0;
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ((float) DOL_VERSION >= 6) {
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
}
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
|
||||
if ($action == 'updateMask') {
|
||||
$maskconststocktransfer = GETPOST('maskconststocktransfer', 'alpha');
|
||||
@ -131,7 +120,9 @@ if ($action == 'updateMask') {
|
||||
$ret = delDocumentModel($value, 'stocktransfer');
|
||||
if ($ret > 0) {
|
||||
$constforval = strtoupper($tmpobjectkey).'_ADDON_PDF';
|
||||
if ($conf->global->$constforval == "$value") dolibarr_del_const($db, $constforval, $conf->entity);
|
||||
if (getDolGlobalString($constforval) == "$value") {
|
||||
dolibarr_del_const($db, $constforval, $conf->entity);
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'setdoc') { // Set default model
|
||||
$tmpobjectkey = 'StockTransfer';
|
||||
@ -294,7 +285,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
|
||||
|
||||
print '<td class="center">';
|
||||
$constforvar = 'STOCKTRANSFER_'.strtoupper($myTmpObjectKey).'_ADDON';
|
||||
if ($conf->global->$constforvar == $file) {
|
||||
if (getDolGlobalString($constforvar) == $file) {
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
} else {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&object='.strtolower($myTmpObjectKey).'&value='.$file.'">';
|
||||
@ -428,7 +419,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
|
||||
// Default
|
||||
print '<td class="center">';
|
||||
$constforvar = strtoupper($myTmpObjectKey).'_ADDON_PDF';
|
||||
if ($conf->global->$constforvar == $name) {
|
||||
if (getDolGlobalString($constforvar) == $name) {
|
||||
print img_picto($langs->trans("Default"), 'on');
|
||||
} else {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&object='.$myTmpObjectKey.'&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
||||
|
||||
@ -652,7 +652,7 @@ foreach ($accounts as $key => $type) {
|
||||
print '<span class="opacitymedium">'.$langs->trans("ConciliationDisabled").'</span>';
|
||||
} else {
|
||||
$result = $objecttmp->load_board($user, $objecttmp->id);
|
||||
if ($result < 0) {
|
||||
if (is_numeric($result) && $result < 0) {
|
||||
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
|
||||
} else {
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=asc,asc,asc&id='.$objecttmp->id.'&search_account='.$objecttmp->id.'&search_conciliated=0&contextpage=banktransactionlist">';
|
||||
|
||||
@ -5667,7 +5667,7 @@ if ($action == 'create') {
|
||||
&& $usercancreate
|
||||
&& !$objectidnext
|
||||
&& $object->is_last_in_cycle()
|
||||
&& $conf->global->INVOICE_USE_SITUATION_CREDIT_NOTE
|
||||
&& getDolGlobalInt('INVOICE_USE_SITUATION_CREDIT_NOTE')
|
||||
) {
|
||||
if ($usercanunvalidate) {
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?socid='.$object->socid.'&fac_avoir='.$object->id.'&invoiceAvoirWithLines=1&action=create&type=2'.($object->fk_project > 0 ? '&projectid='.$object->fk_project : '').'">'.$langs->trans("CreateCreditNote").'</a>';
|
||||
|
||||
@ -4917,15 +4917,18 @@ abstract class CommonObject
|
||||
// Note: This is deprecated. If you need to overwrite the tpl file, use instead the hook.
|
||||
$dirtpls = array_merge($conf->modules_parts['tpl'], array($defaulttpldir));
|
||||
foreach ($dirtpls as $module => $reldir) {
|
||||
$res = 0;
|
||||
if (!empty($module)) {
|
||||
$tpl = dol_buildpath($reldir.'/objectline_title.tpl.php');
|
||||
} else {
|
||||
$tpl = DOL_DOCUMENT_ROOT.$reldir.'/objectline_title.tpl.php';
|
||||
}
|
||||
if (empty($conf->file->strict_mode)) {
|
||||
$res = @include $tpl;
|
||||
} else {
|
||||
$res = include $tpl; // for debug
|
||||
if (file_exists($tpl)) {
|
||||
if (empty($conf->file->strict_mode)) {
|
||||
$res = @include $tpl;
|
||||
} else {
|
||||
$res = include $tpl; // for debug
|
||||
}
|
||||
}
|
||||
if ($res) {
|
||||
break;
|
||||
@ -5040,16 +5043,18 @@ abstract class CommonObject
|
||||
// Note: This is deprecated. If you need to overwrite the tpl file, use instead the hook printObjectLine and printObjectSubLine.
|
||||
$dirtpls = array_merge($conf->modules_parts['tpl'], array($defaulttpldir));
|
||||
foreach ($dirtpls as $module => $reldir) {
|
||||
$res = 0;
|
||||
if (!empty($module)) {
|
||||
$tpl = dol_buildpath($reldir.'/objectline_view.tpl.php');
|
||||
} else {
|
||||
$tpl = DOL_DOCUMENT_ROOT.$reldir.'/objectline_view.tpl.php';
|
||||
}
|
||||
|
||||
if (empty($conf->file->strict_mode)) {
|
||||
$res = @include $tpl;
|
||||
} else {
|
||||
$res = include $tpl; // for debug
|
||||
if (file_exists($tpl)) {
|
||||
if (empty($conf->file->strict_mode)) {
|
||||
$res = @include $tpl;
|
||||
} else {
|
||||
$res = include $tpl; // for debug
|
||||
}
|
||||
}
|
||||
if ($res) {
|
||||
break;
|
||||
|
||||
@ -8887,7 +8887,7 @@ class Form
|
||||
$form = new Form($this->db);
|
||||
print $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")).' ';
|
||||
}
|
||||
print '<span class="amount">'.price($objp->total_ht).'</span>';
|
||||
print '<span class="amount">'.(isset($objp->total_ht) ? price($objp->total_ht) : '').'</span>';
|
||||
print '</td>';
|
||||
print '<td>'.$objp->name.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -100,7 +100,7 @@ class FormMargin
|
||||
$pv = $line->total_ht;
|
||||
$pa_ht = ($pv < 0 ? -$line->pa_ht : $line->pa_ht); // We choosed to have line->pa_ht always positive in database, so we guess the correct sign
|
||||
if (($object->element == 'facture' && $object->type == $object::TYPE_SITUATION)
|
||||
|| ($object->element == 'facture' && $object->type == $object::TYPE_CREDIT_NOTE && $conf->global->INVOICE_USE_SITUATION_CREDIT_NOTE && $object->situation_counter > 0)) {
|
||||
|| ($object->element == 'facture' && $object->type == $object::TYPE_CREDIT_NOTE && getDolGlobalInt('INVOICE_USE_SITUATION_CREDIT_NOTE') && $object->situation_counter > 0)) {
|
||||
$pa = $line->qty * $pa_ht * ($line->situation_percent / 100);
|
||||
} else {
|
||||
$pa = $line->qty * $pa_ht;
|
||||
|
||||
@ -1079,7 +1079,7 @@ class FormSetupItem
|
||||
$tmp = explode(':', $this->type);
|
||||
|
||||
$template = $formmail->getEMailTemplate($this->db, $tmp[1], $user, $this->langs, $this->fieldValue);
|
||||
if ($template<0) {
|
||||
if (is_numeric($template) && $template < 0) {
|
||||
$this->setErrors($formmail->errors);
|
||||
}
|
||||
$out.= $this->langs->trans($template->label);
|
||||
|
||||
@ -438,7 +438,11 @@ function societe_prepare_head2($object)
|
||||
*/
|
||||
function societe_admin_prepare_head()
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $langs, $conf, $user, $db;
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extrafields->fetch_name_optionals_label('societe');
|
||||
$extrafields->fetch_name_optionals_label('socpeople');
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
@ -456,11 +460,19 @@ function societe_admin_prepare_head()
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/admin/societe_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFieldsThirdParties");
|
||||
$nbExtrafields = $extrafields->attributes['societe']['count'];
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
|
||||
}
|
||||
$head[$h][2] = 'attributes';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/admin/contact_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFieldsContacts");
|
||||
$nbExtrafields = $extrafields->attributes['socpeople']['count'];
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
|
||||
}
|
||||
$head[$h][2] = 'attributes_contacts';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ if (!empty($extrafieldsobjectkey) && !empty($extrafields->attributes[$extrafield
|
||||
|
||||
$tmpkey = 'options_'.$key;
|
||||
|
||||
if (in_array($extrafields->attributes[$extrafieldsobjectkey]['type'][$key], array('date', 'datetime', 'timestamp')) && !is_numeric($obj->$tmpkey)) {
|
||||
if (in_array($extrafields->attributes[$extrafieldsobjectkey]['type'][$key], array('date', 'datetime', 'timestamp')) && isset($obj->$tmpkey) && !is_numeric($obj->$tmpkey)) {
|
||||
$datenotinstring = $obj->$tmpkey;
|
||||
if (!is_numeric($obj->$tmpkey)) { // For backward compatibility
|
||||
$datenotinstring = $db->jdate($datenotinstring);
|
||||
|
||||
@ -849,8 +849,8 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
|
||||
$desiredstock = $objp->desiredstock;
|
||||
$alertstock = $objp->seuil_stock_alerte;
|
||||
$desiredstockwarehouse = ($objp->desiredstockpse ? $objp->desiredstockpse : 0);
|
||||
$alertstockwarehouse = ($objp->seuil_stock_alertepse ? $objp->seuil_stock_alertepse : 0);
|
||||
$desiredstockwarehouse = (!empty($objp->desiredstockpse) ? $objp->desiredstockpse : 0);
|
||||
$alertstockwarehouse = (!empty($objp->seuil_stock_alertepse) ? $objp->seuil_stock_alertepse : 0);
|
||||
|
||||
$warning = '';
|
||||
if ($alertstock && ($stock < $alertstock)) {
|
||||
|
||||
@ -51,6 +51,7 @@ $search_dateyear = GETPOST('search_dateyear', 'int');
|
||||
$search_datemonth = GETPOST('search_datemonth', 'int');
|
||||
$search_dateday = GETPOST('search_dateday', 'int');
|
||||
$search_date = dol_mktime(0, 0, 0, $search_datemonth, $search_dateday, $search_dateyear);
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
@ -130,9 +131,9 @@ if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
}
|
||||
$sql .= ' WHERE cf.fk_soc = s.rowid ';
|
||||
$sql .= ' AND cf.entity = '.$conf->entity;
|
||||
if ($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) {
|
||||
if (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER)) {
|
||||
$sql .= ' AND cf.fk_statut < 3';
|
||||
} elseif ($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
|
||||
} elseif (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
|
||||
$sql .= ' AND cf.fk_statut < 6'; // We want also status 5, we will keep them visible if dispatching is not yet finished (tested with function dolDispatchToDo).
|
||||
} else {
|
||||
$sql .= ' AND cf.fk_statut < 5';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user