2004-10-19 22:43:23 +02:00
|
|
|
<?php
|
2005-04-08 17:37:29 +02:00
|
|
|
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
2008-01-08 09:39:25 +01:00
|
|
|
* Copyright (C) 2003 Eric Seigne <erics@rycks.com>
|
2016-10-16 21:29:12 +02:00
|
|
|
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
2018-10-27 14:43:12 +02:00
|
|
|
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@inodbox.com>
|
2015-04-18 11:32:01 +02:00
|
|
|
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
|
2015-08-26 19:30:40 +02:00
|
|
|
* Copyright (C) 2014 Jean Heimburger <jean@tiaris.info>
|
2015-02-27 15:08:08 +01:00
|
|
|
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
2015-08-26 19:30:40 +02:00
|
|
|
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
2002-05-06 21:10:48 +02: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
|
2013-01-16 15:36:08 +01:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2002-05-06 21:10:48 +02:00
|
|
|
* (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/>.
|
2002-05-06 21:10:48 +02:00
|
|
|
*/
|
2004-12-11 01:54:01 +01:00
|
|
|
|
2005-04-28 22:33:30 +02:00
|
|
|
/**
|
2014-09-18 21:18:25 +02:00
|
|
|
* \file htdocs/fourn/card.php
|
2009-02-18 15:29:56 +01:00
|
|
|
* \ingroup fournisseur, facture
|
2010-10-30 12:52:53 +02:00
|
|
|
* \brief Page for supplier third party card (view, edit)
|
2009-02-18 13:26:55 +01:00
|
|
|
*/
|
2004-12-11 01:54:01 +01:00
|
|
|
|
2012-08-22 23:24:21 +02:00
|
|
|
require '../main.inc.php';
|
2012-08-22 23:11:24 +02:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
2016-06-06 21:26:31 +02:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
|
2012-08-22 23:11:24 +02:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
2015-03-13 20:27:54 +01:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
2019-11-13 19:35:39 +01:00
|
|
|
if (!empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
2020-01-15 23:01:36 +01:00
|
|
|
if (!empty($conf->categorie->enabled)) require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
2002-05-06 21:10:48 +02:00
|
|
|
|
2018-05-26 16:03:19 +02:00
|
|
|
// Load translation files required by page
|
|
|
|
|
$langs->loadLangs(array(
|
|
|
|
|
'companies',
|
|
|
|
|
'suppliers',
|
|
|
|
|
'products',
|
|
|
|
|
'bills',
|
|
|
|
|
'orders',
|
|
|
|
|
'commercial',
|
|
|
|
|
));
|
2004-08-06 02:46:07 +02:00
|
|
|
|
2020-04-10 10:59:32 +02:00
|
|
|
$action = GETPOST('action', 'aZ09');
|
2019-01-27 11:55:16 +01:00
|
|
|
$cancelbutton = GETPOST('cancel', 'alpha');
|
2011-11-08 23:10:31 +01:00
|
|
|
|
2008-02-25 17:30:43 +01:00
|
|
|
// Security check
|
2019-01-27 11:55:16 +01:00
|
|
|
$id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int'));
|
2020-04-10 10:59:32 +02:00
|
|
|
if ($user->socid) $id = $user->socid;
|
2018-03-22 23:25:54 +01:00
|
|
|
$result = restrictedArea($user, 'societe&fournisseur', $id, '&societe', '', 'rowid');
|
2006-04-06 21:21:19 +02:00
|
|
|
|
2011-11-08 23:10:31 +01:00
|
|
|
$object = new Fournisseur($db);
|
2015-03-13 20:27:54 +01:00
|
|
|
$extrafields = new ExtraFields($db);
|
2006-04-06 21:21:19 +02:00
|
|
|
|
2015-03-14 13:05:28 +01:00
|
|
|
// fetch optionals attributes and labels
|
2019-10-06 14:41:52 +02:00
|
|
|
$extrafields->fetch_name_optionals_label($object->table_element);
|
2006-04-06 21:21:19 +02:00
|
|
|
|
2017-06-10 12:56:28 +02:00
|
|
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
2019-11-13 19:35:39 +01:00
|
|
|
$hookmanager->initHooks(array('suppliercard', 'globalcard'));
|
2014-09-23 11:59:57 +02:00
|
|
|
|
2015-03-14 13:05:28 +01:00
|
|
|
|
2010-09-19 14:50:53 +02:00
|
|
|
/*
|
|
|
|
|
* Action
|
|
|
|
|
*/
|
|
|
|
|
|
2019-11-13 19:35:39 +01:00
|
|
|
$parameters = array('id'=>$id);
|
|
|
|
|
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
2014-09-28 03:41:32 +02:00
|
|
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
2014-07-23 06:20:17 +02:00
|
|
|
|
2015-01-18 17:13:42 +01:00
|
|
|
if (empty($reshook))
|
2010-09-19 14:50:53 +02:00
|
|
|
{
|
2015-01-18 18:44:22 +01:00
|
|
|
if ($cancelbutton)
|
|
|
|
|
{
|
|
|
|
|
$action = "";
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-17 19:28:27 +01:00
|
|
|
if ($action == 'setsupplieraccountancycode')
|
2014-12-26 04:44:15 +01:00
|
|
|
{
|
2020-04-10 10:59:32 +02:00
|
|
|
$result = $object->fetch($id);
|
|
|
|
|
$object->code_compta_fournisseur = $_POST["supplieraccountancycode"];
|
|
|
|
|
$result = $object->update($object->id, $user, 1, 0, 1);
|
2019-10-11 18:08:15 +02:00
|
|
|
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
2014-12-23 11:00:18 +01:00
|
|
|
}
|
2019-03-22 09:38:04 +01:00
|
|
|
// terms of the settlement
|
2015-01-17 19:28:27 +01:00
|
|
|
if ($action == 'setconditions' && $user->rights->societe->creer)
|
|
|
|
|
{
|
|
|
|
|
$object->fetch($id);
|
2020-04-10 10:59:32 +02:00
|
|
|
$result = $object->setPaymentTerms(GETPOST('cond_reglement_supplier_id', 'int'));
|
2019-01-27 11:55:16 +01:00
|
|
|
if ($result < 0) dol_print_error($db, $object->error);
|
2015-01-17 19:28:27 +01:00
|
|
|
}
|
|
|
|
|
// mode de reglement
|
|
|
|
|
if ($action == 'setmode' && $user->rights->societe->creer)
|
|
|
|
|
{
|
|
|
|
|
$object->fetch($id);
|
2020-04-10 10:59:32 +02:00
|
|
|
$result = $object->setPaymentMethods(GETPOST('mode_reglement_supplier_id', 'int'));
|
2019-01-27 11:55:16 +01:00
|
|
|
if ($result < 0) dol_print_error($db, $object->error);
|
2014-12-23 11:00:18 +01:00
|
|
|
}
|
2018-02-20 18:09:38 +01:00
|
|
|
|
2018-01-20 16:40:56 +01:00
|
|
|
// update supplier order min amount
|
|
|
|
|
if ($action == 'setsupplier_order_min_amount')
|
|
|
|
|
{
|
|
|
|
|
$object->fetch($id);
|
2019-11-13 19:35:39 +01:00
|
|
|
$object->supplier_order_min_amount = price2num(GETPOST('supplier_order_min_amount', 'alpha'));
|
|
|
|
|
$result = $object->update($object->id, $user);
|
2018-01-20 16:40:56 +01:00
|
|
|
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
|
|
|
|
}
|
2018-02-08 14:20:53 +01:00
|
|
|
|
2018-02-01 09:31:04 +01:00
|
|
|
if ($action == 'update_extras') {
|
|
|
|
|
$object->fetch($id);
|
|
|
|
|
|
2018-02-23 16:11:00 +01:00
|
|
|
$object->oldcopy = dol_clone($object);
|
|
|
|
|
|
2018-02-01 09:31:04 +01:00
|
|
|
// Fill array 'array_options' with data from update form
|
2019-10-06 14:41:52 +02:00
|
|
|
$ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'none'));
|
2018-02-14 17:25:13 +01:00
|
|
|
|
2018-02-01 09:31:04 +01:00
|
|
|
if ($ret < 0) $error++;
|
2018-04-10 12:03:01 +02:00
|
|
|
|
2019-11-13 19:35:39 +01:00
|
|
|
if (!$error)
|
2018-02-01 09:31:04 +01:00
|
|
|
{
|
2018-02-20 18:09:38 +01:00
|
|
|
$result = $object->insertExtraFields('COMPANY_MODIFY');
|
2018-02-01 09:31:04 +01:00
|
|
|
if ($result < 0) $error++;
|
|
|
|
|
}
|
2018-04-10 12:03:01 +02:00
|
|
|
|
2018-02-01 09:31:04 +01:00
|
|
|
if ($error) $action = 'edit_extras';
|
|
|
|
|
}
|
2013-07-30 15:06:57 +02:00
|
|
|
}
|
2010-09-19 14:50:53 +02:00
|
|
|
|
2005-06-11 13:34:38 +02:00
|
|
|
|
2002-05-06 21:10:48 +02:00
|
|
|
/*
|
2008-03-07 03:08:43 +01:00
|
|
|
* View
|
2009-02-18 13:26:55 +01:00
|
|
|
*/
|
2009-02-18 15:29:56 +01:00
|
|
|
|
2007-12-05 14:37:39 +01:00
|
|
|
$contactstatic = new Contact($db);
|
2008-03-07 03:08:43 +01:00
|
|
|
$form = new Form($db);
|
2002-05-06 21:10:48 +02:00
|
|
|
|
2015-01-17 14:34:16 +01:00
|
|
|
if ($id > 0 && empty($object->id))
|
2004-02-12 19:14:58 +01:00
|
|
|
{
|
2015-01-17 14:34:16 +01:00
|
|
|
// Load data of third party
|
2019-11-13 19:35:39 +01:00
|
|
|
$res = $object->fetch($id);
|
2019-01-27 11:55:16 +01:00
|
|
|
if ($object->id <= 0) dol_print_error($db, $object->error);
|
2015-01-17 14:34:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($object->id > 0)
|
|
|
|
|
{
|
2019-11-13 19:35:39 +01:00
|
|
|
$title = $langs->trans("ThirdParty")." - ".$langs->trans('Supplier');
|
|
|
|
|
if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title = $object->name." - ".$langs->trans('Supplier');
|
|
|
|
|
$help_url = '';
|
2019-01-27 11:55:16 +01:00
|
|
|
llxHeader('', $title, $help_url);
|
2009-02-18 13:26:55 +01:00
|
|
|
|
|
|
|
|
/*
|
2015-01-17 14:34:16 +01:00
|
|
|
* Show tabs
|
2009-02-18 13:26:55 +01:00
|
|
|
*/
|
2011-11-08 23:10:31 +01:00
|
|
|
$head = societe_prepare_head($object);
|
2009-02-18 13:26:55 +01:00
|
|
|
|
2017-05-23 01:32:19 +02:00
|
|
|
dol_fiche_head($head, 'supplier', $langs->trans("ThirdParty"), -1, 'company');
|
2009-02-18 13:26:55 +01:00
|
|
|
|
2017-11-24 10:00:46 +01:00
|
|
|
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
2017-06-07 16:44:04 +02:00
|
|
|
|
2020-04-10 10:59:32 +02:00
|
|
|
dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom');
|
2017-06-07 16:44:04 +02:00
|
|
|
|
2013-04-21 17:56:29 +02:00
|
|
|
print '<div class="fichecenter"><div class="fichehalfleft">';
|
2009-02-18 13:26:55 +01:00
|
|
|
|
2015-10-13 13:06:32 +02:00
|
|
|
print '<div class="underbanner clearboth"></div>';
|
2009-02-18 13:26:55 +01:00
|
|
|
print '<table width="100%" class="border">';
|
|
|
|
|
|
2020-04-10 10:59:32 +02:00
|
|
|
if (!empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
2011-01-29 17:25:01 +01:00
|
|
|
{
|
2011-11-08 23:10:31 +01:00
|
|
|
print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
|
2011-01-29 17:25:01 +01:00
|
|
|
}
|
2009-02-18 13:26:55 +01:00
|
|
|
|
2011-11-08 23:10:31 +01:00
|
|
|
if ($object->fournisseur)
|
2009-02-18 13:26:55 +01:00
|
|
|
{
|
2013-05-24 18:20:28 +02:00
|
|
|
print '<tr>';
|
2019-11-13 19:35:39 +01:00
|
|
|
print '<td class="titlefield">'.$langs->trans("SupplierCode").'</td><td>';
|
2011-11-08 23:10:31 +01:00
|
|
|
print $object->code_fournisseur;
|
|
|
|
|
if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
|
2010-09-19 14:50:53 +02:00
|
|
|
print '</td>';
|
|
|
|
|
print '</tr>';
|
|
|
|
|
|
2013-05-24 18:20:28 +02:00
|
|
|
$langs->load('compta');
|
2010-09-19 14:50:53 +02:00
|
|
|
print '<tr>';
|
|
|
|
|
print '<td>';
|
2019-01-27 11:55:16 +01:00
|
|
|
print $form->editfieldkey("SupplierAccountancyCode", 'supplieraccountancycode', $object->code_compta_fournisseur, $object, $user->rights->societe->creer);
|
2016-10-16 21:29:12 +02:00
|
|
|
print '</td><td>';
|
2019-01-27 11:55:16 +01:00
|
|
|
print $form->editfieldval("SupplierAccountancyCode", 'supplieraccountancycode', $object->code_compta_fournisseur, $object, $user->rights->societe->creer);
|
2010-09-19 14:50:53 +02:00
|
|
|
print '</td>';
|
|
|
|
|
print '</tr>';
|
2009-02-18 13:26:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Assujetti a TVA ou pas
|
|
|
|
|
print '<tr>';
|
2018-03-15 14:25:09 +01:00
|
|
|
print '<td class="titlefield">';
|
2019-01-27 11:55:16 +01:00
|
|
|
print $form->textwithpicto($langs->trans('VATIsUsed'), $langs->trans('VATIsUsedWhenSelling'));
|
2018-03-15 14:25:09 +01:00
|
|
|
print '</td><td>';
|
2011-11-08 23:10:31 +01:00
|
|
|
print yn($object->tva_assuj);
|
2009-02-18 13:26:55 +01:00
|
|
|
print '</td>';
|
|
|
|
|
print '</tr>';
|
2010-02-08 04:38:05 +01:00
|
|
|
|
|
|
|
|
// Local Taxes
|
2014-12-26 04:44:15 +01:00
|
|
|
if ($mysoc->useLocalTax(1))
|
2010-02-07 12:18:00 +01:00
|
|
|
{
|
2016-10-16 21:29:12 +02:00
|
|
|
print '<tr><td>'.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).'</td><td>';
|
2014-07-04 13:37:25 +02:00
|
|
|
print yn($object->localtax1_assuj);
|
|
|
|
|
print '</td></tr>';
|
|
|
|
|
}
|
2014-12-26 04:44:15 +01:00
|
|
|
if ($mysoc->useLocalTax(2))
|
2014-07-04 13:37:25 +02:00
|
|
|
{
|
2016-10-16 21:29:12 +02:00
|
|
|
print '<tr><td>'.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).'</td><td>';
|
2014-07-04 13:37:25 +02:00
|
|
|
print yn($object->localtax2_assuj);
|
|
|
|
|
print '</td></tr>';
|
2010-02-07 12:18:00 +01:00
|
|
|
}
|
2010-05-08 19:17:17 +02:00
|
|
|
|
2011-05-12 21:01:14 +02:00
|
|
|
// TVA Intra
|
2016-10-16 21:29:12 +02:00
|
|
|
print '<tr><td class="nowrap">'.$langs->trans('VATIntra').'</td><td>';
|
2011-11-08 23:10:31 +01:00
|
|
|
print $object->tva_intra;
|
2011-05-12 21:01:14 +02:00
|
|
|
print '</td></tr>';
|
|
|
|
|
|
2019-03-22 09:44:30 +01:00
|
|
|
// Default terms of the settlement
|
2013-07-30 15:06:57 +02:00
|
|
|
$langs->load('bills');
|
|
|
|
|
$form = new Form($db);
|
|
|
|
|
print '<tr><td>';
|
|
|
|
|
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
|
|
|
|
print $langs->trans('PaymentConditions');
|
|
|
|
|
print '<td>';
|
2019-10-06 15:34:22 +02:00
|
|
|
if (($action != 'editconditions') && $user->rights->societe->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&socid='.$object->id.'">'.img_edit($langs->trans('SetConditions'), 1).'</a></td>';
|
2013-07-30 15:06:57 +02:00
|
|
|
print '</tr></table>';
|
2016-10-16 21:29:12 +02:00
|
|
|
print '</td><td>';
|
2013-07-30 15:06:57 +02:00
|
|
|
if ($action == 'editconditions')
|
|
|
|
|
{
|
2019-01-27 11:55:16 +01:00
|
|
|
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->cond_reglement_supplier_id, 'cond_reglement_supplier_id', -1, 1);
|
2020-05-21 15:05:19 +02:00
|
|
|
} else {
|
2019-01-27 11:55:16 +01:00
|
|
|
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->cond_reglement_supplier_id, 'none');
|
2013-07-30 15:06:57 +02:00
|
|
|
}
|
|
|
|
|
print "</td>";
|
|
|
|
|
print '</tr>';
|
|
|
|
|
|
|
|
|
|
// Mode de reglement par defaut
|
|
|
|
|
print '<tr><td class="nowrap">';
|
|
|
|
|
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
|
|
|
|
print $langs->trans('PaymentMode');
|
|
|
|
|
print '<td>';
|
2019-10-06 15:34:22 +02:00
|
|
|
if (($action != 'editmode') && $user->rights->societe->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&socid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
|
2013-07-30 15:06:57 +02:00
|
|
|
print '</tr></table>';
|
2016-10-16 21:29:12 +02:00
|
|
|
print '</td><td>';
|
2013-07-30 15:06:57 +02:00
|
|
|
if ($action == 'editmode')
|
|
|
|
|
{
|
2019-01-27 11:55:16 +01:00
|
|
|
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->mode_reglement_supplier_id, 'mode_reglement_supplier_id', 'DBIT', 1, 1);
|
2020-05-21 15:05:19 +02:00
|
|
|
} else {
|
2019-01-27 11:55:16 +01:00
|
|
|
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->mode_reglement_supplier_id, 'none');
|
2013-07-30 15:06:57 +02:00
|
|
|
}
|
|
|
|
|
print "</td>";
|
|
|
|
|
print '</tr>';
|
2018-02-20 18:09:38 +01:00
|
|
|
|
2018-03-05 10:58:19 +01:00
|
|
|
// Relative discounts (Discounts-Drawbacks-Rebates)
|
|
|
|
|
print '<tr><td class="nowrap">';
|
|
|
|
|
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
|
|
|
|
print $langs->trans("CustomerRelativeDiscountShort");
|
2019-03-07 20:46:38 +01:00
|
|
|
print '<td><td class="right">';
|
2019-10-31 20:46:31 +01:00
|
|
|
if ($user->rights->societe->creer && !$user->socid > 0)
|
2018-03-05 10:58:19 +01:00
|
|
|
{
|
2019-10-06 15:34:22 +02:00
|
|
|
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$object->id.'">'.img_edit($langs->trans("Modify")).'</a>';
|
2018-02-21 09:31:01 +01:00
|
|
|
}
|
2018-03-05 10:58:19 +01:00
|
|
|
print '</td></tr></table>';
|
2019-11-13 19:35:39 +01:00
|
|
|
print '</td><td>'.($object->remise_supplier_percent ? '<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$object->id.'">'.$object->remise_supplier_percent.'%</a>' : '').'</td>';
|
2018-03-05 10:58:19 +01:00
|
|
|
print '</tr>';
|
|
|
|
|
|
|
|
|
|
// Absolute discounts (Discounts-Drawbacks-Rebates)
|
|
|
|
|
print '<tr><td class="nowrap">';
|
|
|
|
|
print '<table width="100%" class="nobordernopadding">';
|
|
|
|
|
print '<tr><td class="nowrap">';
|
|
|
|
|
print $langs->trans("CustomerAbsoluteDiscountShort");
|
2019-03-07 20:46:38 +01:00
|
|
|
print '<td><td class="right">';
|
2019-10-31 20:46:31 +01:00
|
|
|
if ($user->rights->societe->creer && !$user->socid > 0)
|
2018-03-05 10:58:19 +01:00
|
|
|
{
|
2019-10-08 11:56:38 +02:00
|
|
|
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'">'.img_edit($langs->trans("Modify")).'</a>';
|
2018-03-05 10:58:19 +01:00
|
|
|
}
|
|
|
|
|
print '</td></tr></table>';
|
|
|
|
|
print '</td>';
|
|
|
|
|
print '<td>';
|
2019-11-13 19:35:39 +01:00
|
|
|
$amount_discount = $object->getAvailableDiscounts('', '', 0, 1);
|
2019-01-27 11:55:16 +01:00
|
|
|
if ($amount_discount < 0) dol_print_error($db, $object->error);
|
|
|
|
|
if ($amount_discount > 0) print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'">'.price($amount_discount, 1, $langs, 1, -1, -1, $conf->currency).'</a>';
|
2018-03-05 10:58:19 +01:00
|
|
|
//else print $langs->trans("DiscountNone");
|
|
|
|
|
print '</td>';
|
|
|
|
|
print '</tr>';
|
2018-03-15 14:25:09 +01:00
|
|
|
|
2020-03-24 22:02:58 +01:00
|
|
|
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) && !empty($conf->global->ORDER_MANAGE_MIN_AMOUNT))
|
2018-09-06 17:37:02 +02:00
|
|
|
{
|
|
|
|
|
print '<tr class="nowrap">';
|
|
|
|
|
print '<td>';
|
2019-01-27 11:55:16 +01:00
|
|
|
print $form->editfieldkey("OrderMinAmount", 'supplier_order_min_amount', $object->supplier_order_min_amount, $object, $user->rights->societe->creer);
|
2018-09-06 17:37:02 +02:00
|
|
|
print '</td><td>';
|
2019-11-13 19:35:39 +01:00
|
|
|
$limit_field_type = (!empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) ? 'numeric' : 'amount';
|
2019-01-27 11:55:16 +01:00
|
|
|
print $form->editfieldval("OrderMinAmount", 'supplier_order_min_amount', $object->supplier_order_min_amount, $object, $user->rights->societe->creer, $limit_field_type, ($object->supplier_order_min_amount != '' ? price($object->supplier_order_min_amount) : ''));
|
2018-09-06 17:37:02 +02:00
|
|
|
print '</td>';
|
|
|
|
|
print '</tr>';
|
|
|
|
|
}
|
2011-05-12 21:01:14 +02:00
|
|
|
|
2015-08-26 19:30:40 +02:00
|
|
|
// Categories
|
2019-11-13 19:35:39 +01:00
|
|
|
if (!empty($conf->categorie->enabled))
|
2015-09-16 21:21:34 +02:00
|
|
|
{
|
2016-06-21 15:16:33 +02:00
|
|
|
$langs->load("categories");
|
2019-11-13 19:35:39 +01:00
|
|
|
print '<tr><td>'.$langs->trans("SuppliersCategoriesShort").'</td>';
|
2016-10-16 21:29:12 +02:00
|
|
|
print '<td>';
|
2019-11-14 08:15:39 +01:00
|
|
|
print $form->showCategories($object->id, Categorie::TYPE_SUPPLIER, 1);
|
2015-09-16 21:21:34 +02:00
|
|
|
print "</td></tr>";
|
|
|
|
|
}
|
2015-08-26 19:30:40 +02:00
|
|
|
|
2015-03-14 13:05:28 +01:00
|
|
|
// Other attributes
|
2019-11-13 19:35:39 +01:00
|
|
|
$parameters = array('socid'=>$object->id, 'colspan' => ' colspan="3"', 'colspanvalue' => '3');
|
|
|
|
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
|
2015-03-14 13:05:28 +01:00
|
|
|
|
|
|
|
|
// Module Adherent
|
2019-11-13 19:35:39 +01:00
|
|
|
if (!empty($conf->adherent->enabled))
|
2011-02-09 16:28:15 +01:00
|
|
|
{
|
|
|
|
|
$langs->load("members");
|
|
|
|
|
$langs->load("users");
|
2016-10-16 21:29:12 +02:00
|
|
|
print '<tr><td>'.$langs->trans("LinkedToDolibarrMember").'</td>';
|
|
|
|
|
print '<td>';
|
2019-11-13 19:35:39 +01:00
|
|
|
$adh = new Adherent($db);
|
|
|
|
|
$result = $adh->fetch('', '', $object->id);
|
2011-02-09 16:28:15 +01:00
|
|
|
if ($result > 0)
|
|
|
|
|
{
|
2019-11-13 19:35:39 +01:00
|
|
|
$adh->ref = $adh->getFullName($langs);
|
2011-02-09 16:28:15 +01:00
|
|
|
print $adh->getNomUrl(1);
|
2020-05-21 15:05:19 +02:00
|
|
|
} else {
|
2013-11-05 15:29:58 +01:00
|
|
|
print $langs->trans("ThirdpartyNotLinkedToMember");
|
2011-02-09 16:28:15 +01:00
|
|
|
}
|
|
|
|
|
print '</td>';
|
|
|
|
|
print "</tr>\n";
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-18 13:26:55 +01:00
|
|
|
print '</table>';
|
|
|
|
|
|
2013-04-28 01:12:40 +02:00
|
|
|
|
2013-06-05 16:24:32 +02:00
|
|
|
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
2013-04-21 17:56:29 +02:00
|
|
|
|
2017-01-23 20:54:52 +01:00
|
|
|
$boxstat = '';
|
2017-06-07 16:44:04 +02:00
|
|
|
|
2017-01-23 20:54:52 +01:00
|
|
|
// Nbre max d'elements des petites listes
|
2019-11-13 19:35:39 +01:00
|
|
|
$MAXLIST = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
|
2017-06-07 16:44:04 +02:00
|
|
|
|
2018-03-01 23:51:06 +01:00
|
|
|
print '<div class="underbanner clearboth"></div>';
|
|
|
|
|
|
2017-01-23 20:54:52 +01:00
|
|
|
// Lien recap
|
2019-11-13 19:35:39 +01:00
|
|
|
$boxstat .= '<div class="box">';
|
|
|
|
|
$boxstat .= '<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="border boxtable boxtablenobottom boxtablenotop" width="100%">';
|
2020-06-23 11:27:40 +02:00
|
|
|
$boxstat .= '<tr class="impair nohover"><td colspan="2" class="tdboxstats nohover">';
|
2017-06-07 16:44:04 +02:00
|
|
|
|
2017-01-23 20:54:52 +01:00
|
|
|
if ($conf->supplier_proposal->enabled)
|
|
|
|
|
{
|
|
|
|
|
// Box proposals
|
|
|
|
|
$tmp = $object->getOutstandingProposals('supplier');
|
2019-11-13 19:35:39 +01:00
|
|
|
$outstandingOpened = $tmp['opened'];
|
|
|
|
|
$outstandingTotal = $tmp['total_ht'];
|
|
|
|
|
$outstandingTotalIncTax = $tmp['total_ttc'];
|
|
|
|
|
$text = $langs->trans("OverAllSupplierProposals");
|
|
|
|
|
$link = DOL_URL_ROOT.'/supplier_proposal/list.php?socid='.$object->id;
|
|
|
|
|
$icon = 'bill';
|
|
|
|
|
if ($link) $boxstat .= '<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
|
|
|
|
|
$boxstat .= '<div class="boxstats" title="'.dol_escape_htmltag($text).'">';
|
|
|
|
|
$boxstat .= '<span class="boxstatstext">'.img_object("", $icon).' '.$text.'</span><br>';
|
|
|
|
|
$boxstat .= '<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'</span>';
|
|
|
|
|
$boxstat .= '</div>';
|
|
|
|
|
if ($link) $boxstat .= '</a>';
|
2017-01-23 20:54:52 +01:00
|
|
|
}
|
2017-06-07 16:44:04 +02:00
|
|
|
|
2020-03-24 22:02:58 +01:00
|
|
|
if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))
|
2017-01-23 20:54:52 +01:00
|
|
|
{
|
|
|
|
|
// Box proposals
|
|
|
|
|
$tmp = $object->getOutstandingOrders('supplier');
|
2019-11-13 19:35:39 +01:00
|
|
|
$outstandingOpened = $tmp['opened'];
|
|
|
|
|
$outstandingTotal = $tmp['total_ht'];
|
|
|
|
|
$outstandingTotalIncTax = $tmp['total_ttc'];
|
|
|
|
|
$text = $langs->trans("OverAllOrders");
|
|
|
|
|
$link = DOL_URL_ROOT.'/fourn/commande/list.php?socid='.$object->id;
|
|
|
|
|
$icon = 'bill';
|
|
|
|
|
if ($link) $boxstat .= '<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
|
|
|
|
|
$boxstat .= '<div class="boxstats" title="'.dol_escape_htmltag($text).'">';
|
|
|
|
|
$boxstat .= '<span class="boxstatstext">'.img_object("", $icon).' '.$text.'</span><br>';
|
|
|
|
|
$boxstat .= '<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'</span>';
|
|
|
|
|
$boxstat .= '</div>';
|
|
|
|
|
if ($link) $boxstat .= '</a>';
|
2017-01-23 20:54:52 +01:00
|
|
|
}
|
2017-06-07 16:44:04 +02:00
|
|
|
|
2020-03-24 22:02:58 +01:00
|
|
|
if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))
|
2017-01-23 20:54:52 +01:00
|
|
|
{
|
|
|
|
|
$tmp = $object->getOutstandingBills('supplier');
|
2019-11-13 19:35:39 +01:00
|
|
|
$outstandingOpened = $tmp['opened'];
|
|
|
|
|
$outstandingTotal = $tmp['total_ht'];
|
|
|
|
|
$outstandingTotalIncTax = $tmp['total_ttc'];
|
|
|
|
|
|
|
|
|
|
$text = $langs->trans("OverAllInvoices");
|
|
|
|
|
$link = DOL_URL_ROOT.'/fourn/facture/list.php?socid='.$object->id;
|
|
|
|
|
$icon = 'bill';
|
|
|
|
|
if ($link) $boxstat .= '<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
|
|
|
|
|
$boxstat .= '<div class="boxstats" title="'.dol_escape_htmltag($text).'">';
|
|
|
|
|
$boxstat .= '<span class="boxstatstext">'.img_object("", $icon).' '.$text.'</span><br>';
|
|
|
|
|
$boxstat .= '<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'</span>';
|
|
|
|
|
$boxstat .= '</div>';
|
|
|
|
|
if ($link) $boxstat .= '</a>';
|
2017-06-07 16:44:04 +02:00
|
|
|
|
2017-01-23 20:54:52 +01:00
|
|
|
// Box outstanding bill
|
2019-11-13 19:35:39 +01:00
|
|
|
$text = $langs->trans("CurrentOutstandingBill");
|
|
|
|
|
$link = DOL_URL_ROOT.'/fourn/recap-fourn.php?socid='.$object->id;
|
|
|
|
|
$icon = 'bill';
|
|
|
|
|
if ($link) $boxstat .= '<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
|
|
|
|
|
$boxstat .= '<div class="boxstats" title="'.dol_escape_htmltag($text).'">';
|
|
|
|
|
$boxstat .= '<span class="boxstatstext">'.img_object("", $icon).' '.$text.'</span><br>';
|
|
|
|
|
$boxstat .= '<span class="boxstatsindicator'.($outstandingOpened > 0 ? ' amountremaintopay' : '').'">'.price($outstandingOpened, 1, $langs, 1, -1, -1, $conf->currency).$warn.'</span>';
|
|
|
|
|
$boxstat .= '</div>';
|
|
|
|
|
if ($link) $boxstat .= '</a>';
|
2017-01-23 20:54:52 +01:00
|
|
|
}
|
2017-06-07 16:44:04 +02:00
|
|
|
|
2019-11-13 19:35:39 +01:00
|
|
|
$boxstat .= '</td></tr>';
|
|
|
|
|
$boxstat .= '</table>';
|
|
|
|
|
$boxstat .= '</div>';
|
2017-06-07 16:44:04 +02:00
|
|
|
|
2017-01-23 20:54:52 +01:00
|
|
|
print $boxstat;
|
2017-06-07 16:44:04 +02:00
|
|
|
|
|
|
|
|
|
2019-11-13 19:35:39 +01:00
|
|
|
$MAXLIST = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
|
2009-02-18 13:26:55 +01:00
|
|
|
|
|
|
|
|
// Lien recap
|
2017-01-23 20:54:52 +01:00
|
|
|
/*
|
2019-11-05 21:24:41 +01:00
|
|
|
print '<table class="noborder centpercent">';
|
2009-02-18 13:26:55 +01:00
|
|
|
print '<tr class="liste_titre">';
|
2009-10-29 18:30:29 +01:00
|
|
|
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("Summary").'</td>';
|
2019-03-07 20:46:38 +01:00
|
|
|
print '<td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/fourn/recap-fourn.php?socid='.$object->id.'">'.$langs->trans("ShowSupplierPreview").'</a></td></tr></table></td>';
|
2009-02-18 13:26:55 +01:00
|
|
|
print '</tr>';
|
|
|
|
|
print '</table>';
|
2015-03-22 18:54:12 +01:00
|
|
|
print '<br>';
|
2017-01-23 20:54:52 +01:00
|
|
|
*/
|
2009-02-21 14:45:25 +01:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* List of products
|
|
|
|
|
*/
|
2019-11-13 19:35:39 +01:00
|
|
|
if (!empty($conf->product->enabled) || !empty($conf->service->enabled))
|
2009-02-21 14:45:25 +01:00
|
|
|
{
|
|
|
|
|
$langs->load("products");
|
2015-03-20 12:59:37 +01:00
|
|
|
//Query from product/liste.php
|
2016-09-11 14:04:03 +02:00
|
|
|
$sql = 'SELECT p.rowid, p.ref, p.label, p.fk_product_type, p.entity,';
|
2019-11-13 19:35:39 +01:00
|
|
|
$sql .= ' pfp.tms, pfp.ref_fourn as supplier_ref, pfp.price, pfp.quantity, pfp.unitprice';
|
|
|
|
|
$sql .= ' FROM '.MAIN_DB_PREFIX.'product_fournisseur_price as pfp';
|
|
|
|
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = pfp.fk_product";
|
|
|
|
|
$sql .= ' WHERE p.entity IN ('.getEntity('product').')';
|
|
|
|
|
$sql .= ' AND pfp.fk_soc = '.$object->id;
|
2015-03-20 12:59:37 +01:00
|
|
|
$sql .= $db->order('pfp.tms', 'desc');
|
2019-11-13 19:35:39 +01:00
|
|
|
$sql .= $db->plimit($MAXLIST);
|
2017-06-07 16:44:04 +02:00
|
|
|
|
2015-03-20 12:59:37 +01:00
|
|
|
$query = $db->query($sql);
|
2019-11-13 19:35:39 +01:00
|
|
|
if (!$query) dol_print_error($db);
|
2017-06-07 16:44:04 +02:00
|
|
|
|
2017-07-14 13:28:21 +02:00
|
|
|
$num = $db->num_rows($query);
|
2015-03-20 12:59:37 +01:00
|
|
|
|
2019-07-27 01:13:39 +02:00
|
|
|
print '<table class="noborder centpercent lastrecordtable">';
|
2019-11-13 19:35:39 +01:00
|
|
|
print '<tr class="liste_titre'.(($num == 0) ? ' nobottom' : '').'">';
|
2019-03-07 20:46:38 +01:00
|
|
|
print '<td colspan="3">'.$langs->trans("ProductsAndServices").'</td><td class="right">';
|
2019-12-02 11:00:09 +01:00
|
|
|
print '<a class="notasortlink" href="'.DOL_URL_ROOT.'/fourn/product/list.php?fourn_id='.$object->id.'">'.$langs->trans("AllProductReferencesOfSupplier").'<span class="badge marginleftonlyshort">'.$object->nbOfProductRefs().'</span>';
|
2017-07-14 13:28:21 +02:00
|
|
|
print '</a></td></tr>';
|
2015-03-20 12:59:37 +01:00
|
|
|
|
2017-07-14 13:28:21 +02:00
|
|
|
$return = array();
|
|
|
|
|
if ($num > 0)
|
|
|
|
|
{
|
2015-03-20 12:59:37 +01:00
|
|
|
$productstatic = new Product($db);
|
|
|
|
|
|
2017-07-14 13:28:21 +02:00
|
|
|
while ($objp = $db->fetch_object($query))
|
|
|
|
|
{
|
2015-03-20 12:59:37 +01:00
|
|
|
$productstatic->id = $objp->rowid;
|
|
|
|
|
$productstatic->ref = $objp->ref;
|
|
|
|
|
$productstatic->label = $objp->label;
|
|
|
|
|
$productstatic->type = $objp->fk_product_type;
|
2015-10-29 12:28:28 +01:00
|
|
|
$productstatic->entity = $objp->entity;
|
2015-03-20 12:59:37 +01:00
|
|
|
|
2017-04-14 11:22:48 +02:00
|
|
|
print '<tr class="oddeven">';
|
2015-03-20 12:59:37 +01:00
|
|
|
print '<td class="nowrap">';
|
|
|
|
|
print $productstatic->getNomUrl(1);
|
|
|
|
|
print '</td>';
|
2016-09-11 13:48:05 +02:00
|
|
|
print '<td>';
|
2016-09-11 14:04:03 +02:00
|
|
|
print $objp->supplier_ref;
|
2016-09-11 13:48:05 +02:00
|
|
|
print '</td>';
|
2016-09-11 14:04:03 +02:00
|
|
|
print '<td class="maxwidthonsmartphone">';
|
2015-03-20 12:59:37 +01:00
|
|
|
print dol_trunc(dol_htmlentities($objp->label), 30);
|
|
|
|
|
print '</td>';
|
2019-03-07 20:46:38 +01:00
|
|
|
//print '<td class="right" class="nowrap">'.dol_print_date($objp->tms, 'day').'</td>';
|
|
|
|
|
print '<td class="right">';
|
2016-09-11 14:04:03 +02:00
|
|
|
//print (isset($objp->unitprice) ? price($objp->unitprice) : '');
|
|
|
|
|
if (isset($objp->price))
|
|
|
|
|
{
|
|
|
|
|
print price($objp->price);
|
|
|
|
|
if ($objp->quantity > 1)
|
|
|
|
|
{
|
|
|
|
|
print ' / ';
|
|
|
|
|
print $objp->quantity;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
print '</td>';
|
2015-03-20 12:59:37 +01:00
|
|
|
print '</tr>';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
print '</table>';
|
2009-02-21 14:45:25 +01:00
|
|
|
}
|
2009-10-04 14:16:45 +02:00
|
|
|
|
2017-06-07 16:44:04 +02:00
|
|
|
|
2016-06-06 21:26:31 +02:00
|
|
|
/*
|
2018-02-14 17:25:13 +01:00
|
|
|
* Latest supplier proposal
|
2016-06-06 21:26:31 +02:00
|
|
|
*/
|
|
|
|
|
$proposalstatic = new SupplierProposal($db);
|
2017-06-07 16:44:04 +02:00
|
|
|
|
2016-06-06 21:26:31 +02:00
|
|
|
if ($user->rights->supplier_proposal->lire)
|
|
|
|
|
{
|
2019-11-13 19:35:39 +01:00
|
|
|
$sql = "SELECT p.rowid, p.ref, p.date_valid as dc, p.fk_statut, p.total_ht, p.tva as total_tva, p.total as total_ttc";
|
|
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."supplier_proposal as p ";
|
|
|
|
|
$sql .= " WHERE p.fk_soc =".$object->id;
|
|
|
|
|
$sql .= " AND p.entity IN (".getEntity('supplier_proposal').")";
|
|
|
|
|
$sql .= " ORDER BY p.date_valid DESC";
|
|
|
|
|
$sql .= " ".$db->plimit($MAXLIST);
|
|
|
|
|
|
|
|
|
|
$resql = $db->query($sql);
|
2016-06-06 21:26:31 +02:00
|
|
|
if ($resql)
|
|
|
|
|
{
|
2019-11-13 19:35:39 +01:00
|
|
|
$i = 0;
|
2016-06-06 21:26:31 +02:00
|
|
|
$num = $db->num_rows($resql);
|
2017-06-07 16:44:04 +02:00
|
|
|
|
2016-06-06 21:26:31 +02:00
|
|
|
if ($num > 0)
|
|
|
|
|
{
|
2019-07-27 01:13:39 +02:00
|
|
|
print '<table class="noborder centpercent lastrecordtable">';
|
2017-06-07 16:44:04 +02:00
|
|
|
|
2016-06-06 21:26:31 +02:00
|
|
|
print '<tr class="liste_titre">';
|
|
|
|
|
print '<td colspan="3">';
|
2019-11-13 19:35:39 +01:00
|
|
|
print '<table class="nobordernopadding centpercent"><tr><td>'.$langs->trans("LastSupplierProposals", ($num < $MAXLIST ? "" : $MAXLIST)).'</td>';
|
2019-12-02 11:00:09 +01:00
|
|
|
print '<td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/supplier_proposal/list.php?socid='.$object->id.'">'.$langs->trans("AllPriceRequests").'<span class="badge marginleftonlyshort">'.$num.'</span></td>';
|
2019-03-07 20:46:38 +01:00
|
|
|
print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/supplier_proposal/stats/index.php?mode=supplier&socid='.$object->id.'">'.img_picto($langs->trans("Statistics"), 'stats').'</a></td>';
|
2016-06-06 21:26:31 +02:00
|
|
|
print '</tr></table>';
|
|
|
|
|
print '</td></tr>';
|
|
|
|
|
}
|
2017-06-07 16:44:04 +02:00
|
|
|
|
2016-06-06 21:26:31 +02:00
|
|
|
while ($i < $num && $i <= $MAXLIST)
|
|
|
|
|
{
|
|
|
|
|
$obj = $db->fetch_object($resql);
|
2017-06-07 16:44:04 +02:00
|
|
|
|
2017-04-14 11:22:48 +02:00
|
|
|
print '<tr class="oddeven">';
|
2016-06-06 21:26:31 +02:00
|
|
|
print '<td class="nowrap">';
|
|
|
|
|
$proposalstatic->id = $obj->rowid;
|
|
|
|
|
$proposalstatic->ref = $obj->ref;
|
|
|
|
|
$proposalstatic->total_ht = $obj->total_ht;
|
|
|
|
|
$proposalstatic->total_tva = $obj->total_tva;
|
|
|
|
|
$proposalstatic->total_ttc = $obj->total_ttc;
|
|
|
|
|
print $proposalstatic->getNomUrl(1);
|
|
|
|
|
print '</td>';
|
2019-03-07 20:46:38 +01:00
|
|
|
print '<td class="center" width="80">';
|
2016-06-06 21:26:31 +02:00
|
|
|
if ($obj->dc)
|
|
|
|
|
{
|
2019-01-27 11:55:16 +01:00
|
|
|
print dol_print_date($db->jdate($obj->dc), 'day');
|
2020-05-21 15:05:19 +02:00
|
|
|
} else {
|
2016-06-06 21:26:31 +02:00
|
|
|
print "-";
|
|
|
|
|
}
|
|
|
|
|
print '</td>';
|
2019-03-07 20:46:38 +01:00
|
|
|
print '<td class="right" class="nowrap">'.$proposalstatic->LibStatut($obj->fk_statut, 5).'</td>';
|
2016-06-06 21:26:31 +02:00
|
|
|
print '</tr>';
|
|
|
|
|
$i++;
|
|
|
|
|
}
|
|
|
|
|
$db->free($resql);
|
2017-06-07 16:44:04 +02:00
|
|
|
|
2019-11-13 19:35:39 +01:00
|
|
|
if ($num > 0) print "</table>";
|
2020-05-21 15:05:19 +02:00
|
|
|
} else {
|
2016-06-06 21:26:31 +02:00
|
|
|
dol_print_error($db);
|
|
|
|
|
}
|
2017-06-07 16:44:04 +02:00
|
|
|
}
|
2009-02-18 13:26:55 +01:00
|
|
|
|
|
|
|
|
/*
|
2018-02-14 17:25:13 +01:00
|
|
|
* Latest supplier orders
|
2009-02-18 13:26:55 +01:00
|
|
|
*/
|
|
|
|
|
$orderstatic = new CommandeFournisseur($db);
|
|
|
|
|
|
2009-10-04 14:16:45 +02:00
|
|
|
if ($user->rights->fournisseur->commande->lire)
|
2006-04-06 21:21:19 +02:00
|
|
|
{
|
2014-09-23 16:28:29 +02:00
|
|
|
// TODO move to DAO class
|
|
|
|
|
// Check if there are supplier orders billable
|
|
|
|
|
$sql2 = 'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_supplier,';
|
2019-11-13 19:35:39 +01:00
|
|
|
$sql2 .= ' c.date_valid, c.date_commande, c.date_livraison, c.fk_statut';
|
|
|
|
|
$sql2 .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
|
|
|
|
|
$sql2 .= ', '.MAIN_DB_PREFIX.'commande_fournisseur as c';
|
|
|
|
|
$sql2 .= ' WHERE c.fk_soc = s.rowid';
|
|
|
|
|
$sql2 .= " AND c.entity IN (".getEntity('commande_fournisseur').")";
|
|
|
|
|
$sql2 .= ' AND s.rowid = '.$object->id;
|
2019-10-01 15:01:29 +02:00
|
|
|
// Show orders we can bill
|
|
|
|
|
if (empty($conf->global->SUPPLIER_ORDER_TO_INVOICE_STATUS))
|
|
|
|
|
{
|
2019-11-13 19:35:39 +01:00
|
|
|
$sql2 .= " AND c.fk_statut IN (".CommandeFournisseur::STATUS_RECEIVED_COMPLETELY.")"; // Must match filter in htdocs/fourn/orderstoinvoice.php
|
2020-05-21 15:05:19 +02:00
|
|
|
} else {
|
2019-10-01 15:01:29 +02:00
|
|
|
// CommandeFournisseur::STATUS_ORDERSENT.", ".CommandeFournisseur::STATUS_RECEIVED_PARTIALLY.", ".CommandeFournisseur::STATUS_RECEIVED_COMPLETELY
|
2019-11-13 19:35:39 +01:00
|
|
|
$sql2 .= " AND c.fk_statut IN (".$db->escape($conf->global->SUPPLIER_ORDER_TO_INVOICE_STATUS).")";
|
2019-10-01 15:01:29 +02:00
|
|
|
}
|
2019-11-13 19:35:39 +01:00
|
|
|
$sql2 .= " AND c.billed = 0";
|
2014-09-23 16:28:29 +02:00
|
|
|
// Find order that are not already invoiced
|
2015-11-16 14:55:46 +01:00
|
|
|
// just need to check received status because we have the billed status now
|
|
|
|
|
//$sql2 .= " AND c.rowid NOT IN (SELECT fk_source FROM " . MAIN_DB_PREFIX . "element_element WHERE targettype='invoice_supplier')";
|
2019-11-13 19:35:39 +01:00
|
|
|
$resql2 = $db->query($sql2);
|
2014-09-23 16:28:29 +02:00
|
|
|
if ($resql2) {
|
|
|
|
|
$orders2invoice = $db->num_rows($resql2);
|
|
|
|
|
$db->free($resql2);
|
|
|
|
|
} else {
|
2015-12-10 16:14:37 +01:00
|
|
|
setEventMessages($db->lasterror(), null, 'errors');
|
2014-09-23 16:28:29 +02:00
|
|
|
}
|
2014-11-15 20:48:39 +01:00
|
|
|
|
2011-11-08 23:10:31 +01:00
|
|
|
// TODO move to DAO class
|
2019-11-13 19:35:39 +01:00
|
|
|
$sql = "SELECT count(p.rowid) as total";
|
|
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p";
|
|
|
|
|
$sql .= " WHERE p.fk_soc =".$object->id;
|
|
|
|
|
$sql .= " AND p.entity IN (".getEntity('commande_fournisseur').")";
|
|
|
|
|
$resql = $db->query($sql);
|
2016-06-30 16:53:24 +02:00
|
|
|
if ($resql)
|
|
|
|
|
{
|
|
|
|
|
$object_count = $db->fetch_object($resql);
|
|
|
|
|
$num = $object_count->total;
|
|
|
|
|
}
|
2017-06-07 16:44:04 +02:00
|
|
|
|
2015-01-25 01:20:58 +01:00
|
|
|
$sql = "SELECT p.rowid,p.ref, p.date_commande as dc, p.fk_statut, p.total_ht, p.tva as total_tva, p.total_ttc";
|
2019-11-13 19:35:39 +01:00
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p";
|
|
|
|
|
$sql .= " WHERE p.fk_soc =".$object->id;
|
|
|
|
|
$sql .= " AND p.entity IN (".getEntity('commande_fournisseur').")";
|
|
|
|
|
$sql .= " ORDER BY p.date_commande DESC";
|
|
|
|
|
$sql .= " ".$db->plimit($MAXLIST);
|
|
|
|
|
$resql = $db->query($sql);
|
2009-10-04 14:16:45 +02:00
|
|
|
if ($resql)
|
2006-04-06 21:21:19 +02:00
|
|
|
{
|
2019-11-13 19:35:39 +01:00
|
|
|
$i = 0;
|
2011-06-13 17:14:11 +02:00
|
|
|
|
|
|
|
|
if ($num > 0)
|
|
|
|
|
{
|
2019-07-27 01:13:39 +02:00
|
|
|
print '<table class="noborder centpercent lastrecordtable">';
|
2011-11-03 01:59:13 +01:00
|
|
|
|
|
|
|
|
print '<tr class="liste_titre">';
|
2011-06-13 17:14:11 +02:00
|
|
|
print '<td colspan="3">';
|
2019-11-13 19:35:39 +01:00
|
|
|
print '<table class="nobordernopadding" width="100%"><tr><td>'.$langs->trans("LastSupplierOrders", ($num < $MAXLIST ? "" : $MAXLIST)).'</td>';
|
2019-12-02 11:00:09 +01:00
|
|
|
print '<td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/fourn/commande/list.php?socid='.$object->id.'">'.$langs->trans("AllOrders").'<span class="badge marginleftonlyshort">'.$num.'</span></td>';
|
2019-03-07 20:46:38 +01:00
|
|
|
print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/commande/stats/index.php?mode=supplier&socid='.$object->id.'">'.img_picto($langs->trans("Statistics"), 'stats').'</a></td>';
|
2011-06-13 17:14:11 +02:00
|
|
|
print '</tr></table>';
|
|
|
|
|
print '</td></tr>';
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-30 16:53:24 +02:00
|
|
|
while ($i < $num && $i < $MAXLIST)
|
2006-04-06 21:21:19 +02:00
|
|
|
{
|
2009-10-04 14:16:45 +02:00
|
|
|
$obj = $db->fetch_object($resql);
|
2017-06-07 16:44:04 +02:00
|
|
|
|
2017-04-14 11:22:48 +02:00
|
|
|
print '<tr class="oddeven">';
|
2015-01-19 19:07:34 +01:00
|
|
|
print '<td class="nowrap">';
|
2015-01-25 01:20:58 +01:00
|
|
|
$orderstatic->id = $obj->rowid;
|
|
|
|
|
$orderstatic->ref = $obj->ref;
|
|
|
|
|
$orderstatic->total_ht = $obj->total_ht;
|
|
|
|
|
$orderstatic->total_tva = $obj->total_tva;
|
|
|
|
|
$orderstatic->total_ttc = $obj->total_ttc;
|
2015-01-19 19:07:34 +01:00
|
|
|
print $orderstatic->getNomUrl(1);
|
|
|
|
|
print '</td>';
|
2019-03-07 20:46:38 +01:00
|
|
|
print '<td class="center" width="80">';
|
2009-10-04 14:16:45 +02:00
|
|
|
if ($obj->dc)
|
|
|
|
|
{
|
2019-01-27 11:55:16 +01:00
|
|
|
print dol_print_date($db->jdate($obj->dc), 'day');
|
2020-05-21 15:05:19 +02:00
|
|
|
} else {
|
2009-10-04 14:16:45 +02:00
|
|
|
print "-";
|
|
|
|
|
}
|
|
|
|
|
print '</td>';
|
2019-03-07 20:46:38 +01:00
|
|
|
print '<td class="right" class="nowrap">'.$orderstatic->LibStatut($obj->fk_statut, 5).'</td>';
|
2009-10-04 14:16:45 +02:00
|
|
|
print '</tr>';
|
|
|
|
|
$i++;
|
2006-04-06 21:21:19 +02:00
|
|
|
}
|
2009-10-04 14:16:45 +02:00
|
|
|
$db->free($resql);
|
2011-11-03 01:59:13 +01:00
|
|
|
|
2019-11-13 19:35:39 +01:00
|
|
|
if ($num > 0) print "</table>";
|
2020-05-21 15:05:19 +02:00
|
|
|
} else {
|
2009-10-04 14:16:45 +02:00
|
|
|
dol_print_error($db);
|
2006-04-06 21:21:19 +02:00
|
|
|
}
|
|
|
|
|
}
|
2004-11-30 20:24:11 +01:00
|
|
|
|
2006-04-06 21:21:19 +02:00
|
|
|
/*
|
2018-02-14 17:25:13 +01:00
|
|
|
* Latest supplier invoices
|
2006-04-06 21:21:19 +02:00
|
|
|
*/
|
2006-03-18 23:46:29 +01:00
|
|
|
|
2005-12-05 19:49:35 +01:00
|
|
|
$langs->load('bills');
|
2006-03-18 23:46:29 +01:00
|
|
|
$facturestatic = new FactureFournisseur($db);
|
|
|
|
|
|
2009-10-04 14:16:45 +02:00
|
|
|
if ($user->rights->fournisseur->facture->lire)
|
2005-12-05 19:49:35 +01:00
|
|
|
{
|
2011-11-08 23:10:31 +01:00
|
|
|
// TODO move to DAO class
|
2019-11-02 12:59:38 +01:00
|
|
|
$sql = 'SELECT f.rowid, f.libelle as label, f.ref, f.ref_supplier, f.fk_statut, f.datef as df, f.total_ht, f.total_tva, f.total_ttc as amount,f.paye,';
|
2020-04-10 10:59:32 +02:00
|
|
|
$sql .= ' SUM(pf.amount) as am';
|
|
|
|
|
$sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f';
|
|
|
|
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON f.rowid=pf.fk_facturefourn';
|
|
|
|
|
$sql .= ' WHERE f.fk_soc = '.$object->id;
|
|
|
|
|
$sql .= " AND f.entity IN (".getEntity('facture_fourn').")";
|
|
|
|
|
$sql .= ' GROUP BY f.rowid,f.libelle,f.ref,f.ref_supplier,f.fk_statut,f.datef,f.total_ht,f.total_tva,f.total_ttc,f.paye';
|
|
|
|
|
$sql .= ' ORDER BY f.datef DESC';
|
|
|
|
|
$resql = $db->query($sql);
|
2009-10-04 14:16:45 +02:00
|
|
|
if ($resql)
|
2005-12-05 19:49:35 +01:00
|
|
|
{
|
2020-04-10 10:59:32 +02:00
|
|
|
$i = 0;
|
2009-10-04 14:16:45 +02:00
|
|
|
$num = $db->num_rows($resql);
|
2011-06-13 17:14:11 +02:00
|
|
|
if ($num > 0)
|
|
|
|
|
{
|
2019-07-27 01:13:39 +02:00
|
|
|
print '<table class="noborder centpercent lastrecordtable">';
|
2011-11-03 01:59:13 +01:00
|
|
|
|
|
|
|
|
print '<tr class="liste_titre">';
|
2011-06-13 17:14:11 +02:00
|
|
|
print '<td colspan="4">';
|
2019-12-02 11:00:09 +01:00
|
|
|
print '<table class="nobordernopadding" width="100%"><tr><td>'.$langs->trans('LastSuppliersBills', ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/fourn/facture/list.php?socid='.$object->id.'">'.$langs->trans('AllBills').'<span class="badge marginleftonlyshort">'.$num.'</span></td>';
|
2019-03-07 20:46:38 +01:00
|
|
|
print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/compta/facture/stats/index.php?mode=supplier&socid='.$object->id.'">'.img_picto($langs->trans("Statistics"), 'stats').'</a></td>';
|
2011-06-13 17:14:11 +02:00
|
|
|
print '</tr></table>';
|
|
|
|
|
print '</td></tr>';
|
|
|
|
|
}
|
2018-04-22 18:51:03 +02:00
|
|
|
|
2019-01-27 11:55:16 +01:00
|
|
|
while ($i < min($num, $MAXLIST))
|
2009-10-04 14:16:45 +02:00
|
|
|
{
|
|
|
|
|
$obj = $db->fetch_object($resql);
|
2017-06-07 16:44:04 +02:00
|
|
|
|
2017-04-14 11:22:48 +02:00
|
|
|
print '<tr class="oddeven">';
|
2009-10-04 14:16:45 +02:00
|
|
|
print '<td>';
|
2014-09-18 21:18:25 +02:00
|
|
|
print '<a href="facture/card.php?facid='.$obj->rowid.'">';
|
2020-04-10 10:59:32 +02:00
|
|
|
$facturestatic->id = $obj->rowid;
|
|
|
|
|
$facturestatic->ref = ($obj->ref ? $obj->ref : $obj->rowid);
|
2018-02-14 17:25:13 +01:00
|
|
|
$facturestatic->ref_supplier = $obj->ref_supplier;
|
2020-04-10 10:59:32 +02:00
|
|
|
$facturestatic->libelle = $obj->label; // deprecated
|
2019-11-02 12:59:38 +01:00
|
|
|
$facturestatic->label = $obj->label;
|
2018-02-14 17:25:13 +01:00
|
|
|
$facturestatic->total_ht = $obj->total_ht;
|
2015-01-25 01:20:58 +01:00
|
|
|
$facturestatic->total_tva = $obj->total_tva;
|
|
|
|
|
$facturestatic->total_ttc = $obj->total_ttc;
|
2014-11-15 20:48:39 +01:00
|
|
|
print $facturestatic->getNomUrl(1);
|
2020-04-10 10:59:32 +02:00
|
|
|
print $obj->ref_supplier ? ' - '.$obj->ref_supplier : '';
|
|
|
|
|
print ($obj->label ? ' - ' : '').dol_trunc($obj->label, 14);
|
2014-11-15 20:48:39 +01:00
|
|
|
print '</td>';
|
2019-03-07 20:46:38 +01:00
|
|
|
print '<td class="center nowrap">'.dol_print_date($db->jdate($obj->df), 'day').'</td>';
|
|
|
|
|
print '<td class="right nowrap">'.price($obj->amount).'</td>';
|
|
|
|
|
print '<td class="right nowrap">';
|
2019-01-27 11:55:16 +01:00
|
|
|
print $facturestatic->LibStatut($obj->paye, $obj->fk_statut, 5, $obj->am);
|
2010-05-21 00:23:58 +02:00
|
|
|
print '</td>';
|
2009-10-04 14:16:45 +02:00
|
|
|
print '</tr>';
|
|
|
|
|
$i++;
|
|
|
|
|
}
|
|
|
|
|
$db->free($resql);
|
2011-11-03 01:59:13 +01:00
|
|
|
if ($num > 0) print '</table>';
|
2020-05-21 15:05:19 +02:00
|
|
|
} else {
|
2009-10-04 14:16:45 +02:00
|
|
|
dol_print_error($db);
|
2005-12-05 19:49:35 +01:00
|
|
|
}
|
|
|
|
|
}
|
2003-01-28 18:54:37 +01:00
|
|
|
|
2013-04-21 17:56:29 +02:00
|
|
|
print '</div></div></div>';
|
|
|
|
|
print '<div style="clear:both"></div>';
|
2013-04-28 01:12:40 +02:00
|
|
|
|
2013-04-21 17:56:29 +02:00
|
|
|
dol_fiche_end();
|
2006-03-18 23:46:29 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Barre d'actions
|
|
|
|
|
*/
|
2016-05-05 21:38:29 +02:00
|
|
|
print '<div class="tabsAction">';
|
|
|
|
|
|
2014-09-23 11:59:57 +02:00
|
|
|
$parameters = array();
|
|
|
|
|
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
|
2014-09-29 15:40:31 +02:00
|
|
|
// modified by hook
|
2014-11-15 20:48:39 +01:00
|
|
|
if (empty($reshook))
|
2014-09-29 15:40:31 +02:00
|
|
|
{
|
2017-02-24 15:16:53 +01:00
|
|
|
if ($object->status != 1)
|
|
|
|
|
{
|
2018-11-13 21:40:17 +01:00
|
|
|
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyIsClosed")).'" href="#">'.$langs->trans("ThirdPartyIsClosed").'</a></div>';
|
2017-02-24 15:16:53 +01:00
|
|
|
}
|
2017-06-07 16:44:04 +02:00
|
|
|
|
2017-01-23 20:38:26 +01:00
|
|
|
if ($conf->supplier_proposal->enabled && $user->rights->supplier_proposal->creer)
|
|
|
|
|
{
|
|
|
|
|
$langs->load("supplier_proposal");
|
2019-10-27 09:51:15 +01:00
|
|
|
if ($object->status == 1) {
|
|
|
|
|
print '<a class="butAction" href="'.DOL_URL_ROOT.'/supplier_proposal/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddSupplierProposal").'</a>';
|
|
|
|
|
} else {
|
|
|
|
|
print '<a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyIsClosed")).'" href="#">'.$langs->trans("AddSupplierProposal").'</a>';
|
|
|
|
|
}
|
2017-01-23 20:38:26 +01:00
|
|
|
}
|
|
|
|
|
|
2017-09-15 11:02:34 +02:00
|
|
|
if ($user->rights->fournisseur->commande->creer)
|
2016-01-02 18:51:31 +01:00
|
|
|
{
|
|
|
|
|
$langs->load("orders");
|
2019-10-27 09:51:15 +01:00
|
|
|
if ($object->status == 1) {
|
|
|
|
|
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddOrder").'</a>';
|
|
|
|
|
} else {
|
|
|
|
|
print '<a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyIsClosed")).'" href="#">'.$langs->trans("AddOrder").'</a>';
|
|
|
|
|
}
|
2016-01-02 18:51:31 +01:00
|
|
|
}
|
2012-10-16 17:59:00 +02:00
|
|
|
|
2016-01-02 18:51:31 +01:00
|
|
|
if ($user->rights->fournisseur->facture->creer)
|
|
|
|
|
{
|
2019-11-13 19:35:39 +01:00
|
|
|
if (!empty($orders2invoice) && $orders2invoice > 0)
|
2017-09-15 11:02:34 +02:00
|
|
|
{
|
2019-10-27 09:51:15 +01:00
|
|
|
if ($object->status == 1)
|
2017-09-15 11:02:34 +02:00
|
|
|
{
|
2019-10-27 09:51:15 +01:00
|
|
|
// Company is open
|
2017-09-15 11:02:34 +02:00
|
|
|
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/orderstoinvoice.php?socid='.$object->id.'">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
|
2020-05-21 15:05:19 +02:00
|
|
|
} else {
|
2018-11-13 21:40:17 +01:00
|
|
|
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
|
2017-09-15 11:02:34 +02:00
|
|
|
}
|
2020-05-21 15:05:19 +02:00
|
|
|
} else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("NoOrdersToInvoice").' ('.$langs->trans("WithReceptionFinished").')').'" href="#">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
|
2016-01-02 18:51:31 +01:00
|
|
|
}
|
2010-02-27 21:30:55 +01:00
|
|
|
|
2020-03-04 13:31:19 +01:00
|
|
|
if ($user->rights->fournisseur->facture->creer)
|
|
|
|
|
{
|
|
|
|
|
$langs->load("bills");
|
|
|
|
|
if ($object->status == 1) {
|
|
|
|
|
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddBill").'</a>';
|
|
|
|
|
} else {
|
|
|
|
|
print '<a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyIsClosed")).'" href="#">'.$langs->trans("AddBill").'</a>';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-02 18:51:31 +01:00
|
|
|
// Add action
|
2019-11-13 19:35:39 +01:00
|
|
|
if (!empty($conf->agenda->enabled) && !empty($conf->global->MAIN_REPEATTASKONEACHTAB) && $object->status == 1)
|
2016-01-02 18:51:31 +01:00
|
|
|
{
|
|
|
|
|
if ($user->rights->agenda->myactions->create)
|
|
|
|
|
{
|
|
|
|
|
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddAction").'</a>';
|
2020-05-21 15:05:19 +02:00
|
|
|
} else {
|
2016-01-02 18:51:31 +01:00
|
|
|
print '<a class="butAction" title="'.dol_escape_js($langs->trans("NotAllowed")).'" href="#">'.$langs->trans("AddAction").'</a>';
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-05-05 21:38:29 +02:00
|
|
|
}
|
2017-06-07 16:44:04 +02:00
|
|
|
|
2016-05-05 21:38:29 +02:00
|
|
|
print '</div>';
|
2017-06-07 16:44:04 +02:00
|
|
|
|
2016-01-02 18:51:31 +01:00
|
|
|
|
2019-11-13 19:35:39 +01:00
|
|
|
if (!empty($conf->global->MAIN_DUPLICATE_CONTACTS_TAB_ON_MAIN_CARD))
|
2017-02-24 15:16:53 +01:00
|
|
|
{
|
|
|
|
|
print '<br>';
|
|
|
|
|
// List of contacts
|
2019-01-27 11:55:16 +01:00
|
|
|
show_contacts($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id);
|
2017-02-24 15:16:53 +01:00
|
|
|
}
|
2016-01-02 18:51:31 +01:00
|
|
|
|
2019-11-13 19:35:39 +01:00
|
|
|
if (!empty($conf->global->MAIN_REPEATTASKONEACHTAB))
|
2017-02-24 15:16:53 +01:00
|
|
|
{
|
2019-01-27 11:55:16 +01:00
|
|
|
print load_fiche_titre($langs->trans("ActionsOnCompany"), '', '');
|
2016-01-02 18:51:31 +01:00
|
|
|
|
2017-02-24 15:16:53 +01:00
|
|
|
// List of todo actions
|
2019-01-27 11:55:16 +01:00
|
|
|
show_actions_todo($conf, $langs, $db, $object);
|
2016-01-02 18:51:31 +01:00
|
|
|
|
2017-02-24 15:16:53 +01:00
|
|
|
// List of done actions
|
2019-01-27 11:55:16 +01:00
|
|
|
show_actions_done($conf, $langs, $db, $object);
|
2017-02-24 15:16:53 +01:00
|
|
|
}
|
2020-05-21 15:05:19 +02:00
|
|
|
} else {
|
2009-02-20 23:53:15 +01:00
|
|
|
dol_print_error($db);
|
2002-05-06 21:10:48 +02:00
|
|
|
}
|
|
|
|
|
|
2018-08-13 10:20:21 +02:00
|
|
|
// End of page
|
2011-08-27 16:24:16 +02:00
|
|
|
llxFooter();
|
2011-12-28 15:21:29 +01:00
|
|
|
$db->close();
|