From 7ea5407ac1f1f8f887b46cd0cc0120c98f731ec6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Jan 2019 01:57:47 +0100 Subject: [PATCH 1/4] Update doc --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 895b48e688d..39c4d5d6ca8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -79,6 +79,7 @@ NEW: The binding step in accountancy has a country filter with autocompletion NEW: Top menu is always on screen with MD theme. NEW: Withdraw request massaction can include already partially paid invoices NEW: Option "Simplify interface for blind persons" +NEW: Generic cash fence feature (compatible with several POS modules) For developers: NEW: Add lib for multiselect with checkboxes From e0d11edb6be9192e2e6ba6c0f2303d48a3572460 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 13 Jan 2019 14:09:40 +0100 Subject: [PATCH 2/4] FIX Sql error on filter of project preview with date --- htdocs/projet/element.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 5494c893b2a..dccc3df312f 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -299,7 +299,7 @@ $listofreferent=array( 'title'=>"ListSupplierProposalsAssociatedProject", 'class'=>'SupplierProposal', 'table'=>'supplier_proposal', - 'datefieldname'=>'date', + 'datefieldname'=>'date_valid', 'urlnew'=>DOL_URL_ROOT.'/supplier_proposal/card.php?action=create&projectid='.$id, // No socid parameter here, the socid is often the customer and we create a supplier object 'lang'=>'supplier_proposal', 'buttonnew'=>'AddSupplierProposal', From 8c6fde72f867d72d967d516ebd1f195b7891b81f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 13 Jan 2019 19:36:00 +0100 Subject: [PATCH 3/4] Several fixes in look and feel of module survey --- .../modulebuilder/template/myobject_list.php | 6 + .../class/opensurveysondage.class.php | 12 +- htdocs/opensurvey/list.php | 312 ++++++++++++++---- htdocs/societe/admin/societe.php | 20 +- 4 files changed, 281 insertions(+), 69 deletions(-) diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 23c2614eb0f..7c33b5ee8eb 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -352,6 +352,12 @@ $newcardbutton=''; $newcardbutton.= ''; $newcardbutton.= ''; //} +//else +//{ +// $newcardbutton=''.$langs->trans('New'); +// $newcardbutton.= ''; +// $newcardbutton.= ''; +//} print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, $newcardbutton, '', $limit); diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index 2e6789b3f89..807d550e35c 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -138,7 +138,6 @@ class Opensurveysondage extends CommonObject // Insert request $sql = "INSERT INTO ".MAIN_DB_PREFIX."opensurvey_sondage("; - $sql.= "id_sondage,"; $sql.= "commentaires,"; $sql.= "fk_user_creat,"; @@ -151,7 +150,6 @@ class Opensurveysondage extends CommonObject $sql.= "allow_spy,"; $sql.= "sujet"; $sql.= ") VALUES ("; - $sql.= "'".$this->db->escape($this->id_sondage)."',"; $sql.= " ".(empty($this->commentaires)?'NULL':"'".$this->db->escape($this->commentaires)."'").","; $sql.= " ".$user->id.","; @@ -163,7 +161,6 @@ class Opensurveysondage extends CommonObject $sql.= " ".$this->db->escape($this->allow_comments).","; $sql.= " ".$this->db->escape($this->allow_spy).","; $sql.= " '".$this->db->escape($this->sujet)."'"; - $sql.= ")"; $this->db->begin(); @@ -229,7 +226,7 @@ class Opensurveysondage extends CommonObject $sql.= " t.sujet,"; $sql.= " t.tms"; $sql.= " FROM ".MAIN_DB_PREFIX."opensurvey_sondage as t"; - $sql.= " WHERE t.id_sondage = '".$this->db->escape($numsurvey)."'"; + $sql.= " WHERE t.id_sondage = '".$this->db->escape($id ? $id : $numsurvey)."'"; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); @@ -359,11 +356,16 @@ class Opensurveysondage extends CommonObject * @param string $numsondage Num sondage admin to delete * @return int <0 if KO, >0 if OK */ - function delete(User $user, $notrigger, $numsondage) + function delete(User $user, $notrigger=0, $numsondage='') { global $conf, $langs; $error=0; + if (empty($numsondage)) + { + $numsondage = $this->id_sondage; + } + $this->db->begin(); if (! $error) diff --git a/htdocs/opensurvey/list.php b/htdocs/opensurvey/list.php index ecb26047e52..cf52d83c680 100644 --- a/htdocs/opensurvey/list.php +++ b/htdocs/opensurvey/list.php @@ -27,8 +27,8 @@ require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"; require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"; require_once DOL_DOCUMENT_ROOT."/opensurvey/class/opensurveysondage.class.php"; -// Security check -if (!$user->rights->opensurvey->read) accessforbidden(); +// Load translation files required by the page +$langs->load("opensurvey"); $action = GETPOST('action','aZ09')?GETPOST('action','aZ09'):'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... $massaction = GETPOST('massaction','alpha'); // The bulk action (combo box choice into lists) @@ -41,7 +41,6 @@ $backtopage = GETPOST('backtopage','alpha'); // Go back to a dedicated $optioncss = GETPOST('optioncss','aZ'); // Option for the css output (always '' except when 'print') $id=GETPOST('id','alpha'); -$numsondage= $id; $search_ref = GETPOST('search_ref', 'alpha'); $search_title = GETPOST('search_title', 'alpha'); $search_status = GETPOST('search_status', 'alpha'); @@ -51,26 +50,87 @@ $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 +if (empty($page) || $page == -1 || GETPOST('button_search','alpha') || GETPOST('button_removefilter','alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; + +// Initialize technical objects +$object = new Opensurveysondage($db); +$opensurvey_static = new Opensurveysondage($db); + +$extrafields = new ExtraFields($db); +$diroutputmassaction = $conf->opensurvey->dir_output . '/temp/massgeneration/'.$user->id; +$hookmanager->initHooks(array('surveylist')); // Note that conf->hooks_modules contains array +// Fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label('survey'); // Load $extrafields->attributes['myobject'] +$search_array_options = $extrafields->getOptionalsFromPost($object->table_element,'','search_'); + +// Default sort order (if not yet defined by previous GETPOST) if (! $sortfield) $sortfield="p.date_fin"; if (! $sortorder) $sortorder="DESC"; -// Load translation files required by the page -$langs->load("opensurvey"); +// Security check +if (!$user->rights->opensurvey->read) accessforbidden(); + +// Definition of fields for list +$arrayfields=array(); +foreach($object->fields as $key => $val) +{ + // If $val['visible']==0, then we never show the field + if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled'], 'position'=>$val['position']); +} +// Extra fields +if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) +{ + foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val) + { + if (! empty($extrafields->attributes[$object->table_element]['list'][$key])) + $arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key])); + } +} +$object->fields = dol_sort_array($object->fields, 'position'); +$arrayfields = dol_sort_array($arrayfields, 'position'); /* * Actions */ -if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers +if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; } +if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } + +$parameters=array(); +$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +if (empty($reshook)) { - $search_status=''; - $search_title=''; - $search_ref=''; + // Selection of new fields + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + + // Purge search criteria + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers + { + $search_status=''; + $search_title=''; + $search_ref=''; + $toselect=''; + $search_array_options=array(); + } + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha') + || GETPOST('button_search_x','alpha') || GETPOST('button_search.x','alpha') || GETPOST('button_search','alpha')) + { + $massaction=''; // Protection to avoid mass action if we force a new search during a mass action confirmation + } + + // Mass actions + $objectclass='Opensurveysondage'; + $objectlabel='Opensurveysondage'; + $permtoread = $user->rights->opensurvey->read; + $permtodelete = $user->rights->opensurvey->write; + $uploaddir = $conf->opensurvey->dir_output; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -79,40 +139,15 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x', */ $form=new Form($db); -$opensurvey_static = new Opensurveysondage($db); $now = dol_now(); -llxHeader('', $langs->trans("OpenSurveyArea")); - -$param=''; -$fieldtosortuser=empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?'firstname':'lastname'; +//$help_url="EN:Module_MyObject|FR:Module_MyObject_FR|ES:Módulo_MyObject"; +$help_url=''; +$title = $langs->trans('OpenSurveyArea'); - - - - - - - - -$newcardbutton=''; -if (!$user->rights->opensurvey->creer) -{ - $newcardbutton=''.$langs->trans('NewSurvey').''; - $newcardbutton.= ''; - $newcardbutton.= ''; -} -else -{ - $newcardbutton=''.$langs->trans('NewSurvey'); - $newcardbutton.= ''; - $newcardbutton.= ''; -} - - -$sql = "SELECT p.id_sondage, p.fk_user_creat, p.format, p.date_fin, p.status, p.titre, p.nom_admin,"; +$sql = "SELECT p.id_sondage as rowid, p.fk_user_creat, p.format, p.date_fin, p.status, p.titre, p.nom_admin,"; $sql.= " u.login, u.firstname, u.lastname"; $sql.= " FROM ".MAIN_DB_PREFIX."opensurvey_sondage as p"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user u ON u.rowid = p.fk_user_creat"; @@ -122,44 +157,124 @@ if ($search_expired == 'expired') $sql.=" AND p.date_fin < '".$db->idate($now)." if ($search_expired == 'opened') $sql.=" AND p.date_fin >= '".$db->idate($now)."'"; if ($search_ref) $sql.=natural_search("p.id_sondage", $search_ref); if ($search_title) $sql.=natural_search("p.titre", $search_title); -$sql.= $db->order($sortfield,$sortorder); +// Add where from extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; +// Add where from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; + +$sql.=$db->order($sortfield,$sortorder); // Count total nb of records $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { - $result = $db->query($sql); - $nbtotalofrecords = $db->num_rows($result); - if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 + $resql = $db->query($sql); + $nbtotalofrecords = $db->num_rows($resql); + if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0 { $page = 0; $offset = 0; } } +// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set. +if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) +{ + $num = $nbtotalofrecords; +} +else +{ + $sql.= $db->plimit($limit+1, $offset); -$sql.= $db->plimit($limit+1, $offset); + $resql=$db->query($sql); + if (! $resql) + { + dol_print_error($db); + exit; + } -$resql=$db->query($sql); -if (! $resql) dol_print_error($db); + $num = $db->num_rows($resql); +} -$num=$db->num_rows($resql); +// Direct jump if only one record found +if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all) +{ + $obj = $db->fetch_object($resql); + $id = $obj->rowid; + header("Location: ".dol_buildpath('/opensurvey/card.php', 1).'?id='.$id); + exit; +} +llxHeader('', $title, $help_url); +$arrayofselected=is_array($toselect)?$toselect:array(); + +$param=''; +if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); +if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); +$fieldtosortuser=empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?'firstname':'lastname'; + +if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); +// Add $param from extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; + +// List of mass actions available +$arrayofmassactions = array( + //'presend'=>$langs->trans("SendByMail"), + //'builddoc'=>$langs->trans("PDFMerge"), +); +if ($user->rights->opensurvey->write) $arrayofmassactions['predelete']=$langs->trans("Delete"); +if (GETPOST('nomassaction','int') || in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); +$massactionbutton=$form->selectMassAction('', $arrayofmassactions); // List of surveys into database -print '
'; +print ''; +if ($optioncss != '') print ''; print ''; +print ''; print ''; print ''; print ''; print ''; +print ''; -print_barre_liste($langs->trans("OpenSurveyArea"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionsbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, $newcardbutton, '', $limit); +$newcardbutton=''; +if (! empty($user->rights->opensurvey->write)) +{ + $newcardbutton=''.$langs->trans('NewSurvey').''; + $newcardbutton.= ''; + $newcardbutton.= ''; +} +else +{ + $newcardbutton=''.$langs->trans('NewSurvey'); + $newcardbutton.= ''; + $newcardbutton.= ''; +} + +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, $newcardbutton, '', $limit); + +// Add code for pre mass action (confirmation or email presend form) +$topicmail="SendOpenSurveyRef"; +$modelmail="opensurvey"; +$objecttmp=new Opensurveysondage($db); +$trackid='surv'.$object->id; +include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; + +if ($sall) +{ + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; +} $moreforfilter = ''; +/*$moreforfilter.='
'; +$moreforfilter.= $langs->trans('MyFilter') . ': '; +$moreforfilter.= '
';*/ $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook @@ -174,7 +289,8 @@ if (! empty($moreforfilter)) } $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; -$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +//$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +$selectedfields=''; $selectedfields.=(count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; @@ -191,12 +307,21 @@ print ''; print ''; $arraystatus=array('-1'=>' ','0'=>$langs->trans("Draft"),'1'=>$langs->trans("Opened"),'2'=>$langs->trans("Closed")); print ''. $form->selectarray('search_status', $arraystatus, $search_status).''; +// Extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; + +// Fields from hook +$parameters=array('arrayfields'=>$arrayfields); +$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; +// Action column print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; print ''."\n"; + // Fields title label // -------------------------------------------------------------------- print ''; @@ -207,7 +332,13 @@ print_liste_field_titre("Author", $_SERVER["PHP_SELF"], "u.".$fieldtosortuser, $ print_liste_field_titre("NbOfVoters", $_SERVER["PHP_SELF"], "", $param,"",'align="right"',$sortfield,$sortorder); print_liste_field_titre("ExpireDate", $_SERVER["PHP_SELF"], "p.date_fin", $param,"",'align="center"',$sortfield,$sortorder); print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "p.status", $param,"",'align="center"',$sortfield,$sortorder); -print_liste_field_titre(''); +// Extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; +// Hook fields +$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); +$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; +print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"],'','','','align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n"; print ''."\n"; @@ -230,8 +361,8 @@ while ($i < min($num, $limit)) } else dol_print_error($db); - $opensurvey_static->id=$obj->id_sondage; - $opensurvey_static->ref=$obj->id_sondage; + $opensurvey_static->id=$obj->rowid; + $opensurvey_static->ref=$obj->rowid; $opensurvey_static->title=$obj->titre; $opensurvey_static->status=$obj->status; $opensurvey_static->date_fin=$db->jdate($obj->date_fin); @@ -278,23 +409,86 @@ while ($i < min($num, $limit)) print''.$opensurvey_static->getLibStatut(5).''."\n"; - print''."\n"; + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Action column + print ''; + if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + { + $selected=0; + if (in_array($obj->rowid, $arrayofselected)) $selected=1; + print ''; + } + print ''; print ''."\n"; $i++; } +// Show total line +if (isset($totalarray['pos'])) +{ + print ''; + $i=0; + while ($i < $totalarray['nbfield']) + { + $i++; + if (! empty($totalarray['pos'][$i])) print ''.price($totalarray['val'][$totalarray['pos'][$i]]).''; + else + { + if ($i == 1) + { + if ($num < $limit) print ''.$langs->trans("Total").''; + else print ''.$langs->trans("Totalforthispage").''; + } + else print ''; + } + } + print ''; +} + // If no record found if ($num == 0) { - $colspan=8; - //foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; } - print ''.$langs->trans("NoRecordFound").''; + $colspan=1; + foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; } + print ''.$langs->trans("NoRecordFound").''; } + +$db->free($resql); + +$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); +$reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + print ''."\n"; -print '
'; -print '
'; +print ''."\n"; + +print ''."\n"; + +if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) +{ + $hidegeneratedfilelistifempty=1; + if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0; + + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; + $formfile = new FormFile($db); + + // Show list of available documents + $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; + $urlsource.=str_replace('&','&',$param); + + $filedir=$diroutputmassaction; + $genallowed=$user->rights->mymodule->read; + $delallowed=$user->rights->mymodule->create; + + print $formfile->showdocuments('massfilesarea_mymodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty); +} // End of page llxFooter(); diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index dac7f9ea126..c5e4c8648d7 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -29,7 +29,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; -$langs->loadLangs(array("admin", "other")); +$langs->loadLangs(array("admin", "companies", "other")); $action=GETPOST('action','alpha'); $value=GETPOST('value','alpha'); @@ -332,6 +332,7 @@ $dirsociete=array_merge(array('/core/modules/societe/'),$conf->modules_parts['so print load_fiche_titre($langs->trans("CompanyCodeChecker"),'',''); +print '
'; print ''."\n"; print ''."\n"; print ' '; @@ -403,7 +404,7 @@ foreach ($dirsociete as $dirroot) } } print '
'.$langs->trans("Name").'
'; - +print '
'; print "
"; @@ -412,6 +413,7 @@ print "
"; print load_fiche_titre($langs->trans("AccountCodeManager"),'',''); +print '
'; print ''; print ''; print ''; @@ -473,6 +475,7 @@ foreach ($dirsociete as $dirroot) } } print "
'.$langs->trans("Name").'
\n"; +print '
'; /* @@ -504,6 +507,7 @@ else dol_print_error($db); } +print '
'; print ''; print ''; print ''; @@ -619,12 +623,14 @@ foreach ($dirsociete as $dirroot) } } print '
'.$langs->trans("Name").'
'; +print '
'; print '
'; //IDProf print load_fiche_titre($langs->trans("CompanyIdProfChecker"),'',''); +print '
'; print ''; print ''; print ''; @@ -711,8 +717,10 @@ foreach($profid as $key => $val) $i++; } -print "
'.$langs->trans("Name").'

