diff --git a/dev/setup/codesniffer/README b/dev/setup/codesniffer/README index 087fb318f6f..2fdc66b9d1f 100644 --- a/dev/setup/codesniffer/README +++ b/dev/setup/codesniffer/README @@ -10,6 +10,11 @@ To run phpcs: > cd dolibarrgitrepo > phpcs --standard=dev/setup/codesniffer/ruleset.xml --extensions=php --parallel=8 . +To fix with phpcbf: +> cd dolibarrgitrepo +> phpcbf --standard=dev/setup/codesniffer/ruleset.xml --extensions=php --parallel=8 . + + Note with Eclipse: You must setup the PTI plugin of Eclipse into PHPCodeSniffer menu with: * tab value to 4 * path of code sniffer standard to dev/codesniffer diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 2ffc1e2c9fd..0104f8f36e8 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -366,7 +366,7 @@ class AdherentType extends CommonObject $sql .= "libelle = '".$this->db->escape($this->label)."',"; $sql .= "morphy = '".$this->db->escape($this->morphy)."',"; $sql .= "subscription = '".$this->db->escape($this->subscription)."',"; - $sql .= "amount = '".$this->db->escape($this->amount)."',"; + $sql .= "amount = ".((empty($this->amount) && $this->amount == '') ? 'null' : ((float) $this->amount)).","; $sql .= "duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."',"; $sql .= "note = '".$this->db->escape($this->note)."',"; $sql .= "vote = ".(integer) $this->db->escape($this->vote).","; diff --git a/htdocs/adherents/stats/index.php b/htdocs/adherents/stats/index.php index 11c0025dcc5..e820d0a0d23 100644 --- a/htdocs/adherents/stats/index.php +++ b/htdocs/adherents/stats/index.php @@ -198,8 +198,8 @@ foreach ($data as $val) { //print ''; print ''; print ''.$val['nb'].''; - print ''.price(price2num($val['total'], 'MT'), 1).''; - print ''.price(price2num($val['avg'], 'MT'), 1).''; + print ''.price(price2num($val['total'], 'MT'), 1).''; + print ''.price(price2num($val['avg'], 'MT'), 1).''; print ''; $oldyear = $year; } diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 6c4f63725e1..033592a9afc 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -71,7 +71,7 @@ $label = GETPOST("label", "alpha"); $morphy = GETPOST("morphy", "alpha"); $status = GETPOST("status", "int"); $subscription = GETPOST("subscription", "int"); -$amount = price2num(GETPOST('amount', 'alpha'), 'MT'); +$amount = GETPOST('amount', 'alpha'); $duration_value = GETPOST('duration_value', 'int'); $duration_unit = GETPOST('duration_unit', 'alpha'); $vote = GETPOST("vote", "int"); @@ -119,7 +119,7 @@ if ($action == 'add' && $user->rights->adherent->configurer) { $object->morphy = trim($morphy); $object->status = (int) $status; $object->subscription = (int) $subscription; - $object->amount = $amount; + $object->amount = ($amount == '' ? '' : price2num($amount, 'MT')); $object->duration_value = $duration_value; $object->duration_unit = $duration_unit; $object->note = trim($comment); @@ -166,12 +166,11 @@ if ($action == 'update' && $user->rights->adherent->configurer) { $object->fetch($rowid); $object->oldcopy = clone $object; - $object->label= trim($label); $object->morphy = trim($morphy); $object->status = (int) $status; $object->subscription = (int) $subscription; - $object->amount = $amount; + $object->amount = ($amount == '' ? '' : price2num($amount, 'MT'));; $object->duration_value = $duration_value; $object->duration_unit = $duration_unit; $object->note = trim($comment); @@ -306,7 +305,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') { } print ''; print ''.yn($objp->subscription).''; - print ''.price($objp->amount).''; + print ''.(is_null($objp->amount) || $objp->amount === '' ? '' : price($objp->amount)).''; print ''.yn($objp->vote).''; print ''.$membertype->getLibStatut(5).''; if ($user->rights->adherent->configurer) { @@ -446,7 +445,7 @@ if ($rowid > 0) { print ''; print ''.$langs->trans("Amount").''; - print price($object->amount); + print ((is_null($object->amount) || $object->amount === '') ? '' : price($object->amount)); print ''; print ''.$langs->trans("VoteAllowed").''; @@ -594,24 +593,24 @@ if ($rowid > 0) { $titre .= " (".$membertype->label.")"; } - $param = "&rowid=".$object->id; + $param = "&rowid=".urlencode($object->id); if (!empty($status)) { - $param .= "&status=".$status; + $param .= "&status=".urlencode($status); } if (!empty($search_lastname)) { - $param .= "&search_lastname=".$search_lastname; + $param .= "&search_lastname=".urlencode($search_lastname); } if (!empty($search_firstname)) { - $param .= "&search_firstname=".$search_firstname; + $param .= "&search_firstname=".urlencode($search_firstname); } if (!empty($search_login)) { - $param .= "&search_login=".$search_login; + $param .= "&search_login=".urlencode($search_login); } if (!empty($search_email)) { - $param .= "&search_email=".$search_email; + $param .= "&search_email=".urlencode($search_email); } if (!empty($filter)) { - $param .= "&filter=".$filter; + $param .= "&filter=".urlencode($filter); } if ($sall) { @@ -797,7 +796,9 @@ if ($rowid > 0) { print ''; print ''.$langs->trans("Amount").''; - print ''; + print ''; print ''; print ''.$langs->trans("VoteAllowed").''; diff --git a/htdocs/admin/security_file.php b/htdocs/admin/security_file.php index 2b6a4e81fb4..12c90cf3c21 100644 --- a/htdocs/admin/security_file.php +++ b/htdocs/admin/security_file.php @@ -66,7 +66,7 @@ if ($action == 'updateform') { } elseif ($action == 'delete') { // Delete file $langs->load("other"); - $file = $conf->admin->dir_temp.'/'.GETPOST('urlfile', 'alpha'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). + $file = $conf->admin->dir_temp.'/'.GETPOST('urlfile', 'alpha'); $ret = dol_delete_file($file); if ($ret) { setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile', 'alpha')), null, 'mesgs'); diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index d8dd21719fd..36f08309e02 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -40,6 +40,8 @@ if (GETPOST('action', 'aZ09') == 'donothing') { exit; } +$execmethod = empty($conf->global->MAIN_EXEC_USE_POPEN) ? 1 : $conf->global->MAIN_EXEC_USE_POPEN; + /* * View @@ -74,7 +76,13 @@ print "PHP allow_url_include = ".(ini_get('allow_url_include') print "PHP disable_functions = "; $arrayoffunctionsdisabled = explode(',', ini_get('disable_functions')); $arrayoffunctionstodisable = explode(',', 'pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals'); -$arrayoffunctionstodisable2 = explode(',', 'exec,passthru,shell_exec,system,proc_open,popen'); +if ($execmethod == 1) { + $arrayoffunctionstodisable2 = explode(',', 'passthru,shell_exec,system,proc_open,popen'); + $functiontokeep = 'exec'; +} else { + $arrayoffunctionstodisable2 = explode(',', 'exec,passthru,shell_exec,system,proc_open'); + $functiontokeep = 'popen'; +} $i = 0; foreach ($arrayoffunctionsdisabled as $functionkey) { if ($i > 0) { @@ -115,6 +123,13 @@ if ($todisabletext) { print '
'; } +print $langs->trans("PHPFunctionsRequiredForCLI").': '; +if (in_array($functiontokeep, $arrayoffunctionsdisabled)) { + print img_picto($langs->trans("PHPFunctionsRequiredForCLI"), 'warning'); +} +print ''.$functiontokeep.''; +print '
'; + print '
'; // XDebug @@ -245,6 +260,22 @@ print 'MAIN_SECURITY_ANTI_SSRF_SERVER_IP = '.(empty($conf->glob print '
'; +print 'MAIN_EXEC_USE_POPEN = '; +if (empty($conf->global->MAIN_EXEC_USE_POPEN)) { + print ''.$langs->trans("Undefined").'   '; +} else { + print $conf->global->MAIN_EXEC_USE_POPEN.'   '; +} +if ($execmethod == 1) { + print ' --> "exec" PHP method will be used for shell commands.'; +} +if ($execmethod == 2) { + print ' --> "popen" PHP method will be used for shell commands.'; +} +print "
"; +print '
'; + + print ''.$langs->trans("AntivirusEnabledOnUpload").': '; print empty($conf->global->MAIN_ANTIVIRUS_COMMAND) ? '' : img_picto('', 'tick').' '; print yn($conf->global->MAIN_ANTIVIRUS_COMMAND ? 1 : 0); diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 29310aa831b..984d77e7263 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -347,7 +347,7 @@ if (empty($reshook)) { $duration = GETPOST('duree_validite', 'int'); if (empty($datep)) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DatePropal")), null, 'errors'); $action = 'create'; $error++; } @@ -1622,7 +1622,7 @@ if ($action == 'create') { } // Date - print ''.$langs->trans('Date').''; + print ''.$langs->trans('DatePropal').''; print $form->selectDate('', '', '', '', '', "addprop", 1, 1); print ''; @@ -2063,7 +2063,7 @@ if ($action == 'create') { print ''; print ''; print ''; if ($action != 'editdate' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) { print ''; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 43c83117457..e1ec555837f 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -10,7 +10,7 @@ * Copyright (C) 2012 Christophe Battarel * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2016-2018 Ferran Marcet + * Copyright (C) 2016-2021 Ferran Marcet * Copyright (C) 2017-2018 Charlene Benke * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2019 Alexandre Spangaro @@ -182,7 +182,7 @@ $arrayfields = array( 'state.nom'=>array('label'=>"StateShort", 'checked'=>0), 'country.code_iso'=>array('label'=>"Country", 'checked'=>0), 'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers), - 'p.date'=>array('label'=>"Date", 'checked'=>1), + 'p.date'=>array('label'=>"DatePropal", 'checked'=>1), 'p.fin_validite'=>array('label'=>"DateEnd", 'checked'=>1), 'p.date_livraison'=>array('label'=>"DeliveryDate", 'checked'=>0), 'ava.rowid'=>array('label'=>"AvailabilityPeriod", 'checked'=>0), @@ -711,24 +711,12 @@ if ($resql) { if ($sall) { $param .= '&sall='.urlencode($sall); } - if ($search_date_start) { - $param .= '&search_date_start='.urlencode($search_date_start); - } - if ($search_date_end) { - $param .= '&search_date_end='.urlencode($search_date_end); - } - if ($search_dateend_start) { - $param .= '&search_dateend_start='.urlencode($search_dateend_start); - } - if ($search_dateend_end) { - $param .= '&search_dateend_end='.urlencode($search_dateend_end); - } - if ($search_datedelivery_start) { - $param .= '&search_datedelivery_start='.urlencode($search_datedelivery_start); - } - if ($search_datedelivery_end) { - $param .= '&search_datedelivery_end='.urlencode($search_datedelivery_end); - } + if ($search_date_start) $param .= '&search_date_startday='.urlencode(dol_print_date($search_date_start, '%d')).'&search_date_startmonth='.urlencode(dol_print_date($search_date_start, '%m')).'&search_date_startyear='.urlencode(dol_print_date($search_date_start, '%Y')); + if ($search_date_end) $param .= '&search_date_endday='.urlencode(dol_print_date($search_date_end, '%d')).'&search_date_endmonth='.urlencode(dol_print_date($search_date_end, '%m')).'&search_date_endyear='.urlencode(dol_print_date($search_date_end, '%Y')); + if ($search_dateend_start) $param .= '&search_dateend_startday='.urlencode(dol_print_date($search_dateend_start, '%d')).'&search_dateend_startmonth='.urlencode(dol_print_date($search_dateend_start, '%m')).'&search_dateend_startyear='.urlencode(dol_print_date($search_dateend_start, '%Y')); + if ($search_dateend_end) $param .= '&search_dateend_endday='.urlencode(dol_print_date($search_dateend_end, '%d')).'&search_dateend_endmonth='.urlencode(dol_print_date($search_dateend_end, '%m')).'&search_dateend_endyear='.urlencode(dol_print_date($search_dateend_end, '%Y')); + if ($search_datedelivery_start) $param .= '&search_datedelivery_startday='.urlencode(dol_print_date($search_datedelivery_start, '%d')).'&search_datedelivery_startmonth='.urlencode(dol_print_date($search_datedelivery_start, '%m')).'&search_datedelivery_startyear='.urlencode(dol_print_date($search_datedelivery_start, '%Y')); + if ($search_datedelivery_end) $param .= '&search_datedelivery_endday='.urlencode(dol_print_date($search_datedelivery_end, '%d')).'&search_datedelivery_endmonth='.urlencode(dol_print_date($search_datedelivery_end, '%m')).'&search_datedelivery_endyear='.urlencode(dol_print_date($search_datedelivery_end, '%Y')); if ($search_ref) { $param .= '&search_ref='.urlencode($search_ref); } @@ -787,37 +775,37 @@ if ($resql) { $param .= '&search_categ_cus='.urlencode($search_categ_cus); } if ($search_product_category != '') { - $param .= '&search_product_category='.$search_product_category; + $param .= '&search_product_category='.urlencode($search_product_category); } if ($search_fk_cond_reglement > 0) { - $param .= '&search_fk_cond_reglement='.$search_fk_cond_reglement; + $param .= '&search_fk_cond_reglement='.urlencode($search_fk_cond_reglement); } if ($search_fk_shipping_method > 0) { - $param .= '&search_fk_shipping_method='.$search_fk_shipping_method; + $param .= '&search_fk_shipping_method='.urlencode($search_fk_shipping_method); } if ($search_fk_input_reason > 0) { - $param .= '&search_fk_input_reason='.$search_fk_input_reason; + $param .= '&search_fk_input_reason='.urlencode($search_fk_input_reason); } if ($search_fk_mode_reglement > 0) { - $param .= '&search_fk_mode_reglement='.$search_fk_mode_reglement; + $param .= '&search_fk_mode_reglement='.urlencode($search_fk_mode_reglement); } if ($search_type_thirdparty > 0) { - $param .= '&search_type_thirdparty='.$search_type_thirdparty; + $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); } if ($search_town) { - $param .= '&search_town='.$search_town; + $param .= '&search_town='.urlencode($search_town); } if ($search_zip) { - $param .= '&search_zip='.$search_zip; + $param .= '&search_zip='.urlencode($search_zip); } if ($search_state) { - $param .= '&search_state='.$search_state; + $param .= '&search_state='.urlencode($search_state); } if ($search_town) { - $param .= '&search_town='.$search_town; + $param .= '&search_town='.urlencode($search_town); } if ($search_country) { - $param .= '&search_country='.$search_country; + $param .= '&search_country='.urlencode($search_country); } // Add $param from extra fields @@ -825,23 +813,22 @@ if ($resql) { // List of mass actions available $arrayofmassactions = array( - 'generate_doc'=>img_picto('', 'pdf').' '.$langs->trans("ReGeneratePDF"), - 'builddoc'=>img_picto('', 'pdf').' '.$langs->trans("PDFMerge"), - + 'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), + 'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), ); if ($permissiontosendbymail) { - $arrayofmassactions['presend']=img_picto('', 'email').' '.$langs->trans("SendByMail"); + $arrayofmassactions['presend']=img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"); } if ($permissiontovalidate) { - $arrayofmassactions['prevalidate']=img_picto('', 'check').' '.$langs->trans("Validate"); + $arrayofmassactions['prevalidate']=img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"); } if ($permissiontoclose) { - $arrayofmassactions['presign']=img_picto('', 'propal').' '.$langs->trans("Sign"); - $arrayofmassactions['nopresign']=img_picto('', 'propal').' '.$langs->trans("NoSign"); - $arrayofmassactions['setbilled'] =img_picto('', 'bill').' '.$langs->trans("ClassifyBilled"); + $arrayofmassactions['presign']=img_picto('', 'propal', 'class="pictofixedwidth"').$langs->trans("Sign"); + $arrayofmassactions['nopresign']=img_picto('', 'propal', 'class="pictofixedwidth"').$langs->trans("NoSign"); + $arrayofmassactions['setbilled'] =img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("ClassifyBilled"); } if ($permissiontodelete) { - $arrayofmassactions['predelete'] = img_picto('', 'delete').' '.$langs->trans("Delete"); + $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } if (in_array($massaction, array('presend', 'predelete', 'closed'))) { diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 3747b2107b2..5bb8e6ccb0c 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -9,7 +9,7 @@ * Copyright (C) 2015-2018 Frédéric France * Copyright (C) 2015 Marcos García * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2016 Ferran Marcet + * Copyright (C) 2016-2021 Ferran Marcet * Copyright (C) 2018 Charlene Benke * Copyright (C) 2021 Anthony Berton * @@ -706,10 +706,10 @@ if ($resql) { $param .= '&search_status='.urlencode($search_status); } if ($search_datecloture_start) { - $param .= '&search_datecloture_start='.urlencode($search_datecloture_start); + $param .= '&search_datecloture_startday='.dol_print_date($search_datecloture_start, '%d').'&search_datecloture_startmonth='.dol_print_date($search_datecloture_start, '%m').'&search_datecloture_startyear='.dol_print_date($search_datecloture_start, '%Y'); } if ($search_datecloture_end) { - $param .= '&search_datecloture_end='.urlencode($search_datecloture_end); + $param .= '&search_datecloture_endday='.dol_print_date($search_datecloture_end, '%d').'&search_datecloture_endmonth='.dol_print_date($search_datecloture_end, '%m').'&search_datecloture_endyear='.dol_print_date($search_datecloture_end, '%Y'); } if ($search_dateorder_start) { $param .= '&search_dateorder_start_day='.dol_print_date($search_dateorder_start, '%d').'&search_dateorder_start_month='.dol_print_date($search_dateorder_start, '%m').'&search_dateorder_start_year='.dol_print_date($search_dateorder_start, '%Y'); @@ -805,16 +805,16 @@ if ($resql) { $param .= '&search_billed='.urlencode($search_billed); } if ($search_fk_cond_reglement > 0) { - $param .= '&search_fk_cond_reglement='.$search_fk_cond_reglement; + $param .= '&search_fk_cond_reglement='.urlencode($search_fk_cond_reglement); } if ($search_fk_shipping_method > 0) { - $param .= '&search_fk_shipping_method='.$search_fk_shipping_method; + $param .= '&search_fk_shipping_method='.urlencode($search_fk_shipping_method); } if ($search_fk_mode_reglement > 0) { - $param .= '&search_fk_mode_reglement='.$search_fk_mode_reglement; + $param .= '&search_fk_mode_reglement='.urlencode($search_fk_mode_reglement); } if ($search_fk_input_reason > 0) { - $param .= '&search_fk_input_reason='.$search_fk_input_reason; + $param .= '&search_fk_input_reason='.urlencode($search_fk_input_reason); } // Add $param from extra fields @@ -887,7 +887,6 @@ if ($resql) { } if ($massaction == 'createbills') { - //var_dump($_REQUEST); print ''; print '
'; - print $langs->trans('Date'); + print $langs->trans('DatePropal'); print 'id.'">'.img_edit($langs->trans('SetDate'), 1).'
'; diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index bf30b1831f9..30aa32a8d58 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -829,7 +829,7 @@ if ($action == 'create') { print ''; print ''; print ''; - print ''."\n\n"; + print ''."\n\n"; print dol_get_fiche_head(array(), 0, '', 0); diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index 5e6d199db0a..f78e004f571 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -338,14 +338,13 @@ if ($result) { if ($search_accountancy_subledger > 0) { $param .= '&search_accountancy_subledger='.urlencode($search_accountancy_subledger); } - if ($optioncss != '') { - $param .= '&optioncss='.urlencode($optioncss); + $param .= '&optioncss='.urlencode($optioncss); } $url = DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create'; if (!empty($socid)) { - $url .= '&socid='.$socid; + $url .= '&socid='.urlencode($socid); } $newcardbutton = dolGetButtonTitle($langs->trans('MenuNewVariousPayment'), '', 'fa fa-plus-circle', $url, '', $user->rights->banque->modifier); @@ -423,7 +422,7 @@ if ($result) { // Payment type if ($arrayfields['type']['checked']) { - print ''; } @@ -498,7 +497,7 @@ if ($result) { print_liste_field_titre($arrayfields['ref']['label'], $_SERVER["PHP_SELF"], 'v.rowid', '', $param, '', $sortfield, $sortorder); } if ($arrayfields['label']['checked']) { - print_liste_field_titre($arrayfields['label']['label'], $_SERVER["PHP_SELF"], 'v.label', '', $param, '', $sortfield, $sortorder, 'left '); + print_liste_field_titre($arrayfields['label']['label'], $_SERVER["PHP_SELF"], 'v.label', '', $param, '', $sortfield, $sortorder); } if ($arrayfields['datep']['checked']) { print_liste_field_titre($arrayfields['datep']['label'], $_SERVER["PHP_SELF"], 'v.datep,v.rowid', '', $param, '', $sortfield, $sortorder, 'center '); @@ -507,7 +506,7 @@ if ($result) { print_liste_field_titre($arrayfields['datev']['label'], $_SERVER["PHP_SELF"], 'v.datev,v.rowid', '', $param, '', $sortfield, $sortorder, 'center '); } if ($arrayfields['type']['checked']) { - print_liste_field_titre($arrayfields['type']['label'], $_SERVER["PHP_SELF"], 'type', '', $param, '', $sortfield, $sortorder, 'left '); + print_liste_field_titre($arrayfields['type']['label'], $_SERVER["PHP_SELF"], 'type', '', $param, '', $sortfield, $sortorder, 'center '); } if ($arrayfields['project']['checked']) { print_liste_field_titre($arrayfields['project']['label'], $_SERVER["PHP_SELF"], 'fk_project', '', $param, '', $sortfield, $sortorder); @@ -590,7 +589,7 @@ if ($result) { // Type if ($arrayfields['type']['checked']) { - print ''; } - print ''."\n"; + print ''."\n"; print ""; } } else { - $colspan = 13; + $colspan = 14; if (!empty($conf->multicompany->enabled)) { $colspan++; } diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php index bca1386c82e..9c1387d7d58 100644 --- a/htdocs/core/tpl/card_presend.tpl.php +++ b/htdocs/core/tpl/card_presend.tpl.php @@ -58,8 +58,8 @@ if ($action == 'presend') { // Define output language $outputlangs = $langs; $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && !empty($_REQUEST['lang_id'])) { - $newlang = $_REQUEST['lang_id']; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { + $newlang = GETPOST('lang_id', 'aZ09'); } if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { $newlang = $object->thirdparty->default_lang; diff --git a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php index 7268da76007..6fee9958fd1 100644 --- a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php @@ -26,6 +26,10 @@ if (!empty($extrafieldsobjectkey) && !empty($search_array_options) && is_array($ if ($crit != '' && in_array($typ, array('date', 'datetime', 'timestamp'))) { if (is_numeric($crit)) { + if ($typ == 'date'){ + include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + $crit = dol_get_first_hour($crit); + } $sql .= " AND ".$extrafieldsobjectprefix.$tmpkey." = '".$db->idate($crit)."'"; } elseif (is_array($crit)) { if ($crit['start'] !== '' && $crit['end'] !== '') { diff --git a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php index b8454b80ea1..d6209ba1694 100644 --- a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php +++ b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php @@ -183,7 +183,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers $this->error = "ErrorLDAP ".$ldap->error; } } - } elseif ($action == 'USER_SETINGROUP') { + /*} elseif ($action == 'USER_SETINGROUP') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') { $ldap = new Ldap(); @@ -250,7 +250,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers if ($result < 0) { $this->error = "ErrorLDAP ".$ldap->error; } - } + } */ } elseif ($action == 'USERGROUP_CREATE') { // Groupes dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); @@ -262,8 +262,8 @@ class InterfaceLdapsynchro extends DolibarrTriggers $info = $object->_load_ldap_info(); $dn = $object->_load_ldap_dn($info); - // Get a gid number for objectclass PosixGroup - if (in_array('posixGroup', $info['objectclass'])) { + // Get a gid number for objectclass PosixGroup if none was provided + if (empty($info[$conf->global->LDAP_GROUP_FIELD_GROUPID]) && in_array('posixGroup', $info['objectclass'])) { $info['gidNumber'] = $ldap->getNextGroupGid('LDAP_KEY_GROUPS'); } diff --git a/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php b/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php index f2d77553827..4e808d5bf15 100644 --- a/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php +++ b/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php @@ -111,13 +111,9 @@ class InterfaceZapierTriggers extends DolibarrTriggers //case 'USER_NEW_PASSWORD': //case 'USER_ENABLEDISABLE': //case 'USER_DELETE': - //case 'USER_SETINGROUP': - //case 'USER_REMOVEFROMGROUP': - // case 'USER_LOGIN': - // case 'USER_LOGIN_FAILED': - // case 'USER_LOGOUT': - // Warning: To increase performances, this action is triggered only if constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1. - // // case 'USER_UPDATE_SESSION': + //case 'USER_LOGIN': + //case 'USER_LOGIN_FAILED': + //case 'USER_LOGOUT': // Actions case 'ACTION_MODIFY': diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index 2c6415f17b7..4855c9c1e49 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -542,8 +542,8 @@ if ($action == 'create') { // Create. Seems to no be used if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { $outputlangs = $langs; $newlang = ''; - if (empty($newlang) && !empty($_REQUEST['lang_id'])) { - $newlang = $_REQUEST['lang_id']; + if (empty($newlang) && GETPOST('lang_id', 'aZ09')) { + $newlang = GETPOST('lang_id', 'aZ09'); } if (empty($newlang)) { $newlang = $object->thirdparty->default_lang; diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 49675c263f9..a1070d02ef1 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -2,7 +2,7 @@ /* Copyright (C) 2001-2005 Rodolphe Quiedeville * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin - * Copyright (C) 2016-2018 Ferran Marcet + * Copyright (C) 2016-2021 Ferran Marcet * Copyright (C) 2019 Nicolas ZABOURI * Copyright (C) 2020 Thibault FOUCART * @@ -434,20 +434,18 @@ if ($search_zip) { if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) { $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); } - -if ($search_datedelivery_start) { - $param .= '&search_datedelivery_start='.urlencode($search_datedelivery_start); +if ($search_datedelivery_start) { + $param .= '&search_datedelivery_startday='.urlencode(dol_print_date($search_datedelivery_start, '%d')).'&search_datedelivery_startmonth='.urlencode(dol_print_date($search_datedelivery_start, '%m')).'&search_datedelivery_startyear='.urlencode(dol_print_date($search_datedelivery_start, '%Y')); } if ($search_datedelivery_end) { - $param .= '&search_datedelivery_end='.urlencode($search_datedelivery_end); + $param .= '&search_datedelivery_endday='.urlencode(dol_print_date($search_datedelivery_end, '%d')).'&search_datedelivery_endmonth='.urlencode(dol_print_date($search_datedelivery_end, '%m')).'&search_datedelivery_endyear='.urlencode(dol_print_date($search_datedelivery_end, '%Y')); } if ($search_datereceipt_start) { - $param .= '&search_datereceipt_start='.urlencode($search_datereceipt_start); + $param .= '&search_datereceipt_startday='.urlencode(dol_print_date($search_datereceipt_start, '%d')).'&search_datereceipt_startmonth='.urlencode(dol_print_date($search_datereceipt_start, '%m')).'&search_datereceipt_startyear='.urlencode(dol_print_date($search_datereceipt_start, '%Y')); } if ($search_datereceipt_end) { - $param .= '&search_datereceipt_end='.urlencode($search_datereceipt_end); + $param .= '&search_datereceipt_endday='.urlencode(dol_print_date($search_datereceipt_end, '%d')).'&search_datereceipt_endmonth='.urlencode(dol_print_date($search_datereceipt_end, '%m')).'&search_datereceipt_endyear='.urlencode(dol_print_date($search_datereceipt_end, '%Y')); } - if ($search_product_category != '') { $param .= '&search_product_category='.urlencode($search_product_category); } @@ -863,10 +861,6 @@ while ($i < min($num, $limit)) { if (!empty($arrayfields['e.date_delivery']['checked'])) { print '\n"; } // Tracking number diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 1231f0b513e..8f5903dd988 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -687,8 +687,8 @@ if ($id > 0 || !empty($ref)) { $outputlangs = $langs; $newlang = ''; - if (empty($newlang) && !empty($_REQUEST['lang_id'])) { - $newlang = $_REQUEST['lang_id']; + if (empty($newlang) && GETPOST('lang_id', 'aZ09')) { + $newlang = GETPOST('lang_id', 'aZ09'); } if (empty($newlang)) { $newlang = $object->thirdparty->default_lang; diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index a4c565bc1be..cb6dcfc94b8 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -55,6 +55,7 @@ $action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); +$id = GETPOST('id', 'int'); $date_start = dol_mktime(0, 0, 0, GETPOST('date_debutmonth', 'int'), GETPOST('date_debutday', 'int'), GETPOST('date_debutyear', 'int')); $date_end = dol_mktime(0, 0, 0, GETPOST('date_finmonth', 'int'), GETPOST('date_finday', 'int'), GETPOST('date_finyear', 'int')); $date = dol_mktime(0, 0, 0, GETPOST('datemonth', 'int'), GETPOST('dateday', 'int'), GETPOST('dateyear', 'int')); @@ -120,7 +121,6 @@ if ($object->id > 0) { } // Security check -$id = GETPOST("id", 'int'); if ($user->socid) { $socid = $user->socid; } diff --git a/htdocs/expensereport/index.php b/htdocs/expensereport/index.php index be8c735edc1..8198883e58f 100644 --- a/htdocs/expensereport/index.php +++ b/htdocs/expensereport/index.php @@ -171,9 +171,6 @@ $langs->load("boxes"); $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.statut as user_status, u.photo, u.email, u.admin,"; $sql .= " d.rowid, d.ref, d.date_debut as dated, d.date_fin as datef, d.date_create as dm, d.total_ht, d.total_ttc, d.fk_statut as status"; $sql .= " FROM ".MAIN_DB_PREFIX."expensereport as d, ".MAIN_DB_PREFIX."user as u"; -if (!$user->rights->societe->client->voir && !$user->socid) { - $sql .= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc"; -} $sql .= " WHERE u.rowid = d.fk_user_author"; // RESTRICT RIGHTS if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous) @@ -183,12 +180,6 @@ if (empty($user->rights->expensereport->readall) && empty($user->rights->expense $sql .= " AND d.fk_user_author IN (".$db->sanitize(join(',', $childids)).")\n"; } $sql .= ' AND d.entity IN ('.getEntity('expensereport').')'; -if (!$user->rights->societe->client->voir && !$user->socid) { - $sql .= " AND d.fk_user_author = s.rowid AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); -} -if ($socid) { - $sql .= " AND d.fk_user_author = ".$socid; -} $sql .= $db->order($sortfield, $sortorder); $sql .= $db->plimit($max, 0); diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index e83899d28d1..ce1dc4e3c09 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -138,8 +138,8 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen $fieldstosearchall = array( 'd.ref'=>'Ref', 'd.note_public'=>"NotePublic", - 'u.lastname'=>'Lastname', - 'u.firstname'=>"Firstname", + 'u.lastname'=>'EmployeeLastname', + 'u.firstname'=>"EmployeeFirstname", 'u.login'=>"Login", ); if (empty($user->socid)) { diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php index 09485357956..50fd4c3f521 100644 --- a/htdocs/hrm/index.php +++ b/htdocs/hrm/index.php @@ -40,8 +40,13 @@ if ($conf->deplacement->enabled) { if ($conf->expensereport->enabled) { require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; } -require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentcandidature.class.php'; -require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; +if ($conf->recruitment->enabled) { + require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentcandidature.class.php'; + require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentjobposition.class.php'; +} +if ($conf->holiday->enabled) { + require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; +} $hookmanager = new HookManager($db); $hookmanager->initHooks('hrmindex'); @@ -60,10 +65,6 @@ if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INF $setupcompanynotcomplete = 1; } -$holiday = new Holiday($db); -$holidaystatic = new Holiday($db); -$staticrecruitmentcandidature = new RecruitmentCandidature($db); - $max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT; @@ -73,7 +74,8 @@ $max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT; // Update sold if (!empty($conf->holiday->enabled) && !empty($setupcompanynotcomplete)) { - $result = $holiday->updateBalance(); + $holidaystatic = new Holiday($db); + $result = $holidaystatic->updateBalance(); } @@ -144,6 +146,7 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) { // This is usel if (!empty($conf->holiday->enabled)) { if (empty($conf->global->HOLIDAY_HIDE_BALANCE)) { + $holidaystatic = new Holiday($db); $user_id = $user->id; print '
'; @@ -154,9 +157,9 @@ if (!empty($conf->holiday->enabled)) { $out = ''; $nb_holiday = 0; - $typeleaves = $holiday->getTypes(1, 1); + $typeleaves = $holidaystatic->getTypes(1, 1); foreach ($typeleaves as $key => $val) { - $nb_type = $holiday->getCPforUser($user->id, $val['rowid']); + $nb_type = $holidaystatic->getCPforUser($user->id, $val['rowid']); $nb_holiday += $nb_type; $out .= ' - '.($langs->trans($val['code']) != $val['code'] ? $langs->trans($val['code']) : $val['label']).': '.($nb_type ? price2num($nb_type) : 0).'
'; } @@ -179,7 +182,7 @@ print '
'; // Latest leave requests if (!empty($conf->holiday->enabled) && $user->rights->holiday->read) { $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.photo, u.statut as user_status,"; - $sql .= " x.rowid, x.rowid as ref, x.fk_type, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.tms as dm, x.statut as status"; + $sql .= " x.rowid, x.ref, x.fk_type, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.tms as dm, x.statut as status"; $sql .= " FROM ".MAIN_DB_PREFIX."holiday as x, ".MAIN_DB_PREFIX."user as u"; $sql .= " WHERE u.rowid = x.fk_user"; $sql .= " AND x.entity = ".$conf->entity; @@ -330,20 +333,23 @@ if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->lire) // Last modified job position if (!empty($conf->recruitment->enabled) && $user->rights->recruitment->recruitmentjobposition->read) { - $sql = "SELECT rc.rowid, rc.ref, rc.email, rc.lastname, rc.firstname, rc.date_creation, rc.tms, rc.status"; + $staticrecruitmentcandidature = new RecruitmentCandidature($db); + $staticrecruitmentjobposition = new RecruitmentJobPosition($db); + $sql = "SELECT rc.rowid, rc.ref, rc.email, rc.lastname, rc.firstname, rc.date_creation, rc.tms, rc.status,"; + $sql.= " rp.rowid as jobid, rp.ref as jobref, rp.label"; $sql .= " FROM ".MAIN_DB_PREFIX."recruitment_recruitmentcandidature as rc"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."recruitment_recruitmentjobposition as s ON rc.fk_recruitmentjobposition = s.rowid"; - if (!$user->rights->societe->client->voir && !$socid) { + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."recruitment_recruitmentjobposition as rp ON rc.fk_recruitmentjobposition = rp.rowid"; + if ($conf->societe->enabled && !$user->rights->societe->client->voir && !$socid) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } - $sql .= " WHERE rc.entity IN (".getEntity($staticrecruitmentjobposition->element).")"; - if (!$user->rights->societe->client->voir && !$socid) { - $sql .= " AND s.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id; + $sql .= " WHERE rc.entity IN (".getEntity($staticrecruitmentcandidature->element).")"; + if ($conf->societe->enabled && !$user->rights->societe->client->voir && !$socid) { + $sql .= " AND rp.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id; } if ($socid) { - $sql .= " AND s.fk_soc = $socid"; + $sql .= " AND rp.fk_soc = $socid"; } - $sql .= " ORDER BY rc.tms DESC"; + $sql .= $db->order("rc.tms", "DESC"); $sql .= $db->plimit($max, 0); $resql = $db->query($sql); @@ -354,8 +360,8 @@ if (!empty($conf->recruitment->enabled) && $user->rights->recruitment->recruitme print '
'; print '
'; + print ''; $form->select_types_paiements($typeid, 'typeid', '', 0, 1, 1, 16, 1, 'maxwidth100'); print ''; + print ''; if ($obj->payment_code) { print $langs->trans("PaymentTypeShort".$obj->payment_code); print ' '; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 48b7c505264..e5b4b2d2398 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1093,6 +1093,19 @@ if (empty($reshook)) { } } $id = $object->create($user); + if ($id < 0) { + $error++; + } else { + // copy internal contacts + if ($object->copy_linked_contact($facture_source, 'internal') < 0) { + $error++; + } elseif ($facture_source->socid == $object->socid) { + // copy external contacts if same company + if ($object->copy_linked_contact($facture_source, 'external') < 0) { + $error++; + } + } + } // NOTE: Pb with situation invoice // NOTE: fields total on situation invoice are stored as cumulative values on total of lines (bad) but delta on invoice total diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 14b0383fa8d..1ac8765171d 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -10,7 +10,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2015-2016 Ferran Marcet + * Copyright (C) 2015-2021 Ferran Marcet * Copyright (C) 2017 Josep Lluís Amador * Copyright (C) 2018 Charlene Benke * Copyright (C) 2019-2021 Alexandre Spangaro diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 39b5ded892b..04eee81ced0 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -126,8 +126,8 @@ if ($action == 'create' && GETPOST("accountid", "int") > 0 && $user->rights->ban // Define output language $outputlangs = $langs; $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && !empty($_REQUEST['lang_id'])) { - $newlang = $_REQUEST['lang_id']; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { + $newlang = GETPOST('lang_id', 'aZ09'); } //if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; if (!empty($newlang)) { @@ -177,8 +177,8 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->banque- // Define output language $outputlangs = $langs; $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && !empty($_REQUEST['lang_id'])) { - $newlang = $_REQUEST['lang_id']; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { + $newlang = GETPOST('lang_id', 'aZ09'); } //if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; if (!empty($newlang)) { @@ -219,8 +219,8 @@ if ($action == 'builddoc' && $user->rights->banque->cheque) { $outputlangs = $langs; $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && !empty($_REQUEST['lang_id'])) { - $newlang = $_REQUEST['lang_id']; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { + $newlang = GETPOST('lang_id', 'aZ09'); } //if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; if (!empty($newlang)) { diff --git a/htdocs/core/boxes/box_dolibarr_state_board.php b/htdocs/core/boxes/box_dolibarr_state_board.php index d26dd2cb075..348ffeda4cd 100644 --- a/htdocs/core/boxes/box_dolibarr_state_board.php +++ b/htdocs/core/boxes/box_dolibarr_state_board.php @@ -60,13 +60,6 @@ class box_dolibarr_state_board extends ModeleBoxes global $conf, $user; $this->db = $db; - - // disable box for such cases - if (!empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { - $this->enabled = 0; // disabled by this option - } - - $this->hidden = !(!empty($user->rights->societe->lire) && empty($user->socid)); } /** diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 625e8e23d57..9b90ed0b30a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7692,8 +7692,12 @@ class Form 'order'=>array('enabled'=>$conf->commande->enabled, 'perms'=>1, 'label'=>'LinkToOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande').')'), 'invoice'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'), 'invoice_template'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToTemplateInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'), - 'contrat'=>array('enabled'=>$conf->contrat->enabled, 'perms'=>1, 'label'=>'LinkToContract', - 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_customer as ref_client, t.ref_supplier, SUM(td.total_ht) as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t, ".MAIN_DB_PREFIX."contratdet as td WHERE t.fk_soc = s.rowid AND td.fk_contrat = t.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('contract').')'), + 'contrat'=>array( + 'enabled'=>$conf->contrat->enabled, + 'perms'=>1, + 'label'=>'LinkToContract', + 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_customer as ref_client, t.ref_supplier, SUM(td.total_ht) as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t, ".MAIN_DB_PREFIX."contratdet as td WHERE t.fk_soc = s.rowid AND td.fk_contrat = t.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('contract').') GROUP BY s.rowid, s.nom, s.client, t.rowid, t.ref, t.ref_customer, t.ref_supplier' + ), 'fichinter'=>array('enabled'=>$conf->ficheinter->enabled, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('intervention').')'), 'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled, 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('supplier_proposal').')'), 'order_supplier'=>array('enabled'=>$conf->supplier_order->enabled, 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande_fournisseur').')'), diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index ba3ff77d394..46858191c7b 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -88,8 +88,8 @@ class FormOther */ $out .= '
'; $out .= '
'; - $out .= ''; - $out .= ''; + $out .= ''; + $out .= ''; $out .= '
'; $out .= ''.$langs->trans("FeatureNotYetAvailable").''; diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 7d012077700..3cec6c19789 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -103,11 +103,13 @@ class FormTicket */ public function __construct($db) { + global $conf; + $this->db = $db; $this->action = 'add'; - $this->withcompany = 1; + $this->withcompany = $conf->societe->enabled ? 1 : 0; $this->withfromsocid = 0; $this->withfromcontactid = 0; //$this->withthreadid=0; diff --git a/htdocs/core/class/rssparser.class.php b/htdocs/core/class/rssparser.class.php index c11bdd5563d..6a8a91dbb05 100644 --- a/htdocs/core/class/rssparser.class.php +++ b/htdocs/core/class/rssparser.class.php @@ -1,19 +1,19 @@ * -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ /** * \file htdocs/core/class/rssparser.class.php @@ -538,22 +538,18 @@ class RssParser if ($el == 'channel') { $this->inchannel = true; - } elseif ($el == 'item' or $el == 'entry') { + } elseif ($el == 'item' || $el == 'entry') { $this->initem = true; if (isset($attrs['rdf:about'])) { $this->current_item['about'] = $attrs['rdf:about']; } - } elseif ($this->_format == 'rss' and - $this->current_namespace == '' and - $el == 'textinput') { + } elseif ($this->_format == 'rss' && $this->current_namespace == '' && $el == 'textinput') { // if we're in the default namespace of an RSS feed, // record textinput or image fields $this->intextinput = true; - } elseif ($this->_format == 'rss' and - $this->current_namespace == '' and - $el == 'image') { + } elseif ($this->_format == 'rss' && $this->current_namespace == '' && $el == 'image') { $this->inimage = true; - } elseif ($this->_format == 'atom' and in_array($el, $this->_CONTENT_CONSTRUCTS)) { + } elseif ($this->_format == 'atom' && in_array($el, $this->_CONTENT_CONSTRUCTS)) { // handle atom content constructs // avoid clashing w/ RSS mod_content if ($el == 'content') { @@ -561,7 +557,7 @@ class RssParser } $this->incontent = $el; - } elseif ($this->_format == 'atom' and $this->incontent) { + } elseif ($this->_format == 'atom' && $this->incontent) { // if inside an Atom content construct (e.g. content or summary) field treat tags as text // if tags are inlined, then flatten $attrs_str = join(' ', array_map('map_attrs', array_keys($attrs), array_values($attrs))); @@ -569,7 +565,7 @@ class RssParser $this->append_content("<$element $attrs_str>"); array_unshift($this->stack, $el); - } elseif ($this->_format == 'atom' and $el == 'link') { + } elseif ($this->_format == 'atom' && $el == 'link') { // Atom support many links per containging element. // Magpie treats link elements of type rel='alternate' // as being equivalent to RSS's simple link element. diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index 9534970a856..d2987e8fc63 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -354,7 +354,7 @@ class Utils $execmethod = 1; } - dol_syslog("Utils::dumpDatabase execmethod=".$execmethod." command:".$fullcommandcrypted, LOG_DEBUG); + dol_syslog("Utils::dumpDatabase execmethod=".$execmethod." command:".$fullcommandcrypted, LOG_INFO); // TODO Replace with executeCLI function if ($execmethod == 1) { diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index 15e7286ab08..880019d7b97 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -316,8 +316,8 @@ function show_list_sending_receive($origin, $origin_id, $filter = '') $outputlangs = $langs; $newlang = ''; - if (empty($newlang) && !empty($_REQUEST['lang_id'])) { - $newlang = $_REQUEST['lang_id']; + if (empty($newlang) && GETPOST('lang_id', 'aZ09')) { + $newlang = GETPOST('lang_id', 'aZ09'); } if (empty($newlang)) { $newlang = $object->thirdparty->default_lang; diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index e2e06487de8..4d9d4bb2fa2 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -84,7 +84,7 @@ function ticket_prepare_head($object) $head[$h][2] = 'tabTicket'; $h++; - if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && empty($user->socid)) { + if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && empty($user->socid) && $conf->societe->enabled) { $nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external')); $head[$h][0] = DOL_URL_ROOT.'/ticket/contact.php?track_id='.$object->track_id; $head[$h][1] = $langs->trans('ContactsAddresses'); @@ -157,7 +157,8 @@ function showDirectPublicLink($object) $out = ''; if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) { - $out .= ''.$langs->trans("PublicInterfaceNotEnabled").''; + $langs->load('errors'); + $out .= ''.$langs->trans("ErrorPublicInterfaceNotEnabled").''; } else { $out .= img_picto('', 'object_globe.png').' '.$langs->trans("TicketPublicAccess").'
'; if ($url) { diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index 4fa0f053236..89fd777cd20 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -502,7 +502,7 @@ function includeContainer($containerref) } $includehtmlcontentopened++; if ($includehtmlcontentopened > $MAXLEVEL) { - print 'ERROR: RECURSIVE CONTENT LEVEL. Depth of recursive call is more than the limit of '.$MAXLEVEL.".\n"; + print 'ERROR: RECURSIVE CONTENT LEVEL. Depth of recursive call is more than the limit of '.((int) $MAXLEVEL).".\n"; return; } @@ -549,20 +549,20 @@ function getStructuredData($type, $data = array()) "@type": "SoftwareApplication", "name": "'.dol_escape_json($data['name']).'", "operatingSystem": "'.dol_escape_json($data['os']).'", - "applicationCategory": "https://schema.org/'.$data['applicationCategory'].'",'; + "applicationCategory": "https://schema.org/'.dol_escape_json($data['applicationCategory']).'",'; if (!empty($data['ratingcount'])) { $ret .= ' "aggregateRating": { "@type": "AggregateRating", - "ratingValue": "'.$data['ratingvalue'].'", - "ratingCount": "'.$data['ratingcount'].'" + "ratingValue": "'.dol_escape_json($data['ratingvalue']).'", + "ratingCount": "'.dol_escape_json($data['ratingcount']).'" },'; } $ret .= ' "offers": { "@type": "Offer", - "price": "'.$data['price'].'", - "priceCurrency": "'.($data['currency'] ? $data['currency'] : $conf->currency).'" + "price": "'.dol_escape_json($data['price']).'", + "priceCurrency": "'.dol_escape_json($data['currency'] ? $data['currency'] : $conf->currency).'" } }'."\n"; $ret .= ''."\n"; @@ -618,7 +618,7 @@ function getStructuredData($type, $data = array()) $pageurl = str_replace('__WEBSITE_KEY__', $website->ref, $pageurl); $title = str_replace('__WEBSITE_KEY__', $website->ref, $title); - $image = '/medias/'.str_replace('__WEBSITE_KEY__', $website->ref, $image); + $image = '/medias'.(preg_match('/^\//', $image) ? '' : '/').str_replace('__WEBSITE_KEY__', $website->ref, $image); $companyname = str_replace('__WEBSITE_KEY__', $website->ref, $companyname); $description = str_replace('__WEBSITE_KEY__', $website->ref, $description); @@ -666,6 +666,8 @@ function getStructuredData($type, $data = array()) $ret .= '"description": "'.dol_escape_json($description).'"'; $ret .= "\n".'}'."\n"; $ret .= ''."\n"; + } else { + $ret .= ''."\n"; } } elseif ($type == 'product') { $ret = ''."\n"; @@ -691,8 +693,8 @@ function getStructuredData($type, $data = array()) "offers": { "@type": "Offer", "url": "https://example.com/anvil", - "priceCurrency": "'.($data['currency'] ? $data['currency'] : $conf->currency).'", - "price": "'.$data['price'].'", + "priceCurrency": "'.dol_escape_json($data['currency'] ? $data['currency'] : $conf->currency).'", + "price": "'.dol_escape_json($data['price']).'", "itemCondition": "https://schema.org/UsedCondition", "availability": "https://schema.org/InStock", "seller": { diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index df1a625fdc8..b56fbc758db 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -1516,7 +1516,7 @@ class pdf_azur extends ModelePDFPropales $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->date, "day", false, $outputlangs, true), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("DatePropal")." : ".dol_print_date($object->date, "day", false, $outputlangs, true), '', 'R'); $posy += 4; $pdf->SetXY($posx, $posy); diff --git a/htdocs/core/tpl/admin_extrafields_view.tpl.php b/htdocs/core/tpl/admin_extrafields_view.tpl.php index c4a21812b01..284407383d4 100644 --- a/htdocs/core/tpl/admin_extrafields_view.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_view.tpl.php @@ -115,12 +115,14 @@ if (isset($extrafields->attributes[$elementtype]['type']) && is_array($extrafiel } print '
'.img_edit().''; - print '  '.img_delete().''; + print ''.img_edit().''; + print '  '.img_delete().''; + print '
'; print dol_print_date($db->jdate($obj->delivery_date), "dayhour"); - /*$now = time(); - if ( ($now - $db->jdate($obj->date_expedition)) > $conf->warnings->lim && $obj->statutid == 1 ) - { - }*/ print "
'; print ''; - print ''; print ''; print ''; @@ -370,11 +376,15 @@ if (!empty($conf->recruitment->enabled) && $user->rights->recruitment->recruitme $staticrecruitmentcandidature->firstname = $objp->firstname; $staticrecruitmentcandidature->lastname = $objp->lastname; + $staticrecruitmentjobposition->id = $objp->jobid; + $staticrecruitmentjobposition->ref = $objp->jobref; + $staticrecruitmentjobposition->label = $objp->label; + print ''; print ''; - print '"; - print '"; + print ''; + print ''; + print ''; print '"; diff --git a/htdocs/install/fileconf.php b/htdocs/install/fileconf.php index 3f2e714640a..42c8d3459fe 100644 --- a/htdocs/install/fileconf.php +++ b/htdocs/install/fileconf.php @@ -33,7 +33,7 @@ global $langs; $err = 0; -$setuplang = GETPOST("selectlang", '', 3) ? GETPOST("selectlang", '', 3) : (GETPOST('lang', 'alpha', 1) ? GETPOST('lang', 'alpha', 1) : 'auto'); +$setuplang = GETPOST("selectlang", 'alpha', 3) ? GETPOST("selectlang", 'alpha', 3) : (GETPOST('lang', 'alpha', 1) ? GETPOST('lang', 'alpha', 1) : 'auto'); $langs->setDefaultLang($setuplang); $langs->loadLangs(array("install", "errors")); diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index 37719c015c5..cf5da55d719 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -64,6 +64,10 @@ ALTER TABLE llx_export_model MODIFY COLUMN type varchar(64); -- For v14 +ALTER TABLE llx_product_lot ADD COLUMN eol_date datetime NULL; +ALTER TABLE llx_product_lot ADD COLUMN manufacturing_date datetime NULL; +ALTER TABLE llx_product_lot ADD COLUMN scrapping_date datetime NULL; + create table llx_accounting_groups_account ( rowid integer AUTO_INCREMENT PRIMARY KEY, @@ -487,11 +491,15 @@ CREATE TABLE llx_knowledgemanagement_knowledgerecord( import_key varchar(14), model_pdf varchar(255), question text NOT NULL, - answer text, + answer text, + fk_ticket integer, status integer NOT NULL -- END MODULEBUILDER FIELDS ) ENGINE=innodb; +ALTER TABLE llx_knowledgemanagement_knowledgerecord ADD COLUMN fk_ticket integer; + + create table llx_knowledgemanagement_knowledgerecord_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, diff --git a/htdocs/install/mysql/tables/llx_c_ticket_category.sql b/htdocs/install/mysql/tables/llx_c_ticket_category.sql index 10d16331a06..57bd15f2c23 100644 --- a/htdocs/install/mysql/tables/llx_c_ticket_category.sql +++ b/htdocs/install/mysql/tables/llx_c_ticket_category.sql @@ -15,7 +15,7 @@ -- along with this program. If not, see . -- --- Table with the categories of a ticket +-- Table with the custom category tree for the category of a ticket -- create table llx_c_ticket_category diff --git a/htdocs/install/mysql/tables/llx_c_ticket_type.sql b/htdocs/install/mysql/tables/llx_c_ticket_type.sql index d480036d5d5..462d1a71535 100644 --- a/htdocs/install/mysql/tables/llx_c_ticket_type.sql +++ b/htdocs/install/mysql/tables/llx_c_ticket_type.sql @@ -13,7 +13,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- --- +-- Type of ticket. For example: COM, ISSUE, REQUEST, PROJECT, OTHER, ... create table llx_c_ticket_type ( diff --git a/htdocs/install/mysql/tables/llx_knowledgemanagement_knowledgerecord.sql b/htdocs/install/mysql/tables/llx_knowledgemanagement_knowledgerecord.sql index 9c2866980ec..5c9e4cf199f 100644 --- a/htdocs/install/mysql/tables/llx_knowledgemanagement_knowledgerecord.sql +++ b/htdocs/install/mysql/tables/llx_knowledgemanagement_knowledgerecord.sql @@ -27,7 +27,8 @@ CREATE TABLE llx_knowledgemanagement_knowledgerecord( import_key varchar(14), model_pdf varchar(255), question text NOT NULL, - answer text, + answer text, + fk_ticket integer, status integer NOT NULL -- END MODULEBUILDER FIELDS ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_product_lot.sql b/htdocs/install/mysql/tables/llx_product_lot.sql index 86cca7d0f04..f8d02f19ccb 100644 --- a/htdocs/install/mysql/tables/llx_product_lot.sql +++ b/htdocs/install/mysql/tables/llx_product_lot.sql @@ -24,6 +24,9 @@ CREATE TABLE llx_product_lot ( batch varchar(128) DEFAULT NULL, -- Lot or serial number eatby date DEFAULT NULL, -- Eatby date sellby date DEFAULT NULL, -- Sellby date + eol_date datetime NULL, + manufacturing_date datetime NULL, + scrapping_date datetime NULL, datec datetime, tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer, diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index 2dba1581d9e..4d46794aaf8 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -110,8 +110,8 @@ class KnowledgeRecord extends CommonObject 'fk_user_valid' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>'1', 'position'=>512, 'notnull'=>0, 'visible'=>-2,), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,), 'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>1010, 'notnull'=>-1, 'visible'=>0,), - 'question' => array('type'=>'text', 'label'=>'Question', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1,), - 'answer' => array('type'=>'html', 'label'=>'Solution', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>-1,), + 'question' => array('type'=>'text', 'label'=>'Question', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'csslist'=>'tdoverflow300'), + 'answer' => array('type'=>'html', 'label'=>'Solution', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>3, 'csslist'=>'tdoverflow300'), 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'notnull'=>1, 'visible'=>1, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Valid'),), ); public $rowid; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 9f4bcfcfbd4..467fba89199 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2127,7 +2127,8 @@ ConfFileIsReadableOrWritableByAnyUsers=The conf file is readable or writable by MailToSendEventOrganization=Event Organization AGENDA_EVENT_DEFAULT_STATUS=Default event status when creating a event from the form YouShouldDisablePHPFunctions=You should disable PHP functions -IfCLINotRequiredYouShouldDisablePHPFunctions=Except if you need to run system commands (for the module Scheduled job, or to run the external command line Anti-virus for example), you shoud disable PHP functions +IfCLINotRequiredYouShouldDisablePHPFunctions=Except if you need to run system commands in custom code, you shoud disable PHP functions +PHPFunctionsRequiredForCLI=For shell purpose (like scheduled job backup or running an anitivurs program), you must keep PHP functions NoWritableFilesFoundIntoRootDir=No writable files or directories of the common programs were found into your root directory (Good) RecommendedValueIs=Recommended: %s NotRecommended=Not recommanded @@ -2137,3 +2138,4 @@ CheckForModuleUpdateHelp=This action will connect to editors of external modules ModuleUpdateAvailable=An update is available NoExternalModuleWithUpdate=No updates found for external modules SwaggerDescriptionFile=Swagger API description file (for use with redoc for example) +YouEnableDeprecatedWSAPIsUseRESTAPIsInstead=You enabled deprecated WS API. You should use REST API instead. \ No newline at end of file diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index a1155b0f57c..f2d9106107b 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -117,7 +117,7 @@ ErrorCantReadFile=Failed to read file '%s' ErrorCantReadDir=Failed to read directory '%s' ErrorBadLoginPassword=Bad value for login or password ErrorLoginDisabled=Your account has been disabled -ErrorFailedToRunExternalCommand=Failed to run external command. Check it is available and runnable by your PHP server. If PHP Safe Mode is enabled, check that command is inside a directory defined by parameter safe_mode_exec_dir. +ErrorFailedToRunExternalCommand=Failed to run external command. Check it is available and runnable by your PHP server user. Check also the command is not protected on shell level by a security layer like apparmor. ErrorFailedToChangePassword=Failed to change password ErrorLoginDoesNotExists=User with login %s could not be found. ErrorLoginHasNoEmail=This user has no email address. Process aborted. diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 5960f900cca..ddb94c70279 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -249,7 +249,7 @@ SelectAStockMovementFileToImport=select a stock movement file to import InfoTemplateImport=Uploaded file needs to have this format (* are mandatory fields):
Source Warehouse* | Target Warehouse* | Product* | Quantity* | Lot/serial number
CSV character separator must be "%s" LabelOfInventoryMovemement=Inventory %s ReOpen=Reopen -ConfirmFinish=Do you confirm the closing of the inventory ? This will generate all stock movements to update your stock. +ConfirmFinish=Do you confirm the closing of the inventory ? This will generate all stock movements to update your stock to the real qty you entered into the inventory. ObjectNotFound=%s not found MakeMovementsAndClose=Generate movements and close AutofillWithExpected=Fill real quantity with expected quantity \ No newline at end of file diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 0c3679adac5..c9a7dd21ccc 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2201,6 +2201,7 @@ function top_menu_quickadd() { global $langs, $conf, $db, $hookmanager, $user; global $menumanager; + $html = ''; // Define $dropDownQuickAddHtml $dropDownQuickAddHtml = ''; $parameters = array(); diff --git a/htdocs/recruitment/recruitmentindex.php b/htdocs/recruitment/recruitmentindex.php index 3b6ff756b3c..7e369fe6bb2 100644 --- a/htdocs/recruitment/recruitmentindex.php +++ b/htdocs/recruitment/recruitmentindex.php @@ -331,18 +331,18 @@ if (!empty($conf->recruitment->enabled) && $user->rights->recruitment->recruitme $sql = "SELECT s.rowid, s.ref, s.label, s.date_creation, s.tms, s.status, COUNT(rc.rowid) as nbapplications"; $sql .= " FROM ".MAIN_DB_PREFIX."recruitment_recruitmentjobposition as s"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."recruitment_recruitmentcandidature as rc ON rc.fk_recruitmentjobposition = s.rowid"; - if (!$user->rights->societe->client->voir && !$socid) { + if ($conf->societe->enabled && !$user->rights->societe->client->voir && !$socid) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= " WHERE s.entity IN (".getEntity($staticrecruitmentjobposition->element).")"; - if (!$user->rights->societe->client->voir && !$socid) { + if ($conf->societe->enabled && !$user->rights->societe->client->voir && !$socid) { $sql .= " AND s.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id; } if ($socid) { $sql .= " AND s.fk_soc = $socid"; } $sql .= " GROUP BY s.rowid, s.ref, s.label, s.date_creation, s.tms, s.status"; - $sql .= " ORDER BY s.tms DESC"; + $sql .= $db->order('s.tms', 'DESC'); $sql .= $db->plimit($max, 0); $resql = $db->query($sql); @@ -402,17 +402,17 @@ if (!empty($conf->recruitment->enabled) && $user->rights->recruitment->recruitme $sql = "SELECT rc.rowid, rc.ref, rc.email, rc.lastname, rc.firstname, rc.date_creation, rc.tms, rc.status"; $sql .= " FROM ".MAIN_DB_PREFIX."recruitment_recruitmentcandidature as rc"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."recruitment_recruitmentjobposition as s ON rc.fk_recruitmentjobposition = s.rowid"; - if (!$user->rights->societe->client->voir && !$socid) { + if ($conf->societe->enabled && !$user->rights->societe->client->voir && !$socid) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= " WHERE rc.entity IN (".getEntity($staticrecruitmentjobposition->element).")"; - if (!$user->rights->societe->client->voir && !$socid) { + if ($conf->societe->enabled && !$user->rights->societe->client->voir && !$socid) { $sql .= " AND s.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id; } if ($socid) { $sql .= " AND s.fk_soc = $socid"; } - $sql .= " ORDER BY rc.tms DESC"; + $sql .= $db->order('rc.tms', 'DESC'); $sql .= $db->plimit($max, 0); $resql = $db->query($sql); diff --git a/htdocs/salaries/stats/index.php b/htdocs/salaries/stats/index.php index 1fe914d38c2..1a7f2de6d39 100644 --- a/htdocs/salaries/stats/index.php +++ b/htdocs/salaries/stats/index.php @@ -238,16 +238,16 @@ foreach ($data as $val) { print '
'; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; } print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; $oldyear = $year; } diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index defcc71a3e5..946ceeb42f3 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -480,6 +480,7 @@ class Societe extends CommonObject public $remise_percent; public $remise_supplier_percent; + public $mode_reglement_supplier_id; public $cond_reglement_supplier_id; public $transport_mode_supplier_id; @@ -1636,14 +1637,14 @@ class Societe extends CommonObject $sql .= ', s.fk_typent as typent_id'; $sql .= ', s.fk_effectif as effectif_id'; $sql .= ', s.fk_forme_juridique as forme_juridique_code'; - $sql .= ', s.webservices_url, s.webservices_key'; + $sql .= ', s.webservices_url, s.webservices_key, s.model_pdf'; if (empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { $sql .= ', s.accountancy_code_buy, s.accountancy_code_sell'; } else { $sql .= ', spe.accountancy_code_buy, spe.accountancy_code_sell'; } $sql .= ', s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur, s.parent, s.barcode'; - $sql .= ', s.fk_departement as state_id, s.fk_pays as country_id, s.fk_stcomm, s.remise_supplier, s.mode_reglement, s.cond_reglement, s.transport_mode'; + $sql .= ', s.fk_departement as state_id, s.fk_pays as country_id, s.fk_stcomm, s.mode_reglement, s.cond_reglement, s.transport_mode'; $sql .= ', s.fk_account, s.tva_assuj'; $sql .= ', s.mode_reglement_supplier, s.cond_reglement_supplier, s.transport_mode_supplier'; $sql .= ', s.localtax1_assuj, s.localtax1_value, s.localtax2_assuj, s.localtax2_value, s.fk_prospectlevel, s.default_lang, s.logo, s.logo_squarred'; @@ -1659,7 +1660,11 @@ class Societe extends CommonObject $sql .= ', st.libelle as stcomm, st.picto as stcomm_picto'; $sql .= ', te.code as typent_code'; $sql .= ', i.libelle as label_incoterms'; - $sql .= ', sr.remise_client, model_pdf'; + if (empty($conf->multicompany->enabled)) { + $sql .= ', s.remise_client, s.remise_supplier'; + } else { + $sql .= ', sr.remise_client, sr2.remise_supplier'; + } $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s'; if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity); @@ -1672,8 +1677,12 @@ class Societe extends CommonObject $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_regions as r ON d.fk_region = r.code_region '; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as te ON s.fk_typent = te.id'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON s.fk_incoterms = i.rowid'; - $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_remise as sr ON sr.rowid = (SELECT MAX(rowid) FROM '.MAIN_DB_PREFIX.'societe_remise WHERE fk_soc = s.rowid AND entity IN ('.getEntity('discount').'))'; - + // With default setup, llx_societe_remise is a history table in default setup and current value is in llx_societe. + // We use it for real value when multicompany is on. A better place would be into llx_societe_perentity. + if (!empty($conf->multicompany->enabled)) { + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_remise as sr ON sr.rowid = (SELECT MAX(rowid) FROM '.MAIN_DB_PREFIX.'societe_remise WHERE fk_soc = s.rowid AND entity IN ('.getEntity('discount').'))'; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_remise_supplier as sr2 ON sr2.rowid = (SELECT MAX(rowid) FROM '.MAIN_DB_PREFIX.'societe_remise_supplier WHERE fk_soc = s.rowid AND entity IN ('.getEntity('discount').'))'; + } $sql .= ' WHERE s.entity IN ('.getEntity($this->element).')'; if ($rowid) { $sql .= ' AND s.rowid = '.((int) $rowid); @@ -1809,6 +1818,7 @@ class Societe extends CommonObject $this->remise_percent = $obj->remise_client ? price2num($obj->remise_client) : 0; // 0.000000 must be 0 $this->remise_supplier_percent = $obj->remise_supplier; + $this->mode_reglement_id = $obj->mode_reglement; $this->cond_reglement_id = $obj->cond_reglement; $this->transport_mode_id = $obj->transport_mode; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 912cf21a1de..3518518a5ef 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -6767,9 +6767,9 @@ div.phpdebugbar-widgets-templates a.phpdebugbar-widgets-editor-link:before /* ============================================================================== */ span.clipboardCPValue.hidewithsize { - width: 0 !important; - display: inline-block; - color: transparent; + width: 0 !important; + display: inline-block; + color: transparent; } .clipboardCPShowOnHover .clipboardCPButton { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 8152e56e945..70a2ce1303e 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -369,7 +369,7 @@ select.vmenusearchselectcombo { background-color: unset; } -textarea:focus, button:focus { +textarea:focus { /* v6 box-shadow: 0 0 4px #8091BF; */ border: 1px solid #aaa !important; } @@ -738,6 +738,9 @@ div.floatright .largenumber { font-size: 1.4em; } +button:focus { + outline: none; +} th .button { -webkit-box-shadow: none !important; @@ -790,10 +793,19 @@ textarea.centpercent { color: #777; } +.flip { + transform: scaleX(-1) translate(2px, 0); +} +.rotate90 { + transform: rotate(90deg) translate(0, 2px); +} .center { text-align: center; margin: 0px auto; } +.alignstart { + text-align: start; +} .left { text-align: ; } @@ -3833,7 +3845,7 @@ tr.liste_titre_sel th, th.liste_titre_sel, tr.liste_titre_sel td, td.liste_titre font-family: ; font-weight: normal; border-bottom: 1px solid #FDFFFF; - text-decoration: underline; + /* text-decoration: underline; */ } input.liste_titre { background: transparent; @@ -4278,10 +4290,10 @@ div.divphotoref > a > .photowithmargin { /* Margin right for photo not inside a .photowithborder { border: 1px solid #f0f0f0; } -.photointoolitp { +.photointooltip { margin-top: 8px; margin-bottom: 6px; - text-align: center; + text-align: center !important; } .photodelete { margin-top: 6px !important; @@ -6611,9 +6623,9 @@ div.phpdebugbar-widgets-templates a.phpdebugbar-widgets-editor-link:before /* ============================================================================== */ span.clipboardCPValue.hidewithsize { - width: 0 !important; - display: inline-block; - color: transparent; + width: 0 !important; + display: inline-block; + color: transparent; } .clipboardCPShowOnHover .clipboardCPButton { diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 4b4b8e594d4..e04e3c51ce3 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -1364,8 +1364,8 @@ if ($action == 'create' || $action == 'presend') { // Define output language $outputlangs = $langs; $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && !empty($_REQUEST['lang_id'])) { - $newlang = $_REQUEST['lang_id']; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { + $newlang = GETPOST('lang_id', 'aZ09'); } if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { $newlang = $object->default_lang; diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 6c883be6b1a..5180abe6140 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -2917,7 +2917,7 @@ class Ticket extends CommonObject $sql = "SELECT p.rowid, p.ref, p.datec as datec"; $sql .= " FROM ".MAIN_DB_PREFIX."ticket as p"; - if (!$user->rights->societe->client->voir && !$user->socid) { + if ($conf->societe->enabled && !$user->rights->societe->client->voir && !$user->socid) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc"; $sql .= " WHERE sc.fk_user = ".$user->id; $clause = " AND"; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 2752ee745a1..891c71867eb 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2795,10 +2795,10 @@ class User extends CommonObject if (!empty($conf->global->LDAP_FIELD_USERID)) { $info[$conf->global->LDAP_FIELD_USERID] = $this->id; } - if (!empty($info[$conf->global->LDAP_FIELD_GROUPID])) { + if (!empty($conf->global->LDAP_FIELD_GROUPID)) { $usergroup = new UserGroup($this->db); $groupslist = $usergroup->listGroupsForUser($this->id); - $info[$conf->global->LDAP_FIELD_GROUPID] = '1'; + $info[$conf->global->LDAP_FIELD_GROUPID] = '65534'; if (!empty($groupslist)) { foreach ($groupslist as $groupforuser) { $info[$conf->global->LDAP_FIELD_GROUPID] = $groupforuser->id; //Select first group in list @@ -2806,8 +2806,8 @@ class User extends CommonObject } } } - if (!empty($this->firstname) && !empty($conf->global->LDAP_FIELD_HOMEDIRECTORY) && !empty($conf->global->LDAP_FIELD_HOMEDIRECTORYPREFIX)) { - $info[$conf->global->LDAP_FIELD_HOMEDIRECTORY] = "{$conf->global->LDAP_FIELD_HOMEDIRECTORYPREFIX}/$this->firstname"; + if (!empty($conf->global->LDAP_FIELD_HOMEDIRECTORY) && !empty($conf->global->LDAP_FIELD_HOMEDIRECTORYPREFIX)) { + $info[$conf->global->LDAP_FIELD_HOMEDIRECTORY] = "{$conf->global->LDAP_FIELD_HOMEDIRECTORYPREFIX}/$this->login"; } return $info; diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 3738c63b435..b393d8ae261 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -855,10 +855,10 @@ class UserGroup extends CommonObject $valueofldapfield[] = $muser->_load_ldap_dn($info2); } $info[$conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS] = (!empty($valueofldapfield) ? $valueofldapfield : ''); - } - if (!empty($info[$conf->global->LDAP_GROUP_FIELD_GROUPID])) { - $info[$conf->global->LDAP_GROUP_FIELD_GROUPID] = $this->id; - } + } + if (!empty($conf->global->LDAP_GROUP_FIELD_GROUPID)) { + $info[$conf->global->LDAP_GROUP_FIELD_GROUPID] = $this->id; + } return $info; } diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index 33921544b45..19b78cf06e9 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -138,7 +138,11 @@ if (empty($reshook)) { if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { $object->entity = 0; } else { - $object->entity = GETPOST("entity"); + if ($conf->entity == 1 && $user->admin && !$user->entity) { // Same permissions test than the one used to show the combo of entities into the form + $object->entity = GETPOSTISSET("entity") ? GETPOST("entity") : $conf->entity; + } else { + $object->entity = $conf->entity; + } } $db->begin(); diff --git a/htdocs/user/group/ldap.php b/htdocs/user/group/ldap.php index aee79688aee..458978d25ea 100644 --- a/htdocs/user/group/ldap.php +++ b/htdocs/user/group/ldap.php @@ -67,8 +67,8 @@ if ($action == 'dolibarr2ldap') { if ($result > 0) { $info = $object->_load_ldap_info(); - // Get a gid number for objectclass PosixGroup - if (in_array('posixGroup', $info['objectclass'])) { + // Get a gid number for objectclass PosixGroup if none was provided + if (empty($info[$conf->global->LDAP_GROUP_FIELD_GROUPID]) && in_array('posixGroup', $info['objectclass'])) { $info['gidNumber'] = $ldap->getNextGroupGid('LDAP_KEY_GROUPS'); } diff --git a/htdocs/website/index.php b/htdocs/website/index.php index da1244b567c..7247427363a 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2390,6 +2390,18 @@ if ($action == 'generatesitemaps' && $usercanedit) { } } + // Now add sitempas extension for news + // TODO When adding and when not ? + /* + + The Example Times + en + + 2008-12-23 + Companies A, B in Merger Talks + + */ + $root->appendChild($url); $i++; }
'; - print $langs->trans("BoxTitleLatestModifiedCandidatures", $max); + print ''; + print $langs->trans("BoxTitleLatestModifiedCandidatures", min($max, $num)); print ''.$langs->trans("FullList").'
'.$staticrecruitmentcandidature->getNomUrl(1, '').''; - print "'.dol_print_date($db->jdate($objp->tms), 'day')."'.$staticrecruitmentcandidature->getFullName($langs).''.$staticrecruitmentjobposition->getNomUrl(1).''.dol_print_date($db->jdate($objp->tms), 'day').''; print $staticrecruitmentcandidature->getLibStatut(3); print "
'.$oldyear.'00000
'.$year.''.$val['nb'].''.price(price2num($val['total'], 'MT'), 1).''.price(price2num($val['avg'], 'MT'), 1).''.price(price2num($val['total'], 'MT'), 1).''.price(price2num($val['avg'], 'MT'), 1).'