Fix generator of page
This commit is contained in:
parent
3ed4a7494f
commit
de739c58a1
8
dev/skeletons/build_class_from_table.php
Normal file → Executable file
8
dev/skeletons/build_class_from_table.php
Normal file → Executable file
@ -120,7 +120,7 @@ else
|
|||||||
}
|
}
|
||||||
//var_dump($property);
|
//var_dump($property);
|
||||||
|
|
||||||
// Define substitute select parameters
|
// Define substitute fetch/select parameters
|
||||||
$varpropselect="\n";
|
$varpropselect="\n";
|
||||||
$cleanparam='';
|
$cleanparam='';
|
||||||
$i=0;
|
$i=0;
|
||||||
@ -313,7 +313,7 @@ foreach($property as $key => $prop)
|
|||||||
$targetcontent=preg_replace('/\$sql.= " field1=".\(isset\(\$this->field1\)\?"\'".\$this->db->escape\(\$this->field1\)."\'":"null"\).",";/', $varprop, $targetcontent);
|
$targetcontent=preg_replace('/\$sql.= " field1=".\(isset\(\$this->field1\)\?"\'".\$this->db->escape\(\$this->field1\)."\'":"null"\).",";/', $varprop, $targetcontent);
|
||||||
$targetcontent=preg_replace('/\$sql.= " field2=".\(isset\(\$this->field2\)\?"\'".\$this->db->escape\(\$this->field2\)."\'":"null"\)."";/', '', $targetcontent);
|
$targetcontent=preg_replace('/\$sql.= " field2=".\(isset\(\$this->field2\)\?"\'".\$this->db->escape\(\$this->field2\)."\'":"null"\)."";/', '', $targetcontent);
|
||||||
|
|
||||||
// Substitute select parameters
|
// Substitute fetch/select parameters
|
||||||
$targetcontent=preg_replace('/\$sql\.= " t\.field1,";/', $varpropselect, $targetcontent);
|
$targetcontent=preg_replace('/\$sql\.= " t\.field1,";/', $varpropselect, $targetcontent);
|
||||||
$targetcontent=preg_replace('/\$sql\.= " t\.field2";/', '', $targetcontent);
|
$targetcontent=preg_replace('/\$sql\.= " t\.field2";/', '', $targetcontent);
|
||||||
|
|
||||||
@ -445,6 +445,10 @@ $targetcontent=preg_replace('/Put here some comments/','Initialy built by build_
|
|||||||
// Substitute table name
|
// Substitute table name
|
||||||
$targetcontent=preg_replace('/MAIN_DB_PREFIX."mytable/', 'MAIN_DB_PREFIX."'.$tablenoprefix, $targetcontent);
|
$targetcontent=preg_replace('/MAIN_DB_PREFIX."mytable/', 'MAIN_DB_PREFIX."'.$tablenoprefix, $targetcontent);
|
||||||
|
|
||||||
|
// Substitute fetch/select parameters
|
||||||
|
$targetcontent=preg_replace('/\$sql\.= " t\.field1,";/', $varpropselect, $targetcontent);
|
||||||
|
$targetcontent=preg_replace('/\$sql\.= " t\.field2";/', '', $targetcontent);
|
||||||
|
|
||||||
// Build file
|
// Build file
|
||||||
$fp=fopen($outfile,"w");
|
$fp=fopen($outfile,"w");
|
||||||
if ($fp)
|
if ($fp)
|
||||||
|
|||||||
@ -119,19 +119,22 @@ jQuery(document).ready(function() {
|
|||||||
|
|
||||||
|
|
||||||
// Example 2 : Adding links to objects
|
// Example 2 : Adding links to objects
|
||||||
$somethingshown=$myobject->showLinkedObjectBlock();
|
// The class must extends CommonObject class to have this method available
|
||||||
|
//$somethingshown=$myobject->showLinkedObjectBlock();
|
||||||
|
|
||||||
|
|
||||||
// Example 3 : List of data
|
// Example 3 : List of data
|
||||||
if ($action == 'list')
|
if ($action == 'list')
|
||||||
{
|
{
|
||||||
$sql = "SELECT";
|
$sql = "SELECT";
|
||||||
|
$sql.= " t.rowid,";
|
||||||
$sql.= " t.field1,";
|
$sql.= " t.field1,";
|
||||||
$sql.= " t.field2";
|
$sql.= " t.field2";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."skeleton as t";
|
$sql.= " FROM ".MAIN_DB_PREFIX."mytable as t";
|
||||||
$sql.= " WHERE field3 = 'xxx'";
|
$sql.= " WHERE field3 = 'xxx'";
|
||||||
$sql.= " ORDER BY field1 ASC";
|
$sql.= " ORDER BY field1 ASC";
|
||||||
|
|
||||||
|
print '<table class="noborder">'."\n";
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre($langs->trans('field1'),$_SERVER['PHP_SELF'],'t.field1','',$param,'',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans('field1'),$_SERVER['PHP_SELF'],'t.field1','',$param,'',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans('field2'),$_SERVER['PHP_SELF'],'t.field2','',$param,'',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans('field2'),$_SERVER['PHP_SELF'],'t.field2','',$param,'',$sortfield,$sortorder);
|
||||||
@ -165,6 +168,8 @@ if ($action == 'list')
|
|||||||
$error++;
|
$error++;
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print '</table>'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user