\n"; +print "\n"; +print '
'; +print "
\n"; print load_fiche_titre($langs->trans("Other"),'',''); @@ -723,6 +731,7 @@ print '
'; print ''; print ''; +print '
'; print ''; print ''; print "\n"; @@ -747,7 +756,7 @@ else '2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",2).')', '3'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",3).')', ); - print $form->selectarray("activate_COMPANY_USE_SEARCH_TO_SELECT", $arrval, $conf->global->COMPANY_USE_SEARCH_TO_SELECT); + print $form->selectarray("activate_COMPANY_USE_SEARCH_TO_SELECT", $arrval, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp'); print '"; @@ -771,7 +780,7 @@ else '2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",2).')', '3'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",3).')', ); - print $form->selectarray("activate_CONTACT_USE_SEARCH_TO_SELECT", $arrval, $conf->global->CONTACT_USE_SEARCH_TO_SELECT); + print $form->selectarray("activate_CONTACT_USE_SEARCH_TO_SELECT", $arrval, $conf->global->CONTACT_USE_SEARCH_TO_SELECT, 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp'); print '"; @@ -891,6 +900,7 @@ print ''; */ print '
".$langs->trans("Parameters")."'; print ''; print "'; print ''; print "
'; +print '
'; print '
'; From 2ec2daa18d116acf4937e58b71c59d74ae1eec66 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Jan 2019 10:53:28 +0100 Subject: [PATCH 4/4] FIX Edit blog meta post --- htdocs/website/class/website.class.php | 12 +++++----- htdocs/website/class/websitepage.class.php | 3 +++ htdocs/website/index.php | 27 ++++++++++++++++++---- 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index 26231534f67..7fd906044f6 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -79,16 +79,13 @@ class Website extends CommonObject * @var mixed */ public $date_creation; - - /** - * @var mixed - */ - public $tms = ''; + public $date_modification; /** * @var integer */ public $fk_default_home; + public $fk_user_creat; /** * @var string @@ -169,7 +166,7 @@ class Website extends CommonObject $sql .= ' '.(! isset($this->virtualhost)?'NULL':"'".$this->db->escape($this->virtualhost)."'").","; $sql .= ' '.(! isset($this->fk_user_creat)?$user->id:$this->fk_user_creat).','; $sql .= ' '.(! isset($this->date_creation) || dol_strlen($this->date_creation)==0?'NULL':"'".$this->db->idate($this->date_creation)."'").","; - $sql .= ' '.(! isset($this->date_modification) || dol_strlen($this->date_modification)==0?'NULL':"'".$this->db->idate($this->date_creation)."'"); + $sql .= ' '.(! isset($this->date_modification) || dol_strlen($this->date_modification)==0?'NULL':"'".$this->db->idate($this->date_modification)."'"); $sql .= ')'; $this->db->begin(); @@ -525,6 +522,7 @@ class Website extends CommonObject global $hookmanager, $langs; global $dolibarr_main_data_root; + $now = dol_now(); $error=0; dol_syslog(__METHOD__, LOG_DEBUG); @@ -560,6 +558,8 @@ class Website extends CommonObject $object->ref=$newref; $object->fk_default_home=0; $object->virtualhost=''; + $object->date_creation = $now; + $object->fk_user_creat = $user->id; // Create clone $object->context['createfromclone'] = 'createfromclone'; diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index e84acc03527..3c166c1d1f8 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -410,6 +410,8 @@ class WebsitePage extends CommonObject public function createFromClone(User $user, $fromid, $newref, $newlang='', $istranslation=0, $newwebsite=0, $keeptitleunchanged=0) { global $hookmanager, $langs; + + $now = dol_now(); $error = 0; dol_syslog(__METHOD__, LOG_DEBUG); @@ -428,6 +430,7 @@ class WebsitePage extends CommonObject $object->pageurl = $newref; $object->aliasalt = ''; $object->fk_user_creat = $user->id; + $object->date_creation = $now; $object->title = ($keeptitleunchanged ? '' : $langs->trans("CopyOf").' ').$object->title; if (! empty($newlang)) $object->lang=$newlang; if ($istranslation) $object->fk_page = $fromid; diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 0c7ae842c9b..f0e97b22a13 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -1163,6 +1163,8 @@ if ($action == 'updatemeta') $objectpage->keywords = GETPOST('WEBSITE_KEYWORDS', 'alpha'); $objectpage->lang = GETPOST('WEBSITE_LANG', 'aZ09'); $objectpage->htmlheader = trim(GETPOST('htmlheader', 'none')); + $newdatecreation=dol_mktime(GETPOST('datecreationhour','int'), GETPOST('datecreationmin','int'), GETPOST('datecreationsec','int'), GETPOST('datecreationmonth','int'), GETPOST('datecreationday','int'), GETPOST('datecreationyear','int')); + if ($newdatecreation) $objectpage->date_creation = $newdatecreation; $res = $objectpage->update($user); if (! ($res > 0)) @@ -2506,7 +2508,8 @@ if ($action == 'editmeta' || $action == 'createcontainer') $pagehtmlheader=$objectpage->htmlheader; $pagedatecreation=$objectpage->date_creation; $pagedatemodification=$objectpage->date_modification; - $pageauthorid=$objectpage->fk_user_create; + $pageauthorid=$objectpage->fk_user_creat; + $pageusermodifid=$objectpage->fk_user_modif; } else { @@ -2633,23 +2636,37 @@ if ($action == 'editmeta' || $action == 'createcontainer') print ''; $fuser=new User($db); - $fuser->fetch($pageauthorid); print ''; print $langs->trans('Author'); print ''; - if ($pageauthorid > 0) print $fuser->getNomUrl(1); + if ($pageauthorid > 0) + { + $fuser->fetch($pageauthorid); + print $fuser->getNomUrl(1); + } print ''; print ''; print $langs->trans('DateCreation'); print ''; - print dol_print_date($pagedatecreation, 'dayhour'); + print $form->select_date($pagedatecreation, 'datecreation', 1, 1, 0, '', 1, 1); + //print dol_print_date($pagedatecreation, 'dayhour'); print ''; if ($action != 'createcontainer') { - print ''; + print ''; + print $langs->trans('LastModificationAuthor'); + print ''; + if ($pageusermodifid > 0) + { + $fuser->fetch($pageusermodifid); + print $fuser->getNomUrl(1); + } + print ''; + + print ''; print $langs->trans('DateModification'); print ''; print dol_print_date($pagedatemodification, 'dayhour');