From ddbf841514d9f62e90ea5fce483d340d0a3890be Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Jul 2017 23:57:55 +0200 Subject: [PATCH 1/2] Fix packager must ignore symbolic links in custom --- build/makepack-dolibarr.pl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 41b54022ee4..1843f3c8cfd 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -592,6 +592,8 @@ if ($nboftargetok) { print "Remove subdir of custom dir\n"; print "find $BUILDROOT/$PROJECT/htdocs/custom/* -type d -exec rm -fr {} \\;\n"; $ret=`find $BUILDROOT/$PROJECT/htdocs/custom/* -type d -exec rm -fr {} \\; >/dev/null 2>&1`; # For custom we want to remove all subdirs but not files + print "find $BUILDROOT/$PROJECT/htdocs/custom/* -type l -exec rm -fr {} \\;\n"; + $ret=`find $BUILDROOT/$PROJECT/htdocs/custom/* -type l -exec rm -fr {} \\; >/dev/null 2>&1`; # For custom we want to remove all subdirs, even symbolic links, but not files } # Build package for each target From 41c6d9cbfb6a0dc395fc04f75f75c7be0d67dbdb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Jul 2017 00:00:08 +0200 Subject: [PATCH 2/2] Debug modulebuilder --- .../template/class/myobject.class.php | 16 ++++++++-------- .../modulebuilder/template/myobject_list.php | 19 ++++++++++++++----- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index b3c7a99d24e..f75e40f2730 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -74,7 +74,8 @@ class MyObject extends CommonObject * @var array Array with all fields and their property */ public $fields=array( - 'ref' =>array('type'=>'varchar(64)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>true, 'index'=>true, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'), + 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>true, 'index'=>true, 'position'=>1, 'comment'=>'Id'), + 'ref' =>array('type'=>'varchar(64)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>true, 'index'=>true, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=>true, 'index'=>true, 'position'=>20), 'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1), 'qty' =>array('type'=>'double(24,8)', 'label'=>'Qty', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'searchall'=>0, 'isameasure'=>1), @@ -84,8 +85,8 @@ class MyObject extends CommonObject 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'index'=>true, 'position'=>1000, 'nullifempty'=>1), ); // END MODULEBUILDER PROPERTIES - - + + // If this object has a subtable with lines @@ -129,11 +130,10 @@ class MyObject extends CommonObject * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) * @param string $option On what the link point to * @param int $notooltip 1=Disable tooltip - * @param int $maxlen Max length of visible user name * @param string $morecss Add more css on link * @return string String with URL */ - function getNomUrl($withpicto=0, $option='', $notooltip=0, $maxlen=24, $morecss='') + function getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='') { global $db, $conf, $langs; global $dolibarr_main_authentication, $dolibarr_main_demo; @@ -144,18 +144,18 @@ class MyObject extends CommonObject $result = ''; $companylink = ''; - $label = '' . $langs->trans("MyModule") . ''; + $label = '' . $langs->trans("MyObject") . ''; $label.= '
'; $label.= '' . $langs->trans('Ref') . ': ' . $this->ref; - $url = DOL_URL_ROOT.'/mymodule/'.$this->table_name.'_card.php?id='.$this->id; + $url = $url = dol_buildpath('/mymodule/m_card.php',1).'?id='.$this->id; $linkclose=''; if (empty($notooltip)) { if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { - $label=$langs->trans("ShowProject"); + $label=$langs->trans("ShowMyObject"); $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; } $linkclose.=' title="'.dol_escape_htmltag($label, 1).'"'; diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index b0f95ba6ff4..fb26f9dde0e 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -18,9 +18,8 @@ /** * \file htdocs/modulebuilder/template/myobject_list.php - * \ingroup mymodule othermodule1 othermodule2 - * \brief This file is an example of a php page - * Put here some comments + * \ingroup mymodule + * \brief List page for monmodule */ //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); @@ -472,6 +471,13 @@ while ($i < min($num, $limit)) $obj = $db->fetch_object($resql); if ($obj) { + // Store properties in $object + $object->id = $obj->rowid; + foreach($object->fields as $key => $val) + { + if (isset($obj->$key)) $object->$key = $obj->$key; + } + // Show here line of result print ''; foreach($object->fields as $key => $val) @@ -480,11 +486,13 @@ while ($i < min($num, $limit)) $align=''; if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center'; if (in_array($val['type'], array('timestamp'))) $align.='nowrap'; + if ($key == 'status') $align.=($align?' ':'').'center'; if (! empty($arrayfields['t.'.$key]['checked'])) { print ''; if (in_array($val['type'], array('date','datetime','timestamp'))) print dol_print_date($db->jdate($obj->$key), 'dayhour'); - elseif ($key == 'status') print ''.$object->getLibStatut(3).''; + elseif ($key == 'ref') print $object->getNomUrl(1); + elseif ($key == 'status') print $object->getLibStatut(3); else print $obj->$key; print ''; if (! $i) $totalarray['nbfield']++; @@ -514,7 +522,7 @@ while ($i < min($num, $limit)) { if (! $i) $totalarray['pos'][$totalarray['nbfield']]='ef.'.$tmpkey; $totalarray['val']['ef.'.$tmpkey] += $obj->$tmpkey; - } + } } } } @@ -529,6 +537,7 @@ while ($i < min($num, $limit)) $align=''; if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center'; if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap'; + if ($key == 'status') $align.=($align?' ':'').'center'; if (! empty($arrayfields['t.'.$key]['checked'])) { print '';