PageRenderTime 41ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/htdocs/propal/note.php

https://bitbucket.org/speedealing/speedealing
PHP | 161 lines | 92 code | 31 blank | 38 comment | 24 complexity | 6459ef943e61a9e764e1ca93f6efea27 MD5 | raw file
Possible License(s): LGPL-3.0, LGPL-2.1, GPL-3.0, MIT
  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.houssin@capnetworks.com>
  6. * Copyright (C) 2012 David Moothen <dmoothen@websitti.fr>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. */
  21. /**
  22. * \file htdocs/comm/propal/note.php
  23. * \ingroup propale
  24. * \brief Fiche d'information sur une proposition commerciale
  25. */
  26. require '../main.inc.php';
  27. require_once DOL_DOCUMENT_ROOT.'/propal/class/propal.class.php';
  28. require_once DOL_DOCUMENT_ROOT.'/propal/lib/propal.lib.php';
  29. $langs->load('propal');
  30. $langs->load('compta');
  31. $langs->load('bills');
  32. $id = GETPOST('id','alpha');
  33. $ref=GETPOST('ref','alpha');
  34. $action=GETPOST('action','alpha');
  35. // Security check
  36. if ($user->societe_id) $socid=$user->societe_id;
  37. $result = restrictedArea($user, 'propal', $id, 'propal');
  38. $object = new Propal($db);
  39. /******************************************************************************/
  40. /* Actions */
  41. /******************************************************************************/
  42. if ($action == 'setnote_public' && $user->rights->propal->creer)
  43. {
  44. $object->fetch($id);
  45. $result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
  46. if ($result < 0) dol_print_error($db,$object->error);
  47. }
  48. else if ($action == 'setnote' && $user->rights->propal->creer)
  49. {
  50. $object->fetch($id);
  51. $result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
  52. if ($result < 0) dol_print_error($db,$object->error);
  53. }
  54. /******************************************************************************/
  55. /* Affichage fiche */
  56. /******************************************************************************/
  57. llxHeader('',$langs->trans('Proposal'),'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos');
  58. $form = new Form($db);
  59. if (!(empty($id)) || ! empty($ref))
  60. {
  61. if ($mesg) print $mesg;
  62. $now=dol_now();
  63. if ($object->fetch($id, $ref))
  64. {
  65. $societe = new Societe($db);
  66. if ( $societe->fetch($object->socid) )
  67. {
  68. $head = propal_prepare_head($object);
  69. dol_fiche_head($head, 'note', $langs->trans('Proposal'), 0, 'propal');
  70. print '<table class="border" width="100%">';
  71. $linkback = '<a href="'.DOL_URL_ROOT.'/comm/propal/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans('BackToList').'</a>';
  72. // Ref
  73. print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">';
  74. // print $form->showrefnav($object,'ref',$linkback,1,'ref','ref','');
  75. print $object->ref;
  76. print '</td></tr>';
  77. // Ref client
  78. print '<tr><td>';
  79. print '<table class="nobordernopadding" width="100%"><tr><td nowrap>';
  80. print $langs->trans('RefCustomer').'</td><td align="left">';
  81. print '</td>';
  82. print '</tr></table>';
  83. print '</td><td colspan="3">';
  84. print $object->ref_client;
  85. print '</td>';
  86. print '</tr>';
  87. // Customer
  88. if ( is_null($object->client) )
  89. $object->fetch_thirdparty();
  90. print "<tr><td>".$langs->trans("Company")."</td>";
  91. print '<td colspan="3">'.$object->client->getNomUrl(1).'</td></tr>';
  92. // Ligne info remises tiers
  93. print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="3">';
  94. if ($societe->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$societe->remise_client);
  95. else print $langs->trans("CompanyHasNoRelativeDiscount");
  96. $absolute_discount=$societe->getAvailableDiscounts();
  97. print '. ';
  98. if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->trans("Currency".$conf->currency));
  99. else print $langs->trans("CompanyHasNoAbsoluteDiscount");
  100. print '.';
  101. print '</td></tr>';
  102. // Date
  103. print '<tr><td>'.$langs->trans('Date').'</td><td colspan="3">';
  104. print dol_print_date($object->date,'daytext');
  105. print '</td>';
  106. print '</tr>';
  107. // Date fin propal
  108. print '<tr>';
  109. print '<td>'.$langs->trans('DateEndPropal').'</td><td colspan="3">';
  110. if ($object->fin_validite)
  111. {
  112. print dol_print_date($object->fin_validite,'daytext');
  113. if ($object->statut == 1 && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
  114. }
  115. else
  116. {
  117. print $langs->trans("Unknown");
  118. }
  119. print '</td>';
  120. print '</tr>';
  121. print "</table>";
  122. print '<br>';
  123. include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
  124. dol_fiche_end();
  125. }
  126. }
  127. }
  128. llxFooter();
  129. $db->close();
  130. ?>