supplier.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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/supplier.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. require_once './lib/tiers.lib.php';
  29. // Load translation files required by the page
  30. $langs->loadLangs(array("lmiprestasync@lmiprestasync"));
  31. $action = GETPOST('action', 'alpha');
  32. // Security check
  33. //if (! $user->rights->lmiprestasync->myobject->read) accessforbidden();
  34. $socid = GETPOST('socid', 'int');
  35. if (isset($user->socid) && $user->socid > 0)
  36. {
  37. $action = '';
  38. $socid = $user->socid;
  39. }
  40. $max = 5;
  41. $now = dol_now();
  42. /*
  43. * Actions
  44. */
  45. // None
  46. /*
  47. * View
  48. */
  49. $form = new Form($db);
  50. $formfile = new FormFile($db);
  51. llxHeader("", $langs->trans("LMIPrestaSyncArea"));
  52. print load_fiche_titre($langs->trans("LMIPrestaSyncArea"), '', 'lmiprestasync.png@lmiprestasync');
  53. print '<div class="fichecenter"><div class="fichethirdleft">';
  54. echo "<h3>Synchronisation des Fournisseurs</h3>";
  55. print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
  56. $NBMAX = 3;
  57. $max = 3;
  58. /* BEGIN MODULEBUILDER LASTMODIFIED MYOBJECT
  59. // Last modified myobject
  60. if (! empty($conf->lmiprestasync->enabled) && $user->rights->lmiprestasync->read)
  61. {
  62. $sql = "SELECT s.rowid, s.nom as name, s.client, s.datec, s.tms, s.canvas";
  63. $sql.= ", s.code_client";
  64. $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
  65. if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
  66. $sql.= " WHERE s.client IN (1, 2, 3)";
  67. $sql.= " AND s.entity IN (".getEntity($companystatic->element).")";
  68. if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
  69. if ($socid) $sql.= " AND s.rowid = $socid";
  70. $sql .= " ORDER BY s.tms DESC";
  71. $sql .= $db->plimit($max, 0);
  72. $resql = $db->query($sql);
  73. if ($resql)
  74. {
  75. $num = $db->num_rows($resql);
  76. $i = 0;
  77. print '<table class="noborder centpercent">';
  78. print '<tr class="liste_titre">';
  79. print '<th colspan="2">';
  80. if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print $langs->trans("BoxTitleLastCustomersOrProspects",$max);
  81. else if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print $langs->trans("BoxTitleLastModifiedProspects",$max);
  82. else print $langs->trans("BoxTitleLastModifiedCustomers",$max);
  83. print '</th>';
  84. print '<th class="right">'.$langs->trans("DateModificationShort").'</th>';
  85. print '</tr>';
  86. if ($num)
  87. {
  88. while ($i < $num)
  89. {
  90. $objp = $db->fetch_object($resql);
  91. $companystatic->id=$objp->rowid;
  92. $companystatic->name=$objp->name;
  93. $companystatic->client=$objp->client;
  94. $companystatic->code_client = $objp->code_client;
  95. $companystatic->code_fournisseur = $objp->code_fournisseur;
  96. $companystatic->canvas=$objp->canvas;
  97. print '<tr class="oddeven">';
  98. print '<td class="nowrap">'.$companystatic->getNomUrl(1,'customer',48).'</td>';
  99. print '<td class="right nowrap">';
  100. print $companystatic->getLibCustProspStatut();
  101. print "</td>";
  102. print '<td class="right nowrap">'.dol_print_date($db->jdate($objp->tms),'day')."</td>";
  103. print '</tr>';
  104. $i++;
  105. }
  106. $db->free($resql);
  107. }
  108. else
  109. {
  110. print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
  111. }
  112. print "</table><br>";
  113. }
  114. }
  115. */
  116. print '</div></div></div>';
  117. // End of page
  118. llxFooter();
  119. $db->close();