PageRenderTime 86ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/htdocs/comm/propal/note.php

https://github.com/zeert/dolibarr
PHP | 159 lines | 92 code | 31 blank | 36 comment | 24 complexity | ff3236c95b6071aefb91203f499e07d2 MD5 | raw file
Possible License(s): LGPL-2.0
  1. <?php
  2. /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
  5. * Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.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 2 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 <http://www.gnu.org/licenses/>.
  19. */
  20. /**
  21. * \file htdocs/comm/propal/note.php
  22. * \ingroup propale
  23. * \brief Fiche d'information sur une proposition commerciale
  24. */
  25. require("../../main.inc.php");
  26. require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php");
  27. require_once(DOL_DOCUMENT_ROOT."/core/lib/propal.lib.php");
  28. $langs->load('propal');
  29. $langs->load('compta');
  30. $langs->load('bills');
  31. $id = GETPOST('id','int');
  32. $ref=GETPOST('ref','alpha');
  33. $action=GETPOST('action','alpha');
  34. // Security check
  35. if ($user->societe_id) $socid=$user->societe_id;
  36. $result = restrictedArea($user, 'propale', $id, 'propal');
  37. $object = new Propal($db);
  38. /******************************************************************************/
  39. /* Actions */
  40. /******************************************************************************/
  41. if ($action == 'setnote_public' && $user->rights->propale->creer)
  42. {
  43. $object->fetch($id);
  44. $result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
  45. if ($result < 0) dol_print_error($db,$object->error);
  46. }
  47. else if ($action == 'setnote' && $user->rights->propale->creer)
  48. {
  49. $object->fetch($id);
  50. $result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
  51. if ($result < 0) dol_print_error($db,$object->error);
  52. }
  53. /******************************************************************************/
  54. /* Affichage fiche */
  55. /******************************************************************************/
  56. llxHeader('',$langs->trans('Proposal'),'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos');
  57. $form = new Form($db);
  58. if ($id > 0 || ! empty($ref))
  59. {
  60. if ($mesg) print $mesg;
  61. $now=dol_now();
  62. if ($object->fetch($id, $ref))
  63. {
  64. $societe = new Societe($db);
  65. if ( $societe->fetch($object->socid) )
  66. {
  67. $head = propal_prepare_head($object);
  68. dol_fiche_head($head, 'note', $langs->trans('Proposal'), 0, 'propal');
  69. print '<table class="border" width="100%">';
  70. $linkback = '<a href="'.DOL_URL_ROOT.'/comm/propal/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans('BackToList').'</a>';
  71. // Ref
  72. print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">';
  73. print $form->showrefnav($object,'ref',$linkback,1,'ref','ref','');
  74. print '</td></tr>';
  75. // Ref client
  76. print '<tr><td>';
  77. print '<table class="nobordernopadding" width="100%"><tr><td nowrap>';
  78. print $langs->trans('RefCustomer').'</td><td align="left">';
  79. print '</td>';
  80. print '</tr></table>';
  81. print '</td><td colspan="3">';
  82. print $object->ref_client;
  83. print '</td>';
  84. print '</tr>';
  85. // Customer
  86. if ( is_null($object->client) )
  87. $object->fetch_thirdparty();
  88. print "<tr><td>".$langs->trans("Company")."</td>";
  89. print '<td colspan="3">'.$object->client->getNomUrl(1).'</td></tr>';
  90. // Ligne info remises tiers
  91. print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="3">';
  92. if ($societe->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$societe->remise_client);
  93. else print $langs->trans("CompanyHasNoRelativeDiscount");
  94. $absolute_discount=$societe->getAvailableDiscounts();
  95. print '. ';
  96. if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->trans("Currency".$conf->currency));
  97. else print $langs->trans("CompanyHasNoAbsoluteDiscount");
  98. print '.';
  99. print '</td></tr>';
  100. // Date
  101. print '<tr><td>'.$langs->trans('Date').'</td><td colspan="3">';
  102. print dol_print_date($object->date,'daytext');
  103. print '</td>';
  104. print '</tr>';
  105. // Date fin propal
  106. print '<tr>';
  107. print '<td>'.$langs->trans('DateEndPropal').'</td><td colspan="3">';
  108. if ($object->fin_validite)
  109. {
  110. print dol_print_date($object->fin_validite,'daytext');
  111. if ($object->statut == 1 && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
  112. }
  113. else
  114. {
  115. print $langs->trans("Unknown");
  116. }
  117. print '</td>';
  118. print '</tr>';
  119. print "</table>";
  120. print '<br>';
  121. include(DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php');
  122. dol_fiche_end();
  123. }
  124. }
  125. }
  126. llxFooter();
  127. $db->close();
  128. ?>