alxarafe /
alixar
| 1 | <?php |
||
| 2 | |||
| 3 | /* Copyright (C) 2004 Rodolphe Quiedeville <[email protected]> |
||
| 4 | * Copyright (C) 2004-2016 Laurent Destailleur <[email protected]> |
||
| 5 | * Copyright (C) 2005-2012 Regis Houssin <[email protected]> |
||
| 6 | * Copyright (C) 2017 Ferran Marcet <[email protected]> |
||
| 7 | * Copyright (C) 2024 Rafael San José <[email protected]> |
||
| 8 | * |
||
| 9 | * This program is free software; you can redistribute it and/or modify |
||
| 10 | * it under the terms of the GNU General Public License as published by |
||
| 11 | * the Free Software Foundation; either version 3 of the License, or |
||
| 12 | * (at your option) any later version. |
||
| 13 | * |
||
| 14 | * This program is distributed in the hope that it will be useful, |
||
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
| 17 | * GNU General Public License for more details. |
||
| 18 | * |
||
| 19 | * You should have received a copy of the GNU General Public License |
||
| 20 | * along with this program. If not, see <https://www.gnu.org/licenses/>. |
||
| 21 | */ |
||
| 22 | |||
| 23 | use Dolibarr\Code\Contrat\Classes\Contrat; |
||
| 24 | use Dolibarr\Code\Core\Classes\Form; |
||
| 25 | use Dolibarr\Code\Projet\Classes\Project; |
||
| 26 | use Dolibarr\Lib\ViewMain; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * \file htdocs/contrat/note.php |
||
| 30 | * \ingroup contrat |
||
| 31 | * \brief Fiche de notes sur un contrat |
||
| 32 | */ |
||
| 33 | |||
| 34 | // Load Dolibarr environment |
||
| 35 | require constant('DOL_DOCUMENT_ROOT') . '/main.inc.php'; |
||
| 36 | require_once constant('DOL_DOCUMENT_ROOT') . '/core/lib/contract.lib.php'; |
||
| 37 | |||
| 38 | // Load translation files required by the page |
||
| 39 | $langs->loadLangs(array('companies', 'contracts')); |
||
| 40 | |||
| 41 | $action = GETPOST('action', 'aZ09'); |
||
| 42 | $confirm = GETPOST('confirm', 'alpha'); |
||
| 43 | $socid = GETPOSTINT('socid'); |
||
| 44 | $id = GETPOSTINT('id'); |
||
| 45 | $ref = GETPOST('ref', 'alpha'); |
||
| 46 | |||
| 47 | // Security check |
||
| 48 | if ($user->socid) { |
||
| 49 | $socid = $user->socid; |
||
| 50 | } |
||
| 51 | // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context |
||
| 52 | //$hookmanager->initHooks(array('contractcard', 'globalcard')); -> Conflict with contrat\card.php |
||
| 53 | $hookmanager->initHooks(array('contractnote')); |
||
| 54 | |||
| 55 | $object = new Contrat($db); |
||
| 56 | $object->fetch($id, $ref); |
||
| 57 | |||
| 58 | $permissiontoadd = $user->hasRight('contrat', 'creer'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php |
||
| 59 | $permissionnote = $user->hasRight('contrat', 'creer'); // Used by the include of actions_setnotes.inc.php |
||
| 60 | |||
| 61 | $result = restrictedArea($user, 'contrat', $object->id); |
||
| 62 | |||
| 63 | |||
| 64 | /* |
||
| 65 | * Actions |
||
| 66 | */ |
||
| 67 | |||
| 68 | $reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks |
||
| 69 | if ($reshook < 0) { |
||
| 70 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
||
| 71 | } |
||
| 72 | if (empty($reshook)) { |
||
| 73 | include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not include_once |
||
| 74 | } |
||
| 75 | |||
| 76 | |||
| 77 | /* |
||
| 78 | * View |
||
| 79 | */ |
||
| 80 | |||
| 81 | $title = $langs->trans("Contract"); |
||
| 82 | $help_url = 'EN:Module_Contracts|FR:Module_Contrat'; |
||
| 83 | |||
| 84 | ViewMain::llxHeader('', $title, $help_url); |
||
| 85 | |||
| 86 | $form = new Form($db); |
||
| 87 | |||
| 88 | if ($id > 0 || !empty($ref)) { |
||
| 89 | $object->fetch_thirdparty(); |
||
| 90 | |||
| 91 | $head = contract_prepare_head($object); |
||
| 92 | |||
| 93 | $hselected = 2; |
||
| 94 | |||
| 95 | print dol_get_fiche_head($head, 'note', $langs->trans("Contract"), -1, 'contract'); |
||
| 96 | |||
| 97 | // Contract card |
||
| 98 | |||
| 99 | $linkback = '<a href="' . constant('BASE_URL') . 'contrat/list.php?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; |
||
| 100 | |||
| 101 | |||
| 102 | $morehtmlref = ''; |
||
| 103 | //if (!empty($modCodeContract->code_auto)) { |
||
| 104 | $morehtmlref .= $object->ref; |
||
| 105 | /*} else { |
||
| 106 | $morehtmlref.=$form->editfieldkey("",'ref',$object->ref,0,'string','',0,3); |
||
| 107 | $morehtmlref.=$form->editfieldval("",'ref',$object->ref,0,'string','',0,2); |
||
| 108 | }*/ |
||
| 109 | |||
| 110 | $morehtmlref .= '<div class="refidno">'; |
||
| 111 | // Ref customer |
||
| 112 | $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', 0, 1); |
||
| 113 | $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', null, null, '', 1, 'getFormatedCustomerRef'); |
||
| 114 | // Ref supplier |
||
| 115 | $morehtmlref .= '<br>'; |
||
| 116 | $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); |
||
| 117 | $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1, 'getFormatedSupplierRef'); |
||
| 118 | // Thirdparty |
||
| 119 | $morehtmlref .= '<br>' . $object->thirdparty->getNomUrl(1); |
||
|
0 ignored issues
–
show
|
|||
| 120 | // Project |
||
| 121 | if (isModEnabled('project')) { |
||
| 122 | $langs->load("projects"); |
||
| 123 | $morehtmlref .= '<br>'; |
||
| 124 | if (0) { |
||
| 125 | $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); |
||
| 126 | if ($action != 'classify') { |
||
| 127 | $morehtmlref .= '<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token=' . newToken() . '&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> '; |
||
| 128 | } |
||
| 129 | $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); |
||
| 130 | } else { |
||
| 131 | if (!empty($object->fk_project)) { |
||
| 132 | $proj = new Project($db); |
||
| 133 | $proj->fetch($object->fk_project); |
||
| 134 | $morehtmlref .= $proj->getNomUrl(1); |
||
| 135 | if ($proj->title) { |
||
| 136 | $morehtmlref .= '<span class="opacitymedium"> - ' . dol_escape_htmltag($proj->title) . '</span>'; |
||
| 137 | } |
||
| 138 | } |
||
| 139 | } |
||
| 140 | } |
||
| 141 | $morehtmlref .= '</div>'; |
||
| 142 | |||
| 143 | |||
| 144 | dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'none', $morehtmlref); |
||
| 145 | |||
| 146 | |||
| 147 | print '<div class="fichecenter">'; |
||
| 148 | print '<div class="underbanner clearboth"></div>'; |
||
| 149 | |||
| 150 | print '<table class="border centpercent tableforfield">'; |
||
| 151 | |||
| 152 | |||
| 153 | // Ligne info remises tiers |
||
| 154 | print '<tr><td class="titlefield">' . $langs->trans('Discount') . '</td><td colspan="3">'; |
||
| 155 | if ($object->thirdparty->remise_percent) { |
||
| 156 | print $langs->trans("CompanyHasRelativeDiscount", $object->thirdparty->remise_percent); |
||
| 157 | } else { |
||
| 158 | print $langs->trans("CompanyHasNoRelativeDiscount"); |
||
| 159 | } |
||
| 160 | $absolute_discount = $object->thirdparty->getAvailableDiscounts(); |
||
| 161 | print '. '; |
||
| 162 | if ($absolute_discount) { |
||
| 163 | print $langs->trans("CompanyHasAbsoluteDiscount", price($absolute_discount), $langs->trans("Currency" . $conf->currency)); |
||
| 164 | } else { |
||
| 165 | print $langs->trans("CompanyHasNoAbsoluteDiscount"); |
||
| 166 | } |
||
| 167 | print '.'; |
||
| 168 | print '</td></tr>'; |
||
| 169 | |||
| 170 | // Date |
||
| 171 | print '<tr>'; |
||
| 172 | print '<td class="titlefield">'; |
||
| 173 | print $form->editfieldkey("Date", 'date_contrat', $object->date_contrat, $object, 0); |
||
| 174 | print '</td><td>'; |
||
| 175 | print $form->editfieldval("Date", 'date_contrat', $object->date_contrat, $object, 0, 'datehourpicker'); |
||
| 176 | print '</td>'; |
||
| 177 | print '</tr>'; |
||
| 178 | |||
| 179 | print "</table>"; |
||
| 180 | |||
| 181 | print '</div>'; |
||
| 182 | |||
| 183 | //print '<br>'; |
||
| 184 | |||
| 185 | $cssclass = 'titlefield'; |
||
| 186 | include DOL_DOCUMENT_ROOT . '/core/tpl/notes.tpl.php'; |
||
| 187 | |||
| 188 | print dol_get_fiche_end(); |
||
| 189 | } |
||
| 190 | |||
| 191 | |||
| 192 | ViewMain::llxFooter(); |
||
| 193 | $db->close(); |
||
| 194 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.