From b8b56e2d2632c91d67187d94de55be02d58e200e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Aug 2014 13:25:54 +0200 Subject: [PATCH 1/7] Fix: col balance --- htdocs/core/boxes/box_project.php | 23 +++++++++++------------ htdocs/core/boxes/box_task.php | 13 +++++++------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index fab476c0c95..62ed89dd65b 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -77,10 +77,8 @@ class box_project extends ModeleBoxes { $sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut "; - $sql.= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."projet as p"; - $sql.= ")"; - $sql.= " WHERE p.fk_soc = s.rowid"; - $sql.= " AND s.entity = ".$conf->entity; + $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; + $sql.= " WHERE p.entity = ".$conf->entity; $sql.= " AND p.fk_statut = 1"; // Seulement les projets ouverts $sql.= " ORDER BY p.datec DESC"; $sql.= $db->plimit($max, 0); @@ -107,16 +105,16 @@ class box_project extends ModeleBoxes ); $sql ="SELECT count(*) as nb, sum(progress) as totprogress"; - $sql.=" FROM ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."projet as p"; - $sql.=" WHERE pt.fk_projet = p.rowid"; - $sql.=" AND p.entity = ".$conf->entity; + $sql.=" FROM ".MAIN_DB_PREFIX."projet as p LEFT JOIN ".MAIN_DB_PREFIX."projet_task as pt on pt.fk_projet = p.rowid"; + $sql.=" WHERE p.entity = ".$conf->entity; + $resultTask = $db->query($sql); if ($resultTask) { $objTask = $db->fetch_object($resultTask); $this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => number_format($objTask->nb, 0, ',', ' ')." ".$langs->trans("Tasks")); if ($objTask->nb > 0 ) - $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => number_format(($objTask->totprogress/$objTask->nb), 0, ',', ' ')." % ".$langs->trans("Progress")); + $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => number_format(($objTask->totprogress/$objTask->nb), 0, ',', ' ')."%"); else $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => "N/A "); $totalnbTask += $objTask->nb; @@ -134,10 +132,11 @@ class box_project extends ModeleBoxes // Add the sum à the bottom of the boxes - $this->info_box_contents[$i][0] = array('tr' => 'class="liste_total"', 'td' => 'colspan=2 align="left" ', 'text' => $langs->trans("Total")." ".$textHead); - $this->info_box_contents[$i][1] = array('td' => 'align="right" ', 'text' => number_format($num, 0, ',', ' ')." ".$langs->trans("Projects")); - $this->info_box_contents[$i][2] = array('td' => 'align="right" ', 'text' => number_format($totalnbTask, 0, ',', ' ')." ".$langs->trans("Tasks")); - $this->info_box_contents[$i][4] = array('td' => 'colspan=2', 'text' => ""); + $this->info_box_contents[$i][0] = array('tr' => 'class="liste_total"', 'td' => 'align="left" ', 'text' => $langs->trans("Total")." ".$textHead); + $this->info_box_contents[$i][1] = array('td' => '', 'text' => ""); + $this->info_box_contents[$i][2] = array('td' => 'align="right" ', 'text' => number_format($num, 0, ',', ' ')." ".$langs->trans("Projects")); + $this->info_box_contents[$i][3] = array('td' => 'align="right" ', 'text' => number_format($totalnbTask, 0, ',', ' ')." ".$langs->trans("Tasks")); + $this->info_box_contents[$i][4] = array('td' => '', 'text' => ""); } diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php index 3f2e5f05c16..c15bc9831ce 100644 --- a/htdocs/core/boxes/box_task.php +++ b/htdocs/core/boxes/box_task.php @@ -120,12 +120,13 @@ class box_task extends ModeleBoxes // Add the sum à the bottom of the boxes - $this->info_box_contents[$i][0] = array('tr' => 'class="liste_total"', 'td' => 'colspan=2 align="left" ', 'text' => $langs->trans("Total")." ".$textHead); - $this->info_box_contents[$i][1] = array('td' => 'align="right" ', 'text' => number_format($totalnb, 0, ',', ' ')." ".$langs->trans("Tasks")); - $this->info_box_contents[$i][2] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totalplannedtot,'all',25200,5)); - $this->info_box_contents[$i][3] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totaldurationtot,'all',25200,5)); - $this->info_box_contents[$i][4] = array('td' => 'colspan=2', 'text' => ""); - + $this->info_box_contents[$i][0] = array('tr' => 'class="liste_total"', 'td' => 'align="left" ', 'text' => $langs->trans("Total")." ".$textHead); + $this->info_box_contents[$i][1] = array('td' => '', 'text' => ""); + $this->info_box_contents[$i][2] = array('td' => 'align="right" ', 'text' => number_format($totalnb, 0, ',', ' ')." ".$langs->trans("Tasks")); + $this->info_box_contents[$i][3] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totalplannedtot,'all',25200,5)); + $this->info_box_contents[$i][4] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totaldurationtot,'all',25200,5)); + $this->info_box_contents[$i][5] = array('td' => '', 'text' => ""); + } /** From 4c0059266ca725bec94d5514f6ec6eaee86f1c8a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Aug 2014 13:26:59 +0200 Subject: [PATCH 2/7] Prepare to remove pair and impair css style. --- htdocs/theme/eldy/style.css.php | 144 +++++++++++++++++++------------- 1 file changed, 87 insertions(+), 57 deletions(-) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 759e9bbdadc..c260a1ff161 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -125,12 +125,12 @@ if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED)) $conf->global->THEME_ELDY_BACKTABACTIVE='234,234,234'; //$conf->global->THEME_ELDY_BACKBODY='#ffffff url('.$img_head.') 0 0 no-repeat;'; $conf->global->THEME_ELDY_BACKBODY='#fcfcfc;'; - $conf->global->THEME_ELDY_LINEIMPAIR1='242,242,242'; - $conf->global->THEME_ELDY_LINEIMPAIR2='248,248,248'; - $conf->global->THEME_ELDY_LINEIMPAIRHOVER='238,246,252'; - $conf->global->THEME_ELDY_LINEPAIR1='255,255,255'; - $conf->global->THEME_ELDY_LINEPAIR2='255,255,255'; + $conf->global->THEME_ELDY_LINEPAIR1='242,242,242'; + $conf->global->THEME_ELDY_LINEPAIR2='248,248,248'; $conf->global->THEME_ELDY_LINEPAIRHOVER='238,246,252'; + $conf->global->THEME_ELDY_LINEIMPAIR1='255,255,255'; + $conf->global->THEME_ELDY_LINEIMPAIR2='255,255,255'; + $conf->global->THEME_ELDY_LINEIMPAIRHOVER='238,246,252'; $conf->global->THEME_ELDY_TEXT='50,50,130'; if ($dol_use_jmobile) { @@ -1720,6 +1720,86 @@ table.liste td { .tagtr, .table-border-row { display: table-row; } .tagtd, .table-border-col, .table-key-border-col, .table-val-border-col { display: table-cell; } + +/* Prepare to remove class pair - impair +.noborder > tbody > tr:nth-child(even) td { + background: linear-gradient(bottom, rgb() 85%, rgb() 100%); + background: -o-linear-gradient(bottom, rgb() 85%, rgb() 100%); + background: -moz-linear-gradient(bottom, rgb() 85%, rgb() 100%); + background: -webkit-linear-gradient(bottom, rgb() 85%, rgb() 100%); + background: -ms-linear-gradient(bottom, rgb() 85%, rgb() 100%); + font-family: ; + border: 0px; + margin-bottom: 1px; + color: #202020; + min-height: 18px; +} + +.noborder > tbody > tr:nth-child(odd) td { + background: linear-gradient(bottom, rgb() 85%, rgb() 100%); + background: -o-linear-gradient(bottom, rgb() 85%, rgb() 100%); + background: -moz-linear-gradient(bottom, rgb() 85%, rgb() 100%); + background: -webkit-linear-gradient(bottom, rgb() 85%, rgb() 100%); + background: -ms-linear-gradient(bottom, rgb() 85%, rgb() 100%); + font-family: ; + border: 0px; + margin-bottom: 1px; + color: #202020; +} +*/ + +.impair:hover { + + background: rgb(); + + background: #fafafa; + + border: 0px; +} + +.impair, .nohover .impair:hover, tr.impair td.nohover { + + background: linear-gradient(bottom, rgb() 85%, rgb() 100%) !important; + background: -o-linear-gradient(bottom, rgb() 85%, rgb() 100%) !important; + background: -moz-linear-gradient(bottom, rgb() 85%, rgb() 100%) !important; + background: -webkit-linear-gradient(bottom, rgb() 85%, rgb() 100%) !important; + background: -ms-linear-gradient(bottom, rgb() 85%, rgb() 100%) !important; + + background: #eaeaea !important; + + font-family: ; + border: 0px; + margin-bottom: 1px; + color: #202020; + min-height: 18px; /* seems to not be used */ +} + +td.nohover, .pair:hover { + + background: rgb() !important; + + background: #fafafa !important; + + border: 0px; +} + +.pair, .nohover .pair:hover, tr.pair td.nohover { + + background: linear-gradient(bottom, rgb() 85%, rgb() 100%) !important; + background: -o-linear-gradient(bottom, rgb() 85%, rgb() 100%) !important; + background: -moz-linear-gradient(bottom, rgb() 85%, rgb() 100%) !important; + background: -webkit-linear-gradient(bottom, rgb() 85%, rgb() 100%) !important; + background: -ms-linear-gradient(bottom, rgb() 85%, rgb() 100%) !important; + + background: #ffffff !important; + + font-family: ; + border: 0px; + margin-bottom: 1px; + color: #202020; +} + + tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, table.dataTable.tr { height: 26px !important; @@ -1772,66 +1852,16 @@ input.liste_titre { border: 0px; } -tr.liste_total, form.liste_total { +.noborder tr.liste_total, .noborder tr.liste_total td, tr.liste_total, form.liste_total { background: #F0F0F0; } -tr.liste_total td, form.liste_total div { +.noborder tr.liste_total td, tr.liste_total td, form.liste_total div { border-top: 1px solid #DDDDDD; color: #332266; font-weight: normal; white-space: nowrap; } -.impair:hover { - - background: rgb(); - - background: #fafafa; - - border: 0px; -} - -.impair, .nohover .impair:hover, tr.impair td.nohover { - - background: linear-gradient(bottom, rgb() 85%, rgb() 100%); - background: -o-linear-gradient(bottom, rgb() 85%, rgb() 100%); - background: -moz-linear-gradient(bottom, rgb() 85%, rgb() 100%); - background: -webkit-linear-gradient(bottom, rgb() 85%, rgb() 100%); - background: -ms-linear-gradient(bottom, rgb() 85%, rgb() 100%); - - background: #eaeaea; - - font-family: ; - border: 0px; - margin-bottom: 1px; - color: #202020; - min-height: 18px; /* seems to not be used */ -} - -.pair:hover { - - background: rgb(); - - background: #fafafa; - - border: 0px; -} - -.pair, .nohover .pair:hover, tr.pair td.nohover { - - background: linear-gradient(bottom, rgb() 85%, rgb() 100%); - background: -o-linear-gradient(bottom, rgb() 85%, rgb() 100%); - background: -moz-linear-gradient(bottom, rgb() 85%, rgb() 100%); - background: -webkit-linear-gradient(bottom, rgb() 85%, rgb() 100%); - background: -ms-linear-gradient(bottom, rgb() 85%, rgb() 100%); - - background: #ffffff; - - font-family: ; - border: 0px; - margin-bottom: 1px; - color: #202020; -} .tableforservicepart1 .impair, .tableforservicepart1 .pair, .tableforservicepart2 .impair, .tableforservicepart2 .pair { background: none; From 5a0c66b9ad9ce109fb76d1e79b161cdac4158fd6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Aug 2014 13:29:24 +0200 Subject: [PATCH 3/7] Qual: Use getNomUrl for project into list of timesheet. --- dev/skeletons/skeleton_page.php | 84 ++++++++++++++++++++++++--- htdocs/projet/class/project.class.php | 4 +- htdocs/projet/index.php | 10 +++- 3 files changed, 85 insertions(+), 13 deletions(-) diff --git a/dev/skeletons/skeleton_page.php b/dev/skeletons/skeleton_page.php index 7b625066390..fecd48637ed 100644 --- a/dev/skeletons/skeleton_page.php +++ b/dev/skeletons/skeleton_page.php @@ -43,6 +43,7 @@ if (! $res && file_exists("../../../dolibarr/htdocs/main.inc.php")) $res=@includ if (! $res && file_exists("../../../../dolibarr/htdocs/main.inc.php")) $res=@include '../../../../dolibarr/htdocs/main.inc.php'; // Used on dev env only if (! $res) die("Include of main fails"); // Change this following line to use the correct relative path from htdocs +include_once(DOL_DOCUMENT_ROOT.'/core/class/formcompany.class.php'); dol_include_once('/module/class/skeleton_class.class.php'); // Load traductions files requiredby by page @@ -60,6 +61,14 @@ if ($user->societe_id > 0) //accessforbidden(); } +// Load object if id or ref is provided as parameter +$object=new Skeleton_Class($db); +if (($id || $ref) && $action != 'add') +{ + $result=$object->fetch($id,$ref); + if ($result < 0) dol_print_error($db); +} + /******************************************************************* @@ -72,7 +81,6 @@ if ($action == 'add') { $error=0; - $object=new Skeleton_Class($db); /* object_prop_getpost_prop */ $object->prop1=GETPOST("field1"); $object->prop2=GETPOST("field2"); @@ -122,7 +130,7 @@ $form=new Form($db); // Put here content of your page -// Example 1 : Adding jquery code +// Example : Adding jquery code print ''; -// Example 2 : Adding links to objects -// The class must extends CommonObject class to have this method available -//$somethingshown=$object->showLinkedObjectBlock(); - - -// Example 3 : List of data -if ($action == 'list') +// Part to show a list +if ($action == 'list' || empty($id)) { $sql = "SELECT"; $sql.= " t.rowid,"; @@ -191,6 +194,69 @@ if ($action == 'list') +// Part to edit record +if ($id && $action == 'edit') +{ + dol_fiche_head(); + + print '
'; + print ''; + + + print '
'; + + print '
'; + + print '
'; + + dol_fiche_end(); +} + + + +// Part to show record +if ($id && (empty($action) || $action == 'view')) +{ + dol_fiche_head(); + + + + dol_fiche_end(); + + + // Buttons + print '
'."\n"; + $parameters=array(); + $reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) + { + if ($user->rights->mymodule->write) + { + print ''."\n"; + } + + if ($user->rights->mymodule->delete) + { + if ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile)) // We can't use preloaded confirm form with jmobile + { + print '
'.$langs->trans('Delete').'
'."\n"; + } + else + { + print ''."\n"; + } + } + } + print '
'."\n"; + + + // Example 2 : Adding links to objects + // The class must extends CommonObject class to have this method available + //$somethingshown=$object->showLinkedObjectBlock(); + +} + + // End of page llxFooter(); $db->close(); diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 7b7441ba570..100dd4dfb51 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -741,7 +741,7 @@ class Project extends CommonObject * * @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul * @param string $option Variant ('', 'nolink') - * @param int $addlabel 0=Default, 1=Add label into string + * @param int $addlabel 0=Default, 1=Add label into string, >1=Add first chars into string * @return string Chaine avec URL */ function getNomUrl($withpicto=0, $option='', $addlabel=0) @@ -773,7 +773,7 @@ class Project extends CommonObject if ($withpicto) $result.=($lien . img_object($label, $picto) . $lienfin); if ($withpicto && $withpicto != 2) $result.=' '; - if ($withpicto != 2) $result.=$lien . $this->ref . $lienfin . (($addlabel && $this->title) ? ' - ' . $this->title : ''); + if ($withpicto != 2) $result.=$lien . $this->ref . $lienfin . (($addlabel && $this->title) ? ' - ' . dol_trunc($this->title, ($addlabel > 1 ? $addlabel : 0)) : ''); return $result; } diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index 7ea2a0af1e9..9622f4fa480 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -156,7 +156,7 @@ print ''; // Tasks for all resources of all opened projects and time spent for each task/resource print '
'; -$sql = "SELECT p.title, p.rowid as projectid, t.label, t.rowid as taskid, u.rowid as userid, t.planned_workload, t.dateo, t.datee, SUM(tasktime.task_duration) as timespent"; +$sql = "SELECT p.ref, p.title, p.rowid as projectid, t.label, t.rowid as taskid, u.rowid as userid, t.planned_workload, t.dateo, t.datee, SUM(tasktime.task_duration) as timespent"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."projet_task as t on t.fk_projet = p.rowid"; @@ -216,7 +216,13 @@ if ( $resql ) print ""; print ''.$username.''; - print ''.$obj->title.''; + print ''; + $projectstatic->id=$obj->projectid; + $projectstatic->ref=$obj->ref; + $projectstatic->title=$obj->title; + print $projectstatic->getNomUrl(1,'',16); + //print ''.$obj->title.''; + print ''; print ''.$obj->label.''; print ''.dol_print_date($db->jdate($obj->dateo)).''; print ''.dol_print_date($db->jdate($obj->datee)).''; From 6b26ae6f1f478be92fca5ca4da83d349c01cc85c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Aug 2014 13:30:44 +0200 Subject: [PATCH 4/7] Fix: Header of tables must use th and not td --- htdocs/core/class/commonobject.class.php | 2 ++ htdocs/societe/index.php | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index d322dd201df..e36eef20ff4 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -47,6 +47,8 @@ abstract class CommonObject public $array_options=array(); + public $thirdparty; + public $linkedObjectsIds; // Loaded by ->fetchObjectLinked public $linkedObjects; // Loaded by ->fetchObjectLinked diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index 766e44cf9a7..dad3c5cb5e0 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -64,19 +64,19 @@ print '
'; print ''; print ''; print ''; -print ''; +print ''; print "'; print ''; if (! empty($conf->barcode->enabled)) { - print "'; //print ''; print ''; } -print "'; +print "'; //print ''; print ''; @@ -121,7 +121,7 @@ print '
'.$langs->trans("Search").'
'.$langs->trans("Search").'
"; print ':
"; + print "
"; print ':
"; -print ':
"; +print ':
'; print ''; if (! empty($conf->use_javascript_ajax) && ((round($third['prospect'])?1:0)+(round($third['customer'])?1:0)+(round($third['supplier'])?1:0)+(round($third['other'])?1:0) >= 2)) { - print '
'.$langs->trans("Statistics").'
'; + print '
'; $dataseries=array(); if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) $dataseries[]=array('label'=>$langs->trans("Prospects"),'data'=>round($third['prospect'])); if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) $dataseries[]=array('label'=>$langs->trans("Customers"),'data'=>round($third['customer'])); From 75a46030ded1fb05b2429f090552cd82b5bc4aeb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Aug 2014 15:09:17 +0200 Subject: [PATCH 5/7] Complete ignore --- htdocs/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/.gitignore b/htdocs/.gitignore index a4ebd2bb7c7..8ba0a69acb3 100644 --- a/htdocs/.gitignore +++ b/htdocs/.gitignore @@ -2,6 +2,7 @@ /custom* /extensions* /nltechno* +/anco* /bootstrap* /google* /multicompany* From c17f5e7f007a8600282a50d6c64a0601eabdb0af Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Aug 2014 16:04:42 +0200 Subject: [PATCH 6/7] Accept property fk_thirdparty instead of fk_soc --- htdocs/core/class/commonobject.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index e36eef20ff4..3306d38f214 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -598,10 +598,10 @@ abstract class CommonObject { global $conf; - if (empty($this->socid) && empty($this->fk_soc)) return 0; + if (empty($this->socid) && empty($this->fk_soc) && empty($this->fk_thirdparty)) return 0; $thirdparty = new Societe($this->db); - $result=$thirdparty->fetch(isset($this->socid)?$this->socid:$this->fk_soc); + $result=$thirdparty->fetch(isset($this->socid)?$this->socid:(isset($this->fk_soc)?$this->fk_soc:$this->fk_thirdparty)); $this->client = $thirdparty; // deprecated $this->thirdparty = $thirdparty; From c79fc516d3b2b7174d9c4fbf0844f606b58b5fbc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Aug 2014 17:27:28 +0200 Subject: [PATCH 7/7] Maj squelette --- dev/skeletons/skeleton_page.php | 2 +- htdocs/core/tpl/notes.tpl.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dev/skeletons/skeleton_page.php b/dev/skeletons/skeleton_page.php index fecd48637ed..aab1a965eb6 100644 --- a/dev/skeletons/skeleton_page.php +++ b/dev/skeletons/skeleton_page.php @@ -63,7 +63,7 @@ if ($user->societe_id > 0) // Load object if id or ref is provided as parameter $object=new Skeleton_Class($db); -if (($id || $ref) && $action != 'add') +if (($id > 0 || ! empty($ref)) && $action != 'add') { $result=$object->fetch($id,$ref); if ($result < 0) dol_print_error($db); diff --git a/htdocs/core/tpl/notes.tpl.php b/htdocs/core/tpl/notes.tpl.php index 0cce9a3e3b4..66b310da69d 100644 --- a/htdocs/core/tpl/notes.tpl.php +++ b/htdocs/core/tpl/notes.tpl.php @@ -22,6 +22,7 @@ $note_public = 'note_public'; $note_private = 'note_private'; $colwidth=(isset($colwidth)?$colwidth:25); + $permission=(isset($permission)?$permission:(isset($user->rights->$module->creer)?$user->rights->$module->creer:0)); // If already defined by caller page $moreparam=(isset($moreparam)?$moreparam:''); $value_public=$object->note_public; @@ -59,8 +60,9 @@ elseif ($module == 'contact') { $permission=$user->rights->societe->creer;} elseif ($module == 'shipping') { $permission=$user->rights->expedition->creer;} //else dol_print_error('','Bad value '.$module.' for param module'); -if (! empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $typeofdata='ckeditor:dolibarr_notes:100%:200::1:12:100'; +if (! empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $typeofdata='ckeditor:dolibarr_notes:100%:200::1:12:100'; // Rem: This var is for all notes, not only thirdparties note. else $typeofdata='textarea:12:100'; + ?>