Merge branch 'dev_EventOrganisation' into dev_EventOrganisation_setuppage

This commit is contained in:
Florian HENRY 2021-02-15 11:20:07 +01:00
commit 1427f66e10
11 changed files with 349 additions and 95 deletions

View File

@ -81,6 +81,9 @@ if (!empty($canvas)) {
$objcanvas->getCanvas('adherent', 'membercard', $canvas);
}
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('membercard', 'globalcard'));
// Security check
$result = restrictedArea($user, 'adherent', $id, '', '', 'socid', 'rowid', 0);
@ -107,9 +110,6 @@ if ($id) {
$caneditfieldmember = $user->rights->adherent->creer;
}
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('membercard', 'globalcard'));
/*

View File

@ -55,6 +55,11 @@ $permissionnote = $user->rights->adherent->cotisation->creer; // Used by the inc
$permissiondellink = $user->rights->adherent->cotisation->creer; // Used by the include of actions_dellink.inc.php
$permissiontoedit = $user->rights->adherent->cotisation->creer; // Used by the include of actions_lineupdonw.inc.php
$hookmanager->initHooks(array('subscriptioncard', 'globalcard'));
// Security check
$result = restrictedArea($user, 'subscription', 0); // TODO Check on object id
/*
* Actions

View File

@ -91,7 +91,7 @@ $search_dt_start = dol_mktime(0, 0, 0, GETPOST('search_start_dtmonth', 'int'), G
$search_dt_end = dol_mktime(0, 0, 0, GETPOST('search_end_dtmonth', 'int'), GETPOST('search_end_dtday', 'int'), GETPOST('search_end_dtyear', 'int'));
$search_dv_start = dol_mktime(0, 0, 0, GETPOST('search_start_dvmonth', 'int'), GETPOST('search_start_dvday', 'int'), GETPOST('search_start_dvyear', 'int'));
$search_dv_end = dol_mktime(0, 0, 0, GETPOST('search_end_dvmonth', 'int'), GETPOST('search_end_dvday', 'int'), GETPOST('search_end_dvyear', 'int'));
$search_thirdparty = GETPOST("search_thirdparty", 'alpha') ?GETPOST("search_thirdparty", 'alpha') : GETPOST("thirdparty", 'alpha');
$search_thirdparty_user = GETPOST("search_thirdparty", 'alpha') ?GETPOST("search_thirdparty", 'alpha') : GETPOST("thirdparty", 'alpha');
$search_req_nb = GETPOST("req_nb", 'alpha');
$search_num_releve = GETPOST("search_num_releve", 'alpha');
$search_conciliated = GETPOST("search_conciliated", 'int');
@ -142,16 +142,16 @@ $extrafields->fetch_name_optionals_label('banktransaction');
$search_array_options = $extrafields->getOptionalsFromPost('banktransaction', '', 'search_');
$arrayfields = array(
'b.rowid'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
'b.label'=>array('label'=>$langs->trans("Description"), 'checked'=>1),
'b.dateo'=>array('label'=>$langs->trans("DateOperationShort"), 'checked'=>1),
'b.datev'=>array('label'=>$langs->trans("DateValueShort"), 'checked'=>1),
'type'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
'b.num_chq'=>array('label'=>$langs->trans("Numero"), 'checked'=>1),
'bu.label'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1, 'position'=>500),
'ba.ref'=>array('label'=>$langs->trans("BankAccount"), 'checked'=>(($id > 0 || !empty($ref)) ? 0 : 1), 'position'=>1000),
'b.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1, 'position'=>600),
'b.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1, 'position'=>605),
'b.rowid'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
'b.label'=>array('label'=>$langs->trans("Description"), 'checked'=>1),
'b.dateo'=>array('label'=>$langs->trans("DateOperationShort"), 'checked'=>1),
'b.datev'=>array('label'=>$langs->trans("DateValueShort"), 'checked'=>1),
'type'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
'b.num_chq'=>array('label'=>$langs->trans("Numero"), 'checked'=>1),
'bu.label'=>array('label'=>$langs->trans("ThirdParty").'/'.$langs->trans("User"), 'checked'=>1, 'position'=>500),
'ba.ref'=>array('label'=>$langs->trans("BankAccount"), 'checked'=>(($id > 0 || !empty($ref)) ? 0 : 1), 'position'=>1000),
'b.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1, 'position'=>600),
'b.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1, 'position'=>605),
'balancebefore'=>array('label'=>$langs->trans("BalanceBefore"), 'checked'=>0, 'position'=>1000),
'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>1001),
'b.num_releve'=>array('label'=>$langs->trans("AccountStatement"), 'checked'=>1, 'position'=>1010),
@ -191,7 +191,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_ref = "";
$search_req_nb = '';
$search_description = '';
$search_thirdparty = '';
$search_thirdparty_user = '';
$search_num_releve = '';
$search_conciliated = '';
$thirdparty = '';
@ -255,7 +255,7 @@ if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', '
$param .= '&search_conciliated='.urlencode($search_conciliated);
if ($page) $param .= '&page='.urlencode($page);
if ($offset) $param .= '&offset='.urlencode($offset);
if ($search_thirdparty) $param .= '&search_thirdparty='.urlencode($search_thirdparty);
if ($search_thirdparty_user) $param .= '&search_thirdparty='.urlencode($search_thirdparty_user);
if ($search_num_releve) $param .= '&search_num_releve='.urlencode($search_num_releve);
if ($search_description) $param .= '&search_description='.urlencode($search_description);
if ($search_start_dt) $param .= '&search_start_dt='.urlencode($search_start_dt);
@ -359,6 +359,7 @@ $formaccounting = new FormAccounting($db);
$companystatic = new Societe($db);
$bankaccountstatic = new Account($db);
$userstatic= new User($db);
$banktransferstatic = new BonPrelevement($db);
$societestatic = new Societe($db);
@ -390,7 +391,7 @@ if (!empty($ref)) $param .= '&ref='.urlencode($ref);
if (!empty($search_ref)) $param .= '&search_ref='.urlencode($search_ref);
if (!empty($search_description)) $param .= '&search_description='.urlencode($search_description);
if (!empty($search_type)) $param .= '&type='.urlencode($search_type);
if (!empty($search_thirdparty)) $param .= '&search_thirdparty='.urlencode($search_thirdparty);
if (!empty($search_thirdparty_user)) $param .= '&search_thirdparty='.urlencode($search_thirdparty_user);
if (!empty($search_debit)) $param .= '&search_debit='.urlencode($search_debit);
if (!empty($search_credit)) $param .= '&search_credit='.urlencode($search_credit);
if (!empty($search_account)) $param .= '&search_account='.urlencode($search_account);
@ -482,7 +483,7 @@ if ($id > 0 || !empty($ref))
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro as conciliated, b.num_releve, b.num_chq,";
$sql .= " b.fk_account, b.fk_type,";
$sql .= " ba.rowid as bankid, ba.ref as bankref,";
$sql .= " bu.url_id,";
$sql .= " bu.url_id, bu.type as type_url,";
$sql .= " s.nom, s.name_alias, s.client, s.fournisseur, s.email, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur";
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
@ -512,7 +513,7 @@ if ($search_ref) $sql .= natural_search("b.rowid", $search_ref, 1);
if ($search_req_nb) $sql .= natural_search("b.num_chq", $search_req_nb);
if ($search_num_releve) $sql .= natural_search("b.num_releve", $search_num_releve);
if ($search_conciliated != '' && $search_conciliated != '-1') $sql .= " AND b.rappro = ".urlencode($search_conciliated);
if ($search_thirdparty) $sql .= natural_search("s.nom", $search_thirdparty);
if ($search_thirdparty_user) $sql .= natural_search(array("s.nom", "u.firstname", "u.lastname"), $search_thirdparty_user);
if ($search_description)
{
$search_description_to_use = $search_description;
@ -587,7 +588,7 @@ if (!empty($search_description)) $mode_balance_ok = false;
if (!empty($search_type)) $mode_balance_ok = false;
if (!empty($search_debit)) $mode_balance_ok = false;
if (!empty($search_credit)) $mode_balance_ok = false;
if (!empty($search_thirdparty)) $mode_balance_ok = false;
if (!empty($search_thirdparty_user)) $mode_balance_ok = false;
if ($search_conciliated != '' && $search_conciliated != '-1') $mode_balance_ok = false;
if (!empty($search_num_releve)) $mode_balance_ok = false;
@ -1012,6 +1013,8 @@ if ($resql)
while ($i < min($num, $limit))
{
$objp = $db->fetch_object($resql);
$links = $bankaccountstatic->get_url($objp->rowid);
// If we are in a situation where we need/can show balance, we calculate the start of balance
if (!$balancecalculated && (!empty($arrayfields['balancebefore']['checked']) || !empty($arrayfields['balance']['checked'])) && ($mode_balance_ok || $search_conciliated === '0'))
{
@ -1202,7 +1205,6 @@ if ($resql)
//print "</a>&nbsp;";
// Add links after description
$links = $bankaccountstatic->get_url($objp->rowid);
$cachebankaccount = array();
foreach ($links as $key=>$val)
{
@ -1369,24 +1371,51 @@ if ($resql)
}
// Third party
if (!empty($arrayfields['bu.label']['checked']))
{
print '<td class="tdoverflowmax150">';
if (!empty($arrayfields['bu.label']['checked']))
{
print '<td class="tdoverflowmax150">';
if ($objp->url_id)
{
$companystatic->id = $objp->url_id;
$companystatic->name = $objp->nom;
$companystatic->name_alias = $objp->name_alias;
$companystatic->client = $objp->client;
$companystatic->email = $objp->email;
$companystatic->fournisseur = $objp->fournisseur;
$companystatic->code_client = $objp->code_client;
$companystatic->code_fournisseur = $objp->code_fournisseur;
$companystatic->code_compta = $objp->code_compta;
$companystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
print $companystatic->getNomUrl(1);
} else {
print '&nbsp;';
if ($objp->type_url == 'company') {
$companystatic->id = $objp->url_id;
$companystatic->name = $objp->nom;
$companystatic->name_alias = $objp->name_alias;
$companystatic->client = $objp->client;
$companystatic->email = $objp->email;
$companystatic->fournisseur = $objp->fournisseur;
$companystatic->code_client = $objp->code_client;
$companystatic->code_fournisseur = $objp->code_fournisseur;
$companystatic->code_compta = $objp->code_compta;
$companystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
print $companystatic->getNomUrl(1);
}
}
else //display user or nothing
{
//payment line type to define user display
foreach ($links as $key=>$value){
if ($links[$key]['type'] == 'payment_sc') $type_link = 'payment_sc';
if ($links[$key]['type'] == 'payment_salary') $type_link = 'payment_salary';
}
$sqlu = "SELECT url_id FROM ".MAIN_DB_PREFIX."bank_url WHERE fk_bank=".$objp->rowid." AND type='user'";
$resqlu = $db->query($sqlu);
if ($resqlu) {
if ($db->num_rows($resqlu) > 0 &&
(($type_link == 'payment_salary' && !empty($user->rights->salaries->read))
|| ($type_link == 'payment_sc' && !empty($user->rights->tax->charges->lire)))) {
$obj = $db->fetch_object($resqlu);
$userstatic->fetch($obj->url_id);
print $userstatic->getNomUrl(1);
}
else {
print '&nbsp;';
}
} else {
dol_print_error($db);
}
}
print '</td>';
if (!$i) $totalarray['nbfield']++;

View File

@ -567,6 +567,25 @@ class PaymentSocialContribution extends CommonObject
$socialcontrib->fetch($key);
$result = $acc->add_url_line($bank_line_id, $socialcontrib->id, DOL_URL_ROOT.'/compta/charges.php?id=', $socialcontrib->type_label.(($socialcontrib->lib && $socialcontrib->lib != $socialcontrib->type_label) ? ' ('.$socialcontrib->lib.')' : ''), 'sc');
if ($result <= 0) dol_print_error($this->db);
if ($socialcontrib->fk_user) {
$fuser = new User($this->db);
$fuser->fetch($socialcontrib->fk_user);
// Add link 'user' in bank_url between operation and bank transaction
$result = $acc->add_url_line(
$bank_line_id,
$socialcontrib->fk_user,
DOL_URL_ROOT . '/user/card.php?id=',
$fuser->getFullName($langs),
'user'
);
if ($result <= 0) {
$this->error = $acc->error;
$error++;
}
}
}
}
} else {

View File

@ -825,7 +825,7 @@ class dolReceiptPrinter extends Printer
if ($this->printer->connector instanceof DummyPrintConnector || $conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector")
{
$data = $this->printer->connector->getData();
if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") echo base64_encode($data);
if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") echo rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
dol_syslog($data);
}
// Close and print

View File

@ -50,8 +50,19 @@ class Cronjob extends CommonObject
*/
public $entity;
/**
* @var string Job type
*/
public $jobtype;
/**
* @var string|int Date for last cron object update
*/
public $tms = '';
/**
* @var string|int Date for cron job create
*/
public $datec = '';
/**
@ -59,6 +70,9 @@ class Cronjob extends CommonObject
*/
public $label;
/**
* @var string Job command
*/
public $command;
public $classesname;
public $objectname;
@ -67,20 +81,50 @@ class Cronjob extends CommonObject
public $md5params;
public $module_name;
public $priority;
/**
* @var string|int Date for last job execution
*/
public $datelastrun = '';
/**
* @var string|int Date for next job execution
*/
public $datenextrun = '';
/**
* @var string|int Date for end job execution
*/
public $dateend = '';
/**
* @var string|int Date for first start job execution
*/
public $datestart = '';
/**
* @var string|int Date for last result job execution
*/
public $datelastresult = '';
/**
* @var string Last result from end job execution
*/
public $lastresult;
/**
* @var string Last output from end job execution
*/
public $lastoutput;
/**
* @var string Unit frequency of job execution
*/
public $unitfrequency;
/**
* @var int Frequency of job execution
*/
public $frequency;
/**
@ -88,6 +132,9 @@ class Cronjob extends CommonObject
*/
public $status;
/**
* @var int Is job processing
*/
public $processing;
/**
@ -100,9 +147,25 @@ class Cronjob extends CommonObject
*/
public $fk_user_mod;
/**
* @var int Number of run job execution
*/
public $nbrun;
/**
* @var int Maximum run job execution
*/
public $maxrun;
/**
* @var string Libname
*/
public $libname;
public $test; // A test condition to know if job is visible/qualified
/**
* @var string A test condition to know if job is visible/qualified
*/
public $test;
const STATUS_DISABLED = 0;
const STATUS_ENABLED = 1;
@ -152,7 +215,12 @@ class Cronjob extends CommonObject
if (isset($this->frequency)) $this->frequency = trim($this->frequency);
if (isset($this->status)) $this->status = trim($this->status);
if (isset($this->note_private)) $this->note_private = trim($this->note_private);
if (isset($this->nbrun)) $this->nbrun = trim($this->nbrun);
if (isset($this->nbrun)) {
$this->nbrun = (int) $this->nbrun;
}
if (isset($this->maxrun)) {
$this->maxrun = (int) $this->maxrun;
}
if (isset($this->libname)) $this->libname = trim($this->libname);
if (isset($this->test)) $this->test = trim($this->test);
@ -262,7 +330,10 @@ class Cronjob extends CommonObject
dol_syslog(get_class($this)."::create", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); }
if (!$resql) {
$error++;
$this->errors[] = "Error ".$this->db->lasterror();
}
if (!$error)
{
@ -1253,8 +1324,7 @@ class Cronjob extends CommonObject
}
$result = $this->update($user);
if ($result < 0)
{
if ($result < 0) {
dol_syslog(get_class($this)."::reprogram_jobs ".$this->error, LOG_ERR);
return -1;
}
@ -1289,14 +1359,16 @@ class Cronjob extends CommonObject
$this->labelStatus = array(); // Force reset o array because label depends on other fields
$this->labelStatusShort = array();
if (empty($this->labelStatus) || empty($this->labelStatusShort))
{
if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
global $langs;
$langs->load('users');
$moretext = '';
if ($processing) $moretext = ' ('.$langs->trans("Running").')';
elseif ($lastresult) $moretext .= ' ('.$langs->trans("Error").')';
if ($processing) {
$moretext = ' ('.$langs->trans("Running").')';
} elseif ($lastresult) {
$moretext .= ' ('.$langs->trans("Error").')';
}
$this->labelStatus[self::STATUS_DISABLED] = $langs->trans('Disabled').$moretext;
$this->labelStatus[self::STATUS_ENABLED] = $langs->trans('Scheduled').$moretext;

View File

@ -99,6 +99,7 @@ VirtualStock=Virtual stock
VirtualStockAtDate=Virtual stock at date
VirtualStockAtDateDesc=Virtual stock once all pending orders that are planned to be done before the date will be finished
VirtualStockDesc=Virtual stock is the calculated stock available once all open/pending actions (that affect stocks) are closed (purchase orders received, sales orders shipped, manufacturing orders produced, etc)
AtDate=At date
IdWarehouse=Id warehouse
DescWareHouse=Description warehouse
LieuWareHouse=Localisation warehouse

View File

@ -1701,17 +1701,18 @@ if (is_array($listofmodules) && count($listofmodules) > 0) {
foreach ($objMod->config_page_url as $page)
{
$urlpage = $page;
if ($i++)
{
if ($i++) {
$linktoenabledisable .= ' <a href="'.$urlpage.'" title="'.$langs->trans($page).'">'.img_picto(ucfirst($page), "setup").'</a>';
// print '<a href="'.$page.'">'.ucfirst($page).'</a>&nbsp;';
} else {
if (preg_match('/^([^@]+)@([^@]+)$/i', $urlpage, $regs))
{
$urltouse = dol_buildpath('/'.$regs[2].'/admin/'.$regs[1], 1);
$linktoenabledisable .= ' &nbsp; <a href="'.$urltouse.(preg_match('/\?/', $urltouse) ? '&' : '?').'save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').'</a>';
} else {
// Case standard admin page (not a page provided by the module but a page
// Case standard admin page (not a page provided by the
// module but a page provided by dolibarr)
$urltouse = DOL_URL_ROOT.'/admin/'.$urlpage;
$linktoenabledisable .= ' &nbsp; <a href="'.$urltouse.(preg_match('/\?/', $urltouse) ? '&' : '?').'save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').'</a>';
}

View File

@ -61,8 +61,11 @@ $scandir = GETPOST('scan_dir', 'alpha');
$type = 'myobject';
$arrayofparameters = array(
'MYMODULE_MYPARAM1'=>array('css'=>'minwidth200', 'enabled'=>1),
'MYMODULE_MYPARAM2'=>array('css'=>'minwidth500', 'enabled'=>1)
'MYMODULE_MYPARAM1'=>array('type'=>'string', 'css'=>'minwidth500' ,'enabled'=>1),
'MYMODULE_MYPARAM2'=>array('type'=>'textarea','enabled'=>1),
//'MYMODULE_MYPARAM3'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1),
//'MYMODULE_MYPARAM4'=>array('type'=>'emailtemplate:thirdparty', 'enabled'=>1),
//'MYMODULE_MYPARAM5'=>array('type'=>'yesno', 'enabled'=>1),
);
$error = 0;
@ -208,11 +211,57 @@ if ($action == 'edit') {
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
foreach ($arrayofparameters as $key => $val) {
print '<tr class="oddeven"><td>';
$tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : '');
print $form->textwithpicto($langs->trans($key), $tooltiphelp);
print '</td><td><input name="'.$key.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.$conf->global->$key.'"></td></tr>';
foreach ($arrayofparameters as $constname => $val) {
if ($val['enabled']==1) {
$setupnotempty++;
print '<tr class="oddeven"><td>';
$tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : '');
print '<span id="helplink'.$constname.'" class="spanforparamtooltip">'.$form->textwithpicto($langs->trans($constname), $tooltiphelp, 1, 'info', '', 0, 3, 'tootips'.$constname).'</span>';
print '</td><td>';
if ($val['type'] == 'textarea') {
print '<textarea class="flat" name="'.$constname.'" id="'.$constname.'" cols="50" rows="5" wrap="soft">' . "\n";
print $conf->global->{$constname};
print "</textarea>\n";
} elseif ($val['type']== 'html') {
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$doleditor = new DolEditor($constname, $conf->global->{$constname}, '', 160, 'dolibarr_notes', '', false, false, $conf->fckeditor->enabled, ROWS_5, '90%');
$doleditor->Create();
} elseif ($val['type'] == 'yesno') {
print $form->selectyesno($constname, $conf->global->{$constname}, 1);
} elseif (preg_match('/emailtemplate:/', $val['type'])) {
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
$tmp = explode(':', $val['type']);
$nboftemplates = $formmail->fetchAllEMailTemplate($tmp[1], $user, null, 1); // We set lang=null to get in priority record with no lang
//$arraydefaultmessage = $formmail->getEMailTemplate($db, $tmp[1], $user, null, 0, 1, '');
$arrayofmessagename = array();
if (is_array($formmail->lines_model)) {
foreach ($formmail->lines_model as $modelmail) {
//var_dump($modelmail);
$moreonlabel = '';
if (!empty($arrayofmessagename[$modelmail->label])) {
$moreonlabel = ' <span class="opacitymedium">(' . $langs->trans("SeveralLangugeVariatFound") . ')</span>';
}
// The 'label' is the key that is unique if we exclude the language
$arrayofmessagename[$modelmail->id] = $langs->trans(preg_replace('/\(|\)/', '', $modelmail->label)) . $moreonlabel;
}
}
print $form->selectarray($constname, $arrayofmessagename, $conf->global->{$constname}, 'None', 0, 0, '', 0, 0, 0, '', '', 1);
} elseif (preg_match('/category:/', $val['type'])) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
$formother = new FormOther($db);
$tmp = explode(':', $val['type']);
print img_picto('', 'category', 'class="pictofixedwidth"');
print $formother->select_categories($tmp[1], $conf->global->{$constname}, $constname, 0, $langs->trans('CustomersProspectsCategoriesShort'));
} else {
print '<input name="'.$constname.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.$conf->global->{$constname}.'">';
}
print '</td></tr>';
}
}
print '</table>';
@ -227,13 +276,48 @@ if ($action == 'edit') {
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
foreach ($arrayofparameters as $key => $val) {
$setupnotempty++;
foreach ($arrayofparameters as $constname => $val) {
if ($val['enabled']==1) {
$setupnotempty++;
print '<tr class="oddeven"><td>';
$tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : '');
print $form->textwithpicto($langs->trans($constname), $tooltiphelp);
print '</td><td>';
print '<tr class="oddeven"><td>';
$tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : '');
print $form->textwithpicto($langs->trans($key), $tooltiphelp);
print '</td><td>'.$conf->global->$key.'</td></tr>';
if ($val['type'] == 'textarea') {
print dol_nl2br($conf->global->{$constname});
} elseif ($val['type']== 'html') {
print $conf->global->{$constname};
} elseif ($val['type'] == 'yesno') {
print ajax_constantonoff($constname);
} elseif (preg_match('/emailtemplate:/', $val['type'])) {
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
$tmp = explode(':', $val['type']);
$template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, $conf->global->{$constname});
if ($template<0) {
setEventMessages(null, $formmail->errors, 'errors');
}
print $langs->trans($template->label);
} elseif (preg_match('/category:/', $val['type'])) {
$c = new Categorie($db);
$result = $c->fetch($conf->global->{$constname});
if ($result < 0) {
setEventMessages(null, $c->errors, 'errors');
}
$ways = $c->print_all_ways(' &gt;&gt; ', 'none', 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text
$toprint = array();
foreach ($ways as $way) {
$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>';
}
print '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
} else {
print $conf->global->{$constname};
}
print '</td></tr>';
}
}
print '</table>';

View File

@ -66,8 +66,14 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected
$result = restrictedArea($user, 'stock');
$idproduct = GETPOST('idproduct', 'int');
$year = GETPOST("year");
$month = GETPOST("month");
$search_date_startday = GETPOST('search_date_startday', 'int');
$search_date_startmonth = GETPOST('search_date_startmonth', 'int');
$search_date_startyear = GETPOST('search_date_startyear', 'int');
$search_date_endday = GETPOST('search_date_endday', 'int');
$search_date_endmonth = GETPOST('search_date_endmonth', 'int');
$search_date_endyear = GETPOST('search_date_endyear', 'int');
$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int'), 'tzuserrel');
$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int'), 'tzuserrel');
$search_ref = GETPOST('search_ref', 'alpha');
$search_movement = GETPOST("search_movement");
$search_product_ref = trim(GETPOST("search_product_ref"));
@ -105,7 +111,7 @@ $arrayfields = array(
'm.rowid'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
'm.datem'=>array('label'=>$langs->trans("Date"), 'checked'=>1),
'p.ref'=>array('label'=>$langs->trans("ProductRef"), 'checked'=>1, 'css'=>'maxwidth100'),
'p.label'=>array('label'=>$langs->trans("ProductLabel"), 'checked'=>1),
'p.label'=>array('label'=>$langs->trans("ProductLabel"), 'checked'=>0),
'm.batch'=>array('label'=>$langs->trans("BatchNumberShort"), 'checked'=>1, 'enabled'=>(!empty($conf->productbatch->enabled))),
'pl.eatby'=>array('label'=>$langs->trans("EatByDate"), 'checked'=>0, 'enabled'=>(!empty($conf->productbatch->enabled))),
'pl.sellby'=>array('label'=>$langs->trans("SellByDate"), 'checked'=>0, 'position'=>10, 'enabled'=>(!empty($conf->productbatch->enabled))),
@ -113,7 +119,7 @@ $arrayfields = array(
'm.fk_user_author'=>array('label'=>$langs->trans("Author"), 'checked'=>0),
'm.inventorycode'=>array('label'=>$langs->trans("InventoryCodeShort"), 'checked'=>1),
'm.label'=>array('label'=>$langs->trans("MovementLabel"), 'checked'=>1),
'm.type_mouvement'=>array('label'=>$langs->trans("TypeMovement"), 'checked'=>1),
'm.type_mouvement'=>array('label'=>$langs->trans("TypeMovement"), 'checked'=>0),
'origin'=>array('label'=>$langs->trans("Origin"), 'checked'=>1),
'm.value'=>array('label'=>$langs->trans("Qty"), 'checked'=>1),
'm.price'=>array('label'=>$langs->trans("UnitPurchaseValue"), 'checked'=>0),
@ -162,8 +168,14 @@ if (empty($reshook))
// Do we click on purge search criteria ?
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test are required to be compatible with all browsers
{
$year = '';
$month = '';
$search_date_startday = '';
$search_date_startmonth = '';
$search_date_startyear = '';
$search_date_endday = '';
$search_date_endmonth = '';
$search_date_endyear = '';
$search_date_start = '';
$search_date_end = '';
$search_ref = '';
$search_movement = "";
$search_type_mouvement = "";
@ -461,7 +473,7 @@ $sql .= " m.batch, m.price,";
$sql .= " m.type_mouvement,";
$sql .= " m.fk_projet as fk_project,";
$sql .= " pl.rowid as lotid, pl.eatby, pl.sellby,";
$sql .= " u.login, u.photo, u.lastname, u.firstname";
$sql .= " u.login, u.photo, u.lastname, u.firstname, u.email as user_email, u.statut as user_status";
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
@ -482,17 +494,18 @@ $sql .= " AND m.fk_entrepot = e.rowid";
$sql .= " AND e.entity IN (".getEntity('stock').")";
if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) $sql .= " AND p.fk_product_type = 0";
if ($id > 0) $sql .= " AND e.rowid ='".$id."'";
$sql .= dolSqlDateFilter('m.datem', 0, $month, $year);
if (!empty($search_date_start)) $sql .= " AND m.datem >= '" . $db->idate($search_date_start) . "'";
if (!empty($search_date_end)) $sql .= " AND m.datem <= '" . $db->idate($search_date_end) . "'";
if ($idproduct > 0) $sql .= " AND p.rowid = ".((int) $idproduct);
if (!empty($search_ref)) $sql .= natural_search('m.rowid', $search_ref, 1);
if (!empty($search_movement)) $sql .= natural_search('m.label', $search_movement);
if (!empty($search_inventorycode)) $sql .= natural_search('m.inventorycode', $search_inventorycode);
if (!empty($search_product_ref)) $sql .= natural_search('p.ref', $search_product_ref);
if (!empty($search_product)) $sql .= natural_search('p.label', $search_product);
if (!empty($search_movement)) $sql .= natural_search('m.label', $search_movement);
if (!empty($search_inventorycode)) $sql .= natural_search('m.inventorycode', $search_inventorycode);
if (!empty($search_product_ref)) $sql .= natural_search('p.ref', $search_product_ref);
if (!empty($search_product)) $sql .= natural_search('p.label', $search_product);
if ($search_warehouse != '' && $search_warehouse != '-1') $sql .= natural_search('e.rowid', $search_warehouse, 2);
if (!empty($search_user)) $sql .= natural_search('u.login', $search_user);
if (!empty($search_batch)) $sql .= natural_search('m.batch', $search_batch);
if (!empty($product_id)) $sql .= natural_search('p.rowid', $product_id);
if (!empty($search_user)) $sql .= natural_search('u.login', $search_user);
if (!empty($search_batch)) $sql .= natural_search('m.batch', $search_batch);
if (!empty($product_id)) $sql .= natural_search('p.rowid', $product_id);
if ($search_qty != '') $sql .= natural_search('m.value', $search_qty, 1);
if ($search_type_mouvement != '' && $search_type_mouvement != '-1') $sql .= natural_search('m.type_mouvement', $search_type_mouvement, 2);
// Add where from extra fields
@ -711,6 +724,12 @@ if ($resql)
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
if ($id > 0) $param .= '&id='.urlencode($id);
if ($search_date_startday) $param .= '&search_date_startday='.urlencode($search_date_startday);
if ($search_date_startmonth) $param .= '&search_date_startmonth='.urlencode($search_date_startmonth);
if ($search_date_startyear) $param .= '&search_date_startyear='.urlencode($search_date_startyear);
if ($search_date_endday) $param .= '&search_date_endday='.urlencode($search_date_endday);
if ($search_date_endmonth) $param .= '&search_date_endmonth='.urlencode($search_date_endmonth);
if ($search_date_endyear) $param .= '&search_date_endyear='.urlencode($search_date_endyear);
if ($search_movement) $param .= '&search_movement='.urlencode($search_movement);
if ($search_inventorycode) $param .= '&search_inventorycode='.urlencode($search_inventorycode);
if ($search_type_mouvement) $param .= '&search_type_mouvement='.urlencode($search_type_mouvement);
@ -789,16 +808,15 @@ if ($resql)
print '<input class="flat maxwidth25" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
print '</td>';
}
if (!empty($arrayfields['m.datem']['checked']))
if (! empty($arrayfields['m.datem']['checked']))
{
// Date
print '<td class="liste_titre nowraponall">';
print '<input class="flat" type="text" size="2" maxlength="2" placeholder="'.dol_escape_htmltag($langs->trans("Month")).'" name="month" value="'.$month.'">';
if (empty($conf->productbatch->enabled)) print '&nbsp;';
//else print '<br>';
$syear = $year ? $year : -1;
print '<input class="flat maxwidth50" type="text" maxlength="4" placeholder="'.dol_escape_htmltag($langs->trans("Year")).'" name="year" value="'.($syear > 0 ? $syear : '').'">';
//print $formother->selectyear($syear,'year',1, 20, 5);
print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'), 'tzuserrel');
print '</div>';
print '<div class="nowrap">';
print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'), 'tzuserrel');
print '</div>';
print '</td>';
}
if (!empty($arrayfields['p.ref']['checked']))
@ -1013,6 +1031,8 @@ if ($resql)
$userstatic->lastname = $objp->lastname;
$userstatic->firstname = $objp->firstname;
$userstatic->photo = $objp->photo;
$userstatic->email = $objp->user_email;
$userstatic->statut = $objp->user_status;
$productstatic->id = $objp->rowid;
$productstatic->ref = $objp->product_ref;
@ -1063,11 +1083,7 @@ if ($resql)
if (!empty($arrayfields['p.label']['checked']))
{
// Product label
print '<td>';
/*$productstatic->id=$objp->rowid;
$productstatic->ref=$objp->produit;
$productstatic->type=$objp->type;
print $productstatic->getNomUrl(1,'',16);*/
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($productstatic->label).'">';
print $productstatic->label;
print "</td>\n";
}
@ -1089,7 +1105,7 @@ if ($resql)
// Warehouse
if (!empty($arrayfields['e.ref']['checked']))
{
print '<td>';
print '<td class="tdoverflowmax100">';
print $warehousestatic->getNomUrl(1);
print "</td>\n";
}

View File

@ -243,9 +243,12 @@ $title = $langs->trans('StockAtDate');
$sql = 'SELECT p.rowid, p.ref, p.label, p.description, p.price,';
$sql .= ' p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,';
$sql .= ' p.tms as datem, p.duration, p.tobuy, p.stock';
$sql .= ' p.tms as datem, p.duration, p.tobuy, p.stock, ';
if ($fk_warehouse > 0) {
$sql .= " SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue";
$sql .= ', SUM(ps.reel) as stock_reel';
} else {
$sql .= " SUM(p.pmp * p.stock) as estimatedvalue, SUM(p.price * p.stock) as sellvalue";
}
// Add fields from hooks
$parameters = array();
@ -271,6 +274,9 @@ if (!empty($canvas)) $sql .= ' AND p.canvas = "'.$db->escape($canvas).'"';
if ($fk_warehouse > 0) {
$sql .= ' GROUP BY p.rowid, p.ref, p.label, p.description, p.price, p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,';
$sql .= ' p.tms, p.duration, p.tobuy, p.stock';
} else {
$sql .= ' GROUP BY p.rowid, p.ref, p.label, p.description, p.price, p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,';
$sql .= ' p.tms, p.duration, p.tobuy, p.stock';
}
// Add where from hooks
$parameters = array();
@ -403,6 +409,9 @@ print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
if ($mode == 'future') {
print '<td class="liste_titre"></td>';
} else {
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
}
// Fields from hook
$parameters = array('param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
@ -424,6 +433,7 @@ if ($fk_warehouse > 0) {
print '<tr class="liste_titre">';
print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], 'p.ref', $param, '', '', $sortfield, $sortorder);
print_liste_field_titre('Label', $_SERVER["PHP_SELF"], 'p.label', $param, '', '', $sortfield, $sortorder);
if ($mode == 'future') {
print_liste_field_titre('CurrentStock', $_SERVER["PHP_SELF"], $fieldtosortcurrentstock, $param, '', '', $sortfield, $sortorder, 'right ');
print_liste_field_titre('', $_SERVER["PHP_SELF"]);
@ -431,6 +441,8 @@ if ($mode == 'future') {
print_liste_field_titre('VirtualStock', $_SERVER["PHP_SELF"], '', $param, '', '', $sortfield, $sortorder, 'right ', 'VirtualStockDesc');
} else {
print_liste_field_titre($stocklabel, $_SERVER["PHP_SELF"], '', $param, '', '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("EstimatedStockValue", $_SERVER["PHP_SELF"], "estimatedvalue", '', $param, '', $sortfield, $sortorder, 'right ', $langs->trans("AtDate"), 1);
print_liste_field_titre("EstimatedStockValueSell", $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right ', $langs->trans("AtDate"), 1);
print_liste_field_titre('', $_SERVER["PHP_SELF"]);
print_liste_field_titre('CurrentStock', $_SERVER["PHP_SELF"], $fieldtosortcurrentstock, $param, '', '', $sortfield, $sortorder, 'right ');
}
@ -531,6 +543,21 @@ while ($i < ($limit ? min($num, $limit) : $num))
// Stock at date
print '<td class="right">'.($stock ? $stock : '<span class="opacitymedium">'.$stock.'</span>').'</td>';
// PMP value
print '<td class="right">';
if (price2num($objp->estimatedvalue, 'MT')) print price(price2num($objp->estimatedvalue, 'MT'), 1);
else print '';
print '</td>';
// Selling value
print '<td class="right">';
if (empty($conf->global->PRODUIT_MULTIPRICES)) print price(price2num($objp->sellvalue, 'MT'), 1);
else {
$htmltext = $langs->trans("OptionMULTIPRICESIsOn");
print $form->textwithtooltip($langs->trans("Variable"), $htmltext);
}
print'</td>';
print '<td class="right">';
if ($nbofmovement > 0) {
print '<a href="'.DOL_URL_ROOT.'/product/stock/movement_list.php?idproduct='.$objp->rowid.($fk_warehouse > 0 ? '&search_warehouse='.$fk_warehouse : '').'">'.$langs->trans("Movements").'</a>';
@ -560,7 +587,7 @@ $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // N
print $hookmanager->resPrint;
if (empty($date) || ! $dateIsValid) {
$colspan = 6;
$colspan = 8;
if ($mode == 'future') $colspan++;
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("EnterADateCriteria").'</span></td></tr>';
}