2
0
forked from Wavyzz/dolibarr

Merge branch '6.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur
2017-07-25 00:00:55 +02:00
3 changed files with 24 additions and 13 deletions

View File

@@ -592,6 +592,8 @@ if ($nboftargetok) {
print "Remove subdir of custom dir\n"; print "Remove subdir of custom dir\n";
print "find $BUILDROOT/$PROJECT/htdocs/custom/* -type d -exec rm -fr {} \\;\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 $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 # Build package for each target

View File

@@ -74,7 +74,8 @@ class MyObject extends CommonObject
* @var array Array with all fields and their property * @var array Array with all fields and their property
*/ */
public $fields=array( 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), '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), '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), 'qty' =>array('type'=>'double(24,8)', 'label'=>'Qty', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'searchall'=>0, 'isameasure'=>1),
@@ -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 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 string $option On what the link point to
* @param int $notooltip 1=Disable tooltip * @param int $notooltip 1=Disable tooltip
* @param int $maxlen Max length of visible user name
* @param string $morecss Add more css on link * @param string $morecss Add more css on link
* @return string String with URL * @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 $db, $conf, $langs;
global $dolibarr_main_authentication, $dolibarr_main_demo; global $dolibarr_main_authentication, $dolibarr_main_demo;
@@ -144,18 +144,18 @@ class MyObject extends CommonObject
$result = ''; $result = '';
$companylink = ''; $companylink = '';
$label = '<u>' . $langs->trans("MyModule") . '</u>'; $label = '<u>' . $langs->trans("MyObject") . '</u>';
$label.= '<br>'; $label.= '<br>';
$label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref; $label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $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=''; $linkclose='';
if (empty($notooltip)) if (empty($notooltip))
{ {
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{ {
$label=$langs->trans("ShowProject"); $label=$langs->trans("ShowMyObject");
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
} }
$linkclose.=' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose.=' title="'.dol_escape_htmltag($label, 1).'"';

View File

@@ -18,9 +18,8 @@
/** /**
* \file htdocs/modulebuilder/template/myobject_list.php * \file htdocs/modulebuilder/template/myobject_list.php
* \ingroup mymodule othermodule1 othermodule2 * \ingroup mymodule
* \brief This file is an example of a php page * \brief List page for monmodule
* Put here some comments
*/ */
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1');
@@ -472,6 +471,13 @@ while ($i < min($num, $limit))
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if ($obj) 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 // Show here line of result
print '<tr class="oddeven">'; print '<tr class="oddeven">';
foreach($object->fields as $key => $val) foreach($object->fields as $key => $val)
@@ -480,11 +486,13 @@ while ($i < min($num, $limit))
$align=''; $align='';
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center'; if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
if (in_array($val['type'], array('timestamp'))) $align.='nowrap'; if (in_array($val['type'], array('timestamp'))) $align.='nowrap';
if ($key == 'status') $align.=($align?' ':'').'center';
if (! empty($arrayfields['t.'.$key]['checked'])) if (! empty($arrayfields['t.'.$key]['checked']))
{ {
print '<td'.($align?' class="'.$align.'"':'').'>'; print '<td'.($align?' class="'.$align.'"':'').'>';
if (in_array($val['type'], array('date','datetime','timestamp'))) print dol_print_date($db->jdate($obj->$key), 'dayhour'); if (in_array($val['type'], array('date','datetime','timestamp'))) print dol_print_date($db->jdate($obj->$key), 'dayhour');
elseif ($key == 'status') print '<td align="center">'.$object->getLibStatut(3).'</td>'; elseif ($key == 'ref') print $object->getNomUrl(1);
elseif ($key == 'status') print $object->getLibStatut(3);
else print $obj->$key; else print $obj->$key;
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
@@ -529,6 +537,7 @@ while ($i < min($num, $limit))
$align=''; $align='';
if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center'; if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center';
if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap'; if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap';
if ($key == 'status') $align.=($align?' ':'').'center';
if (! empty($arrayfields['t.'.$key]['checked'])) if (! empty($arrayfields['t.'.$key]['checked']))
{ {
print '<td'.($align?' class="'.$align.'"':'').'>'; print '<td'.($align?' class="'.$align.'"':'').'>';