Merge pull request #13101 from Dolibarr/scrutinizer-patch-3
Scrutinizer Auto-Fixes
This commit is contained in:
commit
d57c4649d4
@ -67,8 +67,8 @@ $search_note = GETPOST('search_note', 'alpha');
|
||||
$dateselect = dol_mktime(0, 0, 0, GETPOST('dateselectmonth', 'int'), GETPOST('dateselectday', 'int'), GETPOST('dateselectyear', 'int'));
|
||||
$datestart = dol_mktime(0, 0, 0, GETPOST('datestartmonth', 'int'), GETPOST('datestartday', 'int'), GETPOST('datestartyear', 'int'));
|
||||
$dateend = dol_mktime(0, 0, 0, GETPOST('dateendmonth', 'int'), GETPOST('dateendday', 'int'), GETPOST('dateendyear', 'int'));
|
||||
if ($search_status == '' && ! GETPOSTISSET('search_status')) $search_status = (empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
|
||||
if (empty($action) && ! GETPOSTISSET('action')) $action = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW);
|
||||
if ($search_status == '' && !GETPOSTISSET('search_status')) $search_status = (empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
|
||||
if (empty($action) && !GETPOSTISSET('action')) $action = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW);
|
||||
|
||||
$filter = GETPOST("search_filter", 'alpha', 3) ?GETPOST("search_filter", 'alpha', 3) : GETPOST("filter", 'alpha', 3);
|
||||
$filtert = GETPOST("search_filtert", "int", 3) ?GETPOST("search_filtert", "int", 3) : GETPOST("filtert", "int", 3);
|
||||
|
||||
@ -388,7 +388,7 @@ class Utils
|
||||
if ($compression == 'none') fclose($handle);
|
||||
if ($compression == 'gz') gzclose($handle);
|
||||
if ($compression == 'bz') bzclose($handle);
|
||||
if ($ok && preg_match('/^-- (MySql|MariaDB)/i', $errormsg)) { // No error
|
||||
if ($ok && preg_match('/^-- (MySql|MariaDB)/i', $errormsg)) { // No error
|
||||
$errormsg = '';
|
||||
}
|
||||
else
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
* \brief Page to make custom reports
|
||||
*/
|
||||
|
||||
if (! defined('USE_CUSTOME_REPORT_AS_INCLUDE'))
|
||||
if (!defined('USE_CUSTOME_REPORT_AS_INCLUDE'))
|
||||
{
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
|
||||
@ -37,7 +37,7 @@ if (! defined('USE_CUSTOME_REPORT_AS_INCLUDE'))
|
||||
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
|
||||
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
|
||||
|
||||
$mode = GETPOST('mode', 'alpha') ? GETPOST('mode', 'alpha') : 'graph';
|
||||
$mode = GETPOST('mode', 'alpha') ? GETPOST('mode', 'alpha') : 'graph';
|
||||
$objecttype = GETPOST('objecttype', 'aZ09');
|
||||
$tabfamily = GETPOST('tabfamily', 'aZ09');
|
||||
|
||||
@ -93,21 +93,21 @@ $parameters = array('objecttype'=>$objecttype, 'tabfamily'=>$tabfamily);
|
||||
$reshook = $hookmanager->executeHooks('loadDataForCustomReports', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
elseif (is_array($hookmanager->resArray)) {
|
||||
if (! empty($hookmanager->resArray['title'])) { // Add entries for tabs
|
||||
if (!empty($hookmanager->resArray['title'])) { // Add entries for tabs
|
||||
$title = $hookmanager->resArray['title'];
|
||||
}
|
||||
if (! empty($hookmanager->resArray['picto'])) { // Add entries for tabs
|
||||
if (!empty($hookmanager->resArray['picto'])) { // Add entries for tabs
|
||||
$picto = $hookmanager->resArray['picto'];
|
||||
}
|
||||
if (! empty($hookmanager->resArray['head'])) { // Add entries for tabs
|
||||
if (!empty($hookmanager->resArray['head'])) { // Add entries for tabs
|
||||
$head = array_merge($head, $hookmanager->resArray['head']);
|
||||
}
|
||||
if (! empty($hookmanager->resArray['arrayoftype'])) { // Add entries from hook
|
||||
foreach($hookmanager->resArray['arrayoftype'] as $key => $val) {
|
||||
if (!empty($hookmanager->resArray['arrayoftype'])) { // Add entries from hook
|
||||
foreach ($hookmanager->resArray['arrayoftype'] as $key => $val) {
|
||||
$arrayoftype[$key] = $val;
|
||||
}
|
||||
}
|
||||
if (! empty($hookmanager->resArray['modenotusedforlist'])) { // Show objecttype selection even if objecttype is set
|
||||
if (!empty($hookmanager->resArray['modenotusedforlist'])) { // Show objecttype selection even if objecttype is set
|
||||
$modenotusedforlist = $hookmanager->resArray['modenotusedforlist'];
|
||||
}
|
||||
}
|
||||
@ -125,7 +125,7 @@ if ($objecttype) {
|
||||
$ObjectClassName = $arrayoftype[$objecttype]['ObjectClassName'];
|
||||
$object = new $ObjectClassName($db);
|
||||
}
|
||||
catch(Exception $e) {
|
||||
catch (Exception $e) {
|
||||
print 'Failed to load class for type '.$objecttype;
|
||||
}
|
||||
}
|
||||
@ -145,7 +145,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
||||
|
||||
$search_component_params=array('');
|
||||
$search_component_params = array('');
|
||||
|
||||
|
||||
/*
|
||||
@ -160,9 +160,9 @@ $search_component_params=array('');
|
||||
* View
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
$form = new Form($db);
|
||||
|
||||
if (! defined('USE_CUSTOME_REPORT_AS_INCLUDE')) {
|
||||
if (!defined('USE_CUSTOME_REPORT_AS_INCLUDE')) {
|
||||
llxHeader('', $langs->transnoentitiesnoconv('CustomReports'), '');
|
||||
|
||||
dol_fiche_head($head, 'customreports', $title, -1, $picto);
|
||||
@ -170,13 +170,13 @@ if (! defined('USE_CUSTOME_REPORT_AS_INCLUDE')) {
|
||||
|
||||
// Check parameters
|
||||
if ($action == 'viewgraph') {
|
||||
if (! count($search_measures)) {
|
||||
if (!count($search_measures)) {
|
||||
setEventMessages($langs->trans("AtLeastOneMeasureIsRequired"), null, 'warnings');
|
||||
} elseif ($mode == 'graph' && count($search_xaxis) > 1) {
|
||||
setEventMessages($langs->trans("OnlyOneFieldForXAxisIsPossible"), null, 'warnings');
|
||||
$search_xaxis = array(0 => $search_xaxis[0]);
|
||||
}
|
||||
if (! count($search_xaxis)) {
|
||||
if (!count($search_xaxis)) {
|
||||
setEventMessages($langs->trans("AtLeastOneXAxisIsRequired"), null, 'warnings');
|
||||
} elseif ($mode == 'graph' && $search_graph == 'bars' && count($search_measures) > 3) {
|
||||
setEventMessages($langs->trans("GraphInBarsAreLimitedTo3Measures"), null, 'warnings');
|
||||
@ -184,11 +184,11 @@ if ($action == 'viewgraph') {
|
||||
}
|
||||
}
|
||||
|
||||
$tmparray=dol_getdate(dol_now());
|
||||
$endyear=$tmparray['year'];
|
||||
$endmonth=$tmparray['mon'];
|
||||
$datelastday=dol_get_last_day($endyear, $endmonth, 1);
|
||||
$startyear=$endyear-2;
|
||||
$tmparray = dol_getdate(dol_now());
|
||||
$endyear = $tmparray['year'];
|
||||
$endmonth = $tmparray['mon'];
|
||||
$datelastday = dol_get_last_day($endyear, $endmonth, 1);
|
||||
$startyear = $endyear - 2;
|
||||
|
||||
$param = '';
|
||||
|
||||
@ -207,7 +207,7 @@ print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print '<div class="divadvancedsearchfield center floatnone">';
|
||||
print '<div class="inline-block"><span class="opacitymedium">'.$langs->trans("StatisticsOn").'</span></div> ';
|
||||
$newarrayoftype = array();
|
||||
foreach($arrayoftype as $key => $val) {
|
||||
foreach ($arrayoftype as $key => $val) {
|
||||
if (dol_eval($val['enabled'], 1)) {
|
||||
$newarrayoftype[$key] = $arrayoftype[$key];
|
||||
}
|
||||
@ -219,7 +219,7 @@ else {
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#objecttype").change(function() {
|
||||
console.log("Reload for "+jQuery("#objecttype").val());
|
||||
location.href = "'.$_SERVER["PHP_SELF"].'?objecttype="+jQuery("#objecttype").val()+"'.($tabfamily?'&tabfamily='.$tabfamily:'').'";
|
||||
location.href = "'.$_SERVER["PHP_SELF"].'?objecttype="+jQuery("#objecttype").val()+"'.($tabfamily ? '&tabfamily='.$tabfamily : '').'";
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
@ -233,7 +233,7 @@ print '</div>';
|
||||
|
||||
// Measures
|
||||
print '<div class="divadvancedsearchfield clearboth">';
|
||||
foreach($object->fields as $key => $val) {
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if ($val['isameasure']) {
|
||||
$arrayofmesures['t.'.$key.'-sum'] = $langs->trans($val['label']).' <span class="opacitymedium">('.$langs->trans("Sum").')</span>';
|
||||
$arrayofmesures['t.'.$key.'-average'] = $langs->trans($val['label']).' <span class="opacitymedium">('.$langs->trans("Average").')</span>';
|
||||
@ -243,8 +243,8 @@ foreach($object->fields as $key => $val) {
|
||||
}
|
||||
// Add measure from extrafields
|
||||
if ($object->isextrafieldmanaged) {
|
||||
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
if (! empty($extrafields->attributes[$object->table_element]['totalizable'][$key])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key])) {
|
||||
$arrayofmesures['te.'.$key.'-sum'] = $langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' <span class="opacitymedium">('.$langs->trans("Sum").')</span>';
|
||||
$arrayofmesures['te.'.$key.'-average'] = $langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' <span class="opacitymedium">('.$langs->trans("Average").')</span>';
|
||||
$arrayofmesures['te.'.$key.'-min'] = $langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' <span class="opacitymedium">('.$langs->trans("Minimum").')</span>';
|
||||
@ -258,14 +258,14 @@ print '</div>';
|
||||
|
||||
// XAxis
|
||||
print '<div class="divadvancedsearchfield">';
|
||||
foreach($object->fields as $key => $val) {
|
||||
if (! $val['measure']) {
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if (!$val['measure']) {
|
||||
if (in_array($key, array(
|
||||
'id', 'ref_int', 'ref_ext', 'rowid', 'entity', 'last_main_doc', 'logo', 'logo_squarred', 'extraparams',
|
||||
'parent', 'photo', 'socialnetworks', 'webservices_url', 'webservices_key'))) continue;
|
||||
if (isset($val['enabled']) && ! dol_eval($val['enabled'], 1)) continue;
|
||||
if (isset($val['visible']) && ! dol_eval($val['visible'], 1)) continue;
|
||||
if (preg_match('/^fk_/', $key) && ! preg_match('/^fk_statu/', $key)) continue;
|
||||
if (isset($val['enabled']) && !dol_eval($val['enabled'], 1)) continue;
|
||||
if (isset($val['visible']) && !dol_eval($val['visible'], 1)) continue;
|
||||
if (preg_match('/^fk_/', $key) && !preg_match('/^fk_statu/', $key)) continue;
|
||||
if (preg_match('/^pass/', $key)) continue;
|
||||
if (in_array($val['type'], array('html', 'text'))) continue;
|
||||
if (in_array($val['type'], array('timestamp', 'date', 'datetime'))) {
|
||||
@ -278,8 +278,8 @@ foreach($object->fields as $key => $val) {
|
||||
}
|
||||
// Add measure from extrafields
|
||||
if ($object->isextrafieldmanaged) {
|
||||
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
if (! empty($extrafields->attributes[$object->table_element]['totalizable'][$key])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key])) {
|
||||
$arrayofxaxis['te.'.$key] = array('label' => $extrafields->attributes[$object->table_element]['label'][$key], 'position' => (int) $extrafields->attributes[$object->table_element]['pos'][$key]);
|
||||
}
|
||||
}
|
||||
@ -287,7 +287,7 @@ foreach($object->fields as $key => $val) {
|
||||
}
|
||||
$arrayofxaxis = dol_sort_array($arrayofxaxis, 'position');
|
||||
$arrayofxaxislabel = array();
|
||||
foreach($arrayofxaxis as $key => $val) {
|
||||
foreach ($arrayofxaxis as $key => $val) {
|
||||
$arrayofxaxislabel[$key] = $val['label'];
|
||||
}
|
||||
print '<div class="inline-block opacitymedium"><span class="fas fa-ruler-horizontal paddingright" title="'.$langs->trans("XAxis").'"></span>'.$langs->trans("XAxis").'</div> ';
|
||||
@ -297,8 +297,8 @@ print '</div>';
|
||||
// YAxis
|
||||
if ($mode == 'grid') {
|
||||
print '<div class="divadvancedsearchfield">';
|
||||
foreach($object->fields as $key => $val) {
|
||||
if (! $val['measure']) {
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if (!$val['measure']) {
|
||||
if (in_array($key, array('id', 'rowid', 'entity', 'last_main_doc', 'extraparams'))) continue;
|
||||
if (preg_match('/^fk_/', $key)) continue;
|
||||
if (in_array($val['type'], array('html', 'text'))) continue;
|
||||
@ -312,8 +312,8 @@ if ($mode == 'grid') {
|
||||
}
|
||||
// Add measure from extrafields
|
||||
if ($object->isextrafieldmanaged) {
|
||||
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
if (! empty($extrafields->attributes[$object->table_element]['totalizable'][$key])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key])) {
|
||||
$arrayofyaxis['te.'.$key] = array('label' => $extrafields->attributes[$object->table_element]['label'][$key], 'position' => (int) $extrafields->attributes[$object->table_element]['pos'][$key]);
|
||||
}
|
||||
}
|
||||
@ -321,7 +321,7 @@ if ($mode == 'grid') {
|
||||
}
|
||||
$arrayofyaxis = dol_sort_array($arrayofyaxis, 'position');
|
||||
$arrayofyaxislabel = array();
|
||||
foreach($arrayofyaxis as $key => $val) {
|
||||
foreach ($arrayofyaxis as $key => $val) {
|
||||
$arrayofyaxislabel[$key] = $val['label'];
|
||||
}
|
||||
print '<div class="inline-block opacitymedium"><span class="fas fa-ruler-vertical paddingright" title="'.$langs->trans("YAxis").'"></span>'.$langs->trans("YAxis").'</div> ';
|
||||
@ -345,12 +345,12 @@ print '</form>';
|
||||
|
||||
// Generate the SQL request
|
||||
$sql = '';
|
||||
if (! empty($search_measures) && ! empty($search_xaxis))
|
||||
if (!empty($search_measures) && !empty($search_xaxis))
|
||||
{
|
||||
$fieldid = 'rowid';
|
||||
|
||||
$sql = 'SELECT ';
|
||||
foreach($search_xaxis as $key => $val) {
|
||||
foreach ($search_xaxis as $key => $val) {
|
||||
if (preg_match('/\-year$/', $val)) {
|
||||
$tmpval = preg_replace('/\-year$/', '', $val);
|
||||
$sql .= 'DATE_FORMAT('.$tmpval.", '%Y') as x_".$key.', ';
|
||||
@ -363,14 +363,14 @@ if (! empty($search_measures) && ! empty($search_xaxis))
|
||||
}
|
||||
else $sql .= $val.' as x_'.$key.', ';
|
||||
}
|
||||
foreach($search_measures as $key => $val) {
|
||||
foreach ($search_measures as $key => $val) {
|
||||
if ($val == 't.count') $sql .= 'COUNT(t.'.$fieldid.') as y_'.$key.', ';
|
||||
elseif (preg_match('/\-sum$/', $val)) {
|
||||
$tmpval = preg_replace('/\-sum$/', '', $val);
|
||||
$tmpval = preg_replace('/\-sum$/', '', $val);
|
||||
$sql .= 'SUM('.$db->ifsql($tmpval.' IS NULL', '0', $tmpval).') as y_'.$key.', ';
|
||||
}
|
||||
elseif (preg_match('/\-average$/', $val)) {
|
||||
$tmpval = preg_replace('/\-average$/', '', $val);
|
||||
$tmpval = preg_replace('/\-average$/', '', $val);
|
||||
$sql .= 'AVG('.$db->ifsql($tmpval.' IS NULL', '0', $tmpval).') as y_'.$key.', ';
|
||||
}
|
||||
elseif (preg_match('/\-min$/', $val)) {
|
||||
@ -378,7 +378,7 @@ if (! empty($search_measures) && ! empty($search_xaxis))
|
||||
$sql .= 'MIN('.$db->ifsql($tmpval.' IS NULL', '0', $tmpval).') as y_'.$key.', ';
|
||||
}
|
||||
elseif (preg_match('/\-max$/', $val)) {
|
||||
$tmpval = preg_replace('/\-max$/', '', $val);
|
||||
$tmpval = preg_replace('/\-max$/', '', $val);
|
||||
$sql .= 'MAX('.$db->ifsql($tmpval.' IS NULL', '0', $tmpval).') as y_'.$key.', ';
|
||||
}
|
||||
}
|
||||
@ -401,11 +401,11 @@ if (! empty($search_measures) && ! empty($search_xaxis))
|
||||
if ($object->ismultientitymanaged == 1) {
|
||||
$sql .= ' AND entity IN ('.getEntity($object->element).')';
|
||||
}
|
||||
foreach($search_filters as $key => $val) {
|
||||
foreach ($search_filters as $key => $val) {
|
||||
// TODO
|
||||
}
|
||||
$sql .= ' GROUP BY ';
|
||||
foreach($search_xaxis as $key => $val) {
|
||||
foreach ($search_xaxis as $key => $val) {
|
||||
if (preg_match('/\-year$/', $val)) {
|
||||
$tmpval = preg_replace('/\-year$/', '', $val);
|
||||
$sql .= 'DATE_FORMAT('.$tmpval.", '%Y'), ";
|
||||
@ -420,7 +420,7 @@ if (! empty($search_measures) && ! empty($search_xaxis))
|
||||
}
|
||||
$sql = preg_replace('/,\s*$/', '', $sql);
|
||||
$sql .= ' ORDER BY ';
|
||||
foreach($search_xaxis as $key => $val) {
|
||||
foreach ($search_xaxis as $key => $val) {
|
||||
if (preg_match('/\-year$/', $val)) {
|
||||
$tmpval = preg_replace('/\-year$/', '', $val);
|
||||
$sql .= 'DATE_FORMAT('.$tmpval.", '%Y'), ";
|
||||
@ -437,8 +437,8 @@ if (! empty($search_measures) && ! empty($search_xaxis))
|
||||
}
|
||||
|
||||
|
||||
$legend=array();
|
||||
foreach($search_measures as $key => $val) {
|
||||
$legend = array();
|
||||
foreach ($search_measures as $key => $val) {
|
||||
$legend[] = $langs->trans($arrayofmesures[$val]);
|
||||
}
|
||||
|
||||
@ -447,21 +447,21 @@ $totalnbofrecord = 0;
|
||||
$data = array();
|
||||
if ($sql) {
|
||||
$resql = $db->query($sql);
|
||||
if (! $resql) {
|
||||
if (!$resql) {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
while($obj = $db->fetch_object($resql)) {
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
// $this->data = array(array(0=>'labelxA',1=>yA1,...,n=>yAn), array('labelxB',yB1,...yBn)); // or when there is n series to show for each x
|
||||
foreach($search_xaxis as $xkey => $xval) {
|
||||
foreach ($search_xaxis as $xkey => $xval) {
|
||||
$fieldforxkey = 'x_'.$xkey;
|
||||
$xlabel = $obj->$fieldforxkey;
|
||||
$xvalwithoutprefix = preg_replace('/^[a-z]+\./', '', $xval);
|
||||
if (! empty($object->fields[$xvalwithoutprefix]['arrayofkeyval'])) {
|
||||
if (!empty($object->fields[$xvalwithoutprefix]['arrayofkeyval'])) {
|
||||
$xlabel = $object->fields[$xvalwithoutprefix]['arrayofkeyval'][$obj->$fieldforxkey];
|
||||
}
|
||||
$xarray = array(0 => (($xlabel || $xlabel == '0') ? dol_trunc($xlabel, 20, 'middle') : $langs->trans("NotDefined")));
|
||||
foreach($search_measures as $key => $val) {
|
||||
foreach ($search_measures as $key => $val) {
|
||||
$fieldfory = 'y_'.$key;
|
||||
$xarray[] = $obj->$fieldfory;
|
||||
}
|
||||
@ -473,7 +473,7 @@ if ($sql) {
|
||||
}
|
||||
|
||||
|
||||
print '<div class="customreportsoutput'.($totalnbofrecord?'':' customreportsoutputnotdata').'">';
|
||||
print '<div class="customreportsoutput'.($totalnbofrecord ? '' : ' customreportsoutputnotdata').'">';
|
||||
|
||||
|
||||
if ($mode == 'grid') {
|
||||
@ -487,13 +487,13 @@ if ($mode == 'graph') {
|
||||
// Show graph
|
||||
$px1 = new DolGraph();
|
||||
$mesg = $px1->isGraphKo();
|
||||
if (! $mesg)
|
||||
if (!$mesg)
|
||||
{
|
||||
$px1->SetData($data);
|
||||
unset($data);
|
||||
|
||||
$arrayoftypes = array();
|
||||
foreach($search_measures as $key => $val) {
|
||||
foreach ($search_measures as $key => $val) {
|
||||
$arrayoftypes[] = $search_graph;
|
||||
}
|
||||
|
||||
@ -507,10 +507,10 @@ if ($mode == 'graph') {
|
||||
$px1->SetHorizTickIncrement(1);
|
||||
$px1->SetCssPrefix("cssboxes");
|
||||
$px1->SetType($arrayoftypes);
|
||||
$px1->mode='depth';
|
||||
$px1->mode = 'depth';
|
||||
$px1->SetTitle('');
|
||||
|
||||
$dir=$conf->user->dir_temp;
|
||||
$dir = $conf->user->dir_temp;
|
||||
dol_mkdir($dir);
|
||||
$filenamenb = $dir.'/customreport_'.$object->element.'.png';
|
||||
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=user&file=customreport_'.$object->element.'.png';
|
||||
@ -528,7 +528,7 @@ if ($sql) {
|
||||
|
||||
print '<div>';
|
||||
|
||||
if (! defined('USE_CUSTOME_REPORT_AS_INCLUDE')) {
|
||||
if (!defined('USE_CUSTOME_REPORT_AS_INCLUDE')) {
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
||||
|
||||
@ -1105,8 +1105,8 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename =
|
||||
'ip' => false
|
||||
);
|
||||
|
||||
$remoteip = getUserRemoteIP(); // Get ip when page run on a web server
|
||||
if (! empty($remoteip)) {
|
||||
$remoteip = getUserRemoteIP(); // Get ip when page run on a web server
|
||||
if (!empty($remoteip)) {
|
||||
$data['ip'] = $remoteip;
|
||||
// This is when server run behind a reverse proxy
|
||||
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR'] != $remoteip) $data['ip'] = $_SERVER['HTTP_X_FORWARDED_FOR'].' -> '.$data['ip'];
|
||||
@ -5600,7 +5600,7 @@ function dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles = 1)
|
||||
$allowed_tags_string = '<'.$allowed_tags_string.'>';
|
||||
|
||||
if ($cleanalsosomestyles) {
|
||||
$stringtoclean = preg_replace('/position\s*:\s*(absolute|fixed)\s*!\s*important/', '', $stringtoclean); // Note: If hacker try to introduce css comment into string to avoid this, string should be encoded by the dol_htmlentitiesbr so be harmless
|
||||
$stringtoclean = preg_replace('/position\s*:\s*(absolute|fixed)\s*!\s*important/', '', $stringtoclean); // Note: If hacker try to introduce css comment into string to avoid this, string should be encoded by the dol_htmlentitiesbr so be harmless
|
||||
}
|
||||
|
||||
$temp = strip_tags($stringtoclean, $allowed_tags_string);
|
||||
@ -5629,7 +5629,7 @@ function dol_string_neverthesehtmltags($stringtoclean, $disallowed_tags = array(
|
||||
}
|
||||
|
||||
if ($cleanalsosomestyles) {
|
||||
$temp = preg_replace('/position\s*:\s*(absolute|fixed)\s*!\s*important/', '', $temp); // Note: If hacker try to introduce css comment into string to avoid this, string should be encoded by the dol_htmlentitiesbr so be harmless
|
||||
$temp = preg_replace('/position\s*:\s*(absolute|fixed)\s*!\s*important/', '', $temp); // Note: If hacker try to introduce css comment into string to avoid this, string should be encoded by the dol_htmlentitiesbr so be harmless
|
||||
}
|
||||
|
||||
return $temp;
|
||||
@ -6129,7 +6129,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
|
||||
$substitutionarray['__REFCLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : null));
|
||||
$substitutionarray['__REFSUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : null);
|
||||
$substitutionarray['__SUPPLIER_ORDER_DATE_DELIVERY__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, 'day', 0, $outputlangs) : '');
|
||||
$substitutionarray['__SUPPLIER_ORDER_DELAY_DELIVERY__'] = $outputlangs->transnoentities("AvailabilityType".$object->availability_code)!=('AvailabilityType'.$object->availability_code)?$outputlangs->transnoentities("AvailabilityType".$object->availability_code):$outputlangs->convToOutputCharset(isset($object->availability)?$object->availability:'');
|
||||
$substitutionarray['__SUPPLIER_ORDER_DELAY_DELIVERY__'] = $outputlangs->transnoentities("AvailabilityType".$object->availability_code) != ('AvailabilityType'.$object->availability_code) ? $outputlangs->transnoentities("AvailabilityType".$object->availability_code) : $outputlangs->convToOutputCharset(isset($object->availability) ? $object->availability : '');
|
||||
|
||||
$birthday = dol_print_date($object->birth, 'day');
|
||||
|
||||
@ -6954,9 +6954,9 @@ function ascii_check($str)
|
||||
{
|
||||
if (function_exists('mb_check_encoding')) {
|
||||
//if (mb_detect_encoding($str, 'ASCII', true) return false;
|
||||
if (! mb_check_encoding($str, 'ASCII')) return false;
|
||||
if (!mb_check_encoding($str, 'ASCII')) return false;
|
||||
} else {
|
||||
if (preg_match('/[^\x00-\x7f]/', $str)) return false; // Contains a byte > 7f
|
||||
if (preg_match('/[^\x00-\x7f]/', $str)) return false; // Contains a byte > 7f
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -8044,7 +8044,7 @@ function dol_mimetype($file, $default = 'application/octet-stream', $mode = 0)
|
||||
if (preg_match('/\.bas$/i', $tmpfile)) { $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'bas'; $famime = 'file-code-o'; }
|
||||
if (preg_match('/\.(c)$/i', $tmpfile)) { $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'c'; $famime = 'file-code-o'; }
|
||||
if (preg_match('/\.(cpp)$/i', $tmpfile)) { $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'cpp'; $famime = 'file-code-o'; }
|
||||
if (preg_match('/\.cs$/i', $tmpfile)) { $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'cs'; $famime = 'file-code-o'; }
|
||||
if (preg_match('/\.cs$/i', $tmpfile)) { $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'cs'; $famime = 'file-code-o'; }
|
||||
if (preg_match('/\.(h)$/i', $tmpfile)) { $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'h'; $famime = 'file-code-o'; }
|
||||
if (preg_match('/\.(java|jsp)$/i', $tmpfile)) { $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'java'; $famime = 'file-code-o'; }
|
||||
if (preg_match('/\.php([0-9]{1})?$/i', $tmpfile)) { $mime = 'text/plain'; $imgmime = 'php.png'; $srclang = 'php'; $famime = 'file-code-o'; }
|
||||
|
||||
@ -609,7 +609,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$curY = $tab_top_newpage;
|
||||
|
||||
// Allows data in the first page if description is long enough to break in multiples pages
|
||||
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
|
||||
if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
|
||||
$showpricebeforepagebreak = 1;
|
||||
else
|
||||
$showpricebeforepagebreak = 0;
|
||||
@ -652,7 +652,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
{
|
||||
// We found a page break
|
||||
// Allows data in the first page if description is long enough to break in multiples pages
|
||||
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
|
||||
if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
|
||||
$showpricebeforepagebreak = 1;
|
||||
else
|
||||
$showpricebeforepagebreak = 0;
|
||||
@ -1132,33 +1132,33 @@ class pdf_sponge extends ModelePDFFactures
|
||||
|
||||
$pdf->SetFont('', '', $default_font_size - 2);
|
||||
$pdf->SetXY($posxval, $posy);
|
||||
$lib_mode_reg=$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code)!=('PaymentType'.$object->mode_reglement_code)?$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code):$outputlangs->convToOutputCharset($object->mode_reglement);
|
||||
$lib_mode_reg = $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) != ('PaymentType'.$object->mode_reglement_code) ? $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement);
|
||||
$pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L');
|
||||
|
||||
// Show online payment link
|
||||
$useonlinepayment = ((! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled)) && !empty($conf->global->PDF_SHOW_LINK_TO_ONLINE_PAYMENT));
|
||||
$useonlinepayment = ((!empty($conf->paypal->enabled) || !empty($conf->stripe->enabled) || !empty($conf->paybox->enabled)) && !empty($conf->global->PDF_SHOW_LINK_TO_ONLINE_PAYMENT));
|
||||
if (($object->mode_reglement_code == 'CB' || $object->mode_reglement_code == 'VAD') && $object->statut != Facture::STATUS_DRAFT && $useonlinepayment) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||
global $langs;
|
||||
|
||||
$langs->loadLangs(array('payment', 'paybox'));
|
||||
$servicename=$langs->transnoentities('Online');
|
||||
$servicename = $langs->transnoentities('Online');
|
||||
$paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, '', '', '');
|
||||
$linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' <a href="'.$paiement_url.'">'.$outputlangs->transnoentities("ClickHere").'</a>';
|
||||
$linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' <a href="'.$paiement_url.'">'.$outputlangs->transnoentities("ClickHere").'</a>';
|
||||
|
||||
$pdf->writeHTMLCell(80, 10, '', '', dol_htmlentitiesbr($linktopay), 0, 1);
|
||||
}
|
||||
|
||||
$posy=$pdf->GetY()+2;
|
||||
$posy = $pdf->GetY() + 2;
|
||||
}
|
||||
|
||||
// Show payment mode CHQ
|
||||
if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ')
|
||||
{
|
||||
// If payment mode unregulated or payment mode forced to CHQ
|
||||
if (! empty($conf->global->FACTURE_CHQ_NUMBER))
|
||||
if (!empty($conf->global->FACTURE_CHQ_NUMBER))
|
||||
{
|
||||
$diffsizetitle=(empty($conf->global->PDF_DIFFSIZE_TITLE)?3:$conf->global->PDF_DIFFSIZE_TITLE);
|
||||
$diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE);
|
||||
|
||||
if ($conf->global->FACTURE_CHQ_NUMBER > 0)
|
||||
{
|
||||
@ -1818,7 +1818,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
if (empty($hidetop))
|
||||
{
|
||||
$titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency));
|
||||
if (! empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && is_object($outputlangsbis)) {
|
||||
if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && is_object($outputlangsbis)) {
|
||||
$titre .= ' - '.$outputlangsbis->transnoentities("AmountInCurrency", $outputlangsbis->transnoentitiesnoconv("Currency".$currency));
|
||||
}
|
||||
|
||||
@ -1926,7 +1926,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
if ($object->type == 3) $title = $outputlangs->transnoentities("InvoiceDeposit");
|
||||
if ($object->type == 4) $title = $outputlangs->transnoentities("InvoiceProForma");
|
||||
if ($this->situationinvoice) $title = $outputlangs->transnoentities("InvoiceSituation");
|
||||
if (! empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && is_object($outputlangsbis)) {
|
||||
if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && is_object($outputlangsbis)) {
|
||||
$title .= ' - ';
|
||||
if ($object->type == 0) {
|
||||
if ($this->situationinvoice) $title .= $outputlangsbis->transnoentities("InvoiceSituation");
|
||||
|
||||
@ -29,56 +29,56 @@ $module = $object->element;
|
||||
$note_public = 'note_public';
|
||||
$note_private = 'note_private';
|
||||
|
||||
$colwidth=(isset($colwidth)?$colwidth:(empty($cssclass)?'25':''));
|
||||
$colwidth = (isset($colwidth) ? $colwidth : (empty($cssclass) ? '25' : ''));
|
||||
// Set $permission from the $permissionnote var defined on calling page
|
||||
$permission=(isset($permissionnote)?$permissionnote:(isset($permission)?$permission:(isset($user->rights->$module->create)?$user->rights->$module->create:(isset($user->rights->$module->creer)?$user->rights->$module->creer:0))));
|
||||
$moreparam=(isset($moreparam)?$moreparam:'');
|
||||
$value_public=$object->note_public;
|
||||
$value_private=$object->note_private;
|
||||
if (! empty($conf->global->MAIN_AUTO_TIMESTAMP_IN_PUBLIC_NOTES))
|
||||
$permission = (isset($permissionnote) ? $permissionnote : (isset($permission) ? $permission : (isset($user->rights->$module->create) ? $user->rights->$module->create : (isset($user->rights->$module->creer) ? $user->rights->$module->creer : 0))));
|
||||
$moreparam = (isset($moreparam) ? $moreparam : '');
|
||||
$value_public = $object->note_public;
|
||||
$value_private = $object->note_private;
|
||||
if (!empty($conf->global->MAIN_AUTO_TIMESTAMP_IN_PUBLIC_NOTES))
|
||||
{
|
||||
$stringtoadd=dol_print_date(dol_now(), 'dayhour').' '.$user->getFullName($langs).' --';
|
||||
$stringtoadd = dol_print_date(dol_now(), 'dayhour').' '.$user->getFullName($langs).' --';
|
||||
if (GETPOST('action', 'aZ09') == 'edit'.$note_public)
|
||||
{
|
||||
$value_public=dol_concatdesc($value_public, ($value_public?"\n":"")."-- ".$stringtoadd);
|
||||
if (dol_textishtml($value_public)) $value_public.="<br>\n";
|
||||
else $value_public.="\n";
|
||||
$value_public = dol_concatdesc($value_public, ($value_public ? "\n" : "")."-- ".$stringtoadd);
|
||||
if (dol_textishtml($value_public)) $value_public .= "<br>\n";
|
||||
else $value_public .= "\n";
|
||||
}
|
||||
}
|
||||
if (! empty($conf->global->MAIN_AUTO_TIMESTAMP_IN_PRIVATE_NOTES))
|
||||
if (!empty($conf->global->MAIN_AUTO_TIMESTAMP_IN_PRIVATE_NOTES))
|
||||
{
|
||||
$stringtoadd=dol_print_date(dol_now(), 'dayhour').' '.$user->getFullName($langs).' --';
|
||||
$stringtoadd = dol_print_date(dol_now(), 'dayhour').' '.$user->getFullName($langs).' --';
|
||||
if (GETPOST('action', 'aZ09') == 'edit'.$note_private)
|
||||
{
|
||||
$value_private=dol_concatdesc($value_private, ($value_private?"\n":"")."-- ".$stringtoadd);
|
||||
if (dol_textishtml($value_private)) $value_private.="<br>\n";
|
||||
else $value_private.="\n";
|
||||
$value_private = dol_concatdesc($value_private, ($value_private ? "\n" : "")."-- ".$stringtoadd);
|
||||
if (dol_textishtml($value_private)) $value_private .= "<br>\n";
|
||||
else $value_private .= "\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Special cases
|
||||
if ($module == 'propal') { $permission=$user->rights->propale->creer;}
|
||||
elseif ($module == 'supplier_proposal') { $permission=$user->rights->supplier_proposal->creer;}
|
||||
elseif ($module == 'fichinter') { $permission=$user->rights->ficheinter->creer;}
|
||||
elseif ($module == 'project') { $permission=$user->rights->projet->creer;}
|
||||
elseif ($module == 'project_task') { $permission=$user->rights->projet->creer;}
|
||||
elseif ($module == 'invoice_supplier') { $permission=$user->rights->fournisseur->facture->creer;}
|
||||
elseif ($module == 'order_supplier') { $permission=$user->rights->fournisseur->commande->creer;}
|
||||
elseif ($module == 'societe') { $permission=$user->rights->societe->creer;}
|
||||
elseif ($module == 'contact') { $permission=$user->rights->societe->creer;}
|
||||
elseif ($module == 'shipping') { $permission=$user->rights->expedition->creer;}
|
||||
elseif ($module == 'product') { $permission=$user->rights->produit->creer;}
|
||||
if ($module == 'propal') { $permission = $user->rights->propale->creer; }
|
||||
elseif ($module == 'supplier_proposal') { $permission = $user->rights->supplier_proposal->creer; }
|
||||
elseif ($module == 'fichinter') { $permission = $user->rights->ficheinter->creer; }
|
||||
elseif ($module == 'project') { $permission = $user->rights->projet->creer; }
|
||||
elseif ($module == 'project_task') { $permission = $user->rights->projet->creer; }
|
||||
elseif ($module == 'invoice_supplier') { $permission = $user->rights->fournisseur->facture->creer; }
|
||||
elseif ($module == 'order_supplier') { $permission = $user->rights->fournisseur->commande->creer; }
|
||||
elseif ($module == 'societe') { $permission = $user->rights->societe->creer; }
|
||||
elseif ($module == 'contact') { $permission = $user->rights->societe->creer; }
|
||||
elseif ($module == 'shipping') { $permission = $user->rights->expedition->creer; }
|
||||
elseif ($module == 'product') { $permission = $user->rights->produit->creer; }
|
||||
//else dol_print_error('','Bad value '.$module.' for param module');
|
||||
|
||||
if (! empty($conf->fckeditor->enabled) && ! empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $typeofdata='ckeditor:dolibarr_notes:100%:200::1:12:95%:0'; // Rem: This var is for all notes, not only thirdparties note.
|
||||
else $typeofdata='textarea:12:95%';
|
||||
if (!empty($conf->fckeditor->enabled) && !empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $typeofdata = 'ckeditor:dolibarr_notes:100%:200::1:12:95%:0'; // Rem: This var is for all notes, not only thirdparties note.
|
||||
else $typeofdata = 'textarea:12:95%';
|
||||
|
||||
print '<!-- BEGIN PHP TEMPLATE NOTES -->'."\n";
|
||||
print '<div class="tagtable border table-border tableforfield centpercent">'."\n";
|
||||
if ($module != 'product') {
|
||||
// No public note yet on products
|
||||
print '<div class="tagtr table-border-row">'."\n";
|
||||
print '<div class="tagtd tagtdnote tdtop sensiblehtmlcontent table-key-border-col'.(empty($cssclass)?'':' '.$cssclass).'"'.($colwidth ? ' style="width: '.$colwidth.'%"' : '').'>'."\n";
|
||||
print '<div class="tagtd tagtdnote tdtop sensiblehtmlcontent table-key-border-col'.(empty($cssclass) ? '' : ' '.$cssclass).'"'.($colwidth ? ' style="width: '.$colwidth.'%"' : '').'>'."\n";
|
||||
print $form->editfieldkey("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, $moreparam, '', 0);
|
||||
print '</div>'."\n";
|
||||
print '<div class="tagtd table-val-border-col sensiblehtmlcontent">'."\n";
|
||||
@ -89,7 +89,7 @@ if ($module != 'product') {
|
||||
if (empty($user->socid)) {
|
||||
// Private notes (always hidden to external users)
|
||||
print '<div class="tagtr table-border-row">'."\n";
|
||||
print '<div class="tagtd tagtdnote tdtop sensiblehtmlcontent table-key-border-col'.(empty($cssclass)?'':' '.$cssclass).'"'.($colwidth ? ' style="width: '.$colwidth.'%"' : '').'>'."\n";
|
||||
print '<div class="tagtd tagtdnote tdtop sensiblehtmlcontent table-key-border-col'.(empty($cssclass) ? '' : ' '.$cssclass).'"'.($colwidth ? ' style="width: '.$colwidth.'%"' : '').'>'."\n";
|
||||
print $form->editfieldkey("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, $moreparam, '', 0);
|
||||
print '</div>'."\n";
|
||||
print '<div class="tagtd table-val-border-col sensiblehtmlcontent">'."\n";
|
||||
|
||||
@ -139,7 +139,7 @@ if ($object->id > 0)
|
||||
// ------------------------------------------------------------
|
||||
$linkback = '<a href="'.dol_buildpath('/mrp/mo_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
$morehtmlref = '<div class="refidno">';
|
||||
// Ref customer
|
||||
//$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
|
||||
//$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
|
||||
@ -175,7 +175,7 @@ if ($object->id > 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
|
||||
@ -34,12 +34,12 @@ dol_include_once('/mrp/class/mo.class.php');
|
||||
dol_include_once('/mrp/lib/mrp_mo.lib.php');
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("mrp","companies","other","mails"));
|
||||
$langs->loadLangs(array("mrp", "companies", "other", "mails"));
|
||||
|
||||
|
||||
$action=GETPOST('action', 'aZ09');
|
||||
$confirm=GETPOST('confirm');
|
||||
$id=(GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int'));
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$confirm = GETPOST('confirm');
|
||||
$id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int'));
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
|
||||
// Security check - Protection if external user
|
||||
@ -55,31 +55,31 @@ if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined,
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="name";
|
||||
if (!$sortorder) $sortorder = "ASC";
|
||||
if (!$sortfield) $sortfield = "name";
|
||||
//if (! $sortfield) $sortfield="position_name";
|
||||
|
||||
// Initialize technical objects
|
||||
$object=new Mo($db);
|
||||
$object = new Mo($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
$diroutputmassaction=$conf->mrp->dir_output . '/temp/massgeneration/'.$user->id;
|
||||
$hookmanager->initHooks(array('modocument','globalcard')); // Note that conf->hooks_modules contains array
|
||||
$diroutputmassaction = $conf->mrp->dir_output.'/temp/massgeneration/'.$user->id;
|
||||
$hookmanager->initHooks(array('modocument', 'globalcard')); // Note that conf->hooks_modules contains array
|
||||
|
||||
// Fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
// Load object
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
||||
|
||||
//if ($id > 0 || ! empty($ref)) $upload_dir = $conf->mrp->multidir_output[$object->entity?$object->entity:$conf->entity] . "/mo/" . dol_sanitizeFileName($object->id);
|
||||
if ($id > 0 || ! empty($ref)) $upload_dir = $conf->mrp->multidir_output[$object->entity?$object->entity:$conf->entity] . "/mo/" . dol_sanitizeFileName($object->ref);
|
||||
if ($id > 0 || !empty($ref)) $upload_dir = $conf->mrp->multidir_output[$object->entity ? $object->entity : $conf->entity]."/mo/".dol_sanitizeFileName($object->ref);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
|
||||
|
||||
|
||||
/*
|
||||
@ -89,8 +89,8 @@ include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
|
||||
$form = new Form($db);
|
||||
$formproject = new FormProjets($db);
|
||||
|
||||
$title=$langs->trans("Mo").' - '.$langs->trans("Files");
|
||||
$help_url='';
|
||||
$title = $langs->trans("Mo").' - '.$langs->trans("Files");
|
||||
$help_url = '';
|
||||
//$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
@ -105,18 +105,18 @@ if ($object->id)
|
||||
|
||||
|
||||
// Build file list
|
||||
$filearray=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC), 1);
|
||||
$totalsize=0;
|
||||
foreach($filearray as $key => $file)
|
||||
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
|
||||
$totalsize = 0;
|
||||
foreach ($filearray as $key => $file)
|
||||
{
|
||||
$totalsize+=$file['size'];
|
||||
$totalsize += $file['size'];
|
||||
}
|
||||
|
||||
// Object card
|
||||
// ------------------------------------------------------------
|
||||
$linkback = '<a href="' .dol_buildpath('/mrp/mo_list.php', 1) . '?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||
$linkback = '<a href="'.dol_buildpath('/mrp/mo_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
$morehtmlref = '<div class="refidno">';
|
||||
// Ref customer
|
||||
//$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
|
||||
//$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
|
||||
@ -152,7 +152,7 @@ if ($object->id)
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
@ -176,12 +176,12 @@ if ($object->id)
|
||||
$modulepart = 'mrp';
|
||||
$permission = $user->rights->mrp->write;
|
||||
$permtoedit = $user->rights->mrp->write;
|
||||
$param = '&id=' . $object->id;
|
||||
$param = '&id='.$object->id;
|
||||
|
||||
//$relativepathwithnofile='mo/' . dol_sanitizeFileName($object->id).'/';
|
||||
$relativepathwithnofile='mo/' . dol_sanitizeFileName($object->ref).'/';
|
||||
$relativepathwithnofile = 'mo/'.dol_sanitizeFileName($object->ref).'/';
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -30,20 +30,20 @@ dol_include_once('/mrp/class/mo.class.php');
|
||||
dol_include_once('/mrp/lib/mrp_mo.lib.php');
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("mrp","companies"));
|
||||
$langs->loadLangs(array("mrp", "companies"));
|
||||
|
||||
// Get parameters
|
||||
$id = GETPOST('id', 'int');
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'aZ09');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
||||
// Initialize technical objects
|
||||
$object=new Mo($db);
|
||||
$object = new Mo($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
$diroutputmassaction=$conf->mrp->dir_output . '/temp/massgeneration/'.$user->id;
|
||||
$hookmanager->initHooks(array('monote','globalcard')); // Note that conf->hooks_modules contains array
|
||||
$diroutputmassaction = $conf->mrp->dir_output.'/temp/massgeneration/'.$user->id;
|
||||
$hookmanager->initHooks(array('monote', 'globalcard')); // Note that conf->hooks_modules contains array
|
||||
|
||||
// Fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
@ -54,10 +54,10 @@ $extrafields->fetch_name_optionals_label($object->table_element);
|
||||
//$result = restrictedArea($user, 'mrp', $id);
|
||||
|
||||
// Load object
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
||||
if ($id > 0 || ! empty($ref)) $upload_dir = $conf->mrp->multidir_output[$object->entity] . "/" . $object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
||||
if ($id > 0 || !empty($ref)) $upload_dir = $conf->mrp->multidir_output[$object->entity]."/".$object->id;
|
||||
|
||||
$permissionnote=1;
|
||||
$permissionnote = 1;
|
||||
//$permissionnote=$user->rights->mrp->creer; // Used by the include of actions_setnotes.inc.php
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@ $permissionnote=1;
|
||||
* Actions
|
||||
*/
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
||||
|
||||
|
||||
/*
|
||||
@ -77,10 +77,10 @@ $form = new Form($db);
|
||||
$formproject = new FormProjets($db);
|
||||
|
||||
//$help_url='EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes';
|
||||
$help_url='';
|
||||
$help_url = '';
|
||||
llxHeader('', $langs->trans('Mo'), $help_url);
|
||||
|
||||
if ($id > 0 || ! empty($ref))
|
||||
if ($id > 0 || !empty($ref))
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
@ -90,9 +90,9 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
// Object card
|
||||
// ------------------------------------------------------------
|
||||
$linkback = '<a href="' .dol_buildpath('/mrp/mo_list.php', 1) . '?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||
$linkback = '<a href="'.dol_buildpath('/mrp/mo_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
$morehtmlref = '<div class="refidno">';
|
||||
// Ref customer
|
||||
//$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
|
||||
//$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
|
||||
@ -128,7 +128,7 @@ if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
@ -137,7 +137,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
|
||||
$cssclass="titlefield";
|
||||
$cssclass = "titlefield";
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
|
||||
|
||||
print '</div>';
|
||||
|
||||
@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'usernote'; // To manage different context of search
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'usernote'; // To manage different context of search
|
||||
|
||||
// Load translation files required by page
|
||||
$langs->loadLangs(array('companies', 'members', 'bills', 'users'));
|
||||
@ -39,25 +39,25 @@ $object->fetch($id, '', '', 1);
|
||||
$object->getrights();
|
||||
|
||||
// If user is not user read and no permission to read other users, we stop
|
||||
if (($object->id != $user->id) && (! $user->rights->user->user->lire)) accessforbidden();
|
||||
if (($object->id != $user->id) && (!$user->rights->user->user->lire)) accessforbidden();
|
||||
|
||||
// Security check
|
||||
$socid=0;
|
||||
$socid = 0;
|
||||
if ($user->socid > 0) $socid = $user->socid;
|
||||
$feature2 = (($socid && $user->rights->user->self->creer)?'':'user');
|
||||
$feature2 = (($socid && $user->rights->user->self->creer) ? '' : 'user');
|
||||
|
||||
$result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('usercard','usernote','globalcard'));
|
||||
$hookmanager->initHooks(array('usercard', 'usernote', 'globalcard'));
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$parameters=array('id'=>$socid);
|
||||
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
$parameters = array('id'=>$socid);
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if (empty($reshook)) {
|
||||
@ -118,7 +118,7 @@ if ($id)
|
||||
print "<input type=\"hidden\" name=\"id\" value=\"".$object->id."\">";
|
||||
// Editeur wysiwyg
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor('note_private', $object->note_private, '', 280, 'dolibarr_notes', 'In', true, false, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_8, '90%');
|
||||
$doleditor = new DolEditor('note_private', $object->note_private, '', 280, 'dolibarr_notes', 'In', true, false, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_8, '90%');
|
||||
$doleditor->Create();
|
||||
}
|
||||
else
|
||||
|
||||
Loading…
Reference in New Issue
Block a user