diff --git a/htdocs/admin/ticketsup.php b/htdocs/admin/ticketsup.php index 0d1ecd31dd1..9b0cc0e2684 100644 --- a/htdocs/admin/ticketsup.php +++ b/htdocs/admin/ticketsup.php @@ -384,7 +384,7 @@ print $form->textwithpicto('', $langs->trans("TicketsEmailMustExistHelp"), 1, 'h print ''; print ''; -if ($conf->global->MAIN_FEATURES_LEVEL >= 2) +/*if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { // Show logo for module print '' . $langs->trans("TicketsShowModuleLogo") . ''; @@ -400,7 +400,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) print $form->textwithpicto('', $langs->trans("TicketsShowModuleLogoHelp"), 1, 'help'); print ''; print ''; -} +}*/ // Show logo for company print '' . $langs->trans("TicketsShowCompanyLogo") . ''; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 9fae2dd47a9..5e17f6af031 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -126,7 +126,7 @@ $hookmanager->initHooks(array('agenda')); * Actions */ -if (GETPOST("viewlist") || $action == 'show_list') +if (GETPOST("viewlist",'alpha') || $action == 'show_list') { $param=''; if (is_array($_POST)) @@ -142,7 +142,7 @@ if (GETPOST("viewlist") || $action == 'show_list') exit; } -if (GETPOST("viewperuser") || $action == 'show_peruser') +if (GETPOST("viewperuser",'alpha') || $action == 'show_peruser') { $param=''; if (is_array($_POST)) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index c912ae98b4c..f7e0d451506 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -599,7 +599,7 @@ abstract class CommonObject if (empty($this->last_main_doc)) { - return ''; // No known last doc + return ''; // No way to known which document name to use } include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php'; @@ -4387,6 +4387,9 @@ abstract class CommonObject $ecmfile->gen_or_uploaded = 'generated'; $ecmfile->description = ''; // indexed content $ecmfile->keyword = ''; // keyword content + $ecmfile->src_object_type = $this->table_element; + $ecmfile->src_object_id = $this->id; + $result = $ecmfile->create($user); if ($result < 0) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 2faf8082056..4cbb3043bda 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7219,10 +7219,10 @@ function natural_search($fields, $value, $mode=0, $nofirstand=0) } /** - * Return string with full Url + * Return string with full Url. The file qualified is the one defined by relative path in $object->last_main_doc * - * @param Object $object Object - * @return string Url string + * @param Object $object Object + * @return string Url string */ function showDirectDownloadLink($object) { diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index 01aa8896c35..f6577463208 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -245,7 +245,7 @@ class modAgenda extends DolibarrModules 'type'=>'left', 'titre'=>'Agenda', 'mainmenu'=>'agenda', - 'url'=>'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda', + 'url'=>'/comm/action/index.php?action='.($conf->global->AGENDA_DEFAULT_VIEW!='show_list'?$conf->global->AGENDA_DEFAULT_VIEW:'show_month').'&mainmenu=agenda&leftmenu=agenda', 'langs'=>'agenda', 'position'=>140, 'perms'=>'$user->rights->agenda->myactions->read', @@ -257,7 +257,7 @@ class modAgenda extends DolibarrModules 'type'=>'left', 'titre'=>'MenuToDoMyActions', 'mainmenu'=>'agenda', - 'url'=>'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine', + 'url'=>'/comm/action/index.php?action='.($conf->global->AGENDA_DEFAULT_VIEW!='show_list'?$conf->global->AGENDA_DEFAULT_VIEW:'show_month').'&mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine', 'langs'=>'agenda', 'position'=>141, 'perms'=>'$user->rights->agenda->myactions->read', @@ -269,7 +269,7 @@ class modAgenda extends DolibarrModules 'type'=>'left', 'titre'=>'MenuDoneMyActions', 'mainmenu'=>'agenda', - 'url'=>'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=done&filter=mine', + 'url'=>'/comm/action/index.php?action='.($conf->global->AGENDA_DEFAULT_VIEW!='show_list'?$conf->global->AGENDA_DEFAULT_VIEW:'show_month').'&mainmenu=agenda&leftmenu=agenda&status=done&filter=mine', 'langs'=>'agenda', 'position'=>142, 'perms'=>'$user->rights->agenda->myactions->read', @@ -281,7 +281,7 @@ class modAgenda extends DolibarrModules 'type'=>'left', 'titre'=>'MenuToDoActions', 'mainmenu'=>'agenda', - 'url'=>'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1', + 'url'=>'/comm/action/index.php?action='.($conf->global->AGENDA_DEFAULT_VIEW!='show_list'?$conf->global->AGENDA_DEFAULT_VIEW:'show_month').'&mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1', 'langs'=>'agenda', 'position'=>143, 'perms'=>'$user->rights->agenda->allactions->read', @@ -293,15 +293,16 @@ class modAgenda extends DolibarrModules 'type'=>'left', 'titre'=>'MenuDoneActions', 'mainmenu'=>'agenda', - 'url'=>'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1', + 'url'=>'/comm/action/index.php?action='.($conf->global->AGENDA_DEFAULT_VIEW!='show_list'?$conf->global->AGENDA_DEFAULT_VIEW:'show_month').'&mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1', 'langs'=>'agenda', 'position'=>144, 'perms'=>'$user->rights->agenda->allactions->read', 'enabled'=>'$user->rights->agenda->allactions->read', 'target'=>'', 'user'=>2); - $r++; + // List + $r++; $this->menu[$r]=array('fk_menu'=>'r=1', 'type'=>'left', 'titre'=>'List', diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index 5581d10fe7a..f1c0b6b1448 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -167,13 +167,13 @@ class EcmFiles extends CommonObject $obj = $this->db->fetch_object($resql); $maxposition = (int) $obj->maxposition; } - else + else { $this->errors[] = 'Error ' . $this->db->lasterror(); return --$error; } $maxposition=$maxposition+1; - } + } else { $maxposition=$this->position; @@ -274,14 +274,16 @@ class EcmFiles extends CommonObject /** * Load object in memory from the database * - * @param int $id Id object - * @param string $ref Hash of file name (filename+filepath). Not always defined on some version. - * @param string $relativepath Relative path of file from document directory. Example: path/path2/file - * @param string $hashoffile Hash of file content. Take the first one found if same file is at different places. This hash will also change if file content is changed. - * @param string $hashforshare Hash of file sharing. - * @return int <0 if KO, 0 if not found, >0 if OK + * @param int $id Id object + * @param string $ref Hash of file name (filename+filepath). Not always defined on some version. + * @param string $relativepath Relative path of file from document directory. Example: path/path2/file + * @param string $hashoffile Hash of file content. Take the first one found if same file is at different places. This hash will also change if file content is changed. + * @param string $hashforshare Hash of file sharing. + * @param string $src_object_type src_object_type to search + * @param string $src_object_id src_object_id to search + * @return int <0 if KO, 0 if not found, >0 if OK */ - public function fetch($id, $ref = '', $relativepath = '', $hashoffile='', $hashforshare='') + public function fetch($id, $ref = '', $relativepath = '', $hashoffile='', $hashforshare='', $src_object_type='', $src_object_id=0) { dol_syslog(__METHOD__, LOG_DEBUG); @@ -324,8 +326,13 @@ class EcmFiles extends CommonObject } elseif (! empty($hashforshare)) { $sql .= " AND t.share = '".$this->db->escape($hashforshare)."'"; - } else { - $sql .= ' AND t.rowid = ' . $id; + } + elseif ($src_object_type && $src_object_id) + { + $sql.= " AND t.src_object_type ='".$this->db->escape($src_object_type)."' AND t.src_object_id = ".$this->db->escape($src_object_id); + } + else { + $sql .= ' AND t.rowid = '.$this->db->escape($id); } // When we search on hash of content, we take the first one. Solve also hash conflict. $this->db->plimit(1); @@ -363,7 +370,7 @@ class EcmFiles extends CommonObject // Retrieve all extrafields for invoice // fetch optionals attributes and labels // $this->fetch_optionals(); - + // $this->fetch_lines(); $this->db->free($resql); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 5544991959d..62f6194b267 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -578,7 +578,7 @@ Module2200Desc=Enable the usage of math expressions for prices Module2300Name=Scheduled jobs Module2300Desc=Scheduled jobs management (alias cron or chrono table) Module2400Name=Events/Agenda -Module2400Desc=Follow done and upcoming events. Let application logs automatic events for tracking purposes or record manual events or rendez-vous. +Module2400Desc=Follow done and upcoming events. Let application logs automatic events for tracking purposes or record manual events or rendez-vous. This is the main important module for a good Customer or Supplier Relationship Management. Module2500Name=DMS / ECM Module2500Desc=Document Management System / Electronic Content Management. Automatic organization of your generated or stored documents. Share them when you need. Module2600Name=API/Web services (SOAP server) diff --git a/htdocs/langs/en_US/ticketsup.lang b/htdocs/langs/en_US/ticketsup.lang index 3ce1b9c44ce..d81cd799203 100644 --- a/htdocs/langs/en_US/ticketsup.lang +++ b/htdocs/langs/en_US/ticketsup.lang @@ -103,7 +103,7 @@ TicketPublicInterfaceTopicHelp=This text will appear as the title of the public TicketPublicInterfaceTextHelpMessageLabelAdmin=Help text to the message entry TicketPublicInterfaceTextHelpMessageHelpAdmin=This text will appear above the message input area of the user. ExtraFieldsTicketSup=Extra attributes -TicketSupCkEditorEmailNotActivated=HTML editor is not activated. Please put FCKEDITOR_ENABLE_MAIL contant equal to 1 +TicketSupCkEditorEmailNotActivated=HTML editor is not activated. Please put FCKEDITOR_ENABLE_MAIL content to 1 to get it. TicketsDisableEmail=Do not send ticket creation or message send emails TicketsDisableEmailHelp=By default, emails are sent when new tickets or messages created. Enable this option to disable *all* email notifications TicketsLogEnableEmail=Enable log by email diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index a63d55c5e8f..fe1456fd820 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -469,8 +469,8 @@ if (empty($reshook)) 'use_companybankid'=>GETPOST('companybankid'), 'force_dir_output'=>$conf->societe->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->id) ); - $_POST['lang_id'] = GETPOST('lang_idrib'.GETPOST('companybankid')); - $_POST['model'] = GETPOST('modelrib'.GETPOST('companybankid')); + $_POST['lang_id'] = GETPOST('lang_idrib'.GETPOST('companybankid','int'), 'alpha'); + $_POST['model'] = GETPOST('modelrib'.GETPOST('companybankid','int'), 'alpha'); } $id = $socid; @@ -1255,6 +1255,24 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print $formfile->showdocuments('company', $object->id, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 0, 0, 0, 28, 0, 'entity='.$object->entity, 0, '', $object->default_lang); + // Show direct download link + if (! empty($conf->global->BANK_ACCOUNT_ALLOW_EXTERNAL_DOWNLOAD)) + { + $companybankaccounttemp = new CompanyBankAccount($db); + $companypaymentmodetemp = new CompanyPaymentMode($db); + $result = $companypaymentmodetemp->fetch(0, null, $object->id, 'ban'); + + include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php'; + $ecmfile = new EcmFiles($db); + $result = $ecmfile->fetch(0, '', '', '', '', $companybankaccounttemp->table_element, $companypaymentmodetemp->id); + if ($result > 0) + { + $companybankaccounttemp->last_main_doc = $ecmfile->filepath.'/'.$ecmfile->filename; + print '
'."\n"; + print showDirectDownloadLink($companybankaccounttemp).'
'; + } + } + print '
';