dolibarr/htdocs/compta/bank/various_payment/info.php

107 lines
3.8 KiB
PHP
Raw Normal View History

2017-03-19 08:17:32 +01:00
<?php
2019-01-28 21:39:22 +01:00
/* Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
2017-03-19 08:17:32 +01:00
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
2019-09-23 21:55:30 +02:00
* along with this program. If not, see <https://www.gnu.org/licenses/>.
2017-03-19 08:17:32 +01:00
*/
/**
2017-12-10 14:05:36 +01:00
* \file htdocs/compta/bank/various_payment/info.php
* \ingroup bank
* \brief Page with info about various payment
2017-03-19 08:17:32 +01:00
*/
require '../../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
2018-10-04 19:19:29 +02:00
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
2017-03-19 08:17:32 +01:00
2018-05-27 09:40:17 +02:00
// Load translation files required by the page
2017-12-10 14:05:36 +01:00
$langs->loadLangs(array("compta", "banks", "bills", "users", "accountancy"));
2017-03-19 08:17:32 +01:00
$id = GETPOST('id', 'int');
$action = GETPOST('action', 'aZ09');
2017-03-19 08:17:32 +01:00
// Security check
$socid = GETPOST("socid", "int");
2021-02-23 21:09:01 +01:00
if ($user->socid) {
$socid = $user->socid;
}
2017-12-10 14:05:36 +01:00
$result = restrictedArea($user, 'banque', '', '', '');
2017-03-19 08:17:32 +01:00
/*
* View
*/
llxHeader("", $langs->trans("VariousPayment"));
2017-03-19 08:17:32 +01:00
$object = new PaymentVarious($db);
$result = $object->fetch($id);
$object->info($id);
$head = various_payment_prepare_head($object);
2020-10-22 22:50:03 +02:00
print dol_get_fiche_head($head, 'info', $langs->trans("VariousPayment"), -1, $object->picto);
2017-03-19 08:17:32 +01:00
$morehtmlref = '<div class="refidno">';
2018-10-04 19:19:29 +02:00
// Project
2022-08-29 11:22:14 +02:00
if (isModEnabled('project')) {
2018-10-04 19:19:29 +02:00
$langs->load("projects");
$morehtmlref .= $langs->trans('Project').' : ';
2021-02-23 21:09:01 +01:00
if ($user->rights->banque->modifier && 0) {
2019-10-26 14:42:25 +02:00
if ($action != 'classify') {
2021-09-18 22:09:55 +02:00
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
2019-10-26 14:42:25 +02:00
}
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
$morehtmlref .= $formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref .= '</form>';
2019-10-26 14:42:25 +02:00
} else {
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
2019-10-26 14:42:25 +02:00
}
2018-10-04 19:19:29 +02:00
} else {
if (!empty($object->fk_project)) {
2018-10-04 19:19:29 +02:00
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= $proj->getNomUrl(1);
2018-10-04 19:19:29 +02:00
} else {
$morehtmlref .= '';
2018-10-04 19:19:29 +02:00
}
}
}
$morehtmlref .= '</div>';
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/various_payment/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
2018-10-04 19:19:29 +02:00
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<br>';
2017-03-19 08:17:32 +01:00
print '<table width="100%"><tr><td>';
dol_print_object_info($object);
print '</td></tr></table>';
print '</div>';
2018-07-29 19:16:28 +02:00
// End of page
2017-03-19 08:17:32 +01:00
llxFooter();
$db->close();