diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 035387834bd..84deea18f00 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -3,7 +3,7 @@ *Please:* - *only keep the "Fix", "Close" or "New" section* - *follow the project [contributing guidelines](/.github/CONTRIBUTING.md)* -- *replace the bracket enclosed textswith meaningful informations* +- *replace the bracket enclosed texts with meaningful information* # Fix #[*issue_number Short description*] diff --git a/ChangeLog b/ChangeLog index c477a17d684..66bccd31c06 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,16 @@ English Dolibarr ChangeLog -------------------------------------------------------------- +***** ChangeLog for 15.0.0 compared to 14.0.0 ***** + +For developers: +--------------- + +WARNING: + +Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: +* Update hook 'printOriginObjectLine', removed check on product type and special code. Need now reshook. + ***** ChangeLog for 14.0.0 compared to 13.0.0 ***** For users: diff --git a/README.md b/README.md index 7878f6270a7..834cc09236e 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ If you don't have time to install it yourself, you can try some commercial 'read ## UPGRADING -Dolibarr supports upgrading usually wihtout the need for any (commercial) support (depending on if you use any commercial extensions) and supports upgrading all the way from any version after 2.8 without breakage. This is unique in the ERP ecosystem and a benefit our users highly appreciate! +Dolibarr supports upgrading, usually without the need for any (commercial) support (depending on if you use any commercial extensions). It supports upgrading all the way from any version after 2.8 without breakage. This is unique in the ERP ecosystem and a benefit our users highly appreciate! - At first make a backup of your Dolibarr files & than [see](https://wiki.dolibarr.org/index.php/Installation_-_Upgrade#Upgrade_Dolibarr) - Check that your installed PHP version is supported by the new version [see PHP support](./doc/phpmatrix.md). diff --git a/dev/tools/spider.php b/dev/tools/spider.php new file mode 100644 index 00000000000..954978b24df --- /dev/null +++ b/dev/tools/spider.php @@ -0,0 +1,145 @@ +#!/usr/bin/env php +. + */ + +/** + * \file dev/tools/spider.php + * \brief Script to spider Dolibarr app. + * + * To use it: + * - Disable module "bookmark" + * - Exclude param optioncss, token, sortfield, sortorder + */ + +$crawledLinks=array(); +const MAX_DEPTH=2; + + +/** + * @param string $url URL + * @param string $depth Depth + * @return string String + */ +function followLink($url, $depth = 0) +{ + global $crawledLinks; + $crawling=array(); + if ($depth>MAX_DEPTH) { + echo "
The Crawler is giving up!
"; + return; + } + $options=array( + 'http'=>array( + 'method'=>"GET", + 'user-agent'=>"gfgBot/0.1\n" + ) + ); + $context=stream_context_create($options); + $doc=new DomDocument(); + @$doc->loadHTML(file_get_contents($url, false, $context)); + $links=$doc->getElementsByTagName('a'); + $pageTitle=getDocTitle($doc, $url); + $metaData=getDocMetaData($doc); + foreach ($links as $i) { + $link=$i->getAttribute('href'); + if (ignoreLink($link)) continue; + $link=convertLink($url, $link); + if (!in_array($link, $crawledLinks)) { + $crawledLinks[]=$link; + $crawling[]=$link; + insertIntoDatabase($link, $pageTitle, $metaData, $depth); + } + } + foreach ($crawling as $crawlURL) + followLink($crawlURL, $depth+1); +} + +/** + * @param string $site Site + * @param string $path Path + * @return string String + */ +function convertLink($site, $path) +{ + if (substr_compare($path, "//", 0, 2)==0) + return parse_url($site)['scheme'].$path; + elseif (substr_compare($path, "http://", 0, 7)==0 or + substr_compare($path, "https://", 0, 8)==0 or + substr_compare($path, "www.", 0, 4)==0) + return $path; + else return $site.'/'.$path; +} + +/** + * @param string $url URL + * @return boolean + */ +function ignoreLink($url) +{ + return $url[0]=="#" or substr($url, 0, 11) == "javascript:"; +} + +/** + * @param string $link URL + * @param string $title Title + * @param string $metaData Array + * @param int $depth Depth + * @return void + */ +function insertIntoDatabase($link, $title, &$metaData, $depth) +{ + //global $crawledLinks; + + echo "Inserting new record {URL= ".$link.", Title = '$title', Description = '".$metaData['description']."', Keywords = ' ".$metaData['keywords']."'}


