orders.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <?php
  2. /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
  5. * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  19. */
  20. /**
  21. * \file lmiprestasync/product.php
  22. * \ingroup lmiprestasync
  23. * \brief Home page of lmiprestasync top menu
  24. */
  25. // Load Dolibarr environment
  26. require_once 'main_load.inc.php';
  27. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
  28. // Load translation files required by the page
  29. $langs->loadLangs(array("lmiprestasync@lmiprestasync"));
  30. $action = GETPOST('action', 'alpha');
  31. // Security check
  32. //if (! $user->rights->lmiprestasync->myobject->read) accessforbidden();
  33. $socid = GETPOST('socid', 'int');
  34. if (isset($user->socid) && $user->socid > 0)
  35. {
  36. $action = '';
  37. $socid = $user->socid;
  38. }
  39. $max = 5;
  40. $now = dol_now();
  41. /*
  42. * Actions
  43. */
  44. // None
  45. /*
  46. * View
  47. */
  48. $form = new Form($db);
  49. $formfile = new FormFile($db);
  50. llxHeader("", $langs->trans("LMIPrestaSyncArea"));
  51. print load_fiche_titre($langs->trans("LMIPrestaSyncArea"), '', 'lmiprestasync.png@lmiprestasync');
  52. print '<div class="fichecenter"><div class="fichethirdleft">';
  53. echo "<h3>Synchronisation des Commandes</h3>";
  54. print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
  55. $NBMAX = 3;
  56. $max = 3;
  57. /* BEGIN MODULEBUILDER LASTMODIFIED MYOBJECT
  58. // Last modified myobject
  59. if (! empty($conf->lmiprestasync->enabled) && $user->rights->lmiprestasync->read)
  60. {
  61. $sql = "SELECT s.rowid, s.nom as name, s.client, s.datec, s.tms, s.canvas";
  62. $sql.= ", s.code_client";
  63. $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
  64. if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
  65. $sql.= " WHERE s.client IN (1, 2, 3)";
  66. $sql.= " AND s.entity IN (".getEntity($companystatic->element).")";
  67. if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
  68. if ($socid) $sql.= " AND s.rowid = $socid";
  69. $sql .= " ORDER BY s.tms DESC";
  70. $sql .= $db->plimit($max, 0);
  71. $resql = $db->query($sql);
  72. if ($resql)
  73. {
  74. $num = $db->num_rows($resql);
  75. $i = 0;
  76. print '<table class="noborder centpercent">';
  77. print '<tr class="liste_titre">';
  78. print '<th colspan="2">';
  79. if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print $langs->trans("BoxTitleLastCustomersOrProspects",$max);
  80. else if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print $langs->trans("BoxTitleLastModifiedProspects",$max);
  81. else print $langs->trans("BoxTitleLastModifiedCustomers",$max);
  82. print '</th>';
  83. print '<th class="right">'.$langs->trans("DateModificationShort").'</th>';
  84. print '</tr>';
  85. if ($num)
  86. {
  87. while ($i < $num)
  88. {
  89. $objp = $db->fetch_object($resql);
  90. $companystatic->id=$objp->rowid;
  91. $companystatic->name=$objp->name;
  92. $companystatic->client=$objp->client;
  93. $companystatic->code_client = $objp->code_client;
  94. $companystatic->code_fournisseur = $objp->code_fournisseur;
  95. $companystatic->canvas=$objp->canvas;
  96. print '<tr class="oddeven">';
  97. print '<td class="nowrap">'.$companystatic->getNomUrl(1,'customer',48).'</td>';
  98. print '<td class="right nowrap">';
  99. print $companystatic->getLibCustProspStatut();
  100. print "</td>";
  101. print '<td class="right nowrap">'.dol_print_date($db->jdate($objp->tms),'day')."</td>";
  102. print '</tr>';
  103. $i++;
  104. }
  105. $db->free($resql);
  106. }
  107. else
  108. {
  109. print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
  110. }
  111. print "</table><br>";
  112. }
  113. }
  114. */
  115. print '</div></div></div>';
  116. // End of page
  117. llxFooter();
  118. $db->close();