From 7f44faf0bef218587e35a7be28df3d75810d0e5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 6 Nov 2017 20:29:57 +0100 Subject: [PATCH 01/47] correct merge --- htdocs/accountancy/admin/export.php | 7 ------- 1 file changed, 7 deletions(-) diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php index af11824e91a..4a9625972b8 100644 --- a/htdocs/accountancy/admin/export.php +++ b/htdocs/accountancy/admin/export.php @@ -77,11 +77,6 @@ $model_option = array ( 'label' => 'ACCOUNTING_EXPORT_DATE', 'param' => '', ), - //'ACCOUNTING_EXPORT_PIECE', - //'ACCOUNTING_EXPORT_GLOBAL_ACCOUNT', - //'ACCOUNTING_EXPORT_LABEL', - //'ACCOUNTING_EXPORT_AMOUNT', - //'ACCOUNTING_EXPORT_DEVISE', ); /* @@ -143,7 +138,6 @@ $form = new Form($db); // $linkback = '' . $langs->trans("BackToModuleList") . ''; print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'title_setup'); -$head = admin_accounting_prepare_head(); print "\n".''."\n"; } -} +//} // Close db if mode is not noajax if ((! isset($mode) || $mode != 'noajax') && is_object($db)) $db->close(); diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index f105ef78263..2a514f65f1f 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -914,10 +914,12 @@ class FormFile * @param int $forcedownload Force to open dialog box "Save As" when clicking on file. * @param string $relativepath Relative path of docs (autodefined if not provided), relative to module dir, not to MAIN_DATA_ROOT. * @param int $permonobject Permission on object (so permission to delete or crop document) - * @param int $useinecm Change output for use in ecm module + * @param int $useinecm Change output for use in ecm module: + * 0: Add a previw link. Show also rename and crop file + * 1: Add link to edit ECM entry * @param string $textifempty Text to show if filearray is empty ('NoFileFound' if not defined) * @param int $maxlength Maximum length of file name shown. - * @param string $title Title before list + * @param string $title Title before list. Use 'none' to disable title. * @param string $url Full url to use for click links ('' = autodetect) * @param int $showrelpart 0=Show only filename (default), 1=Show first level 1 dir * @param int $permtoeditline Permission to edit document line (You must provide a value, -1 is deprecated and must not be used any more) @@ -977,7 +979,9 @@ class FormFile } else { - $param = (isset($object->id)?'&id='.$object->id:'').$param; + if (! preg_match('/&id=/', $param) && isset($object->id)) $param.='&id='.$object->id; + $relativepathwihtoutslashend=preg_replace('/\/$/', '', $relativepath); + if ($relativepathwihtoutslashend) $param.= '&file='.urlencode($relativepathwihtoutslashend); if ($permtoeditline < 0) // Old behaviour for backward compatibility. New feature should call method with value 0 or 1 { @@ -995,7 +999,7 @@ class FormFile } // Show list of existing files - if (empty($useinecm)) print load_fiche_titre($title?$title:$langs->trans("AttachedFiles")); + if (empty($useinecm) && $title != 'none') print load_fiche_titre($title?$title:$langs->trans("AttachedFiles")); if (empty($url)) $url=$_SERVER["PHP_SELF"]; print ''."\n"; @@ -1023,6 +1027,7 @@ class FormFile } print ''; + //print $url.' sortfield='.$sortfield.' sortorder='.$sortorder; print_liste_field_titre('Documents2',$url,"name","",$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre('Size',$url,"size","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre('Date',$url,"date","",$param,'align="center"',$sortfield,$sortorder); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 7660b198313..6ca18fda666 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1478,7 +1478,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r if (! empty($object->label)) $morehtmlref.='
'.$object->label.'
'; } - if ($object->element != 'product' && $object->element != 'bookmark' && $object->element != 'ecm_directories') + if (method_exists($object, 'getBannerAddress') && $object->element != 'product' && $object->element != 'bookmark' && $object->element != 'ecm_directories' && $object->element != 'ecm_files') { $morehtmlref.='
'; $morehtmlref.=$object->getBannerAddress('refaddress',$object); diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php index 07c8b0aff00..bbb80f52cba 100644 --- a/htdocs/ecm/class/ecmdirectory.class.php +++ b/htdocs/ecm/class/ecmdirectory.class.php @@ -411,31 +411,33 @@ class EcmDirectory // extends CommonObject * @param string $option Sur quoi pointe le lien * @param int $max Max length * @param string $more Add more param on a link + * @param int $notooltip 1=Disable tooltip * @return string Chaine avec URL */ - function getNomUrl($withpicto=0,$option='',$max=0,$more='') + function getNomUrl($withpicto=0, $option='', $max=0, $more='', $notooltip=0) { global $langs; $result=''; //$newref=str_replace('_',' ',$this->ref); $newref=$this->ref; - $newlabel=$langs->trans("ShowECMSection").': '.$newref; - $linkclose='"'.($more?' '.$more:'').' title="'.dol_escape_htmltag($newlabel, 1).'" class="classfortooltip">'; + $label=$langs->trans("ShowECMSection").': '.$newref; + $linkclose='"'.($more?' '.$more:'').' title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; - $link = 'picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); + if ($withpicto != 2) $result.= ($max?dol_trunc($newref,$max,'middle'):$newref); + $result .= $linkend; - if ($withpicto) $result.=($link.img_object($newlabel, $picto, 'class="classfortooltip"').$linkend); - if ($withpicto && $withpicto != 2) $result.=' '; - if ($withpicto != 2) $result.=$link.($max?dol_trunc($newref,$max,'middle'):$newref).$linkend; return $result; } diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index a329adfd116..ae16ad85eaf 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -43,6 +43,7 @@ class EcmFiles //extends CommonObject * @var string Name of table without prefix where object is stored */ public $table_element = 'ecm_files'; + public $picto = 'generic'; /** */ @@ -752,43 +753,7 @@ class EcmFiles //extends CommonObject static function LibStatut($status,$mode=0) { global $langs; - - if ($mode == 0) - { - $prefix=''; - if ($status == 1) return $langs->trans('Enabled'); - if ($status == 0) return $langs->trans('Disabled'); - } - if ($mode == 1) - { - if ($status == 1) return $langs->trans('Enabled'); - if ($status == 0) return $langs->trans('Disabled'); - } - if ($mode == 2) - { - if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); - if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); - } - if ($mode == 3) - { - if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4'); - if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5'); - } - if ($mode == 4) - { - if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); - if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); - } - if ($mode == 5) - { - if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); - if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); - } - if ($mode == 6) - { - if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); - if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); - } + return ''; } diff --git a/htdocs/ecm/docfile.php b/htdocs/ecm/docfile.php index 339df01b88a..5a14b95291f 100644 --- a/htdocs/ecm/docfile.php +++ b/htdocs/ecm/docfile.php @@ -247,10 +247,9 @@ if ($action == 'edit') print ''; } -dol_fiche_head($head, 'card', $langs->trans("File"), 0, 'generic'); +dol_fiche_head($head, 'card', $langs->trans("File"), -1, 'generic'); + -print ''; -print ''; -/*print ''; -print ''; -*/ -print '
'.$langs->trans("Ref").''; $s=''; $tmpecmdir=new EcmDirectory($db); // Need to create a new one $tmpecmdir->fetch($ecmdir->id); @@ -259,7 +258,7 @@ $i=0; while ($tmpecmdir && $result > 0) { $tmpecmdir->ref=$tmpecmdir->label; - $s=$tmpecmdir->getNomUrl(1).$s; + $s=$tmpecmdir->getNomUrl(1).$s; if ($tmpecmdir->fk_parent) { $s=' -> '.$s; @@ -272,28 +271,18 @@ while ($tmpecmdir && $result > 0) $i++; } -print img_picto('','object_dir').' '.$langs->trans("ECMRoot").' -> '; -print $s; -print ' -> '; -if ($action == 'edit') print ''; -else print $urlfile; -print '
'.$langs->trans("Description").''; -if ($action == 'edit') -{ - print ''; -} -else print dol_nl2br($ecmdir->description); -print '
'.$langs->trans("ECMCreationUser").''; -$userecm=new User($db); -$userecm->fetch($ecmdir->fk_user_c); -print $userecm->getNomUrl(1); -print '
'.$langs->trans("ECMCreationDate").''; +$s = img_picto('','object_dir').' '.$langs->trans("ECMRoot").' -> '.$s.' -> '; +if ($action == 'edit') $s .= ''; +else $s .= $urlfile; + +$object->ref=''; // Force to hide ref +dol_banner_tab($object, '', $morehtml, 0, '', '', $s); + +print '
'; + +print '
'; +print ''; +print ''; /*print ''; print '
'.$langs->trans("ECMCreationDate").''; print dol_print_date(dol_filemtime($fullpath),'dayhour'); print '
'.$langs->trans("ECMDirectoryForFiles").''; @@ -385,6 +374,7 @@ else print '
'; +print '
'; print ajax_autoselect('downloadinternallink'); print ajax_autoselect('downloadlink'); diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php index 56f9b692e94..8841778ce26 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -337,165 +337,6 @@ dol_fiche_head($head, 'index', $langs->trans("ECMArea").' - '.$langs->trans("ECM $module='ecm'; include DOL_DOCUMENT_ROOT.'/ecm/tpl/filemanager.tpl.php'; - -/* -// Start container of all panels -?> - -
-
-'; - -// Toolbar -if ($user->rights->ecm->setup) -{ - print ''; - print ''; - print ''; -} -else -{ - print ''; - print ''; - print ''; -} -$url=((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&module='.$module:'').($section?'&section='.$section:''))); -print ''; -print ''; -print ''; - - -// Start Add new file area -$nameforformuserfile = 'formuserfileecm'; - -print '
'; - -// To attach new file -if ((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) || ! empty($section)) -{ - if ((empty($section) || $section == -1) && ($module != 'medias')) - { - ?> - - form_attach_new_file($_SERVER["PHP_SELF"], 'none', 0, ($section?$section:-1), $user->rights->ecm->upload, 48, null, '', 0, '', 0, $nameforformuserfile); -} -else print ' '; - -print '
'; -// End Add new file area - - -print '
'; -// End top panel, toolbar - -?> -
-
-formconfirm($_SERVER["PHP_SELF"].'?section='.$section, $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$ecmdir->label), 'confirm_deletesection','','',1); -} -// End confirm - - -if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$action) || $action == 'delete') -{ - print ''."\n"; - - print ''."\n"; - print ''."\n"; - print ''; - - $showonrightsize=''; - - // Manual section - $htmltooltip=$langs->trans("ECMAreaDesc2"); - - if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) - { - print ''; - } - else - { - print ''; - } - - - print "
'; - print ' '.$langs->trans("ECMSections"); - print '
'; - - // Show filemanager tree (will be filled by call of ajax enablefiletreeajax.tpl.php that execute ajaxdirtree.php) - print '
'; - - if ($action == 'deletefile') print $form->formconfirm('eeeee', $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', '', 'deletefile'); - - print '
'; - - if (empty($module)) $module='ecm'; - - $_POST['modulepart'] = $module; - $_POST['openeddir'] = GETPOST('openeddir'); - $_POST['dir'] = empty($_POST['dir'])?'/':$_POST['dir']; - - // Show filemanager tree (will be filled by direct include of ajaxdirtree.php in mode noajax, this will return all dir - all levels - to show) - print '
'; - - $mode='noajax'; - $url=DOL_URL_ROOT.'/ecm/index.php'; - include DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirtree.php'; - - print '
'; - print '
"; -} - - -// End left panel -?> -
-
-
-
- -
-
- -
- -use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) { - include DOL_DOCUMENT_ROOT.'/ecm/tpl/enablefiletreeajax.tpl.php'; -} -*/ - // End of page dol_fiche_end(); diff --git a/htdocs/ecm/tpl/enablefiletreeajax.tpl.php b/htdocs/ecm/tpl/enablefiletreeajax.tpl.php index 4be1bf1979a..3e77c0acd92 100644 --- a/htdocs/ecm/tpl/enablefiletreeajax.tpl.php +++ b/htdocs/ecm/tpl/enablefiletreeajax.tpl.php @@ -33,8 +33,8 @@ $(document).ready(function() { $('#filetree').fileTree({ root: '', - // Ajax called if we click to expand a dir (not a file). Parameter 'dir' is provided as a POST parameter by fileTree code. - script: '', + // Ajax called if we click to expand a dir (not a file). Parameter 'dir' is provided as a POST parameter by fileTree code to this following URL. + script: '', folderEvent: 'click', // 'dblclick' multiFolder: false }, // Called if we click on a file (not a dir) @@ -46,7 +46,7 @@ $(document).ready(function() { function(elem) { id=elem.attr('id').substr(12); // We get id that is 'fmdirlia_id_xxx' (id we want is xxx) jQuery("#_section_dir").val(elem.attr('rel')); - jQuery("#_section_id").val(id); + jQuery("#_section_id").val(id); jQuery('#').show(); } ); @@ -73,7 +73,7 @@ function loadandshowpreview(filedirname,section) $('#ecmfileview').empty(); - var url = '?action=preview&module=§ion='+section+'&file='+urlencode(filedirname); + var url = '?action=preview&module=§ion='+section+'&file='+urlencode(filedirname); $.get(url, function(data) { //alert('Load of url '+url+' was performed : '+data); pos=data.indexOf("TYPE=directory",0); diff --git a/htdocs/ecm/tpl/filemanager.tpl.php b/htdocs/ecm/tpl/filemanager.tpl.php index e80e9fd3e83..c5216deb170 100644 --- a/htdocs/ecm/tpl/filemanager.tpl.php +++ b/htdocs/ecm/tpl/filemanager.tpl.php @@ -57,8 +57,8 @@ else } if ($module == 'ecm') { - $url=((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&module='.$module:'').($section?'&section='.$section:''))); - print ''; + $tmpurl=((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&module='.$module:'').($section?'&section='.$section:''))); + print ''; print ''; print ''; } @@ -150,7 +150,7 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti print '
'; $mode='noajax'; - $url=DOL_URL_ROOT.'/ecm/index.php'; + if (empty($url)) $url=DOL_URL_ROOT.'/ecm/index.php'; include DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirtree.php'; print '
'; @@ -173,7 +173,7 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti $mode='noajax'; -$url=DOL_URL_ROOT.'/ecm/index.php'; +if (empty($url)) $url=DOL_URL_ROOT.'/ecm/index.php'; include_once DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirpreview.php'; diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 79eca309e59..b3f1116d50c 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -52,7 +52,6 @@ $pageid=GETPOST('pageid', 'int'); $pageref=GETPOST('pageref', 'aZ09'); $action=GETPOST('action','alpha'); - if (GETPOST('delete')) { $action='delete'; } if (GETPOST('preview')) $action='preview'; if (GETPOST('createsite')) { $action='createsite'; } @@ -67,6 +66,18 @@ if (GETPOST('editcontent')) { $action='editcontent'; } if (GETPOST('createfromclone')) { $action='createfromclone'; } if (GETPOST('createpagefromclone')) { $action='createpagefromclone'; } +// Load variable for pagination +$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; +$sortfield = GETPOST("sortfield",'alpha'); +$sortorder = GETPOST("sortorder",'alpha'); +$page = GETPOST("page",'int'); +if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +//if (! $sortfield) $sortfield='name'; +//if (! $sortorder) $sortorder='ASC'; + if (empty($action)) $action='preview'; $object=new Website($db); @@ -111,7 +122,6 @@ $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current - /* * Actions */ @@ -1792,6 +1802,7 @@ if ($action == 'file_manager') //print '
'.$langs->trans("FeatureNotYetAvailable").''; $module = 'medias'; + if (empty($url)) $url=DOL_URL_ROOT.'/website/index.php'; include DOL_DOCUMENT_ROOT.'/ecm/tpl/filemanager.tpl.php'; } From beacf4225ff0c414a8848fd658eb9933d11a9d12 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Nov 2017 15:29:12 +0100 Subject: [PATCH 19/47] Work on filemanager --- htdocs/core/ajax/ajaxdirpreview.php | 2 +- htdocs/core/class/html.formfile.class.php | 7 ++-- htdocs/core/js/lib_foot.js.php | 6 ++- htdocs/ecm/docdir.php | 26 +++++++++---- htdocs/ecm/tpl/filemanager.tpl.php | 45 +++++++++++++---------- htdocs/main.inc.php | 4 +- htdocs/theme/eldy/style.css.php | 2 +- htdocs/website/index.php | 23 +++++++++++- 8 files changed, 80 insertions(+), 35 deletions(-) diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index 9107b604e80..90e5bc1521f 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -268,7 +268,7 @@ if ($type == 'directory') if ($module == 'medias') { - $useinecm = 0; + $useinecm = 2; $modulepart='medias'; $perm=($user->rights->website->write || $user->rights->emailing->creer); $title='none'; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 2a514f65f1f..bc162abd170 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -917,6 +917,7 @@ class FormFile * @param int $useinecm Change output for use in ecm module: * 0: Add a previw link. Show also rename and crop file * 1: Add link to edit ECM entry + * 2: Add rename and crop file * @param string $textifempty Text to show if filearray is empty ('NoFileFound' if not defined) * @param int $maxlength Maximum length of file name shown. * @param string $title Title before list. Use 'none' to disable title. @@ -1128,11 +1129,11 @@ class FormFile // Delete or view link // ($param must start with &) print '
'; - if ($useinecm) + if ($useinecm == 1) { print ''.img_view('default', 0, 'class="paddingrightonly"').''; } - else + if (! $useinecm || $useinecm == 2) { $newmodulepart=$modulepart; if (in_array($modulepart, array('product','produit','service'))) $newmodulepart='produit|service'; @@ -1151,7 +1152,7 @@ class FormFile if ($permtoeditline) { - print ''.img_edit('default',0,'class="paddingrightonly"').''; + print ''.img_edit('default',0,'class="paddingrightonly"').''; } } if ($permonobject) diff --git a/htdocs/core/js/lib_foot.js.php b/htdocs/core/js/lib_foot.js.php index c133e0014f1..d3b3db60ef8 100644 --- a/htdocs/core/js/lib_foot.js.php +++ b/htdocs/core/js/lib_foot.js.php @@ -58,7 +58,11 @@ if (empty($conf->dol_no_mouse_hover)) return $(this).prop(\'title\'); /* To force to get title as is */ } }); - jQuery(".classfortooltiponclicktext").dialog({ closeOnEscape: true, classes: { "ui-dialog": "highlight" }, maxHeight: window.innerHeight-60, width: '.($conf->browser->layout == 'phone' ? 400 : 700).', autoOpen: false }).css("z-index: 5000"); + jQuery(".classfortooltiponclicktext").dialog( + { closeOnEscape: true, classes: { "ui-dialog": "highlight" }, + maxHeight: window.innerHeight-60, width: '.($conf->browser->layout == 'phone' ? 400 : 700).', + modal: true, + autoOpen: false }).css("z-index: 5000"); jQuery(".classfortooltiponclick").click(function () { console.log("We click on tooltip for element with dolid="+$(this).attr(\'dolid\')); if ($(this).attr(\'dolid\')) diff --git a/htdocs/ecm/docdir.php b/htdocs/ecm/docdir.php index b3b9fa528e0..2fa84f8b96d 100644 --- a/htdocs/ecm/docdir.php +++ b/htdocs/ecm/docdir.php @@ -42,8 +42,10 @@ $langs->load("categories"); if (! $user->rights->ecm->setup) accessforbidden(); // Get parameters -$socid = GETPOST('socid','int'); -$action=GETPOST('action','alpha'); +$socid = GETPOST('socid','int'); +$action = GETPOST('action','alpha'); +$cancel = GETPOST('cancel', 'aZ09'); +$backtopage = GETPOST('backtopage', 'alpha'); $confirm=GETPOST('confirm','alpha'); // Security check @@ -86,11 +88,20 @@ if (! empty($section)) // Action ajout d'un produit ou service if ($action == 'add' && $user->rights->ecm->setup) { - if (! empty($_POST["cancel"])) + if ($cancel) { - header("Location: ".DOL_URL_ROOT.'/ecm/index.php?action=file_manager'); - exit; + if (! empty($backtopage)) + { + header("Location: ".$backtopage); + exit; + } + else + { + header("Location: ".DOL_URL_ROOT.'/ecm/index.php?action=file_manager'); + exit; + } } + $ecmdir->ref = trim($_POST["ref"]); $ecmdir->label = trim($_POST["label"]); $ecmdir->description = trim($_POST["desc"]); @@ -150,10 +161,11 @@ if ($action == 'create') print '
'; print ''; print ''; + print ''; $title=$langs->trans("ECMNewSection"); print load_fiche_titre($title); - + dol_fiche_head(); print ''; @@ -206,7 +218,7 @@ if (empty($action) || $action == 'delete_section') if ($action == 'delete_section') { print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.$section, $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$ecmdir->label), 'confirm_deletesection'); - + } // Construit fiche rubrique diff --git a/htdocs/ecm/tpl/filemanager.tpl.php b/htdocs/ecm/tpl/filemanager.tpl.php index c5216deb170..d201e73798e 100644 --- a/htdocs/ecm/tpl/filemanager.tpl.php +++ b/htdocs/ecm/tpl/filemanager.tpl.php @@ -43,25 +43,32 @@ if (($action == 'delete' || $action == 'file_manager_delete') && empty($conf->us print '
'; // Toolbar -if ($user->rights->ecm->setup) -{ - print ''; - print ''; - print ''; -} -else -{ - print ''; - print ''; - print ''; -} -if ($module == 'ecm') -{ - $tmpurl=((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&module='.$module:'').($section?'&section='.$section:''))); - print ''; - print ''; - print ''; -} +//if (preg_match('/\/ecm/', $_SERVER['PHP_SELF'])) { +//if ($module == 'ecm') { + $permtoadd = 0; + if ($module == 'ecm') $permtoadd = $user->rights->ecm->setup; + if ($module == 'medias') $permtoadd = ($user->rights->ecm->setup || $user->rights->website->setup); + + if ($permtoadd) + { + print ''; + print ''; + print ''; + } + else + { + print ''; + print ''; + print ''; + } + if ($module == 'ecm') + { + $tmpurl=((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&module='.$module:'').($section?'&section='.$section:''))); + print ''; + print ''; + print ''; + } +//} // Start "Add new file" area $nameforformuserfile = 'formuserfileecm'; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 9389d960171..1d049e670c9 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1858,7 +1858,7 @@ if (! function_exists("llxFooter")) global $delayedhtmlcontent; $ext='version='.urlencode(DOL_VERSION); - + // Global html output events ($mesgs, $errors, $warnings) dol_htmloutput_events($disabledoutputofmessages); @@ -1918,7 +1918,7 @@ if (! function_exists("llxFooter")) if (! empty($conf->use_javascript_ajax)) { print "\n".''."\n"; - print ''."\n"; + print ''."\n"; } // Wrapper to add log when clicking on download or preview diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 03825de4406..fb9b9724114 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -4844,7 +4844,7 @@ div.tabsElem a.tab { @media only screen and (max-width: 1024px) { div#ecm-layout-west { - width: 100%; + width: calc(100% - 4px); clear: both; } div#ecm-layout-center { diff --git a/htdocs/website/index.php b/htdocs/website/index.php index b3f1116d50c..d030bdb4647 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -1161,6 +1161,8 @@ if ($action == 'edit') $style=''; if ($action != 'preview' && $action != 'editcontent' && $action != 'editsource') $style=' margin-bottom: 5px;'; +if (! GETPOST('hide_websitemenu')) +{ //var_dump($objectpage);exit; print '
'; @@ -1221,6 +1223,23 @@ if (count($object->records) > 0) print '   '; print ''; + /*print ''.dol_escape_htmltag($langs->trans("MediaFiles")).''; + print ''; + */ } print '
'; @@ -1465,8 +1484,10 @@ else $action=''; } - print '
'; // end current websitebar +} + + $head = array(); From dd93a1793ad5c684c61f7005fa2f546cbcbf0da8 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 10 Nov 2017 16:12:17 +0100 Subject: [PATCH 20/47] Fix: remove var_dump --- htdocs/core/lib/security2.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index e953a8018cb..7d305ded7d4 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -456,7 +456,7 @@ function getRandomPassword($generic=false) $randomCode = ""; $nbofchar = round($length/3); $nbofcharlast = ($length - 2*$nbofchar); - var_dump($nbofchar.'-'.$nbofcharlast); + //var_dump($nbofchar.'-'.$nbofcharlast); if (function_exists('random_int')) // Cryptographic random { $max = strlen($lowercase) - 1; From 3ffe1b6725687aede5f4cb26c88b3e34069165a2 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 10 Nov 2017 16:51:37 +0100 Subject: [PATCH 21/47] Fix: missing status 3 (only on form) --- htdocs/core/class/commonobject.class.php | 2 +- htdocs/core/tpl/extrafields_view.tpl.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 7f73630f7f6..4138607de28 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5620,7 +5620,7 @@ abstract class CommonObject foreach($extrafields->attribute_label as $key=>$label) { if (empty($extrafields->attribute_list[$key])) continue; // 0 = Never visible field - if (($mode == 'create' || $mode == 'edit') && abs($extrafields->attribute_list[$key]) != 1) continue; // <> -1 and <> 1 = not visible on forms, only on list + if (($mode == 'create' || $mode == 'edit') && abs($extrafields->attribute_list[$key]) != 1 && abs($extrafields->attribute_list[$key]) != 3) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list // Load language if required if (! empty($extrafields->attributes[$this->table_element]['langfile'][$key])) $langs->load($extrafields->attributes[$this->table_element]['langfile'][$key]); diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index b57025e3dd6..589a7b56e0e 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -43,7 +43,8 @@ if (empty($reshook) && ! empty($extrafields->attributes[$object->table_element][ foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label) { // Discard if extrafield is a hidden field on form - if (abs($extrafields->attributes[$object->table_element]['list'][$key]) != 1) continue; + if (empty($extrafields->attributes[$object->table_element]['list'][$key])) continue; // 0 = Never visible field + if (abs($extrafields->attributes[$object->table_element]['list'][$key]) != 1 && abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list // Load language if required if (! empty($extrafields->attributes[$object->table_element]['langfile'][$key])) $langs->load($extrafields->attributes[$object->table_element]['langfile'][$key]); From 56829656baf4bbf460021ae5e92087dd6021e312 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 10 Nov 2017 17:57:11 +0100 Subject: [PATCH 22/47] Fix: Avoid ldap error --- htdocs/adherents/class/adherent.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 81167eebc5e..d42f67f075a 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1969,7 +1969,7 @@ class Adherent extends CommonObject $this->fullname=$this->getFullName($langs); // For avoid ldap error when firstname and lastname are empty - if ($this->morphy == 'mor' && empty($this->fullname)) { + if ($this->morphy == 'mor' && (empty($this->fullname) || $this->fullname == $this->societe)) { $this->fullname = $this->societe; $this->lastname = $this->societe; } From cb03b2f3074965ac6cd5f9e8f9e5b593400cbfdb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Nov 2017 18:14:29 +0100 Subject: [PATCH 23/47] NEW Can sort joined files on thirdparty and user card. --- htdocs/core/ajax/row.php | 4 ++-- htdocs/core/class/html.formfile.class.php | 8 +++---- htdocs/core/photos_resize.php | 24 ++++++++++++++++--- .../tpl/document_actions_post_headers.tpl.php | 2 +- htdocs/societe/document.php | 2 +- htdocs/user/class/user.class.php | 13 +++++----- htdocs/user/document.php | 2 +- 7 files changed, 37 insertions(+), 18 deletions(-) diff --git a/htdocs/core/ajax/row.php b/htdocs/core/ajax/row.php index 6e358bdbd88..71a5a0aac88 100644 --- a/htdocs/core/ajax/row.php +++ b/htdocs/core/ajax/row.php @@ -63,9 +63,9 @@ if ((isset($_POST['roworder']) && ! empty($_POST['roworder'])) && (isset($_POST[ $row->table_element_line = $table_element_line; $row->fk_element = $fk_element; $row->id = $element_id; - $row->line_ajaxorder($newrowordertab); + $row->line_ajaxorder($newrowordertab); // This update field rank or position in table table_element_line - // Reorder line to have position of chilren lines sharing same counter than parent lines + // Reorder line to have position of children lines sharing same counter than parent lines // This should be useless because there is no need to have children sharing same counter than parent, but well, it's cleaner into database. if (in_array($fk_element,array('fk_facture','fk_propal','fk_commande'))) { diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index bc162abd170..4c354b66107 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1042,10 +1042,10 @@ class FormFile { completeFileArrayWithDatabaseInfo($filearray, $relativedir); - /*var_dump($sortfield); - var_dump($sortorder);*/ - if ($sortfield && $sortorder) + //var_dump($sortfield.' - '.$sortorder); + if ($sortfield && $sortorder) // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name) { + //var_dump($sortfield); $filearray=dol_sort_array($filearray, $sortfield, $sortorder); } //var_dump($filearray); @@ -1139,7 +1139,7 @@ class FormFile if (in_array($modulepart, array('product','produit','service'))) $newmodulepart='produit|service'; $disablecrop=1; - if (in_array($modulepart, array('product','produit','service','expensereport','holiday','project','user'))) $disablecrop=0; + if (in_array($modulepart, array('societe','product','produit','service','expensereport','holiday','project','user'))) $disablecrop=0; if (! $disablecrop && image_format_supported($file['name']) > 0) { diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php index fcedc2a4e11..9a11523f39b 100644 --- a/htdocs/core/photos_resize.php +++ b/htdocs/core/photos_resize.php @@ -67,9 +67,15 @@ elseif ($modulepart == 'expensereport') } elseif ($modulepart == 'user') { - $result=restrictedArea($user,'user',$id,'user'); - if (! $user->rights->user->user->lire) accessforbidden(); - $accessallowed=1; + $result=restrictedArea($user,'user',$id,'user'); + if (! $user->rights->user->user->lire) accessforbidden(); + $accessallowed=1; +} +elseif ($modulepart == 'societe') +{ + $result=restrictedArea($user,'societe',$id,'societe'); + if (! $user->rights->societe->lire) accessforbidden(); + $accessallowed=1; } // Security: @@ -115,6 +121,17 @@ elseif ($modulepart == 'holiday') $dir=$conf->holiday->dir_output; // By default } } +elseif ($modulepart == 'societe') +{ + require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; + $object = new Societe($db); + if ($id > 0) + { + $result = $object->fetch($id); + if ($result <= 0) dol_print_error($db,'Failed to load object'); + $dir=$conf->societe->dir_output; + } +} elseif ($modulepart == 'user') { require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; @@ -145,6 +162,7 @@ if (empty($backtourl)) else if (in_array($modulepart, array('holiday'))) $backtourl=DOL_URL_ROOT."/holiday/document.php?id=".$id.'&file='.urldecode($_POST["file"]); else if (in_array($modulepart, array('project'))) $backtourl=DOL_URL_ROOT."/projet/document.php?id=".$id.'&file='.urldecode($_POST["file"]); else if (in_array($modulepart, array('user'))) $backtourl=DOL_URL_ROOT."/user/document.php?id=".$id.'&file='.urldecode($_POST["file"]); + else if (in_array($modulepart, array('societe'))) $backtourl=DOL_URL_ROOT."/societe/document.php?id=".$id.'&file='.urldecode($_POST["file"]); } diff --git a/htdocs/core/tpl/document_actions_post_headers.tpl.php b/htdocs/core/tpl/document_actions_post_headers.tpl.php index da1cb9658a0..10650364543 100644 --- a/htdocs/core/tpl/document_actions_post_headers.tpl.php +++ b/htdocs/core/tpl/document_actions_post_headers.tpl.php @@ -79,7 +79,7 @@ $formfile->form_attach_new_file( ); $disablemove=1; -if ($modulepart == 'product' || $modulepart == 'produit') $disablemove=0; // Drag and drop for up and down allowed on product +if (in_array($modulepart, array('product', 'produit', 'societe', 'user'))) $disablemove=0; // Drag and drop for up and down allowed on product // List of document $formfile->list_of_documents( diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index fbfd931b69b..be549d6cac5 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -58,7 +58,7 @@ $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; if (! $sortorder) $sortorder="ASC"; -if (! $sortfield) $sortfield="name"; +if (! $sortfield) $sortfield="position_name"; $object = new Societe($db); if ($id > 0 || ! empty($ref)) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index b9e7378bd31..565e1f014b7 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -40,6 +40,7 @@ class User extends CommonObject { public $element='user'; public $table_element='user'; + public $fk_element='fk_user'; public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe public $id=0; @@ -53,17 +54,17 @@ class User extends CommonObject public $job; public $signature; public $address; - public $zip; - public $town; - public $state_id; - public $state_code; - public $state; + public $zip; + public $town; + public $state_id; + public $state_code; + public $state; public $office_phone; public $office_fax; public $user_mobile; public $admin; public $login; - public $api_key; + public $api_key; public $entity; //! Clear password in memory diff --git a/htdocs/user/document.php b/htdocs/user/document.php index 27cf4eb757a..ff7fe9b5ab9 100644 --- a/htdocs/user/document.php +++ b/htdocs/user/document.php @@ -81,7 +81,7 @@ $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; if (! $sortorder) $sortorder="ASC"; -if (! $sortfield) $sortfield="name"; +if (! $sortfield) $sortfield="position_name"; $object = new User($db); if ($id > 0 || ! empty($ref)) From a029b16795c042f6799d118cb38c37b6f6b231b4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Nov 2017 18:27:03 +0100 Subject: [PATCH 24/47] css --- htdocs/core/class/html.formfile.class.php | 2 +- htdocs/theme/eldy/style.css.php | 3 +++ htdocs/theme/md/style.css.php | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 4c354b66107..7156524a89c 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1128,7 +1128,7 @@ class FormFile { // Delete or view link // ($param must start with &) - print ''; // Show file size @@ -741,12 +741,11 @@ class FormFile //$out.= '&modulepart='.$modulepart; // TODO obsolete ? //$out.= '&urlsource='.urlencode($urlsource); // TODO obsolete ? $out.= '">'.img_picto($langs->trans("Delete"), 'delete.png').''; - //$out.=''; } if ($printer) { //$out.= ''; print '\n"; @@ -1448,10 +1456,10 @@ class FormFile // File print '
'; + print ''; if ($useinecm == 1) { print ''.img_view('default', 0, 'class="paddingrightonly"').''; diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index fb9b9724114..dce3318d1da 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -398,6 +398,9 @@ td.onholidaymorning, td.onholidayafternoon { td.onholidayallday { background-color: #f4eede; } +td.actionbuttons a { + padding-left: 6px; +} select.flat, form.flat select { font-weight: normal; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 92f5f44b64f..266444516f6 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -405,7 +405,9 @@ td.onholidaymorning, td.onholidayafternoon { td.onholidayallday { background-color: #f4eede; } - +td.actionbuttons a { + padding-left: 6px; +} select.flat, form.flat select { font-weight: normal; } From debc0480dd96a2fccbad4e8114560efa7a01de71 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Nov 2017 20:20:59 +0100 Subject: [PATCH 25/47] CSS --- htdocs/core/class/html.formfile.class.php | 52 +++++--- htdocs/core/lib/functions.lib.php | 141 ++++++++++++---------- htdocs/theme/eldy/style.css.php | 4 +- htdocs/theme/md/style.css.php | 4 +- 4 files changed, 112 insertions(+), 89 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 7156524a89c..049f768b549 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -713,14 +713,14 @@ class FormFile // Show file name with link to download $out.= ''; - $tmp = $this->showPreview($file,$modulepart,$relativepath,0,$param); - $out.= ($tmp?$tmp.' ':''); - $out.= 'trans("File").': '.$file["name"]).' '.$file["name"]; + $out.= img_mime($file["name"],$langs->trans("File").': '.$file["name"]); + $out.= $file["name"]; $out.= ''."\n"; + $out.= $this->showPreview($file,$modulepart,$relativepath,0,$param); $out.= ''; - $out.= ' '.img_picto($langs->trans("PrintFile", $relativepath),'printer.png').''; } @@ -841,21 +840,24 @@ class FormFile $file_list=dol_dir_list($filedir, 'files', 0, $filterforfilesearch, '\.meta$|\.png$'); // Get list of files starting with name of ref (but not followed by "-" to discard uploaded files) + //var_dump($file_list); // For ajax treatment $out.= ''."\n"; if (! empty($file_list)) { $out=''; + + if (! $found) $out=''; } else { @@ -1062,6 +1072,7 @@ class FormFile && ! preg_match('/\.meta$/i',$file['name'])) { if ($filearray[$key]['rowid'] > 0) $lastrowid = $filearray[$key]['rowid']; + $filepath=$relativepath.$file['name']; $editline=0; $nboflines++; @@ -1071,18 +1082,14 @@ class FormFile print '
'; - $filepath=$relativepath.$file['name']; - - if (! $editline) print $this->showPreview($file,$modulepart,$filepath); - + // Show file name with link to download //print "XX".$file['name']; //$file['name'] must be utf8 - print ''; - - print img_mime($file['name'],$file['name'].' ('.dol_print_size($file['size'],0,0).')').' '; + print img_mime($file['name'], $file['name'].' ('.dol_print_size($file['size'],0,0).')', 'inline-block valignbottom paddingright'); if ($showrelpart == 1) print $relativepath; //print dol_trunc($file['name'],$maxlength,'middle'); if (GETPOST('action','aZ09') == 'editfile' && $file['name'] == basename(GETPOST('urlfile'))) @@ -1097,6 +1104,7 @@ class FormFile print $file['name']; print ''; } + if (! $editline) print $this->showPreview($file, $modulepart, $filepath); print "'; //print "XX".$file['name']; //$file['name'] must be utf8 - print ''; - print img_mime($file['name'],$file['name'].' ('.dol_print_size($file['size'],0,0).')').' '; + print img_mime($file['name'],$file['name'].' ('.dol_print_size($file['size'],0,0).')'); print dol_trunc($file['name'],$maxlength,'middle'); print ''; @@ -1678,7 +1686,11 @@ class FormFile { $out.= ''; //$out.= ''; - if (empty($ruleforpicto)) $out.= img_picto($langs->trans('Preview').' '.$file['name'], 'detail'); + if (empty($ruleforpicto)) + { + //$out.= img_picto($langs->trans('Preview').' '.$file['name'], 'detail'); + $out.=''; + } else $out.= img_mime($relativepath, $langs->trans('Preview').' '.$file['name']); $out.= ''; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 1628a09d202..1a6f2d821e0 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3216,18 +3216,21 @@ function img_allow($allow, $titlealt = 'default') * * @param string $file Filename * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. + * @param string $morecss More css * @return string Return img tag */ -function img_mime($file, $titlealt = '') +function img_mime($file, $titlealt = '', $morecss='') { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $mimetype = dol_mimetype($file, '', 1); $mimeimg = dol_mimetype($file, '', 2); + $mimefa = dol_mimetype($file, '', 4); if (empty($titlealt)) $titlealt = 'Mime type: '.$mimetype; - return img_picto_common($titlealt, 'mime/'.$mimeimg); + //return img_picto_common($titlealt, 'mime/'.$mimeimg, 'class="'.$morecss.'"'); + return ''; } @@ -6368,7 +6371,7 @@ function printCommonFooter($zone='private') if (empty($reshook)) { if (! empty($conf->global->MAIN_HTML_FOOTER)) print $conf->global->MAIN_HTML_FOOTER."\n"; - + print "\n"; if (! empty($conf->use_javascript_ajax)) { @@ -6385,7 +6388,7 @@ function printCommonFooter($zone='private') print " $('.login_block').toggle()\n"; print '});'."\n"; } - + // Google Analytics (need Google module) if (! empty($conf->google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AN_ID)) { @@ -6404,7 +6407,7 @@ function printCommonFooter($zone='private') print ' })();'."\n"; } } - + // End of tuning if (! empty($_SERVER['MAIN_SHOW_TUNING_INFO']) || ! empty($conf->global->MAIN_SHOW_TUNING_INFO)) { @@ -6434,7 +6437,7 @@ function printCommonFooter($zone='private') } print '");'."\n"; } - + print "\n".''."\n"; } @@ -6443,7 +6446,7 @@ function printCommonFooter($zone='private') { print_r(xdebug_get_code_coverage()); } - + // If there is some logs in buffer to show if (count($conf->logbuffer)) { @@ -6736,92 +6739,93 @@ function getAdvancedPreviewUrl($modulepart, $relativepath, $alldata=0, $param='' * * @param string $file Filename we looking for MIME type * @param string $default Default mime type if extension not found in known list - * @param int $mode 0=Return full mime, 1=otherwise short mime string, 2=image for mime type, 3=source language + * @param int $mode 0=Return full mime, 1=otherwise short mime string, 2=image for mime type, 3=source language, 4=css of font fa * @return string Return a mime type family (text/xxx, application/xxx, image/xxx, audio, video, archive) * @see image_format_supported (images.lib.php) */ -function dol_mimetype($file,$default='application/octet-stream',$mode=0) +function dol_mimetype($file, $default='application/octet-stream', $mode=0) { $mime=$default; $imgmime='other.png'; + $famime='file-o'; $srclang=''; $tmpfile=preg_replace('/\.noexe$/','',$file); // Text files - if (preg_match('/\.txt$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; } - if (preg_match('/\.rtx$/i',$tmpfile)) { $mime='text/richtext'; $imgmime='text.png'; } - if (preg_match('/\.csv$/i',$tmpfile)) { $mime='text/csv'; $imgmime='text.png'; } - if (preg_match('/\.tsv$/i',$tmpfile)) { $mime='text/tab-separated-values'; $imgmime='text.png'; } - if (preg_match('/\.(cf|conf|log)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; } - if (preg_match('/\.ini$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='ini'; } - if (preg_match('/\.css$/i',$tmpfile)) { $mime='text/css'; $imgmime='css.png'; $srclang='css'; } + if (preg_match('/\.txt$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $famime='file-text-o'; } + if (preg_match('/\.rtx$/i',$tmpfile)) { $mime='text/richtext'; $imgmime='text.png'; $famime='file-text-o'; } + if (preg_match('/\.csv$/i',$tmpfile)) { $mime='text/csv'; $imgmime='text.png'; $famime='file-text-o'; } + if (preg_match('/\.tsv$/i',$tmpfile)) { $mime='text/tab-separated-values'; $imgmime='text.png'; $famime='file-text-o'; } + if (preg_match('/\.(cf|conf|log)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $famime='file-text-o'; } + if (preg_match('/\.ini$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='ini'; $famime='file-text-o'; } + if (preg_match('/\.css$/i',$tmpfile)) { $mime='text/css'; $imgmime='css.png'; $srclang='css'; $famime='file-text-o'; } // Certificate files - if (preg_match('/\.(crt|cer|key|pub)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; } + if (preg_match('/\.(crt|cer|key|pub)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $famime='file-text-o'; } // HTML/XML - if (preg_match('/\.(html|htm|shtml)$/i',$tmpfile)) { $mime='text/html'; $imgmime='html.png'; $srclang='html'; } - if (preg_match('/\.(xml|xhtml)$/i',$tmpfile)) { $mime='text/xml'; $imgmime='other.png'; $srclang='xml'; } + if (preg_match('/\.(html|htm|shtml)$/i',$tmpfile)) { $mime='text/html'; $imgmime='html.png'; $srclang='html'; $famime='file-text-o'; } + if (preg_match('/\.(xml|xhtml)$/i',$tmpfile)) { $mime='text/xml'; $imgmime='other.png'; $srclang='xml'; $famime='file-text-o'; } // Languages - if (preg_match('/\.bas$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='bas'; } - if (preg_match('/\.(c)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='c'; } - if (preg_match('/\.(cpp)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='cpp'; } - if (preg_match('/\.(h)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='h'; } - if (preg_match('/\.(java|jsp)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='java'; } - if (preg_match('/\.php([0-9]{1})?$/i',$tmpfile)) { $mime='text/plain'; $imgmime='php.png'; $srclang='php'; } - if (preg_match('/\.phtml$/i',$tmpfile)) { $mime='text/plain'; $imgmime='php.png'; $srclang='php'; } - if (preg_match('/\.(pl|pm)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='pl.png'; $srclang='perl'; } - if (preg_match('/\.sql$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='sql'; } - if (preg_match('/\.js$/i',$tmpfile)) { $mime='text/x-javascript'; $imgmime='jscript.png'; $srclang='js'; } + if (preg_match('/\.bas$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='bas'; $famime='file-code-o'; } + if (preg_match('/\.(c)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='c'; $famime='file-code-o'; } + if (preg_match('/\.(cpp)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='cpp'; $famime='file-code-o'; } + if (preg_match('/\.(h)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='h'; $famime='file-code-o'; } + if (preg_match('/\.(java|jsp)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='java'; $famime='file-code-o'; } + if (preg_match('/\.php([0-9]{1})?$/i',$tmpfile)) { $mime='text/plain'; $imgmime='php.png'; $srclang='php'; $famime='file-code-o'; } + if (preg_match('/\.phtml$/i',$tmpfile)) { $mime='text/plain'; $imgmime='php.png'; $srclang='php'; $famime='file-code-o'; } + if (preg_match('/\.(pl|pm)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='pl.png'; $srclang='perl'; $famime='file-code-o'; } + if (preg_match('/\.sql$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='sql'; $famime='file-code-o'; } + if (preg_match('/\.js$/i',$tmpfile)) { $mime='text/x-javascript'; $imgmime='jscript.png'; $srclang='js'; $famime='file-code-o'; } // Open office - if (preg_match('/\.odp$/i',$tmpfile)) { $mime='application/vnd.oasis.opendocument.presentation'; $imgmime='ooffice.png'; } - if (preg_match('/\.ods$/i',$tmpfile)) { $mime='application/vnd.oasis.opendocument.spreadsheet'; $imgmime='ooffice.png'; } - if (preg_match('/\.odt$/i',$tmpfile)) { $mime='application/vnd.oasis.opendocument.text'; $imgmime='ooffice.png'; } + if (preg_match('/\.odp$/i',$tmpfile)) { $mime='application/vnd.oasis.opendocument.presentation'; $imgmime='ooffice.png'; $famime='file-powerpoint-o'; } + if (preg_match('/\.ods$/i',$tmpfile)) { $mime='application/vnd.oasis.opendocument.spreadsheet'; $imgmime='ooffice.png'; $famime='file-excel-o'; } + if (preg_match('/\.odt$/i',$tmpfile)) { $mime='application/vnd.oasis.opendocument.text'; $imgmime='ooffice.png'; $famime='file-word-o'; } // MS Office - if (preg_match('/\.mdb$/i',$tmpfile)) { $mime='application/msaccess'; $imgmime='mdb.png'; } - if (preg_match('/\.doc(x|m)?$/i',$tmpfile)) { $mime='application/msword'; $imgmime='doc.png'; } - if (preg_match('/\.dot(x|m)?$/i',$tmpfile)) { $mime='application/msword'; $imgmime='doc.png'; } - if (preg_match('/\.xlt(x)?$/i',$tmpfile)) { $mime='application/vnd.ms-excel'; $imgmime='xls.png'; } - if (preg_match('/\.xla(m)?$/i',$tmpfile)) { $mime='application/vnd.ms-excel'; $imgmime='xls.png'; } - if (preg_match('/\.xls$/i',$tmpfile)) { $mime='application/vnd.ms-excel'; $imgmime='xls.png'; } - if (preg_match('/\.xls(b|m|x)$/i',$tmpfile)) { $mime='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; $imgmime='xls.png'; } - if (preg_match('/\.pps(m|x)?$/i',$tmpfile)) { $mime='application/vnd.ms-powerpoint'; $imgmime='ppt.png'; } - if (preg_match('/\.ppt(m|x)?$/i',$tmpfile)) { $mime='application/x-mspowerpoint'; $imgmime='ppt.png'; } + if (preg_match('/\.mdb$/i',$tmpfile)) { $mime='application/msaccess'; $imgmime='mdb.png'; $famime='file-o'; } + if (preg_match('/\.doc(x|m)?$/i',$tmpfile)) { $mime='application/msword'; $imgmime='doc.png'; $famime='file-word-o'; } + if (preg_match('/\.dot(x|m)?$/i',$tmpfile)) { $mime='application/msword'; $imgmime='doc.png'; $famime='file-word-o'; } + if (preg_match('/\.xlt(x)?$/i',$tmpfile)) { $mime='application/vnd.ms-excel'; $imgmime='xls.png'; $famime='file-excel-o'; } + if (preg_match('/\.xla(m)?$/i',$tmpfile)) { $mime='application/vnd.ms-excel'; $imgmime='xls.png'; $famime='file-excel-o'; } + if (preg_match('/\.xls$/i',$tmpfile)) { $mime='application/vnd.ms-excel'; $imgmime='xls.png'; $famime='file-excel-o'; } + if (preg_match('/\.xls(b|m|x)$/i',$tmpfile)) { $mime='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; $imgmime='xls.png'; $famime='file-excel-o'; } + if (preg_match('/\.pps(m|x)?$/i',$tmpfile)) { $mime='application/vnd.ms-powerpoint'; $imgmime='ppt.png'; $famime='file-powerpoint-o'; } + if (preg_match('/\.ppt(m|x)?$/i',$tmpfile)) { $mime='application/x-mspowerpoint'; $imgmime='ppt.png'; $famime='file-powerpoint-o'; } // Other - if (preg_match('/\.pdf$/i',$tmpfile)) { $mime='application/pdf'; $imgmime='pdf.png'; } + if (preg_match('/\.pdf$/i',$tmpfile)) { $mime='application/pdf'; $imgmime='pdf.png'; $famime='file-pdf-o'; } // Scripts - if (preg_match('/\.bat$/i',$tmpfile)) { $mime='text/x-bat'; $imgmime='script.png'; $srclang='dos'; } - if (preg_match('/\.sh$/i',$tmpfile)) { $mime='text/x-sh'; $imgmime='script.png'; $srclang='bash'; } - if (preg_match('/\.ksh$/i',$tmpfile)) { $mime='text/x-ksh'; $imgmime='script.png'; $srclang='bash'; } - if (preg_match('/\.bash$/i',$tmpfile)) { $mime='text/x-bash'; $imgmime='script.png'; $srclang='bash'; } + if (preg_match('/\.bat$/i',$tmpfile)) { $mime='text/x-bat'; $imgmime='script.png'; $srclang='dos'; $famime='file-code-o'; } + if (preg_match('/\.sh$/i',$tmpfile)) { $mime='text/x-sh'; $imgmime='script.png'; $srclang='bash'; $famime='file-code-o'; } + if (preg_match('/\.ksh$/i',$tmpfile)) { $mime='text/x-ksh'; $imgmime='script.png'; $srclang='bash'; $famime='file-code-o'; } + if (preg_match('/\.bash$/i',$tmpfile)) { $mime='text/x-bash'; $imgmime='script.png'; $srclang='bash'; $famime='file-code-o'; } // Images - if (preg_match('/\.ico$/i',$tmpfile)) { $mime='image/x-icon'; $imgmime='image.png'; } - if (preg_match('/\.(jpg|jpeg)$/i',$tmpfile)) { $mime='image/jpeg'; $imgmime='image.png'; } - if (preg_match('/\.png$/i',$tmpfile)) { $mime='image/png'; $imgmime='image.png'; } - if (preg_match('/\.gif$/i',$tmpfile)) { $mime='image/gif'; $imgmime='image.png'; } - if (preg_match('/\.bmp$/i',$tmpfile)) { $mime='image/bmp'; $imgmime='image.png'; } - if (preg_match('/\.(tif|tiff)$/i',$tmpfile)) { $mime='image/tiff'; $imgmime='image.png'; } + if (preg_match('/\.ico$/i',$tmpfile)) { $mime='image/x-icon'; $imgmime='image.png'; $famime='file-image-o'; } + if (preg_match('/\.(jpg|jpeg)$/i',$tmpfile)) { $mime='image/jpeg'; $imgmime='image.png'; $famime='file-image-o'; } + if (preg_match('/\.png$/i',$tmpfile)) { $mime='image/png'; $imgmime='image.png'; $famime='file-image-o'; } + if (preg_match('/\.gif$/i',$tmpfile)) { $mime='image/gif'; $imgmime='image.png'; $famime='file-image-o'; } + if (preg_match('/\.bmp$/i',$tmpfile)) { $mime='image/bmp'; $imgmime='image.png'; $famime='file-image-o'; } + if (preg_match('/\.(tif|tiff)$/i',$tmpfile)) { $mime='image/tiff'; $imgmime='image.png'; $famime='file-image-o'; } // Calendar - if (preg_match('/\.vcs$/i',$tmpfile)) { $mime='text/calendar'; $imgmime='other.png'; } - if (preg_match('/\.ics$/i',$tmpfile)) { $mime='text/calendar'; $imgmime='other.png'; } + if (preg_match('/\.vcs$/i',$tmpfile)) { $mime='text/calendar'; $imgmime='other.png'; $famime='file-text-o'; } + if (preg_match('/\.ics$/i',$tmpfile)) { $mime='text/calendar'; $imgmime='other.png'; $famime='file-text-o'; } // Other - if (preg_match('/\.torrent$/i',$tmpfile)) { $mime='application/x-bittorrent'; $imgmime='other.png'; } + if (preg_match('/\.torrent$/i',$tmpfile)) { $mime='application/x-bittorrent'; $imgmime='other.png'; $famime='file-o'; } // Audio - if (preg_match('/\.(mp3|ogg|au|wav|wma|mid)$/i',$tmpfile)) { $mime='audio'; $imgmime='audio.png'; } + if (preg_match('/\.(mp3|ogg|au|wav|wma|mid)$/i',$tmpfile)) { $mime='audio'; $imgmime='audio.png'; $famime='file-audio-o'; } // Video - if (preg_match('/\.ogv$/i',$tmpfile)) { $mime='video/ogg'; $imgmime='video.png'; } - if (preg_match('/\.webm$/i',$tmpfile)) { $mime='video/webm'; $imgmime='video.png'; } - if (preg_match('/\.avi$/i',$tmpfile)) { $mime='video/x-msvideo'; $imgmime='video.png'; } - if (preg_match('/\.divx$/i',$tmpfile)) { $mime='video/divx'; $imgmime='video.png'; } - if (preg_match('/\.xvid$/i',$tmpfile)) { $mime='video/xvid'; $imgmime='video.png'; } - if (preg_match('/\.(wmv|mpg|mpeg)$/i',$tmpfile)) { $mime='video'; $imgmime='video.png'; } + if (preg_match('/\.ogv$/i',$tmpfile)) { $mime='video/ogg'; $imgmime='video.png'; $famime='file-video-o'; } + if (preg_match('/\.webm$/i',$tmpfile)) { $mime='video/webm'; $imgmime='video.png'; $famime='file-video-o'; } + if (preg_match('/\.avi$/i',$tmpfile)) { $mime='video/x-msvideo'; $imgmime='video.png'; $famime='file-video-o'; } + if (preg_match('/\.divx$/i',$tmpfile)) { $mime='video/divx'; $imgmime='video.png'; $famime='file-video-o'; } + if (preg_match('/\.xvid$/i',$tmpfile)) { $mime='video/xvid'; $imgmime='video.png'; $famime='file-video-o'; } + if (preg_match('/\.(wmv|mpg|mpeg)$/i',$tmpfile)) { $mime='video'; $imgmime='video.png'; $famime='file-video-o'; } // Archive - if (preg_match('/\.(zip|rar|gz|tgz|z|cab|bz2|7z|tar|lzh)$/i',$tmpfile)) { $mime='archive'; $imgmime='archive.png'; } // application/xxx where zzz is zip, ... + if (preg_match('/\.(zip|rar|gz|tgz|z|cab|bz2|7z|tar|lzh)$/i',$tmpfile)) { $mime='archive'; $imgmime='archive.png'; $famime='file-archive-o'; } // application/xxx where zzz is zip, ... // Exe - if (preg_match('/\.(exe|com)$/i',$tmpfile)) { $mime='application/octet-stream'; $imgmime='other.png'; } + if (preg_match('/\.(exe|com)$/i',$tmpfile)) { $mime='application/octet-stream'; $imgmime='other.png'; $famime='file-o'; } // Lib - if (preg_match('/\.(dll|lib|o|so|a)$/i',$tmpfile)) { $mime='library'; $imgmime='library.png'; } + if (preg_match('/\.(dll|lib|o|so|a)$/i',$tmpfile)) { $mime='library'; $imgmime='library.png'; $famime='file-o'; } // Err - if (preg_match('/\.err$/i',$tmpfile)) { $mime='error'; $imgmime='error.png'; } + if (preg_match('/\.err$/i',$tmpfile)) { $mime='error'; $imgmime='error.png'; $famime='file-text-o'; } // Return string if ($mode == 1) @@ -6837,7 +6841,10 @@ function dol_mimetype($file,$default='application/octet-stream',$mode=0) { return $srclang; } - + if ($mode == 4) + { + return $famime; + } return $mime; } diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index dce3318d1da..e20ca0c0acc 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -762,7 +762,9 @@ div.myavailability { box-shadow: 1px 1px 25px #aaa; max-width: calc(100% - 56px); } - +.fa-file-text-o, .fa-file-code-o, .fa-file-powerpoint-o, .fa-file-excel-o, .fa-file-word-o, .fa-file-o, .fa-file-image-o, .fa-file-video-o, .fa-file-audio-o, .fa-file-archive-o, .fa-file-pdf-o { + color: #055; +} /* DOL_XXX for future usage (when left menu has been removed). If we do not use datatable */ /*.table-responsive { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 266444516f6..32add92b970 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -768,7 +768,9 @@ div.myavailability { box-shadow: 1px 1px 25px #aaa; max-width: calc(100% - 56px); } - +.fa-file-text-o, .fa-file-code-o, .fa-file-powerpoint-o, .fa-file-excel-o, .fa-file-word-o, .fa-file-o, .fa-file-image-o, .fa-file-video-o, .fa-file-audio-o, .fa-file-archive-o, .fa-file-pdf-o { + color: #505; +} /* DOL_XXX for future usage (when left menu has been removed). If we do not use datatable */ /*.table-responsive { From b8cbb84e7cb10117a110a61f2745caaa14d12467 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Nov 2017 00:28:00 +0100 Subject: [PATCH 26/47] Clean code --- htdocs/core/boxes/box_activity.php | 2 ++ htdocs/core/boxes/box_external_rss.php | 4 +-- htdocs/core/boxes/box_factures_fourn.php | 3 ++ htdocs/core/boxes/box_ficheinter.php | 26 +++++++------- htdocs/core/boxes/box_members.php | 5 +-- htdocs/core/boxes/box_project.php | 42 ++++++++++------------ htdocs/core/boxes/box_services_expired.php | 42 ++++++++++++---------- htdocs/core/boxes/box_supplier_orders.php | 28 ++++++--------- htdocs/index.php | 4 +-- htdocs/langs/en_US/contracts.lang | 1 - htdocs/langs/en_US/interventions.lang | 1 - htdocs/langs/en_US/main.lang | 2 ++ htdocs/theme/eldy/style.css.php | 2 +- 13 files changed, 80 insertions(+), 82 deletions(-) diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index d3059daba53..cbb866d6f20 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -188,6 +188,8 @@ class box_activity extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; $commandestatic=new Commande($db); + $langs->load("orders"); + $cachedir = DOL_DATA_ROOT.'/commande/temp'; $filename = '/boxactivity-order'.$fileid; $refresh = dol_cache_refresh($cachedir, $filename, $cachetime); diff --git a/htdocs/core/boxes/box_external_rss.php b/htdocs/core/boxes/box_external_rss.php index 264f05b1f03..01eb4ac8893 100644 --- a/htdocs/core/boxes/box_external_rss.php +++ b/htdocs/core/boxes/box_external_rss.php @@ -82,7 +82,7 @@ class box_external_rss extends ModeleBoxes $keyforparamurl="EXTERNAL_RSS_URLRSS_".$site; $keyforparamtitle="EXTERNAL_RSS_TITLE_".$site; - + // Get RSS feed $url=$conf->global->$keyforparamurl; @@ -106,7 +106,7 @@ class box_external_rss extends ModeleBoxes 'text' => $title, 'sublink' => $link, 'subtext'=>$langs->trans("LastRefreshDate").': '.($rssparser->getLastFetchDate()?dol_print_date($rssparser->getLastFetchDate(),"dayhourtext"):$langs->trans("Unknown")), - 'subpicto'=>'object_bookmark', + 'subpicto'=>'help', ); } diff --git a/htdocs/core/boxes/box_factures_fourn.php b/htdocs/core/boxes/box_factures_fourn.php index 0dd0ceb22ba..bae9aef5953 100644 --- a/htdocs/core/boxes/box_factures_fourn.php +++ b/htdocs/core/boxes/box_factures_fourn.php @@ -117,6 +117,7 @@ class box_factures_fourn extends ModeleBoxes $datelimite=$db->jdate($objp->datelimite); $date=$db->jdate($objp->df); $datem=$db->jdate($objp->tms); + $facturestatic->id = $objp->facid; $facturestatic->ref = $objp->ref; $facturestatic->total_ht = $objp->total_ht; @@ -124,6 +125,8 @@ class box_factures_fourn extends ModeleBoxes $facturestatic->total_ttc = $objp->total_ttc; $facturestatic->date_echeance = $datelimite; $facturestatic->statut = $objp->fk_statut; + $facturestatic->ref_supplier = $objp->ref_supplier; + $thirdpartytmp->id = $objp->socid; $thirdpartytmp->name = $objp->name; $thirdpartytmp->fournisseur = 1; diff --git a/htdocs/core/boxes/box_ficheinter.php b/htdocs/core/boxes/box_ficheinter.php index c96fb37afe7..ef7ba62c15c 100644 --- a/htdocs/core/boxes/box_ficheinter.php +++ b/htdocs/core/boxes/box_ficheinter.php @@ -108,27 +108,25 @@ class box_ficheinter extends ModeleBoxes $ficheinterstatic->statut=$objp->fk_statut; $ficheinterstatic->id=$objp->rowid; + $ficheinterstatic->ref=$objp->ref; - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'url' => DOL_URL_ROOT."/fichinter/card.php?id=".$objp->rowid); + $this->info_box_contents[$i][] = array('td' => '', + 'text' => $ficheinterstatic->getNomUrl(1), + 'asis' => 1 + ); - $this->info_box_contents[$i][1] = array('td' => '', - 'text' => ($objp->ref?$objp->ref:$objp->rowid), // Some interventions have no ref - 'url' => DOL_URL_ROOT."/fichinter/card.php?id=".$objp->rowid); - - $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', + $this->info_box_contents[$i][] = array('td' => 'align="left" width="16"', 'logo' => 'company', 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); - $this->info_box_contents[$i][3] = array('td' => '', + $this->info_box_contents[$i][] = array('td' => '', 'text' => dol_trunc($objp->name,40), 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); - $this->info_box_contents[$i][4] = array('td' => 'class="right"', + $this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => dol_print_date($datec,'day')); - $this->info_box_contents[$i][5] = array('td' => 'align="right" class="nowrap"', + $this->info_box_contents[$i][] = array('td' => 'align="right" class="nowrap"', 'text' => $ficheinterstatic->getLibStatut(6), 'asis'=>1 ); @@ -136,20 +134,20 @@ class box_ficheinter extends ModeleBoxes $i++; } - if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedInterventions")); + if ($num==0) $this->info_box_contents[$i][] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedInterventions")); $db->free($resql); } else { - $this->info_box_contents[0][0] = array( 'td' => '', + $this->info_box_contents[0][] = array( 'td' => '', 'maxlength'=>500, 'text' => ($db->error().' sql='.$sql)); } } else { - $this->info_box_contents[0][0] = array( + $this->info_box_contents[0][] = array( 'td' => 'align="left" class="nohover opacitymedium"', 'text' => $langs->trans("ReadPermissionNotAllowed") ); diff --git a/htdocs/core/boxes/box_members.php b/htdocs/core/boxes/box_members.php index bbf7cd8ad48..25fa257d098 100644 --- a/htdocs/core/boxes/box_members.php +++ b/htdocs/core/boxes/box_members.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2015 Frederic France * @@ -109,6 +109,7 @@ class box_members extends ModeleBoxes $memberstatic->firstname=$objp->firstname; $memberstatic->id = $objp->rowid; $memberstatic->ref = $objp->rowid; + $memberstatic->company = $objp->company; if (! empty($objp->fk_soc)) { $memberstatic->socid = $objp->fk_soc; @@ -126,7 +127,7 @@ class box_members extends ModeleBoxes $this->info_box_contents[$line][] = array( 'td' => '', - 'text' => $memberstatic->getFullName($langs), + 'text' => $memberstatic->company, 'url' => DOL_URL_ROOT."/adherents/card.php?rowid=".$objp->rowid, ); diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index 9422f228530..ad5af03ac00 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -110,22 +110,18 @@ class box_project extends ModeleBoxes while ($i < min($num, $max)) { $objp = $db->fetch_object($result); - $tooltip = $langs->trans('Project') . ': ' . $objp->ref; - $this->info_box_contents[$i][0] = array( - 'td' => 'align="left" width="16"', - 'logo' => 'object_project'.($objp->public?'pub':''), - 'tooltip' => $tooltip, - 'url' => DOL_URL_ROOT."/projet/card.php?id=".$objp->rowid, - ); + $projectstatic->id = $objp->rowid; + $projectstatic->ref = $objp->ref; + $projectstatic->title = $objp->title; + $projectstatic->public = $objp->public; - $this->info_box_contents[$i][1] = array( + $this->info_box_contents[$i][] = array( 'td' => '', - 'text' => $objp->ref, - 'tooltip' => $tooltip, - 'url' => DOL_URL_ROOT."/projet/card.php?id=".$objp->rowid, + 'text' => $projectstatic->getNomUrl(1), + 'asis' => 1 ); - $this->info_box_contents[$i][2] = array( + $this->info_box_contents[$i][] = array( 'td' => '', 'text' => $objp->title, ); @@ -137,28 +133,28 @@ class box_project extends ModeleBoxes $resultTask = $db->query($sql); if ($resultTask) { $objTask = $db->fetch_object($resultTask); - $this->info_box_contents[$i][3] = array( + $this->info_box_contents[$i][] = array( 'td' => 'class="right"', 'text' => $objTask->nb." ".$langs->trans("Tasks"), ); if ($objTask->nb > 0) - $this->info_box_contents[$i][4] = array( + $this->info_box_contents[$i][] = array( 'td' => 'class="right"', 'text' => round($objTask->totprogress/$objTask->nb, 0)."%", ); else - $this->info_box_contents[$i][4] = array('td' => 'class="right"', 'text' => "N/A "); + $this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => "N/A "); $totalnbTask += $objTask->nb; } else { - $this->info_box_contents[$i][3] = array('td' => 'class="right"', 'text' => round(0)); - $this->info_box_contents[$i][4] = array('td' => 'class="right"', 'text' => "N/A "); + $this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => round(0)); + $this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => "N/A "); } $i++; } if ($max < $num) { - $this->info_box_contents[$i][0] = array('td' => 'colspan="5"', 'text' => '...'); + $this->info_box_contents[$i][] = array('td' => 'colspan="5"', 'text' => '...'); $i++; } } @@ -166,25 +162,25 @@ class box_project extends ModeleBoxes // Add the sum à the bottom of the boxes - $this->info_box_contents[$i][0] = array( + $this->info_box_contents[$i][] = array( 'tr' => 'class="liste_total"', 'td' => 'align="left" ', 'text' => " ", ); - $this->info_box_contents[$i][1] = array( + $this->info_box_contents[$i][] = array( 'td' => '', 'text' => $langs->trans("Total")." ".$textHead, 'text' => " ", ); - $this->info_box_contents[$i][2] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="right" ', 'text' => round($num, 0)." ".$langs->trans("Projects"), ); - $this->info_box_contents[$i][3] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="right" ', 'text' => (($max < $num) ? '' : (round($totalnbTask, 0)." ".$langs->trans("Tasks"))), ); - $this->info_box_contents[$i][4] = array( + $this->info_box_contents[$i][] = array( 'td' => '', 'text' => " ", ); diff --git a/htdocs/core/boxes/box_services_expired.php b/htdocs/core/boxes/box_services_expired.php index 4f3a2817549..f1d14c0df70 100644 --- a/htdocs/core/boxes/box_services_expired.php +++ b/htdocs/core/boxes/box_services_expired.php @@ -69,6 +69,8 @@ class box_services_expired extends ModeleBoxes $this->max=$max; + include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; + $now=dol_now(); $this->info_box_head = array('text' => $langs->trans("BoxLastExpiredServices",$max)); @@ -77,7 +79,7 @@ class box_services_expired extends ModeleBoxes { // Select contracts with at least one expired service $sql = "SELECT "; - $sql.= " c.rowid, c.ref, c.statut as fk_statut, c.date_contrat,"; + $sql.= " c.rowid, c.ref, c.statut as fk_statut, c.date_contrat, c.ref_customer, c.ref_supplier,"; $sql.= " s.nom as name, s.rowid as socid,"; $sql.= " MIN(cd.date_fin_validite) as date_line, COUNT(cd.rowid) as nb_services"; $sql.= " FROM ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."societe s, ".MAIN_DB_PREFIX."contratdet as cd"; @@ -87,7 +89,7 @@ class box_services_expired extends ModeleBoxes $sql.= " AND c.fk_soc=s.rowid AND cd.fk_contrat=c.rowid AND c.statut > 0"; if ($user->societe_id) $sql.=' AND c.fk_soc = '.$user->societe_id; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - $sql.= " GROUP BY c.rowid, c.ref, c.statut, c.date_contrat, s.nom, s.rowid"; + $sql.= " GROUP BY c.rowid, c.ref, c.statut, c.date_contrat, c.ref_customer, c.ref_supplier, s.nom, s.rowid"; $sql.= " ORDER BY date_line ASC"; $sql.= $db->plimit($max, 0); @@ -99,6 +101,7 @@ class box_services_expired extends ModeleBoxes $i = 0; $thirdpartytmp = new Societe($this->db); + $contract = new Contrat($this->db); while ($i < $num) { @@ -106,30 +109,33 @@ class box_services_expired extends ModeleBoxes $objp = $db->fetch_object($resql); - $dateline=$db->jdate($objp->date_line); - if (($dateline + $conf->contrat->services->expires->warning_delay) < $now) $late=img_warning($langs->trans("Late")); - - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid); - - $this->info_box_contents[$i][1] = array('td' => '', - 'text' => ($objp->ref?$objp->ref:$objp->rowid), // Some contracts have no ref - 'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid); - $thirdpartytmp->id = $objp->socid; $thirdpartytmp->name = $objp->name; - $this->info_box_contents[$i][2] = array('td' => 'class="tdoverflowmax100 maxwidth100onsmartphone" align="left"', + $contract->id = $objp->rowid; + $contract->ref = $objp->ref; + $contract->statut = $objp->fk_statut; + $contract->ref_customer = $objp->ref_customer; + $contract->ref_supplier = $objp->ref_supplier; + + $dateline=$db->jdate($objp->date_line); + if (($dateline + $conf->contrat->services->expires->warning_delay) < $now) $late=img_warning($langs->trans("Late")); + + $this->info_box_contents[$i][] = array('td' => '', + 'text' => $contract->getNomUrl(1), + 'asis' => 1 + ); + + $this->info_box_contents[$i][] = array('td' => 'class="tdoverflowmax100 maxwidth100onsmartphone" align="left"', 'text' => $thirdpartytmp->getNomUrl(1, 'customer'), 'asis' => 1 ); - $this->info_box_contents[$i][4] = array('td' => 'align="center"', + $this->info_box_contents[$i][] = array('td' => 'align="center"', 'text' => dol_print_date($dateline,'day'), 'text2'=> $late); - $this->info_box_contents[$i][5] = array('td' => 'class="right"', + $this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => $objp->nb_services); @@ -139,14 +145,14 @@ class box_services_expired extends ModeleBoxes if ($num==0) { $langs->load("contracts"); - $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoExpiredServices")); + $this->info_box_contents[$i][] = array('td' => 'align="center"','text'=>$langs->trans("NoExpiredServices")); } $db->free($resql); } else { - $this->info_box_contents[0][0] = array( 'td' => '', + $this->info_box_contents[0][] = array( 'td' => '', 'maxlength'=>500, 'text' => ($db->error().' sql='.$sql)); } diff --git a/htdocs/core/boxes/box_supplier_orders.php b/htdocs/core/boxes/box_supplier_orders.php index 34734d9dd5a..dc20e9b9665 100644 --- a/htdocs/core/boxes/box_supplier_orders.php +++ b/htdocs/core/boxes/box_supplier_orders.php @@ -109,28 +109,20 @@ class box_supplier_orders extends ModeleBoxes $objp = $db->fetch_object($result); $date=$db->jdate($objp->date_commande); $datem=$db->jdate($objp->tms); - $thirdpartytmp->id = $objp->socid; + + $supplierorderstatic->id = $objp->id; + $supplierorderstatic->ref = $objp->ref; + + $thirdpartytmp->id = $objp->socid; $thirdpartytmp->name = $objp->name; $thirdpartytmp->fournisseur = 1; $thirdpartytmp->code_fournisseur = $objp->code_fournisseur; $thirdpartytmp->logo = $objp->logo; - $urlo = DOL_URL_ROOT."/fourn/commande/card.php?id=".$objp->rowid; - $urls = DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid; - - $tooltip = $langs->trans('SupplierOrder') . ': ' . $objp->ref; - $this->info_box_contents[$line][] = array( - 'td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'tooltip' => $tooltip, - 'url' => $urlo, - ); - $this->info_box_contents[$line][] = array( 'td' => '', - 'text' => $objp->ref, - 'tooltip' => $tooltip, - 'url' => $urlo, + 'text' => $supplierorderstatic->getNomUrl(1), + 'asis' => 1 ); $this->info_box_contents[$line][] = array( @@ -158,14 +150,14 @@ class box_supplier_orders extends ModeleBoxes } if ($num == 0) - $this->info_box_contents[$line][0] = array( + $this->info_box_contents[$line][] = array( 'td' => 'align="center"', 'text' => $langs->trans("NoSupplierOrder"), ); $db->free($result); } else { - $this->info_box_contents[0][0] = array( + $this->info_box_contents[0][] = array( 'td' => '', 'maxlength'=>500, 'text' => ($db->error().' sql='.$sql), @@ -174,7 +166,7 @@ class box_supplier_orders extends ModeleBoxes } else { - $this->info_box_contents[0][0] = array( + $this->info_box_contents[0][] = array( 'td' => 'align="left" class="nohover opacitymedium"', 'text' => $langs->trans("ReadPermissionNotAllowed") ); diff --git a/htdocs/index.php b/htdocs/index.php index 0cba7291e9b..8c2a45d0edd 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -118,7 +118,7 @@ $langs->load("contracts"); if (empty($user->societe_id)) { $boxstat.='
'; - $boxstat.=''; + $boxstat.='
'; $boxstat.=''; $boxstat.=''; $boxstat.=''; @@ -525,7 +525,7 @@ if(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $totallate = round($to //var_dump($totallate); $boxwork=''; $boxwork.='
'; -$boxwork.='
'.$langs->trans("DolibarrStateBoard").'
'."\n"; +$boxwork.='
'."\n"; $boxwork.=''; $boxwork.=''; $boxwork.=''."\n"; diff --git a/htdocs/langs/en_US/contracts.lang b/htdocs/langs/en_US/contracts.lang index e0642b27c02..3768cfb9ff1 100644 --- a/htdocs/langs/en_US/contracts.lang +++ b/htdocs/langs/en_US/contracts.lang @@ -44,7 +44,6 @@ ConfirmActivateService=Are you sure you want to activate this service with date RefContract=Contract reference DateContract=Contract date DateServiceActivate=Service activation date -ShowContract=Show contract ListOfServices=List of services ListOfInactiveServices=List of not active services ListOfExpiredServices=List of expired active services diff --git a/htdocs/langs/en_US/interventions.lang b/htdocs/langs/en_US/interventions.lang index 15415a7fcd5..4c93eff9d0d 100644 --- a/htdocs/langs/en_US/interventions.lang +++ b/htdocs/langs/en_US/interventions.lang @@ -28,7 +28,6 @@ InterventionClassifyBilled=Classify "Billed" InterventionClassifyUnBilled=Classify "Unbilled" InterventionClassifyDone=Classify "Done" StatusInterInvoiced=Billed -ShowIntervention=Show intervention SendInterventionRef=Submission of intervention %s SendInterventionByMail=Send intervention by Email InterventionCreatedInDolibarr=Intervention %s created diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 7f89918e90a..518b3ea6e04 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -766,6 +766,8 @@ AddBox=Add box SelectElementAndClick=Select an element and click %s PrintFile=Print File %s ShowTransaction=Show entry on bank account +ShowIntervention=Show intervention +ShowContract=Show contract GoIntoSetupToChangeLogo=Go into Home - Setup - Company to change logo or go into Home - Setup - Display to hide. Deny=Deny Denied=Denied diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index e20ca0c0acc..f835ecaddf9 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -4469,7 +4469,7 @@ dl.dropdown { margin-left: 2px; margin-right: 2px; padding:0px; - vertical-align: text-bottom; + vertical-align: middle; display: inline-block; } .dropdown dd, .dropdown dt { From bf0017ffaf602074fa5b659ffb0021cdaf8cb377 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Nov 2017 00:30:16 +0100 Subject: [PATCH 27/47] Fix column --- htdocs/core/boxes/box_project.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index ad5af03ac00..976cbf1766c 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -162,11 +162,6 @@ class box_project extends ModeleBoxes // Add the sum à the bottom of the boxes - $this->info_box_contents[$i][] = array( - 'tr' => 'class="liste_total"', - 'td' => 'align="left" ', - 'text' => " ", - ); $this->info_box_contents[$i][] = array( 'td' => '', 'text' => $langs->trans("Total")." ".$textHead, From d938a56282e0dfa426e620803c42986e72019352 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Nov 2017 01:10:17 +0100 Subject: [PATCH 28/47] Clean code --- .../class/accountingjournal.class.php | 12 +++++------ htdocs/comm/action/rapport/index.php | 8 ++++---- htdocs/hrm/index.php | 20 +++++++++++++++---- 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php index 41cce96995f..41152130f19 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -30,6 +30,7 @@ class AccountingJournal extends CommonObject public $table_element='accounting_journal'; public $fk_element = ''; public $ismultientitymanaged = 0; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + public $picto = 'generic'; var $rowid; @@ -187,9 +188,6 @@ class AccountingJournal extends CommonObject $url = DOL_URL_ROOT . '/accountancy/admin/journals_list.php?id=35'; - $picto = 'billr'; - $label=''; - $label = '' . $langs->trans("ShowAccountingJournal") . ''; if (! empty($this->code)) $label .= '
'.$langs->trans('Code') . ': ' . $this->code; @@ -223,9 +221,11 @@ class AccountingJournal extends CommonObject $label_link = $this->code; if ($withlabel) $label_link .= ' - ' . $this->label; - if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend); - if ($withpicto && $withpicto != 2) $result .= ' '; - if ($withpicto != 2) $result.=$linkstart . $label_link . $linkend; + $result .= $linkstart; + if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); + if ($withpicto != 2) $result.= $label_link; + $result .= $linkend; + return $result; } diff --git a/htdocs/comm/action/rapport/index.php b/htdocs/comm/action/rapport/index.php index 5994f692cc8..2d72fa4c3f8 100644 --- a/htdocs/comm/action/rapport/index.php +++ b/htdocs/comm/action/rapport/index.php @@ -170,15 +170,15 @@ if ($resql) $out=''; // Show file name with link to download - $tmp = $formfile->showPreview($filearray,$modulepart,$relativepath,0,$param); - $out.= ($tmp?$tmp.' ':''); $out.= 'trans("File").': '.$filearray["name"]).' '.$filearray["name"]; + $out.= img_mime($filearray["name"],$langs->trans("File").': '.$filearray["name"]); + $out.= $filearray["name"]; $out.= ''."\n"; - print $out; + $out.= $formfile->showPreview($filearray,$modulepart,$relativepath,0,$param); + print $out; print ''; print '
'; diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php index bcf2c7d99ec..e21db6a1dd1 100644 --- a/htdocs/hrm/index.php +++ b/htdocs/hrm/index.php @@ -77,7 +77,7 @@ print load_fiche_titre($langs->trans("HRMArea"),'', 'title_hrm.png'); if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) $setupcompanynotcomplete=1; -if ( empty($setupcompanynotcomplete)) +if (! empty($setupcompanynotcomplete)) { $langs->load("errors"); $warnpicto=img_warning($langs->trans("WarningMandatorySetupNotComplete")); @@ -165,7 +165,7 @@ $langs->load("boxes"); // 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.photo, u.statut, 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 = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.photo, u.statut, 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.= " 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; @@ -203,14 +203,18 @@ if (! empty($conf->holiday->enabled) && $user->rights->holiday->read) while ($i < $num && $i < $max) { $obj = $db->fetch_object($result); + $holidaystatic->id=$obj->rowid; $holidaystatic->ref=$obj->ref; + $userstatic->id=$obj->uid; $userstatic->lastname=$obj->lastname; $userstatic->firstname=$obj->firstname; $userstatic->login=$obj->login; $userstatic->photo=$obj->photo; + $userstatic->email=$obj->email; $userstatic->statut=$obj->statut; + print ''; print ''; print ''; @@ -242,7 +246,7 @@ if (! empty($conf->holiday->enabled) && $user->rights->holiday->read) // Last expense report (old module) if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire) { - $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.statut, u.photo, d.rowid, d.dated as date, d.tms as dm, d.km, d.fk_statut"; + $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.statut, u.photo, d.rowid, d.dated as date, d.tms as dm, d.km, d.fk_statut"; $sql.= " FROM ".MAIN_DB_PREFIX."deplacement as d, ".MAIN_DB_PREFIX."user as u"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE u.rowid = d.fk_user"; @@ -277,14 +281,18 @@ if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire) while ($i < $num && $i < $max) { $obj = $db->fetch_object($result); + $deplacementstatic->ref=$obj->rowid; $deplacementstatic->id=$obj->rowid; + $userstatic->id=$obj->uid; $userstatic->lastname=$obj->lastname; $userstatic->firstname=$obj->firstname; $userstatic->login=$obj->login; + $userstatic->email=$obj->email; $userstatic->statut=$obj->statut; $userstatic->photo=$obj->photo; + print ''; print ''; print ''; @@ -309,7 +317,7 @@ if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire) // Last expense report (new module) if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire) { - $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.statut, u.photo, x.rowid, x.ref, x.date_debut as date, x.tms as dm, x.total_ttc, x.fk_statut as status"; + $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.statut, u.photo, x.rowid, x.ref, x.date_debut as date, x.tms as dm, x.total_ttc, x.fk_statut as status"; $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as x, ".MAIN_DB_PREFIX."user as u"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE u.rowid = x.fk_user_author"; @@ -344,14 +352,18 @@ if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire while ($i < $num && $i < $max) { $obj = $db->fetch_object($result); + $expensereportstatic->id=$obj->rowid; $expensereportstatic->ref=$obj->ref; + $userstatic->id=$obj->uid; $userstatic->lastname=$obj->lastname; $userstatic->firstname=$obj->firstname; + $userstatic->email=$obj->email; $userstatic->login=$obj->login; $userstatic->statut=$obj->statut; $userstatic->photo=$obj->photo; + print ''; print ''; print ''; From 01a41237bf45cef05ac07960d586a5dadb6bb5a7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Nov 2017 14:20:08 +0100 Subject: [PATCH 29/47] CSS --- htdocs/core/boxes/modules_boxes.php | 2 ++ htdocs/core/class/html.form.class.php | 11 ++++---- htdocs/core/lib/ajax.lib.php | 14 +++++----- htdocs/core/lib/files.lib.php | 2 +- htdocs/ecm/class/htmlecm.form.class.php | 33 +++++++++++++++-------- htdocs/ecm/docdir.php | 35 ++++++++++++++++++------- htdocs/ecm/tpl/filemanager.tpl.php | 26 +++++++++++++----- htdocs/langs/en_US/ecm.lang | 3 ++- htdocs/public/payment/newpayment.php | 6 ++--- htdocs/societe/list.php | 3 +-- htdocs/theme/eldy/style.css.php | 7 +++-- htdocs/theme/md/style.css.php | 6 ++--- 12 files changed, 94 insertions(+), 54 deletions(-) diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index fe919b1fcba..790fe29fbcf 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -231,6 +231,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" $nblines=count($contents); $out.= "\n\n"; + //$out.= '
'; // Does not work on home page. TODO Try to fix this. $out.= '
'."\n"; if (! empty($head['text']) || ! empty($head['sublink']) || ! empty($head['subpicto']) || $nblines) @@ -360,6 +361,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" if (empty($head['text']) && empty($head['sublink']) && empty($head['subpicto']) && ! $nblines) $out.= "
\n"; $out.= "
\n"; + //$out.= "
\n"; $out.= "\n\n"; if (! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) { dol_filecache($cachedir, $filename, $out); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 2274701644f..2a8aa87686f 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -689,18 +689,19 @@ class Form if (empty($row['favorite']) && $atleastonefavorite) { $atleastonefavorite=0; - $out.= ''; + $out.= ''; } if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label']) ) { $foundselected=true; - $out.= ''; } @@ -5508,7 +5509,7 @@ class Form cache: true }, language: select2arrayoflanguage, - containerCssClass: \':all:\', /* Line to add class or origin SELECT propagated to the new tag */ placeholder: "'.dol_escape_js($placeholder).'", escapeMarkup: function (markup) { return markup; }, // let our custom formatter work minimumInputLength: '.$minimumInputLength.', diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 825f99d6e98..2f1caf6e999 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -393,8 +393,10 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $ { global $conf; - if (! empty($conf->browser->phone)) return ''; // select2 disabled for smartphones with standard browser (does not works, popup appears outside screen) - //if (! empty($conf->dol_use_jmobile)) return ''; // select2 works with jmobile but it breaks the autosize feature of jmobile. + // select2 disabled for smartphones with standard browser. + // TODO With select2 v4, it seems ok, except that responsive style on table become crazy when scrolling at end of array) + if (! empty($conf->browser->phone)) return ''; + if (! empty($conf->global->MAIN_DISABLE_AJAX_COMBOX)) return ''; if (empty($conf->use_javascript_ajax)) return ''; if (empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && ! defined('REQUIRE_JQUERY_MULTISELECT')) return ''; @@ -405,19 +407,15 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $ $msg="\n".' '; diff --git a/htdocs/core/js/lib_foot.js.php b/htdocs/core/js/lib_foot.js.php index d3b3db60ef8..f9ee9ea3ad4 100644 --- a/htdocs/core/js/lib_foot.js.php +++ b/htdocs/core/js/lib_foot.js.php @@ -52,7 +52,7 @@ if (empty($conf->dol_no_mouse_hover)) jQuery(document).ready(function () { jQuery(".classfortooltip").tooltip({ show: { collision: "flipfit", effect:\'toggle\', delay:50 }, - hide: { effect:\'toggle\', delay: 50 }, + hide: { delay: 50 }, tooltipClass: "mytooltip", content: function () { return $(this).prop(\'title\'); /* To force to get title as is */ From 97c954908708586c98298cafa8d9e24c7f15f8f2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Nov 2017 11:30:41 +0100 Subject: [PATCH 47/47] Fix ref supplier must be output if it exists, even for free products --- htdocs/core/lib/pdf.lib.php | 70 ++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 36 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 932373665e5..377f2215b6d 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1265,47 +1265,45 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl } } - // If line linked to a product - if ($idprod) + // We add ref of product (and supplier ref if defined) + $prefix_prodserv = ""; + $ref_prodserv = ""; + if (! empty($conf->global->PRODUCT_ADD_TYPE_IN_DOCUMENTS)) // In standard mode, we do not show this { - // We add ref - if ($prodser->ref) + if ($prodser->isService()) { - $prefix_prodserv = ""; - $ref_prodserv = ""; - if (! empty($conf->global->PRODUCT_ADD_TYPE_IN_DOCUMENTS)) // In standard mode, we do not show this - { - if ($prodser->isService()) - { - $prefix_prodserv = $outputlangs->transnoentitiesnoconv("Service")." "; - } - else - { - $prefix_prodserv = $outputlangs->transnoentitiesnoconv("Product")." "; - } - } - - if (empty($hideref)) - { - if ($issupplierline) - { - if ($conf->global->PDF_HIDE_PRODUCT_REF_IN_SUPPLIER_LINES == 1) - $ref_prodserv = $ref_supplier; - elseif ($conf->global->PDF_HIDE_PRODUCT_REF_IN_SUPPLIER_LINES == 2) - $ref_prodserv = $ref_supplier. ' ('.$outputlangs->transnoentitiesnoconv("InternalRef").' '.$prodser->ref.')'; - else - $ref_prodserv = $prodser->ref.($ref_supplier ? ' ('.$outputlangs->transnoentitiesnoconv("SupplierRef").' '.$ref_supplier.')' : ''); - } - else - $ref_prodserv = $prodser->ref; // Show local ref only - - if (! empty($libelleproduitservice)) $ref_prodserv .= " - "; - } - - $libelleproduitservice=$prefix_prodserv.$ref_prodserv.$libelleproduitservice; + $prefix_prodserv = $outputlangs->transnoentitiesnoconv("Service")." "; + } + else + { + $prefix_prodserv = $outputlangs->transnoentitiesnoconv("Product")." "; } } + if (empty($hideref)) + { + if ($issupplierline) + { + if ($conf->global->PDF_HIDE_PRODUCT_REF_IN_SUPPLIER_LINES == 1) + $ref_prodserv = $ref_supplier; + elseif ($conf->global->PDF_HIDE_PRODUCT_REF_IN_SUPPLIER_LINES == 2) + $ref_prodserv = $ref_supplier. ' ('.$outputlangs->transnoentitiesnoconv("InternalRef").' '.$prodser->ref.')'; + else // Common case + { + $ref_prodserv = $prodser->ref; // Show local ref + if ($ref_supplier) $ref_prodserv.= ($prodser->ref?' (':'').$outputlangs->transnoentitiesnoconv("SupplierRef").' '.$ref_supplier.($prodser->ref?')':''); + } + } + else + { + $ref_prodserv = $prodser->ref; // Show local ref only + } + + if (! empty($libelleproduitservice) && ! empty($ref_prodserv)) $ref_prodserv .= " - "; + } + + $libelleproduitservice=$prefix_prodserv.$ref_prodserv.$libelleproduitservice; + // Add an additional description for the category products if (! empty($conf->global->CATEGORY_ADD_DESC_INTO_DOC) && $idprod && ! empty($conf->categorie->enabled)) {
'.$langs->trans("DolibarrWorkBoard").'
'.dol_print_date(dol_filemtime($file),'dayhour').'
'.$holidaystatic->getNomUrl(1).''.$userstatic->getNomUrl(-1, 'leave').'
'.$deplacementstatic->getNomUrl(1).''.$userstatic->getNomUrl(-1).'
'.$expensereportstatic->getNomUrl(1).''.$userstatic->getNomUrl(-1).'