"; + + //²$crawledLinks[]=$link; +} + +/** + * @param string $doc Doc + * @param string $url URL + * @return string URL/Title + */ +function getDocTitle(&$doc, $url) +{ + $titleNodes=$doc->getElementsByTagName('title'); + if (count($titleNodes)==0 or !isset($titleNodes[0]->nodeValue)) + return $url; + $title=str_replace('', '\n', $titleNodes[0]->nodeValue); + return (strlen($title)<1)?$url:$title; +} + +/** + * @param string $doc Doc + * @return array Array + */ +function getDocMetaData(&$doc) +{ + $metaData=array(); + $metaNodes=$doc->getElementsByTagName('meta'); + foreach ($metaNodes as $node) + $metaData[$node->getAttribute("name")] = $node->getAttribute("content"); + if (!isset($metaData['description'])) + $metaData['description']='No Description Available'; + if (!isset($metaData['keywords'])) $metaData['keywords']=''; + return array( + 'keywords'=>str_replace('', '\n', $metaData['keywords']), + 'description'=>str_replace('', '\n', $metaData['description']) + ); +} + + +followLink("http://localhost/dolibarr_dev/htdocs"); diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index 6e13a662948..1842c23f418 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -49,7 +49,7 @@ if (empty($user->rights->accounting->mouvements->lire)) { if (empty($conf->comptabilite->enabled) && empty($conf->accounting->enabled) && empty($conf->asset->enabled) && empty($conf->intracommreport->enabled)) { accessforbidden(); } -if (empty($user->rights->compta->resultat->lire) && empty($user->rights->accounting->mouvements->lire) && empty($user->rights->asset->read) && empty($user->rights->intracommreport->read)) { +if (empty($user->rights->compta->resultat->lire) && empty($user->rights->accounting->comptarapport->lire) && empty($user->rights->accounting->mouvements->lire) && empty($user->rights->asset->read) && empty($user->rights->intracommreport->read)) { accessforbidden(); } diff --git a/htdocs/admin/agenda_reminder.php b/htdocs/admin/agenda_reminder.php index b3a85d1fe4b..2b2da673202 100644 --- a/htdocs/admin/agenda_reminder.php +++ b/htdocs/admin/agenda_reminder.php @@ -226,6 +226,7 @@ if (empty($conf->cron->enabled)) { // Get the max frequency of reminder if ($job->id > 0) { if ($job->status != $job::STATUS_ENABLED) { + $langs->load("cron"); print ''.$langs->trans("JobXMustBeEnabled", $langs->transnoentitiesnoconv("sendEmailsReminder")).''; } else { print ''.img_picto($langs->trans('Enabled'), 'switch_on').''; diff --git a/htdocs/admin/clicktodial.php b/htdocs/admin/clicktodial.php index 9fd92f45faa..09ba880dd33 100644 --- a/htdocs/admin/clicktodial.php +++ b/htdocs/admin/clicktodial.php @@ -101,8 +101,8 @@ print '
'; print $langs->trans("ClickToDialUrlDesc").'
'; print '
'; print ''; -print $langs->trans("Example").':
'; -print 'http://myphoneserver/mypage?login=__LOGIN__&password=__PASS__&caller=__PHONEFROM__&called=__PHONETO__
'; +print $langs->trans("Examples").':
'; +print 'https://myphoneserver/mypage?login=__LOGIN__&password=__PASS__&caller=__PHONEFROM__&called=__PHONETO__
'; print 'sip:__PHONETO__@my.sip.server'; print '
'; diff --git a/htdocs/admin/dav.php b/htdocs/admin/dav.php index e7983ae4b95..df14ef4c1b0 100644 --- a/htdocs/admin/dav.php +++ b/htdocs/admin/dav.php @@ -45,6 +45,11 @@ $arrayofparameters = array( 'DAV_ALLOW_ECM_DIR'=>array('css'=>'minwidth200', 'enabled'=>$conf->ecm->enabled) ); +// To fix when dire does not exists +dol_mkdir($conf->dav->dir_output.'/temp'); +dol_mkdir($conf->dav->dir_output.'/public'); +dol_mkdir($conf->dav->dir_output.'/private'); + /* * Actions diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 1bfc3611439..6835ce82e60 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -202,7 +202,7 @@ $tabsql[3] = "SELECT r.rowid as rowid, r.code_region as state_code, r.nom as lib $tabsql[4] = "SELECT c.rowid as rowid, c.code, c.label, c.active, c.favorite FROM ".MAIN_DB_PREFIX."c_country AS c"; $tabsql[5] = "SELECT c.rowid as rowid, c.code as code, c.label, c.active FROM ".MAIN_DB_PREFIX."c_civility AS c"; $tabsql[6] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.type, a.active, a.module, a.color, a.position FROM ".MAIN_DB_PREFIX."c_actioncomm AS a"; -$tabsql[7] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, a.deductible, c.code as country_code, c.label as country, a.fk_pays as country_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_pays=c.rowid and c.active=1"; +$tabsql[7] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, c.code as country_code, c.label as country, a.fk_pays as country_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_pays=c.rowid and c.active=1"; $tabsql[8] = "SELECT t.id as rowid, t.code as code, t.libelle, t.fk_country as country_id, c.code as country_code, c.label as country, t.position, t.active FROM ".MAIN_DB_PREFIX."c_typent as t LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON t.fk_country=c.rowid"; $tabsql[9] = "SELECT c.code_iso as code, c.label, c.unicode, c.active FROM ".MAIN_DB_PREFIX."c_currencies AS c"; $tabsql[10] = "SELECT t.rowid, t.code, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid"; @@ -294,7 +294,7 @@ $tabfield[3] = "code,libelle,country_id,country"; $tabfield[4] = "code,label"; $tabfield[5] = "code,label"; $tabfield[6] = "code,libelle,type,color,position"; -$tabfield[7] = "code,libelle,country,accountancy_code,deductible"; +$tabfield[7] = "code,libelle,country,accountancy_code"; $tabfield[8] = "code,libelle,country_id,country".(!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? ',position' : ''); $tabfield[9] = "code,label,unicode"; $tabfield[10] = "country_id,country,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note"; @@ -340,7 +340,7 @@ $tabfieldvalue[3] = "code,libelle,country"; $tabfieldvalue[4] = "code,label"; $tabfieldvalue[5] = "code,label"; $tabfieldvalue[6] = "code,libelle,type,color,position"; -$tabfieldvalue[7] = "code,libelle,country,accountancy_code,deductible"; +$tabfieldvalue[7] = "code,libelle,country,accountancy_code"; $tabfieldvalue[8] = "code,libelle,country".(!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? ',position' : ''); $tabfieldvalue[9] = "code,label,unicode"; $tabfieldvalue[10] = "country,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note"; @@ -386,7 +386,7 @@ $tabfieldinsert[3] = "code_region,nom,fk_pays"; $tabfieldinsert[4] = "code,label"; $tabfieldinsert[5] = "code,label"; $tabfieldinsert[6] = "code,libelle,type,color,position"; -$tabfieldinsert[7] = "code,libelle,fk_pays,accountancy_code,deductible"; +$tabfieldinsert[7] = "code,libelle,fk_pays,accountancy_code"; $tabfieldinsert[8] = "code,libelle,fk_country".(!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? ',position' : ''); $tabfieldinsert[9] = "code_iso,label,unicode"; $tabfieldinsert[10] = "fk_pays,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note"; diff --git a/htdocs/admin/eventorganization.php b/htdocs/admin/eventorganization.php index 53d27efeba2..d01aece1ca0 100644 --- a/htdocs/admin/eventorganization.php +++ b/htdocs/admin/eventorganization.php @@ -34,13 +34,9 @@ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; // Translations $langs->loadLangs(array("admin", "eventorganization")); -// Access control -if (!$user->admin) { - accessforbidden(); -} - // Parameters $action = GETPOST('action', 'aZ09'); +$cancel = GETPOST('cancel', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); $value = GETPOST('value', 'alpha'); @@ -70,11 +66,21 @@ $setupnotempty = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); +// Access control +if (empty($user->admin)) { + accessforbidden(); +} + + /* * Actions */ +if ($cancel) { + $action =''; +} + if ((float) DOL_VERSION >= 6) { include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; } @@ -207,7 +213,7 @@ if ($action == 'edit') { print ''; print ''; - print ''; + print ''; foreach ($arrayofparameters as $constname => $val) { if ($val['enabled']==1) { @@ -293,7 +299,9 @@ if ($action == 'edit') { print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; print '
'; - print ''; + print ''; + print '   '; + print ''; print '
'; print ''; @@ -301,7 +309,7 @@ if ($action == 'edit') { } else { if (!empty($arrayofparameters)) { print ''; - print ''; + print ''; foreach ($arrayofparameters as $constname => $val) { if ($val['enabled']==1) { diff --git a/htdocs/admin/holiday.php b/htdocs/admin/holiday.php index f6ac529466e..c9214742d13 100644 --- a/htdocs/admin/holiday.php +++ b/htdocs/admin/holiday.php @@ -274,147 +274,141 @@ print ''; print '
'; -if ($conf->global->MAIN_FEATURES_LEVEL < 2) { - print dol_get_fiche_end(); - // End of page - llxFooter(); - $db->close(); - exit; -} - /* * Documents models for Holidays */ -print load_fiche_titre($langs->trans("TemplatePDFHolidays"), '', ''); +if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { + print load_fiche_titre($langs->trans("TemplatePDFHolidays"), '', ''); -// Defined model definition table -$def = array(); -$sql = "SELECT nom"; -$sql .= " FROM ".MAIN_DB_PREFIX."document_model"; -$sql .= " WHERE type = '".$db->escape($type)."'"; -$sql .= " AND entity = ".$conf->entity; -$resql = $db->query($sql); -if ($resql) { - $i = 0; - $num_rows = $db->num_rows($resql); - while ($i < $num_rows) { - $array = $db->fetch_array($resql); - array_push($def, $array[0]); - $i++; + // Defined model definition table + $def = array(); + $sql = "SELECT nom"; + $sql .= " FROM ".MAIN_DB_PREFIX."document_model"; + $sql .= " WHERE type = '".$db->escape($type)."'"; + $sql .= " AND entity = ".$conf->entity; + $resql = $db->query($sql); + if ($resql) { + $i = 0; + $num_rows = $db->num_rows($resql); + while ($i < $num_rows) { + $array = $db->fetch_array($resql); + array_push($def, $array[0]); + $i++; + } + } else { + dol_print_error($db); } -} else { - dol_print_error($db); -} -print '
'; -print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; -print ''; -print ''; -print ''; -print '\n"; -print '\n"; -print ''; -print ''; -print "\n"; + print '
'; + print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status")."'.$langs->trans("Default")."'.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
'; + print ''; + print ''; + print ''; + print '\n"; + print '\n"; + print ''; + print ''; + print "\n"; -clearstatcache(); + clearstatcache(); -foreach ($dirmodels as $reldir) { - foreach (array('', '/doc') as $valdir) { - $realpath = $reldir."core/modules/holiday".$valdir; - $dir = dol_buildpath($realpath); + foreach ($dirmodels as $reldir) { + foreach (array('', '/doc') as $valdir) { + $realpath = $reldir."core/modules/holiday".$valdir; + $dir = dol_buildpath($realpath); - if (is_dir($dir)) { - $handle = opendir($dir); - if (is_resource($handle)) { - while (($file = readdir($handle)) !== false) { - $filelist[] = $file; - } - closedir($handle); - arsort($filelist); + if (is_dir($dir)) { + $handle = opendir($dir); + if (is_resource($handle)) { + while (($file = readdir($handle)) !== false) { + $filelist[] = $file; + } + closedir($handle); + arsort($filelist); - foreach ($filelist as $file) { - if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) { - if (file_exists($dir.'/'.$file)) { - $name = substr($file, 4, dol_strlen($file) - 16); - $classname = substr($file, 0, dol_strlen($file) - 12); + foreach ($filelist as $file) { + if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) { + if (file_exists($dir.'/'.$file)) { + $name = substr($file, 4, dol_strlen($file) - 16); + $classname = substr($file, 0, dol_strlen($file) - 12); - require_once $dir.'/'.$file; - $module = new $classname($db); + require_once $dir.'/'.$file; + $module = new $classname($db); - $modulequalified = 1; - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { - $modulequalified = 0; - } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { - $modulequalified = 0; - } - - if ($modulequalified) { - print ''; - // Active - if (in_array($name, $def)) { - print ''; - } else { - print '"; + + // Active + if (in_array($name, $def)) { + print ''; + } else { + print '"; + } + + // Default + print ''; + + // Info + $htmltooltip = ''.$langs->trans("Name").': '.$module->name; + $htmltooltip .= '
'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown")); + if ($module->type == 'pdf') { + $htmltooltip .= '
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; + } + $htmltooltip .= '
'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file; + + $htmltooltip .= '

'.$langs->trans("FeaturesSupported").':'; + $htmltooltip .= '
'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1); + $htmltooltip .= '
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1); + $htmltooltip .= '
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1); + $htmltooltip .= '
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1); + $htmltooltip .= '
'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1); + + + print ''; + + // Preview + print ''; + + print "\n"; } - - // Default - print ''; - - // Info - $htmltooltip = ''.$langs->trans("Name").': '.$module->name; - $htmltooltip .= '
'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown")); - if ($module->type == 'pdf') { - $htmltooltip .= '
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; - } - $htmltooltip .= '
'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file; - - $htmltooltip .= '

'.$langs->trans("FeaturesSupported").':'; - $htmltooltip .= '
'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1); - $htmltooltip .= '
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1); - $htmltooltip .= '
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1); - $htmltooltip .= '
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1); - $htmltooltip .= '
'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1); - - - print ''; - - // Preview - print ''; - - print "\n"; } } } @@ -422,11 +416,11 @@ foreach ($dirmodels as $reldir) { } } } -} -print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status")."'.$langs->trans("Default")."'.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
'; - print (empty($module->name) ? $name : $module->name); - print "\n"; - if (method_exists($module, 'info')) { - print $module->info($langs); - } else { - print $module->description; + $modulequalified = 1; + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + $modulequalified = 0; + } + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + $modulequalified = 0; } - print ''."\n"; - print ''; - print img_picto($langs->trans("Enabled"), 'switch_on'); - print ''; + if ($modulequalified) { + print '
'; + print (empty($module->name) ? $name : $module->name); + print "\n"; + if (method_exists($module, 'info')) { + print $module->info($langs); + } else { + print $module->description; + } print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; - print "'."\n"; + print ''; + print img_picto($langs->trans("Enabled"), 'switch_on'); + print ''; + print ''."\n"; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print "'; + if ($conf->global->HOLIDAY_ADDON_PDF == $name) { + print img_picto($langs->trans("Default"), 'on'); + } else { + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + } + print ''; + print $form->textwithpicto('', $htmltooltip, 1, 0); + print ''; + if ($module->type == 'pdf') { + print ''.img_object($langs->trans("Preview"), 'pdf').''; + } else { + print img_object($langs->trans("PreviewNotAvailable"), 'generic'); + } + print '
'; - if ($conf->global->HOLIDAY_ADDON_PDF == $name) { - print img_picto($langs->trans("Default"), 'on'); - } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; - } - print ''; - print $form->textwithpicto('', $htmltooltip, 1, 0); - print ''; - if ($module->type == 'pdf') { - print ''.img_object($langs->trans("Preview"), 'pdf').''; - } else { - print img_object($langs->trans("PreviewNotAvailable"), 'generic'); - } - print '
'; -print ''; -print "
"; + print ''; + print ''; + print "
"; +} /* @@ -446,34 +440,118 @@ print ''.$langs->trans("Parameter").''; print ''.$langs->trans("Value").''; print "\n"; -$substitutionarray = pdf_getSubstitutionArray($langs, array('objectamount'), null, 2); -$substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation"); -$htmltext = ''.$langs->trans("AvailableVariables").':
'; -foreach ($substitutionarray as $key => $val) { - $htmltext .= $key.'
'; +/*var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY); +var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY); +var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY); +var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY); +*/ +if (!isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY)) { + $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY = 1; } -$htmltext .= '
'; +if (!isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY)) { + $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY = 1; +} +/* +var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY); +var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY); +var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY); +var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY); +*/ -print ''; -print $form->textwithpicto($langs->trans("FreeLegalTextOnHolidays"), $langs->trans("AddCRIfTooLong").'

'.$htmltext, 1, 'help', '', 0, 2, 'tooltiphelp'); -print '
'; -$variablename = 'HOLIDAY_FREE_TEXT'; -if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { - print ''; +// Set working days +print ''; +print "".$langs->trans("XIsAUsualNonWorkingDay", $langs->transnoentitiesnoconv("Monday")).""; +print ''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY', array(), null, 0); } else { - include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); - print $doleditor->Create(); + if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY)) { + print ''.img_picto($langs->trans("Enabled"), 'on').''; + } else { + print ''.img_picto($langs->trans("Disabled"), 'off').''; + } } -print ''."\n"; +print ""; +print ""; -//Use draft Watermark +// Set working days +print ''; +print "".$langs->trans("XIsAUsualNonWorkingDay", $langs->transnoentitiesnoconv("Friday")).""; +print ''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY', array(), null, 0); +} else { + if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY)) { + print ''.img_picto($langs->trans("Enabled"), 'on').''; + } else { + print ''.img_picto($langs->trans("Disabled"), 'off').''; + } +} +print ""; +print ""; -print ''; -print $form->textwithpicto($langs->trans("WatermarkOnDraftHolidayCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'
'; -print ''; -print ''; -print ''."\n"; +// Set working days +print ''; +print "".$langs->trans("XIsAUsualNonWorkingDay", $langs->transnoentitiesnoconv("Saturday")).""; +print ''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY', array(), null, 0, 0, 0, 2, 0, 1); +} else { + if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY)) { + print ''.img_picto($langs->trans("Enabled"), 'on').''; + } else { + print ''.img_picto($langs->trans("Disabled"), 'off').''; + } +} +print ""; +print ""; + +// Set working days +print ''; +print "".$langs->trans("XIsAUsualNonWorkingDay", $langs->transnoentitiesnoconv("Sunday")).""; +print ''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY', array(), null, 0, 0, 0, 2, 0, 1); +} else { + if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY)) { + print ''.img_picto($langs->trans("Enabled"), 'on').''; + } else { + print ''.img_picto($langs->trans("Disabled"), 'off').''; + } +} +print ""; +print ""; + +if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { + $substitutionarray = pdf_getSubstitutionArray($langs, array('objectamount'), null, 2); + $substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation"); + $htmltext = ''.$langs->trans("AvailableVariables").':
'; + foreach ($substitutionarray as $key => $val) { + $htmltext .= $key.'
'; + } + $htmltext .= '
'; + + print ''; + print $form->textwithpicto($langs->trans("FreeLegalTextOnHolidays"), $langs->trans("AddCRIfTooLong").'

