You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

list_phcp.php 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <?php
  2. $res=0;
  3. if (! $res && file_exists("../main.inc.php")) $res=@include '../main.inc.php';
  4. if (! $res && file_exists("../../main.inc.php")) $res=@include '../../main.inc.php';
  5. if (! $res && file_exists("../../../main.inc.php")) $res=@include '../../../main.inc.php';
  6. if (! $res && file_exists("../../../dolibarr/htdocs/main.inc.php")) $res=@include '../../../dolibarr/htdocs/main.inc.php'; // Used on dev env only
  7. if (! $res && file_exists("../../../../dolibarr/htdocs/main.inc.php")) $res=@include '../../../../dolibarr/htdocs/main.inc.php'; // Used on dev env only
  8. if (! $res && file_exists("../../../../../dolibarr/htdocs/main.inc.php")) $res=@include '../../../../../dolibarr/htdocs/main.inc.php'; // Used on dev env only
  9. if (! $res) die("Include of main fails");
  10. // Change this following line to use the correct relative path from htdocs
  11. dol_include_once('/module/class/phcp.class.php');
  12. // Load traductions files requiredby by page
  13. $langs->load("companies");
  14. $langs->load("other");
  15. // Get parameters
  16. $id = GETPOST('id','int');
  17. $action = GETPOST('action','alpha');
  18. $myparam = GETPOST('myparam','alpha');
  19. // Protection if external user
  20. if ($user->societe_id > 0)
  21. {
  22. //accessforbidden();
  23. }
  24. /*******************************************************************
  25. * ACTIONS
  26. *
  27. * Put here all code to do according to value of "action" parameter
  28. ********************************************************************/
  29. /***************************************************
  30. * VIEW
  31. *
  32. * Put here all code to build page
  33. ****************************************************/
  34. llxHeader('','Liste des Photocopieurs','');
  35. ?>
  36. <div class="fiche"> <!-- begin div class="fiche" -->
  37. <table width="100%" border="0" style="margin-bottom: 2px;" class="notopnoleftnoright" summary="">
  38. <tbody>
  39. <tr>
  40. <td width="40" valign="middle" align="left" class="nobordernopadding hideonsmartphone">
  41. <img border="0" id="pictotitle" title="" alt="" src="/dolibarr/theme/auguria/img/title.png">
  42. </td>
  43. <td valign="middle" class="nobordernopadding">
  44. <div class="titre">Liste des photocopieurs</div>
  45. </td>
  46. </tr>
  47. </tbody>
  48. </table>
  49. <div class="fichecenter">
  50. <div class="fichethirdleft">
  51. <?php
  52. $form=new Form($db);
  53. $sql = "SELECT";
  54. $sql.= " p.rowid,";
  55. $sql.= " p.phcp_number,";
  56. $sql.= " p.entity,";
  57. $sql.= " p.nom,";
  58. $sql.= " p.ref_ext,";
  59. $sql.= " p.ref_int,";
  60. $sql.= " pt.nom as phcp_type";
  61. $sql.= " FROM ".MAIN_DB_PREFIX."phcp as p, ";
  62. $sql.= MAIN_DB_PREFIX."phcp_type as pt";
  63. $sql.= " WHERE pt.rowid = p.fk_phcp_type";
  64. print '<table class="noborder" width="100%">'."\n";
  65. print '<tr class="liste_titre">';
  66. print_liste_field_titre($langs->trans('rowid'),$_SERVER['PHP_SELF'],'p.rowid','',$param,'',$sortfield,$sortorder);
  67. print_liste_field_titre($langs->trans('nom'),$_SERVER['PHP_SELF'],'p.nom','',$param,'',$sortfield,$sortorder);
  68. print_liste_field_titre($langs->trans('phcp_type'),$_SERVER['PHP_SELF'],'pt.nom','',$param,'',$sortfield,$sortorder);
  69. print '</tr>';
  70. dol_syslog($script_file." sql=".$sql, LOG_DEBUG);
  71. $resql=$db->query($sql);
  72. if ($resql)
  73. {
  74. $num = $db->num_rows($resql);
  75. $i = 0;
  76. $url = DOL_URL_ROOT."/photocopies/phcp.php?id=";
  77. if ($num)
  78. {
  79. while ($i < $num)
  80. {
  81. $obj = $db->fetch_object($resql);
  82. if ($obj)
  83. {
  84. // You can use here results
  85. print '<tr><td>';
  86. print $obj->rowid;
  87. print '</td><td><a href="'.$url.$obj->rowid.'">';
  88. print $obj->nom;
  89. print '</a></td><td>';
  90. print $obj->phcp_type;
  91. print '</td></tr>';
  92. }
  93. $i++;
  94. }
  95. }
  96. }
  97. else
  98. {
  99. $error++;
  100. dol_print_error($db);
  101. }
  102. print '</table>'."\n";
  103. // End of page
  104. llxFooter();
  105. $db->close();
  106. ?>
  107. </div>
  108. </div>
  109. </div>