From 2262c1c7dddbeb940c16f9ee506992f68bfa85ef Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 8 Aug 2016 21:58:47 +0200 Subject: [PATCH] Fix code generator --- dev/skeletons/build_class_from_table.php | 12 ++++++---- dev/skeletons/skeleton_list.php | 30 ++++++++++++++++-------- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/dev/skeletons/build_class_from_table.php b/dev/skeletons/build_class_from_table.php index ecdbbd09dc4..62ad1188759 100755 --- a/dev/skeletons/build_class_from_table.php +++ b/dev/skeletons/build_class_from_table.php @@ -587,11 +587,10 @@ foreach ($skeletonfiles as $skeletonfile => $outfile) { if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime']) { - $varprop.="if (! empty(\$arrayfields['t.".$prop['field']."']['checked'])) print_liste_field_titre(\$arrayfields['t.".$prop['field']."']['label'],\$_SERVER['PHP_SELF'],'t.".$prop['field']."','',\$param,'',\$sortfield,\$sortorder);\n"; + $varprop.="if (! empty(\$arrayfields['t.".$prop['field']."']['checked'])) print_liste_field_titre(\$arrayfields['t.".$prop['field']."']['label'],\$_SERVER['PHP_SELF'],'t.".$prop['field']."','',\$params,'',\$sortfield,\$sortorder);\n"; } } - $targetcontent=preg_replace('/'.preg_quote("if (! empty(\$arrayfields['t.field1']['checked'])) print_liste_field_titre(\$langs->trans('field1'),\$_SERVER['PHP_SELF'],'t.field1','',\$param,'',\$sortfield,\$sortorder);",'/').'/', $varprop, $targetcontent); - $targetcontent=preg_replace('/'.preg_quote("if (! empty(\$arrayfields['t.field2']['checked'])) print_liste_field_titre(\$langs->trans('field2'),\$_SERVER['PHP_SELF'],'t.field2','',\$param,'',\$sortfield,\$sortorder);",'/').'/', '', $targetcontent); + $targetcontent=preg_replace('/LIST_OF_TD_TITLE_FIELDS/', $varprop, $targetcontent); // Substitute fields title search $varprop="\n"; @@ -603,8 +602,7 @@ foreach ($skeletonfiles as $skeletonfile => $outfile) $varprop.="if (! empty(\$arrayfields['t.".$prop['field']."']['checked'])) print '';\n"; } } - $targetcontent=preg_replace('/'.preg_quote("if (! empty(\$arrayfields['t.field1']['checked'])) print '';",'/').'/', $varprop, $targetcontent); - $targetcontent=preg_replace('/'.preg_quote("if (! empty(\$arrayfields['t.field2']['checked'])) print '';",'/').'/', '', $targetcontent); + $targetcontent=preg_replace('/LIST_OF_TD_TITLE_SEARCH/', $varprop, $targetcontent); // Substitute where for .fieldx. $varprop="\n"; @@ -656,6 +654,10 @@ foreach ($skeletonfiles as $skeletonfile => $outfile) $targetcontent=preg_replace('/LIST_OF_TD_LABEL_FIELDS_VIEW/', $varprop, $targetcontent); + // LIST_OF_TD_FIELDS_LIST + + + // Build file $fp=fopen($outfile,"w"); if ($fp) diff --git a/dev/skeletons/skeleton_list.php b/dev/skeletons/skeleton_list.php index f1413bb3712..670f13fc3f0 100644 --- a/dev/skeletons/skeleton_list.php +++ b/dev/skeletons/skeleton_list.php @@ -104,7 +104,7 @@ $arrayfields=array( 't.field1'=>array('label'=>$langs->trans("Field1"), 'checked'=>1), 't.field2'=>array('label'=>$langs->trans("Field2"), 'checked'=>1), //'t.entity'=>array('label'=>$langs->trans("Entity"), 'checked'=>1, 'enabled'=>(! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode))), - 't.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), + 't.datec'=>array('label'=>$langs->trans("DateCreationShort"), 'checked'=>0, 'position'=>500), 't.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), //'t.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), ); @@ -188,12 +188,16 @@ if (empty($reshook)) * Put here all code to build page ****************************************************/ -llxHeader('','MyPageName',''); +$now=dol_now(); $form=new Form($db); -// Put here content of your page +//$help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes"; +$help_url=''; $title = $langs->trans('MyModuleListTitle'); +llxHeader('', $title, $help_url); + +// Put here content of your page // Example : Adding jquery code print '