'.$htmltext, 1, 'help', '', 0, 2, 'tooltiphelp'); + print '
'; + $variablename = 'HOLIDAY_FREE_TEXT'; + if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { + print ''; + } else { + include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); + print $doleditor->Create(); + } + print ''."\n"; + + //Use draft Watermark + + print ''; + print $form->textwithpicto($langs->trans("WatermarkOnDraftHolidayCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'
'; + print ''; + print ''; + print ''."\n"; +} print ''; print ''; diff --git a/htdocs/admin/index.php b/htdocs/admin/index.php index aa571644871..c02ee501d94 100644 --- a/htdocs/admin/index.php +++ b/htdocs/admin/index.php @@ -82,7 +82,8 @@ print '

'; if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) { $setupcompanynotcomplete = 1; } -print img_picto('', 'company', 'class="paddingright"').' '.$langs->trans("SetupDescription3", DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete) ? '' : '&action=edit'), $langs->transnoentities("Setup"), $langs->transnoentities("MenuCompanySetup")); +print img_picto('', 'company', 'class="paddingright valignmiddle double"').' '.$langs->trans("SetupDescriptionLink", DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete) ? '' : '&action=edit'), $langs->transnoentities("Setup"), $langs->transnoentities("MenuCompanySetup")); +print '

'.$langs->trans("SetupDescription3b"); if (!empty($setupcompanynotcomplete)) { $langs->load("errors"); $warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete"), 'style="padding-right: 6px;"'); @@ -93,7 +94,8 @@ print '
'; print '
'; // Show info setup module -print img_picto('', 'cog', 'class="paddingright"').' '.$langs->trans("SetupDescription4", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentities("Setup"), $langs->transnoentities("Modules")); +print img_picto('', 'cog', 'class="paddingright valignmiddle double"').' '.$langs->trans("SetupDescriptionLink", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentities("Setup"), $langs->transnoentities("Modules")); +print '

'.$langs->trans("SetupDescription4b"); if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) { // If only minimal initial modules enabled $langs->load("errors"); $warnpicto = img_warning($langs->trans("WarningEnableYourModulesApplications"), 'style="padding-right: 6px;"'); diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 8d0fb1165a8..db3c45a0776 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -230,6 +230,9 @@ if (!empty($conf->agenda->enabled)) { if (!empty($conf->eventorganization->enabled) && !empty($user->rights->eventorganization->read)) { $elementList['eventorganization_send'] = img_picto('', 'action', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendEventOrganization')); } +if (!empty($conf->partnership->enabled) && !empty($user->rights->partnership->read)) { + $elementList['partnership_send'] = img_picto('', 'partnership', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToPartnership')); +} $parameters = array('elementList'=>$elementList); $reshook = $hookmanager->executeHooks('emailElementlist', $parameters); // Note that $action and $object may have been modified by some hooks diff --git a/htdocs/admin/pdf_other.php b/htdocs/admin/pdf_other.php index ed14f2ac119..d50476528cb 100644 --- a/htdocs/admin/pdf_other.php +++ b/htdocs/admin/pdf_other.php @@ -53,6 +53,16 @@ if ($cancel) { } if ($action == 'update') { + if (GETPOSTISSET('PROPOSAL_PDF_HIDE_PAYMENTTERM')) { + dolibarr_set_const($db, "PROPOSAL_PDF_HIDE_PAYMENTTERM", GETPOST("PROPOSAL_PDF_HIDE_PAYMENTTERM"), 'chaine', 0, '', $conf->entity); + } + if (GETPOSTISSET('PROPOSAL_PDF_HIDE_PAYMENTMODE')) { + dolibarr_set_const($db, "PROPOSAL_PDF_HIDE_PAYMENTMODE", GETPOST("PROPOSAL_PDF_HIDE_PAYMENTMODE"), 'chaine', 0, '', $conf->entity); + } + if (GETPOSTISSET('MAIN_GENERATE_PROPOSALS_WITH_PICTURE')) { + dolibarr_set_const($db, "MAIN_GENERATE_PROPOSALS_WITH_PICTURE", GETPOST("MAIN_GENERATE_PROPOSALS_WITH_PICTURE"), 'chaine', 0, '', $conf->entity); + } + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); @@ -103,6 +113,26 @@ if ($conf->use_javascript_ajax) { } print ''; +print ''.$langs->trans("PROPOSAL_PDF_HIDE_PAYMENTTERM"); +print ''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('PROPOSAL_PDF_HIDE_PAYMENTTERM'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("PROPOSAL_PDF_HIDE_PAYMENTTERM", $arrval, $conf->global->PROPOSAL_PDF_HIDE_PAYMENTTERM); +} +print ''; + +print ''.$langs->trans("PROPOSAL_PDF_HIDE_PAYMENTMODE"); +print ''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('PROPOSAL_PDF_HIDE_PAYMENTMODE'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("PROPOSAL_PDF_HIDE_PAYMENTMODE", $arrval, $conf->global->PROPOSAL_PDF_HIDE_PAYMENTMODE); +} +print ''; + /* print ''.$langs->trans("MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING").''; if ($conf->use_javascript_ajax) { diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index b745ad75818..f2df395060b 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -95,7 +95,7 @@ print "PHP session.cookie_samesite = ".(ini_get('session.cookie print "PHP open_basedir = ".(ini_get('open_basedir') ? ini_get('open_basedir') : yn(0).'   ('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("ARestrictedPath").', '.$langs->transnoentitiesnoconv("Example").' '.$_SERVER["DOCUMENT_ROOT"]).')')."
\n"; print "PHP allow_url_fopen = ".(ini_get('allow_url_fopen') ? img_picto($langs->trans("YouShouldSetThisToOff"), 'warning').' '.ini_get('allow_url_fopen') : yn(0)).'   ('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("No")).")
\n"; print "PHP allow_url_include = ".(ini_get('allow_url_include') ? img_picto($langs->trans("YouShouldSetThisToOff"), 'warning').' '.ini_get('allow_url_include') : yn(0)).'   ('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("No")).")
\n"; -print "PHP safe_mode = ".(ini_get('safe_mode') ? ini_get('safe_mode') : yn(0)).'   '.$langs->trans("Deprecated")." (removed in PHP 5.4)
\n"; +//print "PHP safe_mode = ".(ini_get('safe_mode') ? ini_get('safe_mode') : yn(0)).'   '.$langs->trans("Deprecated")." (removed in PHP 5.4)
\n"; 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'); @@ -249,7 +249,7 @@ if (empty($dolibarr_main_prod)) { } print '
'; -print '$dolibarr_nocsrfcheck: '.$dolibarr_nocsrfcheck; +print '$dolibarr_nocsrfcheck: '.(empty($dolibarr_nocsrfcheck) ? '0' : $dolibarr_nocsrfcheck); if (!empty($dolibarr_nocsrfcheck)) { print '   '.img_picto('', 'warning').' '.$langs->trans("IfYouAreOnAProductionSetThis", 0); } @@ -350,7 +350,7 @@ if (empty($conf->global->MAIN_SECURITY_HASH_ALGO)) { if ($conf->global->MAIN_SECURITY_HASH_ALGO != 'password_hash') { print '
MAIN_SECURITY_SALT = '.(empty($conf->global->MAIN_SECURITY_SALT) ? ''.$langs->trans("Undefined").'' : $conf->global->MAIN_SECURITY_SALT).'
'; } else { - print '('.$langs->trans("Recommanded").': password_hash)'; + print '('.$langs->trans("Recommended").': password_hash)'; print '
'; } if ($conf->global->MAIN_SECURITY_HASH_ALGO != 'password_hash') { @@ -363,16 +363,19 @@ if ($conf->global->MAIN_SECURITY_HASH_ALGO != 'password_hash') { } print '
'; -print 'MAIN_SECURITY_ANTI_SSRF_SERVER_IP = '.(empty($conf->global->MAIN_SECURITY_ANTI_SSRF_SERVER_IP) ? ''.$langs->trans("Undefined").'   ('.$langs->trans("Example").': static-ips-of-server - '.$langs->trans("Note").': common loopback ip like 127.*.*.*, [::1] are already added)' : $conf->global->MAIN_SECURITY_ANTI_SSRF_SERVER_IP)."
"; +print 'MAIN_SECURITY_ANTI_SSRF_SERVER_IP = '.(empty($conf->global->MAIN_SECURITY_ANTI_SSRF_SERVER_IP) ? ''.$langs->trans("Undefined").'   ('.$langs->trans("Recommended").': List of static IPs of server separated with coma - '.$langs->trans("Note").': common loopback ip like 127.*.*.*, [::1] are already added)' : $conf->global->MAIN_SECURITY_ANTI_SSRF_SERVER_IP)."
"; print '
'; -print 'MAIN_ALLOW_SVG_FILES_AS_IMAGES = '.(empty($conf->global->MAIN_ALLOW_SVG_FILES_AS_IMAGES) ? '0   ('.$langs->trans("Recommanded").': 0)' : $conf->global->MAIN_ALLOW_SVG_FILES_AS_IMAGES)."
"; +print 'MAIN_ALLOW_SVG_FILES_AS_IMAGES = '.(empty($conf->global->MAIN_ALLOW_SVG_FILES_AS_IMAGES) ? '0' : $conf->global->MAIN_ALLOW_SVG_FILES_AS_IMAGES).'   ('.$langs->trans("Recommended").': 0)
'; print '
'; -print 'MAIN_RESTRICTHTML_ONLY_VALID_HTML = '.(empty($conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML) ? ''.$langs->trans("Undefined").'   ('.$langs->trans("Recommanded").': 1)' : $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML)."
"; +print 'MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE = '.(empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE) ? ''.$langs->trans("Undefined").'' : $conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE).'   ('.$langs->trans("Recommended").': 1)
'; print '
'; -print 'MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = '.(empty($conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES) ? ''.$langs->trans("Undefined").'   ('.$langs->trans("Recommanded").': 1)' : $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES)."
"; +print 'MAIN_RESTRICTHTML_ONLY_VALID_HTML = '.(empty($conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML) ? ''.$langs->trans("Undefined").'   ('.$langs->trans("Recommended").': 1)' : $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML)."
"; +print '
'; + +print 'MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = '.(empty($conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES) ? ''.$langs->trans("Undefined").'   ('.$langs->trans("Recommended").': 1)' : $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES)."
"; print '
'; print 'MAIN_EXEC_USE_POPEN = '; @@ -382,10 +385,14 @@ if (empty($conf->global->MAIN_EXEC_USE_POPEN)) { print $conf->global->MAIN_EXEC_USE_POPEN; } if ($execmethod == 1) { - print '   ("exec" PHP method will be used for shell commands)'; + print ', "exec" PHP method will be used for shell commands'; + print '   ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 1)'; + print ''; } if ($execmethod == 2) { - print '   ("popen" PHP method will be used for shell commands)'; + print ', "popen" PHP method will be used for shell commands'; + print '   ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 1)'; + print ''; } print "
"; print '
'; diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php index 09156e08588..1b6fa5bebe7 100644 --- a/htdocs/admin/workflow.php +++ b/htdocs/admin/workflow.php @@ -91,15 +91,21 @@ $workflowcodes = array( ), // Automatic classification of order - 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING'=>array( + 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING'=>array( // when shipping validated 'family'=>'classify_order', 'position'=>40, 'enabled'=>(!empty($conf->expedition->enabled) && !empty($conf->commande->enabled)), 'picto'=>'order' ), - 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array( + 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED'=>array( // when shipping closed 'family'=>'classify_order', 'position'=>41, + 'enabled'=>(!empty($conf->expedition->enabled) && !empty($conf->commande->enabled)), + 'picto'=>'order' + ), + 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array( + 'family'=>'classify_order', + 'position'=>42, 'enabled'=>(!empty($conf->facture->enabled) && !empty($conf->commande->enabled)), 'picto'=>'order', 'warning'=>'' diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index 4c52182cff7..d24ba63ef55 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -72,10 +72,12 @@ function printDropdownBookmarksList() // Url to go on create new bookmark page $newbtn = ''; if (!empty($user->rights->bookmark->creer)) { - //$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&urlsource='.urlencode($url).'&url='.urlencode($url); - $urltoadd = DOL_URL_ROOT.'/bookmarks/card.php?action=create&url='.urlencode($url); - $newbtn .= ''; - $newbtn .= img_picto('', 'add', '', false, 0, 0, '', 'paddingright').dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).''; + if (!preg_match('/bookmarks\/card.php/', $_SERVER['PHP_SELF'])) { + //$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&urlsource='.urlencode($url).'&url='.urlencode($url); + $urltoadd = DOL_URL_ROOT.'/bookmarks/card.php?action=create&url='.urlencode($url); + $newbtn .= ''; + $newbtn .= img_picto('', 'add', '', false, 0, 0, '', 'paddingright').dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).''; + } } // Menu with list of bookmarks @@ -105,9 +107,11 @@ function printDropdownBookmarksList() $searchForm .= dol_escape_htmltag($user->rights->bookmark->creer ? $langs->trans('EditBookmarks') : $langs->trans('ListOfBookmarks')).'...'; // Url to go on create new bookmark page if (!empty($user->rights->bookmark->creer)) { - $urltoadd = DOL_URL_ROOT.'/bookmarks/card.php?action=create&url='.urlencode($url); - $searchForm .= ''; + if (!preg_match('/bookmarks\/card.php/', $_SERVER['PHP_SELF'])) { + $urltoadd = DOL_URL_ROOT.'/bookmarks/card.php?action=create&url='.urlencode($url); + $searchForm .= ''; + } } $i = 0; while ((empty($conf->global->BOOKMARKS_SHOW_IN_MENU) || $i < $conf->global->BOOKMARKS_SHOW_IN_MENU) && $obj = $db->fetch_object($resql)) { diff --git a/htdocs/bookmarks/card.php b/htdocs/bookmarks/card.php index 1094eabf0c6..f7795a14f47 100644 --- a/htdocs/bookmarks/card.php +++ b/htdocs/bookmarks/card.php @@ -40,7 +40,7 @@ $action = GETPOST("action", "alpha"); $title = (string) GETPOST("title", "alpha"); $url = (string) GETPOST("url", "alpha"); $urlsource = GETPOST("urlsource", "alpha"); -$target = GETPOST("target", "alpha"); +$target = GETPOST("target", "int"); $userid = GETPOST("userid", "int"); $position = GETPOST("position", "int"); $backtopage = GETPOST('backtopage', 'alpha'); @@ -169,7 +169,7 @@ if ($action == 'create') { // Target print ''.$langs->trans("BehaviourOnClick").''; $liste = array(0=>$langs->trans("ReplaceWindow"), 1=>$langs->trans("OpenANewWindow")); - print $form->selectarray('target', $liste, 1); + print $form->selectarray('target', $liste, GETPOSTISSET('target') ? GETPOST('target', 'int') : 1); print ''.$langs->trans("ChooseIfANewWindowMustBeOpenedOnClickOnBookmark").''; // Owner diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index c6c0d277edd..bbf86d87c59 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -261,7 +261,7 @@ class ActionComm extends CommonObject /** * @var int socpeople id linked to action */ - public $contactid; + public $contact_id; /** * @var Societe|null Company linked to action (optional) @@ -273,7 +273,7 @@ class ActionComm extends CommonObject /** * @var Contact|null Contact linked to action (optional) * @deprecated - * @see $contactid + * @see $contact_id */ public $contact; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 123ea9efef4..1b9536910fa 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2594,7 +2594,7 @@ if ($action == 'create') { } // Create an invoice and classify billed - if ($object->statut == Propal::STATUS_SIGNED) { + if ($object->statut == Propal::STATUS_SIGNED && empty($conf->global->PROPOSAL_ARE_NOT_BILLABLE)) { if (!empty($conf->facture->enabled) && $usercancreateinvoice) { print ''.$langs->trans("AddBill").''; } diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 77eedcd3e34..2e0ec42d2b0 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -187,6 +187,7 @@ $arrayfields = array( 'c.multicurrency_total_vat'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>105), 'c.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>110), 'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>115), + 'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>0, 'position'=>116), 'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>120), 'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>125), 'c.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>130), @@ -1180,6 +1181,9 @@ if ($resql) { print ''; print ''; } + if (!empty($arrayfields['sale_representative']['checked'])) { + print ''; + } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook @@ -1338,6 +1342,9 @@ if ($resql) { if (!empty($arrayfields['u.login']['checked'])) { print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder); } + if (!empty($arrayfields['sale_representative']['checked'])) { + print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder); + } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; @@ -1715,6 +1722,53 @@ if ($resql) { } } + if (!empty($arrayfields['sale_representative']['checked'])) { + // Sales representatives + print ''; + if ($obj->socid > 0) { + $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user); + if ($listsalesrepresentatives < 0) { + dol_print_error($db); + } + $nbofsalesrepresentative = count($listsalesrepresentatives); + if ($nbofsalesrepresentative > 6) { + // We print only number + print $nbofsalesrepresentative; + } elseif ($nbofsalesrepresentative > 0) { + $j = 0; + foreach ($listsalesrepresentatives as $val) { + $userstatic->id = $val['id']; + $userstatic->lastname = $val['lastname']; + $userstatic->firstname = $val['firstname']; + $userstatic->email = $val['email']; + $userstatic->statut = $val['statut']; + $userstatic->entity = $val['entity']; + $userstatic->photo = $val['photo']; + $userstatic->login = $val['login']; + $userstatic->office_phone = $val['office_phone']; + $userstatic->office_fax = $val['office_fax']; + $userstatic->user_mobile = $val['user_mobile']; + $userstatic->job = $val['job']; + $userstatic->gender = $val['gender']; + //print '
': + print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2); + $j++; + if ($j < $nbofsalesrepresentative) { + print ' '; + } + //print '
'; + } + } + //else print $langs->trans("NoSalesRepresentativeAffected"); + } else { + print ' '; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index ed61da3592e..03ec879c5ad 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1519,6 +1519,12 @@ class Account extends CommonObject */ public function needIBAN() { + global $conf; + + if (!empty($conf->global->MAIN_IBAN_IS_NEVER_MANDATORY)) { + return 0; + } + $country_code = $this->getCountryCode(); $country_code_in_EEC = array( diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index f25b2b05975..0becff9e54b 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -234,6 +234,7 @@ $arrayfields = array( 'dynamount_payed'=>array('label'=>"Received", 'checked'=>0, 'position'=>140), 'rtp'=>array('label'=>"Rest", 'checked'=>0, 'position'=>150), // Not enabled by default because slow 'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>165), + 'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>0, 'position'=>166), 'f.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>170), 'f.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>171), 'f.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>180), @@ -1257,6 +1258,9 @@ if ($resql) { print ''; print ''; } + if (!empty($arrayfields['sale_representative']['checked'])) { + print ''; + } if (!empty($arrayfields['f.retained_warranty']['checked'])) { print ''; print ''; @@ -1449,6 +1453,9 @@ if ($resql) { if (!empty($arrayfields['u.login']['checked'])) { print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder); } + if (!empty($arrayfields['sale_representative']['checked'])) { + print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder); + } if (!empty($arrayfields['f.retained_warranty']['checked'])) { print_liste_field_titre($arrayfields['f.retained_warranty']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'align="right"', $sortfield, $sortorder); } @@ -1939,6 +1946,53 @@ if ($resql) { } } + if (!empty($arrayfields['sale_representative']['checked'])) { + // Sales representatives + print ''; + if ($obj->socid > 0) { + $listsalesrepresentatives = $thirdpartystatic->getSalesRepresentatives($user); + if ($listsalesrepresentatives < 0) { + dol_print_error($db); + } + $nbofsalesrepresentative = count($listsalesrepresentatives); + if ($nbofsalesrepresentative > 6) { + // We print only number + print $nbofsalesrepresentative; + } elseif ($nbofsalesrepresentative > 0) { + $j = 0; + foreach ($listsalesrepresentatives as $val) { + $userstatic->id = $val['id']; + $userstatic->lastname = $val['lastname']; + $userstatic->firstname = $val['firstname']; + $userstatic->email = $val['email']; + $userstatic->statut = $val['statut']; + $userstatic->entity = $val['entity']; + $userstatic->photo = $val['photo']; + $userstatic->login = $val['login']; + $userstatic->office_phone = $val['office_phone']; + $userstatic->office_fax = $val['office_fax']; + $userstatic->user_mobile = $val['user_mobile']; + $userstatic->job = $val['job']; + $userstatic->gender = $val['gender']; + //print '
': + print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2); + $j++; + if ($j < $nbofsalesrepresentative) { + print ' '; + } + //print '
'; + } + } + //else print $langs->trans("NoSalesRepresentativeAffected"); + } else { + print ' '; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['f.retained_warranty']['checked'])) { print ''.(!empty($obj->retained_warranty) ?price($obj->retained_warranty).'%' : ' ').''; } diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index b03ed9d93e0..8a232377ab7 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -200,7 +200,8 @@ if ($id > 0 || $ref) { //print ''.$langs->trans("Ref").''.$object->getNomUrl(1).''; print ''.$langs->trans("Date").''.dol_print_date($object->datec, 'day').''; - print ''.$langs->trans("Amount").''.price($object->amount).''; + + print ''.$langs->trans("Amount").''.price($object->amount).''; // Status /* diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index f69c7b476a2..1b6afa3cffe 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -82,7 +82,8 @@ class BonPrelevement extends CommonObject const STATUS_DRAFT = 0; const STATUS_TRANSFERED = 1; - const STATUS_CREDITED = 2; + const STATUS_CREDITED = 2; // STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type + const STATUS_DEBITED = 2; // STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type /** @@ -2343,17 +2344,22 @@ class BonPrelevement extends CommonObject //$langs->load("mymodule"); $this->labelStatus[self::STATUS_DRAFT] = $langs->trans('StatusWaiting'); $this->labelStatus[self::STATUS_TRANSFERED] = $langs->trans('StatusTrans'); - $this->labelStatus[self::STATUS_CREDITED] = $langs->trans('StatusCredited'); $this->labelStatusShort[self::STATUS_DRAFT] = $langs->trans('StatusWaiting'); $this->labelStatusShort[self::STATUS_TRANSFERED] = $langs->trans('StatusTrans'); - $this->labelStatusShort[self::STATUS_CREDITED] = $langs->trans('StatusCredited'); + if ($this->type == 'bank-transfer') { + $this->labelStatus[self::STATUS_DEBITED] = $langs->trans('StatusDebited'); + $this->labelStatusShort[self::STATUS_DEBITED] = $langs->trans('StatusDebited'); + } else { + $this->labelStatus[self::STATUS_CREDITED] = $langs->trans('StatusCredited'); + $this->labelStatusShort[self::STATUS_CREDITED] = $langs->trans('StatusCredited'); + } } $statusType = 'status1'; if ($status == self::STATUS_TRANSFERED) { $statusType = 'status3'; } - if ($status == self::STATUS_CREDITED) { + if ($status == self::STATUS_CREDITED || $status == self::STATUS_DEBITED) { $statusType = 'status6'; } diff --git a/htdocs/compta/tva/list.php b/htdocs/compta/tva/list.php index 69ce8ae8ae5..1dc0180bd60 100644 --- a/htdocs/compta/tva/list.php +++ b/htdocs/compta/tva/list.php @@ -31,6 +31,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; @@ -135,6 +136,7 @@ if (empty($reshook)) { $form = new Form($db); $formother = new FormOther($db); +$formfile = new FormFile($db); $tva_static = new Tva($db); $bankstatic = new Account($db); $accountingjournal = new AccountingJournal($db); @@ -445,7 +447,13 @@ while ($i < min($num, $limit)) { // Ref if (!empty($arrayfields['t.rowid']['checked'])) { - print ''.$tva_static->getNomUrl(1).''; + print ''; + print $tva_static->getNomUrl(1); + $filename = dol_sanitizeFileName($tva_static->ref); + $filedir = $conf->tax->dir_output.'/vat/'.dol_sanitizeFileName($tva_static->ref); + $urlsource = $_SERVER['PHP_SELF'].'?id='.$tva_static->id; + print $formfile->getDocumentsLink($tva_static->element, $filename, $filedir, '', 'valignmiddle paddingleft2imp'); + print ''; if (!$i) { $totalarray['nbfield']++; } diff --git a/htdocs/core/ajax/constantonoff.php b/htdocs/core/ajax/constantonoff.php index 60684c1520b..b8beec3111a 100644 --- a/htdocs/core/ajax/constantonoff.php +++ b/htdocs/core/ajax/constantonoff.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2011-2015 Regis Houssin + * Copyright (C) 2021 Laurent Destailleur * * 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 @@ -47,6 +48,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; $action = GETPOST('action', 'aZ09'); // set or del $name = GETPOST('name', 'alpha'); +$entity = GETPOST('entity', 'int'); +$value = ((GETPOST('value', 'int') || GETPOST('value', 'int') == '0') ? GETPOST('value', 'int') : 1); /* @@ -64,9 +67,6 @@ top_httphead(); // Registering the new value of constant if (!empty($action) && !empty($name)) { - $entity = GETPOST('entity', 'int'); - $value = (GETPOST('value') ?GETPOST('value') : 1); - if ($user->admin) { if ($action == 'set') { dolibarr_set_const($db, $name, $value, 'chaine', 0, '', $entity); diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 2a5e3391eb9..909178d4fb1 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -531,7 +531,7 @@ abstract class CommonDocGenerator $totalUp += $line->subprice * $line->qty; } - // @GS: Calculate total up and total discount percentage + // Calculate total up and total discount percentage // Note that this added fields does not match a field into database in Dolibarr (Dolibarr manage discount on lines not as a global property of object) $resarray['object_total_up'] = $totalUp; $resarray['object_total_up_locale'] = price($resarray['object_total_up'], 0, $outputlangs); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 36df3b1a7b9..50d86d17488 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -123,6 +123,12 @@ abstract class CommonObject */ protected $table_ref_field = ''; + /** + * 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user + * @var integer + */ + public $restrictiononfksoc = 0; + // Following vars are used by some objects only. We keep this property here in CommonObject to be able to provide common method using them. @@ -4111,7 +4117,7 @@ abstract class CommonObject $sql .= " SET ".$fieldstatus." = ".((int) $status); // If status = 1 = validated, update also fk_user_valid if ($status == 1 && $elementTable == 'expensereport') { - $sql .= ", fk_user_valid = ".$user->id; + $sql .= ", fk_user_valid = ".((int) $user->id); } $sql .= " WHERE rowid=".((int) $elementId); @@ -4805,13 +4811,18 @@ abstract class CommonObject if (!empty($this->lines)) { foreach ($this->lines as $line) { - if (is_object($hookmanager) && (($line->product_type == 9 && !empty($line->special_code)) || !empty($line->fk_parent_line))) { + $reshook = 0; + //if (is_object($hookmanager) && (($line->product_type == 9 && !empty($line->special_code)) || !empty($line->fk_parent_line))) { + if (is_object($hookmanager)) { // Old code is commented on preceding line. if (empty($line->fk_parent_line)) { - $parameters = array('line'=>$line, 'i'=>$i); - $action = ''; - $hookmanager->executeHooks('printOriginObjectLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $parameters = array('line'=>$line, 'i'=>$i, 'restrictlist'=>$restrictlist, 'selectedLines'=> $selectedLines); + $reshook = $hookmanager->executeHooks('printOriginObjectLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + } else { + $parameters = array('line'=>$line, 'i'=>$i, 'restrictlist'=>$restrictlist, 'selectedLines'=> $selectedLines, 'fk_parent_line'=>$line->fk_parent_line); + $reshook = $hookmanager->executeHooks('printOriginObjectSubLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks } - } else { + } + if (empty($reshook)) { $this->printOriginLine($line, '', $restrictlist, '/core/tpl', $selectedLines); } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 9bcbf08f71a..8e69a4b49df 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -958,7 +958,7 @@ class Form if ($row['code_iso']) { $labeltoshow .= ' ('.$row['code_iso'].')'; if (empty($hideflags)) { - $tmpflag = picto_from_langcode($row['code_iso'], 'class="saturatemedium paddingrightonly"'); + $tmpflag = picto_from_langcode($row['code_iso'], 'class="saturatemedium paddingrightonly"', 1); $labeltoshow = $tmpflag.' '.$labeltoshow; } } @@ -969,7 +969,7 @@ class Form $out .= ''; + $out .= ''."\n"; } } $out .= ''; @@ -4724,7 +4724,7 @@ class Form $more .= '
'."\n"; foreach ($formquestion as $key => $input) { if (is_array($input) && !empty($input)) { - $size = (!empty($input['size']) ? ' size="'.$input['size'].'"' : ''); + $size = (!empty($input['size']) ? ' size="'.$input['size'].'"' : ''); // deprecated. Use morecss instead. $moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : ''); $morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : ''); diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 2b8a2d15aff..60054ecf5ad 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -981,13 +981,15 @@ class FormFile * You may want to call this into a div like this: * print '
'.$formfile->getDocumentsLink($element_doc, $filename, $filedir).'
'; * - * @param string $modulepart propal, facture, facture_fourn, ... + * @param string $modulepart 'propal', 'facture', 'facture_fourn', ... * @param string $modulesubdir Sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into subdir of module. * @param string $filedir Full path to directory to scan * @param string $filter Filter filenames on this regex string (Example: '\.pdf$') + * @param string $morecss Add more css to the download picto + * @param string $allfiles 0=Only generated docs, 1=All files * @return string Output string with HTML link of documents (might be empty string). This also fill the array ->infofiles */ - public function getDocumentsLink($modulepart, $modulesubdir, $filedir, $filter = '') + public function getDocumentsLink($modulepart, $modulesubdir, $filedir, $filter = '', $morecss = 'valignmiddle', $allfiles = 0) { global $conf, $langs; @@ -1005,12 +1007,11 @@ class FormFile $entity = ((!empty($regs[1]) && $regs[1] > 1) ? $regs[1] : 1); // If entity id not found in $filedir this is entity 1 by default } - // Get list of files starting with name of ref (but not followed by "-" to discard uploaded files and get only generated files) - // @todo Why not showing by default all files by just removing the '[^\-]+' at end of regex ? - if (!empty($conf->global->MAIN_SHOW_ALL_FILES_ON_DOCUMENT_TOOLTIP)) { - $filterforfilesearch = preg_quote(basename($modulesubdir), '/'); + // Get list of files starting with name of ref (Note: files with '^ref\.extension' are generated files, files with '^ref-...' are uploaded files) + if ($allfiles || !empty($conf->global->MAIN_SHOW_ALL_FILES_ON_DOCUMENT_TOOLTIP)) { + $filterforfilesearch = '^'.preg_quote(basename($modulesubdir), '/'); } else { - $filterforfilesearch = preg_quote(basename($modulesubdir), '/').'[^\-]+'; + $filterforfilesearch = '^'.preg_quote(basename($modulesubdir), '/').'\.'; } $file_list = dol_dir_list($filedir, 'files', 0, $filterforfilesearch, '\.meta$|\.png$'); // We also discard .meta and .png preview @@ -1019,7 +1020,7 @@ class FormFile $out .= ''."\n"; if (!empty($file_list)) { $out = '