Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2019-09-27 20:02:08 +02:00
commit 981c5c877a
21 changed files with 617 additions and 207 deletions

View File

@ -23,3 +23,6 @@ The URL to go to the Dolibarr is :
The URL to go to PhpMyAdmin is (login/password is root/root) : The URL to go to PhpMyAdmin is (login/password is root/root) :
http://0.0.0.0:8080 http://0.0.0.0:8080
Setup the database connection during the installation process, please use mariad
b (name of the database container) as database host.

View File

@ -86,6 +86,18 @@ $form = new Form($db);
$formfile = new FormFile($db); $formfile = new FormFile($db);
$formactions = new FormActions($db); $formactions = new FormActions($db);
// Load object
if ($id > 0 && $action!='add') {
$ret = $object->fetch($id);
if ($ret > 0) {
$ret = $object->fetch_optionals();
$ret1 = $object->fetch_userassigned();
}
if ($ret < 0 || $ret1 < 0) {
dol_print_error('', $object->error);
}
}
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
@ -94,6 +106,9 @@ $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('actioncard','globalcard')); $hookmanager->initHooks(array('actioncard','globalcard'));
$parameters = array('socid' => $socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
/* /*
* Actions * Actions
@ -101,7 +116,7 @@ $hookmanager->initHooks(array('actioncard','globalcard'));
$listUserAssignedUpdated = false; $listUserAssignedUpdated = false;
// Remove user to assigned list // Remove user to assigned list
if (GETPOST('removedassigned') || GETPOST('removedassigned') == '0') if (empty($reshook) && (GETPOST('removedassigned') || GETPOST('removedassigned') == '0'))
{ {
$idtoremove=GETPOST('removedassigned'); $idtoremove=GETPOST('removedassigned');
@ -122,7 +137,7 @@ if (GETPOST('removedassigned') || GETPOST('removedassigned') == '0')
} }
// Add user to assigned list // Add user to assigned list
if (GETPOST('addassignedtouser') || GETPOST('updateassignedtouser')) if (empty($reshook) && (GETPOST('addassignedtouser') || GETPOST('updateassignedtouser')))
{ {
// Add a new user // Add a new user
if (GETPOST('assignedtouser') > 0) if (GETPOST('assignedtouser') > 0)
@ -143,15 +158,15 @@ if (GETPOST('addassignedtouser') || GETPOST('updateassignedtouser'))
} }
// Link to a project // Link to a project
if ($action == 'classin' && ($user->rights->agenda->allactions->create || if (empty($reshook) && $action == 'classin' && ($user->rights->agenda->allactions->create ||
(($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create))) (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create)))
{ {
$object->fetch($id); //$object->fetch($id);
$object->setProject(GETPOST('projectid', 'int')); $object->setProject(GETPOST('projectid', 'int'));
} }
// Action clone object // Action clone object
if ($action == 'confirm_clone' && $confirm == 'yes') if (empty($reshook) && $action == 'confirm_clone' && $confirm == 'yes')
{ {
if (1 == 0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers')) if (1 == 0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers'))
{ {
@ -160,7 +175,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes')
else else
{ {
if ($id > 0) { if ($id > 0) {
$object->fetch($id); //$object->fetch($id);
if (!empty($object->socpeopleassigned)) { if (!empty($object->socpeopleassigned)) {
reset($object->socpeopleassigned); reset($object->socpeopleassigned);
$object->contactid = key($object->socpeopleassigned); $object->contactid = key($object->socpeopleassigned);
@ -178,7 +193,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes')
} }
// Add event // Add event
if ($action == 'add') if (empty($reshook) && $action == 'add')
{ {
$error=0; $error=0;
@ -403,7 +418,7 @@ if ($action == 'add')
/* /*
* Action update event * Action update event
*/ */
if ($action == 'update') if (empty($reshook) && $action == 'update')
{ {
if (empty($cancel)) if (empty($cancel))
{ {
@ -421,7 +436,9 @@ if ($action == 'update')
if ($p2min == -1) $p2min='0'; if ($p2min == -1) $p2min='0';
$object->fetch($id); $object->fetch($id);
$object->fetch_optionals();
$object->fetch_userassigned(); $object->fetch_userassigned();
$object->oldcopy = clone $object;
$datep=dol_mktime($fulldayevent?'00':$aphour, $fulldayevent?'00':$apmin, 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]); $datep=dol_mktime($fulldayevent?'00':$aphour, $fulldayevent?'00':$apmin, 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]);
$datef=dol_mktime($fulldayevent?'23':$p2hour, $fulldayevent?'59':$p2min, $fulldayevent?'59':'0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]); $datef=dol_mktime($fulldayevent?'23':$p2hour, $fulldayevent?'59':$p2min, $fulldayevent?'59':'0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]);
@ -605,9 +622,12 @@ if ($action == 'update')
/* /*
* delete event * delete event
*/ */
if ($action == 'confirm_delete' && GETPOST("confirm") == 'yes') if (empty($reshook) && $action == 'confirm_delete' && GETPOST("confirm") == 'yes')
{ {
$object->fetch($id); $object->fetch($id);
$object->fetch_optionals();
$object->fetch_userassigned();
$object->oldcopy = clone $object;
if ($user->rights->agenda->myactions->delete if ($user->rights->agenda->myactions->delete
|| $user->rights->agenda->allactions->delete) || $user->rights->agenda->allactions->delete)
@ -630,10 +650,9 @@ if ($action == 'confirm_delete' && GETPOST("confirm") == 'yes')
* Action move update, used when user move an event in calendar by drag'n drop * Action move update, used when user move an event in calendar by drag'n drop
* TODO Move this into page comm/action/index that trigger this call by the drag and drop of event. * TODO Move this into page comm/action/index that trigger this call by the drag and drop of event.
*/ */
if (GETPOST('actionmove', 'alpha') == 'mupdate') if (empty($reshook) && GETPOST('actionmove', 'alpha') == 'mupdate')
{ {
$object->fetch($id); $error = 0;
$object->fetch_userassigned();
$shour = dol_print_date($object->datep, "%H"); $shour = dol_print_date($object->datep, "%H");
$smin = dol_print_date($object->datep, "%M"); $smin = dol_print_date($object->datep, "%M");
@ -653,10 +672,76 @@ if (GETPOST('actionmove', 'alpha') == 'mupdate')
$object->datef+=$datep-$object->datep; $object->datef+=$datep-$object->datep;
} }
$object->datep=$datep; $object->datep=$datep;
$result=$object->update($user);
if ($result < 0) if (!$error) {
{ // check if an event resource is already in use
setEventMessages($object->error, $object->errors, 'errors'); if (!empty($conf->global->RESOURCE_USED_IN_EVENT_CHECK) && $object->element == 'action') {
$eventDateStart = $object->datep;
$eventDateEnd = $object->datef;
$sql = "SELECT er.rowid, r.ref as r_ref, ac.id as ac_id, ac.label as ac_label";
$sql .= " FROM " . MAIN_DB_PREFIX . "element_resources as er";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "resource as r ON r.rowid = er.resource_id AND er.resource_type = 'dolresource'";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "actioncomm as ac ON ac.id = er.element_id AND er.element_type = '" . $db->escape($object->element) . "'";
$sql .= " WHERE ac.id != " . $object->id;
$sql .= " AND er.resource_id IN (";
$sql .= " SELECT resource_id FROM " . MAIN_DB_PREFIX . "element_resources";
$sql .= " WHERE element_id = " . $object->id;
$sql .= " AND element_type = '" . $db->escape($object->element) . "'";
$sql .= " AND busy = 1";
$sql .= ")";
$sql .= " AND er.busy = 1";
$sql .= " AND (";
// event date start between ac.datep and ac.datep2 (if datep2 is null we consider there is no end)
$sql .= " (ac.datep <= '" . $db->idate($eventDateStart) . "' AND (ac.datep2 IS NULL OR ac.datep2 >= '" . $db->idate($eventDateStart) . "'))";
// event date end between ac.datep and ac.datep2
if (!empty($eventDateEnd)) {
$sql .= " OR (ac.datep <= '" . $db->idate($eventDateEnd) . "' AND (ac.datep2 >= '" . $db->idate($eventDateEnd) . "'))";
}
// event date start before ac.datep and event date end after ac.datep2
$sql .= " OR (";
$sql .= "ac.datep >= '" . $db->idate($eventDateStart) . "'";
if (!empty($eventDateEnd)) {
$sql .= " AND (ac.datep2 IS NOT NULL AND ac.datep2 <= '" . $db->idate($eventDateEnd) . "')";
}
$sql .= ")";
$sql .= ")";
$resql = $db->query($sql);
if (!$resql) {
$error++;
$object->error = $db->lasterror();
$object->errors[] = $object->error;
} else {
if ($db->num_rows($resql) > 0) {
// already in use
$error++;
$object->error = $langs->trans('ErrorResourcesAlreadyInUse') . ' : ';
while ($obj = $db->fetch_object($resql)) {
$object->error .= '<br> - ' . $langs->trans('ErrorResourceUseInEvent', $obj->r_ref, $obj->ac_label . ' [' . $obj->ac_id . ']');
}
$object->errors[] = $object->error;
}
$db->free($resql);
}
if ($error) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
if (!$error) {
$db->begin();
$result = $object->update($user);
if ($result < 0) {
$error++;
setEventMessages($object->error, $object->errors, 'errors');
$db->rollback();
} else {
$db->commit();
}
} }
} }
if (! empty($backtopage)) if (! empty($backtopage))
@ -673,7 +758,9 @@ if (GETPOST('actionmove', 'alpha') == 'mupdate')
// Actions to delete doc // Actions to delete doc
$upload_dir = $conf->agenda->dir_output.'/'.dol_sanitizeFileName($object->ref); $upload_dir = $conf->agenda->dir_output.'/'.dol_sanitizeFileName($object->ref);
$permissioncreate = ($user->rights->agenda->allactions->create || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->read)); $permissioncreate = ($user->rights->agenda->allactions->create || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->read));
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; if (empty($reshook)) {
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
}
/* /*

View File

@ -237,6 +237,11 @@ class AgendaEvents extends DolibarrApi
} }
$result = $this->actioncomm->fetch($id); $result = $this->actioncomm->fetch($id);
if ($result) {
$this->actioncomm->fetch_optionals();
$this->actioncomm->fetch_userassigned();
$this->actioncomm->oldcopy = clone $this->actioncomm;
}
if ( ! $result ) { if ( ! $result ) {
throw new RestException(404, 'actioncomm not found'); throw new RestException(404, 'actioncomm not found');
} }
@ -270,6 +275,11 @@ class AgendaEvents extends DolibarrApi
} }
$result = $this->actioncomm->fetch($id); $result = $this->actioncomm->fetch($id);
if ($result) {
$this->actioncomm->fetch_optionals();
$this->actioncomm->fetch_userassigned();
$this->actioncomm->oldcopy = clone $this->actioncomm;
}
if(! DolibarrApiAccess::$user->rights->agenda->allactions->delete && DolibarrApiAccess::$user->id != $this->actioncomm->userownerid) { if(! DolibarrApiAccess::$user->rights->agenda->allactions->delete && DolibarrApiAccess::$user->id != $this->actioncomm->userownerid) {
throw new RestException(401, "Insuffisant rights to delete an Agenda Event of owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id); throw new RestException(401, "Insuffisant rights to delete an Agenda Event of owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id);

View File

@ -12,7 +12,7 @@
* Copyright (C) 2013 Jean-Francois FERRY <jfefe@aternatik.fr> * Copyright (C) 2013 Jean-Francois FERRY <jfefe@aternatik.fr>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2014-2018 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2014-2019 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *
@ -2862,49 +2862,6 @@ if ($action == 'create')
} }
} }
// Type de facture
$facids = $facturestatic->list_replacable_invoices($soc->id);
if ($facids < 0) {
dol_print_error($db, $facturestatic);
exit();
}
$options = "";
foreach ($facids as $facparam)
{
$options .= '<option value="' . $facparam ['id'] . '"';
if ($facparam ['id'] == $_POST['fac_replacement'])
$options .= ' selected';
$options .= '>' . $facparam ['ref'];
$options .= ' (' . $facturestatic->LibStatut(0, $facparam ['status']) . ')';
$options .= '</option>';
}
// Show link for credit note
$facids=$facturestatic->list_qualified_avoir_invoices($soc->id);
if ($facids < 0)
{
dol_print_error($db, $facturestatic);
exit;
}
$optionsav = "";
$newinvoice_static = new Facture($db);
foreach ($facids as $key => $valarray)
{
$newinvoice_static->id = $key;
$newinvoice_static->ref = $valarray ['ref'];
$newinvoice_static->statut = $valarray ['status'];
$newinvoice_static->type = $valarray ['type'];
$newinvoice_static->paye = $valarray ['paye'];
$optionsav .= '<option value="' . $key . '"';
if ($key == GETPOST('fac_avoir'))
$optionsav .= ' selected';
$optionsav .= '>';
$optionsav .= $newinvoice_static->ref;
$optionsav .= ' (' . $newinvoice_static->getLibStatut(1, $valarray ['paymentornot']) . ')';
$optionsav .= '</option>';
}
print '<tr><td class="tdtop fieldrequired">' . $langs->trans('Type') . '</td><td colspan="2">'; print '<tr><td class="tdtop fieldrequired">' . $langs->trans('Type') . '</td><td colspan="2">';
print '<div class="tagtable">' . "\n"; print '<div class="tagtable">' . "\n";
@ -2981,6 +2938,23 @@ if ($action == 'create')
// Replacement // Replacement
if (empty($conf->global->INVOICE_DISABLE_REPLACEMENT)) if (empty($conf->global->INVOICE_DISABLE_REPLACEMENT))
{ {
// Type de facture
$facids = $facturestatic->list_replacable_invoices($soc->id);
if ($facids < 0) {
dol_print_error($db, $facturestatic);
exit();
}
$options = "";
foreach ($facids as $facparam)
{
$options .= '<option value="' . $facparam ['id'] . '"';
if ($facparam ['id'] == $_POST['fac_replacement'])
$options .= ' selected';
$options .= '>' . $facparam ['ref'];
$options .= ' (' . $facturestatic->LibStatut(0, $facparam ['status']) . ')';
$options .= '</option>';
}
print '<!-- replacement line -->'; print '<!-- replacement line -->';
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">'; print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
$tmp='<input type="radio" name="type" id="radio_replacement" value="1"' . (GETPOST('type') == 1 ? ' checked' : ''); $tmp='<input type="radio" name="type" id="radio_replacement" value="1"' . (GETPOST('type') == 1 ? ' checked' : '');
@ -3048,6 +3022,32 @@ if ($action == 'create')
// Credit note // Credit note
if (empty($conf->global->INVOICE_DISABLE_CREDIT_NOTE)) if (empty($conf->global->INVOICE_DISABLE_CREDIT_NOTE))
{ {
// Show link for credit note
$facids=$facturestatic->list_qualified_avoir_invoices($soc->id);
if ($facids < 0)
{
dol_print_error($db, $facturestatic);
exit;
}
$optionsav = "";
$newinvoice_static = new Facture($db);
foreach ($facids as $key => $valarray)
{
$newinvoice_static->id = $key;
$newinvoice_static->ref = $valarray ['ref'];
$newinvoice_static->statut = $valarray ['status'];
$newinvoice_static->type = $valarray ['type'];
$newinvoice_static->paye = $valarray ['paye'];
$optionsav .= '<option value="' . $key . '"';
if ($key == GETPOST('fac_avoir'))
$optionsav .= ' selected';
$optionsav .= '>';
$optionsav .= $newinvoice_static->ref;
$optionsav .= ' (' . $newinvoice_static->getLibStatut(1, $valarray ['paymentornot']) . ')';
$optionsav .= '</option>';
}
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">'; print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
$tmp='<input type="radio" id="radio_creditnote" name="type" value="2"' . (GETPOST('type') == 2 ? ' checked' : ''); $tmp='<input type="radio" id="radio_creditnote" name="type" value="2"' . (GETPOST('type') == 2 ? ' checked' : '');
if (! $optionsav) $tmp.=' disabled'; if (! $optionsav) $tmp.=' disabled';

View File

@ -0,0 +1,198 @@
<?php
/* Copyright (C) 2004-2006 Destailleur Laurent <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
*
* 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
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/core/boxes/box_supplier_orders.php
* \ingroup fournisseurs
* \brief Module that generates the latest supplier orders box
*/
include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
/**
* Class that manages the box showing latest supplier orders
*/
class box_supplier_orders_awaiting_reception extends ModeleBoxes
{
public $boxcode = "supplierordersawaitingreception";
public $boximg = "object_order";
public $boxlabel="BoxLatestSupplierOrdersAwaitingReception";
public $depends = array("fournisseur");
/**
* @var DoliDB Database handler.
*/
public $db;
public $param;
public $info_box_head = array();
public $info_box_contents = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
public function __construct($db, $param)
{
global $user;
$this->db = $db;
$this->hidden = ! ($user->rights->fournisseur->commande->lire);
}
/**
* Load data into info_box_contents array to show array later.
*
* @param int $max Maximum number of records to load
* @return void
*/
public function loadBox($max = 5)
{
global $conf, $user, $langs, $db;
$langs->loadLangs(array("boxes", "sendings"));
$this->max = $max;
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
$supplierorderstatic=new CommandeFournisseur($db);
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
$thirdpartytmp = new Fournisseur($db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleSupplierOrdersAwaitingReception", $max));
if ($user->rights->fournisseur->commande->lire)
{
$sql = "SELECT s.nom as name, s.rowid as socid,";
$sql.= " s.code_client, s.code_fournisseur,";
$sql.= " s.logo,";
$sql.= " c.rowid, c.ref, c.tms, c.date_commande, c.date_livraison, ";
$sql.= " c.total_ht,";
$sql.= " c.tva as total_tva,";
$sql.= " c.total_ttc,";
$sql.= " c.fk_statut";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as c";
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE c.fk_soc = s.rowid";
$sql.= " AND c.entity = ".$conf->entity;
$sql.= " AND c.fk_statut = ".CommandeFournisseur::STATUS_ORDERSENT;
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($user->socid) $sql.= " AND s.rowid = ".$user->socid;
if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY c.date_commande DESC, c.ref DESC ";
else $sql.= " ORDER BY c.date_livraison ASC, c.fk_statut ASC ";
$sql.= $db->plimit($max, 0);
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
$line = 0;
while ($line < $num) {
$objp = $db->fetch_object($result);
$date=$db->jdate($objp->date_commande);
$date_livraison=$db->jdate($objp->date_livraison);
$datem=$db->jdate($objp->tms);
$supplierorderstatic->date_livraison = $date_livraison;
$supplierorderstatic->statut = $objp->fk_statut;
$supplierorderstatic->id = $objp->rowid;
$supplierorderstatic->ref = $objp->ref;
$thirdpartytmp->id = $objp->socid;
$thirdpartytmp->name = $objp->name;
$thirdpartytmp->fournisseur = 1;
$thirdpartytmp->code_fournisseur = $objp->code_fournisseur;
$thirdpartytmp->logo = $objp->logo;
$this->info_box_contents[$line][] = array(
'td' => '',
'text' => $supplierorderstatic->getNomUrl(1),
'asis' => 1
);
$this->info_box_contents[$line][] = array(
'td' => '',
'text' => $thirdpartytmp->getNomUrl(1, 'supplier'),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right nowrap"',
'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency),
);
$delayIcon = '';
if ($supplierorderstatic->hasDelay()) {
$delayIcon = img_warning($langs->trans("Late"));
}
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => $delayIcon.'<span class="classfortooltip" title="'.$langs->trans('DateDeliveryPlanned').'"><i class="fa fa-dolly" ></i> '. dol_print_date($date_livraison, 'day').'</span>',
'asis' => 1
);
$line++;
}
if ($num == 0)
$this->info_box_contents[$line][] = array(
'td' => 'class="center"',
'text' => $langs->trans("NoSupplierOrder"),
);
$db->free($result);
} else {
$this->info_box_contents[0][] = array(
'td' => '',
'maxlength'=>500,
'text' => ($db->error().' sql='.$sql),
);
}
}
else
{
$this->info_box_contents[0][] = array(
'td' => 'class="nohover opacitymedium left"',
'text' => $langs->trans("ReadPermissionNotAllowed")
);
}
}
/**
* Method to show box
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return string
*/
public function showBox($head = null, $contents = null, $nooutput = 0)
{
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@ -1277,7 +1277,7 @@ class ExtraFields
// Several field into label (eq table:code|libelle:rowid) // Several field into label (eq table:code|libelle:rowid)
$notrans = false; $notrans = false;
$fields_label = explode('|', $InfoFieldList[1]); $fields_label = explode('|', $InfoFieldList[1]);
if (is_array($fields_label)) { if (is_array($fields_label) && count($fields_label) > 1) {
$notrans = true; $notrans = true;
foreach ($fields_label as $field_toshow) { foreach ($fields_label as $field_toshow) {
$labeltoshow .= $obj->$field_toshow . ' '; $labeltoshow .= $obj->$field_toshow . ' ';
@ -1291,27 +1291,16 @@ class ExtraFields
if (!$notrans) { if (!$notrans) {
foreach ($fields_label as $field_toshow) { foreach ($fields_label as $field_toshow) {
$translabel = $langs->trans($obj->$field_toshow); $translabel = $langs->trans($obj->$field_toshow);
if ($translabel != $obj->$field_toshow) { $labeltoshow = dol_trunc($translabel, 18) . ' ';
$labeltoshow = dol_trunc($translabel, 18) . ' ';
} else {
$labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' ';
}
} }
} }
$out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>'; $out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>';
} else { } else {
if (!$notrans) { if (!$notrans) {
$translabel = $langs->trans($obj->{$InfoFieldList[1]}); $translabel = $langs->trans($obj->{$InfoFieldList[1]});
if ($translabel != $obj->{$InfoFieldList[1]}) { $labeltoshow = dol_trunc($translabel, 18);
$labeltoshow = dol_trunc($translabel, 18);
} else {
$labeltoshow = dol_trunc($obj->{$InfoFieldList[1]}, 18);
}
} }
if (empty($labeltoshow)) $labeltoshow = '(not defined)'; if (empty($labeltoshow)) $labeltoshow = '(not defined)';
if ($value == $obj->rowid) {
$out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>';
}
if (!empty($InfoFieldList[3]) && $parentField) { if (!empty($InfoFieldList[3]) && $parentField) {
$parent = $parentName . ':' . $obj->{$parentField}; $parent = $parentName . ':' . $obj->{$parentField};

View File

@ -2064,6 +2064,11 @@ class Form
$out=''; $out='';
$outarray=array(); $outarray=array();
// Units
if ($conf->global->PRODUCT_USE_UNITS) {
$langs->load('other');
}
$warehouseStatusArray = array(); $warehouseStatusArray = array();
if (! empty($warehouseStatus)) if (! empty($warehouseStatus))
{ {
@ -2114,8 +2119,8 @@ class Form
} }
// Units // Units
if (! empty($conf->global->PRODUCT_USE_UNITS)) { if (! empty($conf->global->PRODUCT_USE_UNITS)) {
$sql .= ', u.label as unit_long, u.short_label as unit_short'; $sql .= ", u.label as unit_long, u.short_label as unit_short, p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units";
$selectFields .= ', unit_long, unit_short'; $selectFields .= ', unit_long, unit_short, p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units';
} }
// Multilang : we add translation // Multilang : we add translation
@ -2408,6 +2413,42 @@ class Form
$outdurationvalue=$outtype == Product::TYPE_SERVICE?substr($objp->duration, 0, dol_strlen($objp->duration)-1):''; $outdurationvalue=$outtype == Product::TYPE_SERVICE?substr($objp->duration, 0, dol_strlen($objp->duration)-1):'';
$outdurationunit=$outtype == Product::TYPE_SERVICE?substr($objp->duration, -1):''; $outdurationunit=$outtype == Product::TYPE_SERVICE?substr($objp->duration, -1):'';
// Units
$outvalUnits = '';
if ($conf->global->PRODUCT_USE_UNITS) {
if (!empty($objp->unit_short)) {
$outvalUnits .= ' - ' . $objp->unit_short;
}
if (!empty($objp->weight) && $objp->weight_units!==null) {
$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs);
$outvalUnits .= ' - ' . $unitToShow;
}
if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units!==null) {
$unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuring_units_string($objp->length_units, 'size');
$outvalUnits .= ' - ' . $unitToShow;
}
if (!empty($objp->surface) && $objp->surface_units!==null) {
$unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs);
$outvalUnits .= ' - ' . $unitToShow;
}
if (!empty($objp->volume) && $objp->volume_units!==null) {
$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs);
$outvalUnits .= ' - ' . $unitToShow;
}
if ($outdurationvalue && $outdurationunit) {
$da = array(
'h' => $langs->trans('Hour'),
'd' => $langs->trans('Day'),
'w' => $langs->trans('Week'),
'm' => $langs->trans('Month'),
'y' => $langs->trans('Year')
);
if (isset($da[$outdurationunit])) {
$outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : ''));
}
}
}
$opt = '<option value="'.$objp->rowid.'"'; $opt = '<option value="'.$objp->rowid.'"';
$opt.= ($objp->rowid == $selected)?' selected':''; $opt.= ($objp->rowid == $selected)?' selected':'';
if (!empty($objp->price_by_qty_rowid) && $objp->price_by_qty_rowid > 0) if (!empty($objp->price_by_qty_rowid) && $objp->price_by_qty_rowid > 0)
@ -2423,16 +2464,15 @@ class Form
$opt.= $objp->ref; $opt.= $objp->ref;
if ($outbarcode) $opt.=' ('.$outbarcode.')'; if ($outbarcode) $opt.=' ('.$outbarcode.')';
$opt.=' - '.dol_trunc($label, $maxlengtharticle); $opt.=' - '.dol_trunc($label, $maxlengtharticle);
// Units
if (! empty($conf->global->PRODUCT_USE_UNITS)) {
$opt .= ' (' . $objp->unit_short . ')';
}
$objRef = $objp->ref; $objRef = $objp->ref;
if (! empty($filterkey) && $filterkey != '') $objRef=preg_replace('/('.preg_quote($filterkey).')/i', '<strong>$1</strong>', $objRef, 1); if (! empty($filterkey) && $filterkey != '') $objRef=preg_replace('/('.preg_quote($filterkey).')/i', '<strong>$1</strong>', $objRef, 1);
$outval.=$objRef; $outval.=$objRef;
if ($outbarcode) $outval.=' ('.$outbarcode.')'; if ($outbarcode) $outval.=' ('.$outbarcode.')';
$outval.=' - '.dol_trunc($label, $maxlengtharticle); $outval.=' - '.dol_trunc($label, $maxlengtharticle);
// Units
$opt .= $outvalUnits;
$outval .= $outvalUnits;
$found=0; $found=0;
@ -2594,17 +2634,6 @@ class Form
} }
} }
if ($outdurationvalue && $outdurationunit)
{
$da=array("h"=>$langs->trans("Hour"),"d"=>$langs->trans("Day"),"w"=>$langs->trans("Week"),"m"=>$langs->trans("Month"),"y"=>$langs->trans("Year"));
if (isset($da[$outdurationunit]))
{
$key = $da[$outdurationunit].($outdurationvalue > 1?'s':'');
$opt.= ' - '.$outdurationvalue.' '.$langs->trans($key);
$outval.=' - '.$outdurationvalue.' '.$langs->transnoentities($key);
}
}
$opt.= "</option>\n"; $opt.= "</option>\n";
$optJson = array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'label2'=>$outlabel, 'desc'=>$outdesc, 'type'=>$outtype, 'price_ht'=>price2num($outprice_ht), 'price_ttc'=>price2num($outprice_ttc), 'pricebasetype'=>$outpricebasetype, 'tva_tx'=>$outtva_tx, 'qty'=>$outqty, 'discount'=>$outdiscount, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit); $optJson = array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'label2'=>$outlabel, 'desc'=>$outdesc, 'type'=>$outtype, 'price_ht'=>price2num($outprice_ht), 'price_ttc'=>price2num($outprice_ttc), 'pricebasetype'=>$outpricebasetype, 'tva_tx'=>$outtva_tx, 'qty'=>$outqty, 'discount'=>$outdiscount, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit);
} }
@ -2679,16 +2708,28 @@ class Form
$outarray=array(); $outarray=array();
$langs->load('stocks'); $langs->load('stocks');
// Units
if ($conf->global->PRODUCT_USE_UNITS) {
$langs->load('other');
}
$sql = "SELECT p.rowid, p.label, p.ref, p.price, p.duration, p.fk_product_type,"; $sql = "SELECT p.rowid, p.label, p.ref, p.price, p.duration, p.fk_product_type,";
$sql.= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.remise_percent, pfp.remise, pfp.unitprice,"; $sql.= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.remise_percent, pfp.remise, pfp.unitprice,";
$sql.= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, pfp.fk_soc, s.nom as name,"; $sql.= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, pfp.fk_soc, s.nom as name,";
$sql.= " pfp.supplier_reputation"; $sql.= " pfp.supplier_reputation";
// Units
if ($conf->global->PRODUCT_USE_UNITS) {
$sql .= ", u.label as unit_long, u.short_label as unit_short, p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units";
}
if (! empty($conf->barcode->enabled)) $sql.= " ,pfp.barcode"; if (! empty($conf->barcode->enabled)) $sql.= " ,pfp.barcode";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
if ($socid) $sql.= " AND pfp.fk_soc = ".$socid; if ($socid) $sql.= " AND pfp.fk_soc = ".$socid;
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON pfp.fk_soc = s.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON pfp.fk_soc = s.rowid";
// Units
if ($conf->global->PRODUCT_USE_UNITS) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_units u ON u.rowid = p.fk_unit";
}
$sql.= " WHERE p.entity IN (".getEntity('product').")"; $sql.= " WHERE p.entity IN (".getEntity('product').")";
$sql.= " AND p.tobuy = 1"; $sql.= " AND p.tobuy = 1";
if (strval($filtertype) != '') $sql.=" AND p.fk_product_type=".$this->db->escape($filtertype); if (strval($filtertype) != '') $sql.=" AND p.fk_product_type=".$this->db->escape($filtertype);
@ -2749,6 +2790,42 @@ class Form
$outdurationvalue=$outtype == Product::TYPE_SERVICE?substr($objp->duration, 0, dol_strlen($objp->duration)-1):''; $outdurationvalue=$outtype == Product::TYPE_SERVICE?substr($objp->duration, 0, dol_strlen($objp->duration)-1):'';
$outdurationunit=$outtype == Product::TYPE_SERVICE?substr($objp->duration, -1):''; $outdurationunit=$outtype == Product::TYPE_SERVICE?substr($objp->duration, -1):'';
// Units
$outvalUnits = '';
if ($conf->global->PRODUCT_USE_UNITS) {
if (!empty($objp->unit_short)) {
$outvalUnits .= ' - ' . $objp->unit_short;
}
if (!empty($objp->weight) && $objp->weight_units!==null) {
$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs);
$outvalUnits .= ' - ' . $unitToShow;
}
if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units!==null) {
$unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuring_units_string($objp->length_units, 'size');
$outvalUnits .= ' - ' . $unitToShow;
}
if (!empty($objp->surface) && $objp->surface_units!==null) {
$unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs);
$outvalUnits .= ' - ' . $unitToShow;
}
if (!empty($objp->volume) && $objp->volume_units!==null) {
$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs);
$outvalUnits .= ' - ' . $unitToShow;
}
if ($outdurationvalue && $outdurationunit) {
$da = array(
'h' => $langs->trans('Hour'),
'd' => $langs->trans('Day'),
'w' => $langs->trans('Week'),
'm' => $langs->trans('Month'),
'y' => $langs->trans('Year')
);
if (isset($da[$outdurationunit])) {
$outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : ''));
}
}
}
$opt = '<option value="'.$outkey.'"'; $opt = '<option value="'.$outkey.'"';
if ($selected && $selected == $objp->idprodfournprice) $opt.= ' selected'; if ($selected && $selected == $objp->idprodfournprice) $opt.= ' selected';
if (empty($objp->idprodfournprice) && empty($alsoproductwithnosupplierprice)) $opt.=' disabled'; if (empty($objp->idprodfournprice) && empty($alsoproductwithnosupplierprice)) $opt.=' disabled';
@ -2773,8 +2850,11 @@ class Form
if (! empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) if (! empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn))
$outval.=' ('.$objRefFourn.')'; $outval.=' ('.$objRefFourn.')';
$outval.=' - '; $outval.=' - ';
$opt.=dol_trunc($label, 72).' - '; $opt.=dol_trunc($label, 72);
$outval.=dol_trunc($label, 72).' - '; $outval.=dol_trunc($label, 72);
// Units
$opt .= $outvalUnits;
$outval .= $outvalUnits;
if (! empty($objp->idprodfournprice)) if (! empty($objp->idprodfournprice))
{ {
@ -2799,15 +2879,15 @@ class Form
} }
if ($objp->quantity == 1) if ($objp->quantity == 1)
{ {
$opt.= price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/"; $opt.= ' - '.price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/";
$outval.= price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 0, $langs, 0, 0, -1, $conf->currency)."/"; $outval.= ' - '.price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 0, $langs, 0, 0, -1, $conf->currency)."/";
$opt.= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding $opt.= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding
$outval.=$langs->transnoentities("Unit"); $outval.=$langs->transnoentities("Unit");
} }
else else
{ {
$opt.= price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; $opt.= ' - '.price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
$outval.= price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; $outval.= ' - '.price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
$opt.= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding $opt.= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
$outval.= ' '.$langs->transnoentities("Units"); $outval.= ' '.$langs->transnoentities("Units");
} }
@ -2850,13 +2930,13 @@ class Form
{ {
if (empty($alsoproductwithnosupplierprice)) // No supplier price defined for couple product/supplier if (empty($alsoproductwithnosupplierprice)) // No supplier price defined for couple product/supplier
{ {
$opt.= $langs->trans("NoPriceDefinedForThisSupplier"); $opt.= ' - '.$langs->trans("NoPriceDefinedForThisSupplier");
$outval.=$langs->transnoentities("NoPriceDefinedForThisSupplier"); $outval.=' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier");
} }
else // No supplier price defined for product, even on other suppliers else // No supplier price defined for product, even on other suppliers
{ {
$opt.= $langs->trans("NoPriceDefinedForThisSupplier"); $opt.= ' - '.$langs->trans("NoPriceDefinedForThisSupplier");
$outval.=$langs->transnoentities("NoPriceDefinedForThisSupplier"); $outval.=' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier");
} }
} }
$opt .= "</option>\n"; $opt .= "</option>\n";

View File

@ -3015,9 +3015,9 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
//if (in_array($picto, array('switch_off', 'switch_on', 'off', 'on'))) //if (in_array($picto, array('switch_off', 'switch_on', 'off', 'on')))
if (empty($srconly) && in_array($pictowithoutext, array( if (empty($srconly) && in_array($pictowithoutext, array(
'bank', 'close_title', 'delete', 'edit', 'ellipsis-h', 'filter', 'grip', 'grip_title', 'list', 'listlight', 'note', 'off', 'on', 'play', 'playdisabled', 'printer', 'resize', 'bank', 'close_title', 'delete', 'edit', 'ellipsis-h', 'filter', 'grip', 'grip_title', 'list', 'listlight', 'note', 'off', 'on', 'play', 'playdisabled', 'printer', 'resize',
'note', 'setup', 'sign-out', 'split', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', '1downarrow', '1uparrow', '1leftarrow', '1rightarrow', 'note', 'setup', 'sign-out', 'split', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', '1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected',
'jabber','skype','twitter','facebook','linkedin', 'jabber','skype','twitter','facebook','linkedin',
'chevron-left','chevron-right','chevron-down','chevron-top' 'chevron-left','chevron-right','chevron-down','chevron-top'
) )
)) { )) {
$fa='fa'; $fa='fa';

View File

@ -126,6 +126,7 @@ class modFournisseur extends DolibarrModules
3=>array('file'=>'box_factures_fourn_imp.php','enabledbydefaulton'=>'Home'), 3=>array('file'=>'box_factures_fourn_imp.php','enabledbydefaulton'=>'Home'),
4=>array('file'=>'box_factures_fourn.php','enabledbydefaulton'=>'Home'), 4=>array('file'=>'box_factures_fourn.php','enabledbydefaulton'=>'Home'),
5=>array('file'=>'box_supplier_orders.php','enabledbydefaulton'=>'Home'), 5=>array('file'=>'box_supplier_orders.php','enabledbydefaulton'=>'Home'),
6=>array('file'=>'box_supplier_orders_awaiting_reception.php','enabledbydefaulton'=>'Home'),
); );
// Permissions // Permissions

View File

@ -383,6 +383,11 @@ class pdf_beluga extends ModelePDFProjects
'lang'=>'agenda') 'lang'=>'agenda')
); );
$hookmanager->initHooks(array('completeListOfReferent'));
$hookmanager->executeHooks('completeListOfReferent', ['listofreferent'=>$listofreferent], $object, $action);
if(!empty($hookmanager->resArray)) {
$listofreferent = array_merge($listofreferent, $hookmanager->resArray);
}
foreach ($listofreferent as $key => $value) foreach ($listofreferent as $key => $value)
{ {
@ -392,17 +397,13 @@ class pdf_beluga extends ModelePDFProjects
$datefieldname=$value['datefieldname']; $datefieldname=$value['datefieldname'];
$qualified=$value['test']; $qualified=$value['test'];
$langstoload=$value['lang']; $langstoload=$value['lang'];
$projectField=isset($value['project_field']) ? $value['project_field'] : 'fk_projet';
$langs->load($langstoload); $langs->load($langstoload);
if (! $qualified) continue; if (! $qualified) continue;
//var_dump("$key, $tablename, $datefieldname, $dates, $datee"); //var_dump("$key, $tablename, $datefieldname, $dates, $datee");
$elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee); $elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee, $projectField);
if ($key == 'agenda')
{
// var_dump($elementarray);
}
$num = count($elementarray); $num = count($elementarray);
if ($num >= 0) if ($num >= 0)
@ -416,7 +417,7 @@ class pdf_beluga extends ModelePDFProjects
$pdf->SetXY($this->posxref, $curY); $pdf->SetXY($this->posxref, $curY);
$pdf->MultiCell($this->posxstatut - $this->posxref, 3, $outputlangs->transnoentities($title), 0, 'L'); $pdf->MultiCell($this->posxstatut - $this->posxref, 3, $outputlangs->transnoentities($title), 0, 'L');
$selectList = $formproject->select_element($tablename, $project->thirdparty->id); $selectList = $formproject->select_element($tablename, $project->thirdparty->id, '', -2, $projectField);
$nexY = $pdf->GetY() + 1; $nexY = $pdf->GetY() + 1;
$curY = $nexY; $curY = $nexY;
$pdf->SetXY($this->posxref, $curY); $pdf->SetXY($this->posxref, $curY);
@ -591,9 +592,9 @@ class pdf_beluga extends ModelePDFProjects
// Amount without tax // Amount without tax
if (empty($value['disableamount'])) { if (empty($value['disableamount'])) {
$pdf->SetXY($this->posxamountht, $curY); $pdf->SetXY($this->posxamountht, $curY);
$pdf->MultiCell($this->posxamountttc - $this->posxamountht, 3, (isset($element->total_ht) ? price($element->total_ht) : '&nbsp;'), 1, 'R'); $pdf->MultiCell($this->posxamountttc - $this->posxamountht, 3, (isset($element->total_ht) ? price($element->total_ht) : ''), 1, 'R');
$pdf->SetXY($this->posxamountttc, $curY); $pdf->SetXY($this->posxamountttc, $curY);
$pdf->MultiCell($this->posxstatut - $this->posxamountttc, 3, (isset($element->total_ttc) ? price($element->total_ttc) : '&nbsp;'), 1, 'R'); $pdf->MultiCell($this->posxstatut - $this->posxamountttc, 3, (isset($element->total_ttc) ? price($element->total_ttc) : ''), 1, 'R');
} else { } else {
$pdf->SetXY($this->posxamountht, $curY); $pdf->SetXY($this->posxamountht, $curY);
if ($key == 'agenda') if ($key == 'agenda')
@ -630,9 +631,9 @@ class pdf_beluga extends ModelePDFProjects
$pdf->SetXY($this->posxref, $curY); $pdf->SetXY($this->posxref, $curY);
$pdf->MultiCell($this->posxamountttc - $this->posxref, 3, "TOTAL", 1, 'L'); $pdf->MultiCell($this->posxamountttc - $this->posxref, 3, "TOTAL", 1, 'L');
$pdf->SetXY($this->posxamountht, $curY); $pdf->SetXY($this->posxamountht, $curY);
$pdf->MultiCell($this->posxamountttc - $this->posxamountht, 3, (isset($element->total_ht) ? price($total_ht) : '&nbsp;'), 1, 'R'); $pdf->MultiCell($this->posxamountttc - $this->posxamountht, 3, (isset($element->total_ht) ? price($total_ht) : ''), 1, 'R');
$pdf->SetXY($this->posxamountttc, $curY); $pdf->SetXY($this->posxamountttc, $curY);
$pdf->MultiCell($this->posxstatut - $this->posxamountttc, 3, (isset($element->total_ttc) ? price($total_ttc) : '&nbsp;'), 1, 'R'); $pdf->MultiCell($this->posxstatut - $this->posxamountttc, 3, (isset($element->total_ttc) ? price($total_ttc) : ''), 1, 'R');
$pdf->SetXY($this->posxstatut, $curY); $pdf->SetXY($this->posxstatut, $curY);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxstatut, 3, $outputlangs->transnoentities("Nb") . " " . $num, 1, 'L'); $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxstatut, 3, $outputlangs->transnoentities("Nb") . " " . $num, 1, 'L');
} }

View File

@ -2038,27 +2038,28 @@ elseif ($id || $ref)
print '<br>'; print '<br>';
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%" id="tablelines" >';
print '<thead>';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
// Adds a line numbering column // Adds a line numbering column
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
{ {
print '<td width="5" class="center">&nbsp;</td>'; print '<td width="5" class="center linecolnum">&nbsp;</td>';
} }
// Product/Service // Product/Service
print '<td>'.$langs->trans("Products").'</td>'; print '<td class="linecoldescription" >'.$langs->trans("Products").'</td>';
// Qty // Qty
print '<td class="center">'.$langs->trans("QtyOrdered").'</td>'; print '<td class="center linecolqty">'.$langs->trans("QtyOrdered").'</td>';
if ($origin && $origin_id > 0) if ($origin && $origin_id > 0)
{ {
print '<td class="center">'.$langs->trans("QtyInOtherShipments").'</td>'; print '<td class="center linecolqtyinothershipments">'.$langs->trans("QtyInOtherShipments").'</td>';
} }
if ($action == 'editline') if ($action == 'editline')
{ {
$editColspan = 3; $editColspan = 3;
if (empty($conf->stock->enabled)) $editColspan--; if (empty($conf->stock->enabled)) $editColspan--;
if (empty($conf->productbatch->enabled)) $editColspan--; if (empty($conf->productbatch->enabled)) $editColspan--;
print '<td class="center" colspan="'. $editColspan . '">'; print '<td class="center linecoleditlineotherinfo" colspan="'. $editColspan . '">';
if ($object->statut <= 1) if ($object->statut <= 1)
{ {
print $langs->trans("QtyToShip").' - '; print $langs->trans("QtyToShip").' - ';
@ -2081,24 +2082,24 @@ elseif ($id || $ref)
{ {
if ($object->statut <= 1) if ($object->statut <= 1)
{ {
print '<td class="center">'.$langs->trans("QtyToShip").'</td>'; print '<td class="center linecolqtytoship">'.$langs->trans("QtyToShip").'</td>';
} }
else else
{ {
print '<td class="center">'.$langs->trans("QtyShipped").'</td>'; print '<td class="center linecolqtyshipped">'.$langs->trans("QtyShipped").'</td>';
} }
if (! empty($conf->stock->enabled)) if (! empty($conf->stock->enabled))
{ {
print '<td class="left">'.$langs->trans("WarehouseSource").'</td>'; print '<td class="left linecolwarehousesource">'.$langs->trans("WarehouseSource").'</td>';
} }
if (! empty($conf->productbatch->enabled)) if (! empty($conf->productbatch->enabled))
{ {
print '<td class="left">'.$langs->trans("Batch").'</td>'; print '<td class="left linecolbatch">'.$langs->trans("Batch").'</td>';
} }
} }
print '<td class="center">'.$langs->trans("CalculatedWeight").'</td>'; print '<td class="center linecolweight">'.$langs->trans("CalculatedWeight").'</td>';
print '<td class="center">'.$langs->trans("CalculatedVolume").'</td>'; print '<td class="center linecolvolume">'.$langs->trans("CalculatedVolume").'</td>';
//print '<td class="center">'.$langs->trans("Size").'</td>'; //print '<td class="center">'.$langs->trans("Size").'</td>';
if ($object->statut == 0) if ($object->statut == 0)
{ {
@ -2106,7 +2107,7 @@ elseif ($id || $ref)
print '<td class="linecoldelete" width="10"></td>'; print '<td class="linecoldelete" width="10"></td>';
} }
print "</tr>\n"; print "</tr>\n";
print '</thead>';
$var=false; $var=false;
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
@ -2166,6 +2167,7 @@ elseif ($id || $ref)
//var_dump($alreadysent); //var_dump($alreadysent);
} }
print '<tbody>';
// Loop on each product to send/sent // Loop on each product to send/sent
for ($i = 0 ; $i < $num_prod ; $i++) for ($i = 0 ; $i < $num_prod ; $i++)
{ {
@ -2176,12 +2178,12 @@ elseif ($id || $ref)
if(empty($reshook)) if(empty($reshook))
{ {
print '<!-- origin line id = '.$lines[$i]->origin_line_id.' -->'; // id of order line print '<!-- origin line id = '.$lines[$i]->origin_line_id.' -->'; // id of order line
print '<tr class="oddeven">'; print '<tr class="oddeven" id="row-'.$lines[$i]->id.'" data-id="'.$lines[$i]->id.'" data-element="'.$lines[$i]->element.'" >';
// # // #
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
{ {
print '<td class="center">'.($i+1).'</td>'; print '<td class="center linecolnum">'.($i+1).'</td>';
} }
// Predefined product or service // Predefined product or service
@ -2197,7 +2199,7 @@ elseif ($id || $ref)
else else
$label = (! empty($lines[$i]->label)?$lines[$i]->label:$lines[$i]->product_label); $label = (! empty($lines[$i]->label)?$lines[$i]->label:$lines[$i]->product_label);
print '<td>'; print '<td class="linecoldescription">';
// Show product and description // Show product and description
$product_static->type=$lines[$i]->fk_product_type; $product_static->type=$lines[$i]->fk_product_type;
@ -2217,7 +2219,7 @@ elseif ($id || $ref)
} }
else else
{ {
print "<td>"; print '<td class="linecoldescription" >';
if ($lines[$i]->product_type == Product::TYPE_SERVICE) $text = img_object($langs->trans('Service'), 'service'); if ($lines[$i]->product_type == Product::TYPE_SERVICE) $text = img_object($langs->trans('Service'), 'service');
else $text = img_object($langs->trans('Product'), 'product'); else $text = img_object($langs->trans('Product'), 'product');
@ -2233,12 +2235,12 @@ elseif ($id || $ref)
} }
// Qty ordered // Qty ordered
print '<td class="center">'.$lines[$i]->qty_asked.'</td>'; print '<td class="center linecolqty">'.$lines[$i]->qty_asked.'</td>';
// Qty in other shipments (with shipment and warehouse used) // Qty in other shipments (with shipment and warehouse used)
if ($origin && $origin_id > 0) if ($origin && $origin_id > 0)
{ {
print '<td class="center" class="nowrap">'; print '<td class="linecolqtyinothershipments center nowrap">';
foreach ($alreadysent as $key => $val) foreach ($alreadysent as $key => $val)
{ {
if ($lines[$i]->fk_origin_line == $key) if ($lines[$i]->fk_origin_line == $key)
@ -2352,12 +2354,12 @@ elseif ($id || $ref)
else else
{ {
// Qty to ship or shipped // Qty to ship or shipped
print '<td class="center">'.$lines[$i]->qty_shipped.'</td>'; print '<td class="linecolqtytoship center">'.$lines[$i]->qty_shipped.'</td>';
// Warehouse source // Warehouse source
if (! empty($conf->stock->enabled)) if (! empty($conf->stock->enabled))
{ {
print '<td class="left">'; print '<td class="linecolwarehousesource left">';
if ($lines[$i]->entrepot_id > 0) if ($lines[$i]->entrepot_id > 0)
{ {
$entrepot = new Entrepot($db); $entrepot = new Entrepot($db);
@ -2387,7 +2389,7 @@ elseif ($id || $ref)
if (isset($lines[$i]->detail_batch)) if (isset($lines[$i]->detail_batch))
{ {
print '<!-- Detail of lot -->'; print '<!-- Detail of lot -->';
print '<td>'; print '<td class="linecolbatch">';
if ($lines[$i]->product_tobatch) if ($lines[$i]->product_tobatch)
{ {
$detail = ''; $detail = '';
@ -2407,19 +2409,19 @@ elseif ($id || $ref)
} }
print '</td>'; print '</td>';
} else { } else {
print '<td></td>'; print '<td class="linecolbatch" ></td>';
} }
} }
} }
// Weight // Weight
print '<td class="center">'; print '<td class="center linecolweight">';
if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->weight*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->weight_units, "weight"); if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->weight*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->weight_units, "weight");
else print '&nbsp;'; else print '&nbsp;';
print '</td>'; print '</td>';
// Volume // Volume
print '<td class="center">'; print '<td class="center linecolvolume">';
if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->volume_units, "volume"); if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->volume_units, "volume");
else print '&nbsp;'; else print '&nbsp;';
print '</td>'; print '</td>';
@ -2475,6 +2477,7 @@ elseif ($id || $ref)
// TODO Show also lines ordered but not delivered // TODO Show also lines ordered but not delivered
print "</table>\n"; print "</table>\n";
print '</tbody>';
print '</div>'; print '</div>';
} }

View File

@ -2804,9 +2804,10 @@ class CommandeFournisseur extends CommonOrder
* Load indicators for dashboard (this->nbtodo and this->nbtodolate) * Load indicators for dashboard (this->nbtodo and this->nbtodolate)
* *
* @param User $user Objet user * @param User $user Objet user
* @param int $mode "opened", "awaiting" for orders awaiting reception
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
*/ */
public function load_board($user) public function load_board($user, $mode = 'opened')
{ {
// phpcs:enable // phpcs:enable
global $conf, $langs; global $conf, $langs;
@ -2822,7 +2823,12 @@ class CommandeFournisseur extends CommonOrder
$clause = " AND"; $clause = " AND";
} }
$sql.= $clause." c.entity = ".$conf->entity; $sql.= $clause." c.entity = ".$conf->entity;
$sql.= " AND c.fk_statut IN (".self::STATUS_VALIDATED.", ".self::STATUS_ACCEPTED.")"; if($mode==='awaiting'){
$sql.= " AND c.fk_statut = ".self::STATUS_ORDERSENT;
}
else{
$sql.= " AND c.fk_statut IN (".self::STATUS_VALIDATED.", ".self::STATUS_ACCEPTED.")";
}
if ($user->societe_id) $sql.=" AND c.fk_soc = ".$user->societe_id; if ($user->societe_id) $sql.=" AND c.fk_soc = ".$user->societe_id;
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
@ -2834,9 +2840,15 @@ class CommandeFournisseur extends CommonOrder
$response->warning_delay=$conf->commande->fournisseur->warning_delay/60/60/24; $response->warning_delay=$conf->commande->fournisseur->warning_delay/60/60/24;
$response->label=$langs->trans("SuppliersOrdersToProcess"); $response->label=$langs->trans("SuppliersOrdersToProcess");
$response->labelShort=$langs->trans("Opened"); $response->labelShort=$langs->trans("Opened");
$response->url=DOL_URL_ROOT.'/fourn/commande/list.php?statut=1,2,3&mainmenu=commercial&leftmenu=orders_suppliers'; $response->url=DOL_URL_ROOT.'/fourn/commande/list.php?statut=1,2&mainmenu=commercial&leftmenu=orders_suppliers';
$response->img=img_object('', "order"); $response->img=img_object('', "order");
if($mode==='awaiting'){
$response->label=$langs->trans("SuppliersOrdersAwaitingReception");
$response->labelShort=$langs->trans("AwaitingReception");
$response->url=DOL_URL_ROOT.'/fourn/commande/list.php?statut=3&mainmenu=commercial&leftmenu=orders_suppliers';
}
while ($obj=$this->db->fetch_object($resql)) while ($obj=$this->db->fetch_object($resql))
{ {
$response->nbtodo++; $response->nbtodo++;

View File

@ -10,6 +10,7 @@
* Copyright (C) 2014-2016 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2016-2017 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2016-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -1765,49 +1766,6 @@ if ($action == 'create')
print '<tr><td class="fieldrequired">'.$langs->trans('RefSupplier').'</td><td><input name="ref_supplier" value="'.(isset($_POST['ref_supplier'])?$_POST['ref_supplier']:$objectsrc->ref_supplier).'" type="text"></td>'; print '<tr><td class="fieldrequired">'.$langs->trans('RefSupplier').'</td><td><input name="ref_supplier" value="'.(isset($_POST['ref_supplier'])?$_POST['ref_supplier']:$objectsrc->ref_supplier).'" type="text"></td>';
print '</tr>'; print '</tr>';
// Type invoice
$facids = $facturestatic->list_replacable_supplier_invoices($societe->id);
if ($facids < 0) {
dol_print_error($db, $facturestatic);
exit();
}
$options = "";
foreach ($facids as $facparam)
{
$options .= '<option value="' . $facparam ['id'] . '"';
if ($facparam ['id'] == $_POST['fac_replacement'])
$options .= ' selected';
$options .= '>' . $facparam ['ref'];
$options .= ' (' . $facturestatic->LibStatut(0, $facparam ['status']) . ')';
$options .= '</option>';
}
// Show link for credit note
$facids=$facturestatic->list_qualified_avoir_supplier_invoices($societe->id);
if ($facids < 0)
{
dol_print_error($db, $facturestatic);
exit;
}
$optionsav = "";
$newinvoice_static = new FactureFournisseur($db);
foreach ($facids as $key => $valarray)
{
$newinvoice_static->id = $key;
$newinvoice_static->ref = $valarray ['ref'];
$newinvoice_static->statut = $valarray ['status'];
$newinvoice_static->type = $valarray ['type'];
$newinvoice_static->paye = $valarray ['paye'];
$optionsav .= '<option value="' . $key . '"';
if ($key == GETPOST('fac_avoir', 'int'))
$optionsav .= ' selected';
$optionsav .= '>';
$optionsav .= $newinvoice_static->ref;
$optionsav .= ' (' . $newinvoice_static->getLibStatut(1, $valarray ['paymentornot']) . ')';
$optionsav .= '</option>';
}
print '<tr><td class="tdtop fieldrequired">'.$langs->trans('Type').'</td><td>'; print '<tr><td class="tdtop fieldrequired">'.$langs->trans('Type').'</td><td>';
print '<div class="tagtable">' . "\n"; print '<div class="tagtable">' . "\n";
@ -1860,6 +1818,23 @@ if ($action == 'create')
// Replacement // Replacement
if (empty($conf->global->INVOICE_DISABLE_REPLACEMENT)) if (empty($conf->global->INVOICE_DISABLE_REPLACEMENT))
{ {
// Type invoice
$facids = $facturestatic->list_replacable_supplier_invoices($societe->id);
if ($facids < 0) {
dol_print_error($db, $facturestatic);
exit();
}
$options = "";
foreach ($facids as $facparam)
{
$options .= '<option value="' . $facparam ['id'] . '"';
if ($facparam ['id'] == $_POST['fac_replacement'])
$options .= ' selected';
$options .= '>' . $facparam ['ref'];
$options .= ' (' . $facturestatic->LibStatut(0, $facparam ['status']) . ')';
$options .= '</option>';
}
print '<!-- replacement line -->'; print '<!-- replacement line -->';
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">'; print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
$tmp='<input type="radio" name="type" id="radio_replacement" value="1"' . (GETPOST('type') == 1 ? ' checked' : ''); $tmp='<input type="radio" name="type" id="radio_replacement" value="1"' . (GETPOST('type') == 1 ? ' checked' : '');
@ -1908,6 +1883,32 @@ if ($action == 'create')
// Credit note // Credit note
if (empty($conf->global->INVOICE_DISABLE_CREDIT_NOTE)) if (empty($conf->global->INVOICE_DISABLE_CREDIT_NOTE))
{ {
// Show link for credit note
$facids=$facturestatic->list_qualified_avoir_supplier_invoices($societe->id);
if ($facids < 0)
{
dol_print_error($db, $facturestatic);
exit;
}
$optionsav = "";
$newinvoice_static = new FactureFournisseur($db);
foreach ($facids as $key => $valarray)
{
$newinvoice_static->id = $key;
$newinvoice_static->ref = $valarray ['ref'];
$newinvoice_static->statut = $valarray ['status'];
$newinvoice_static->type = $valarray ['type'];
$newinvoice_static->paye = $valarray ['paye'];
$optionsav .= '<option value="' . $key . '"';
if ($key == GETPOST('fac_avoir', 'int'))
$optionsav .= ' selected';
$optionsav .= '>';
$optionsav .= $newinvoice_static->ref;
$optionsav .= ' (' . $newinvoice_static->getLibStatut(1, $valarray ['paymentornot']) . ')';
$optionsav .= '</option>';
}
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">'; print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
$tmp='<input type="radio" id="radio_creditnote" name="type" value="2"' . (GETPOST('type') == 2 ? ' checked' : ''); $tmp='<input type="radio" id="radio_creditnote" name="type" value="2"' . (GETPOST('type') == 2 ? ' checked' : '');
if (! $optionsav) $tmp.=' disabled'; if (! $optionsav) $tmp.=' disabled';

View File

@ -409,7 +409,8 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
if (!empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire) { if (!empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire) {
include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php'; include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php';
$board = new CommandeFournisseur($db); $board = new CommandeFournisseur($db);
$dashboardlines[$board->element] = $board->load_board($user); $dashboardlines[$board->element . '_opened'] = $board->load_board($user, "opened");
$dashboardlines[$board->element . '_awaiting'] = $board->load_board($user, 'awaiting');
} }
// Number of services enabled (delayed) // Number of services enabled (delayed)
@ -541,7 +542,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
'groupName' => 'SuppliersOrders', 'groupName' => 'SuppliersOrders',
'globalStatsKey' => 'supplier_orders', 'globalStatsKey' => 'supplier_orders',
'stats' => 'stats' =>
array('order_supplier'), array('order_supplier_opened', 'order_supplier_awaiting'),
), ),
'invoice_supplier' => 'invoice_supplier' =>
array( array(

View File

@ -96,7 +96,7 @@ ALTER TABLE llx_adherent ADD gender VARCHAR(10);
ALTER TABLE llx_adherent_type ADD morphy VARCHAR(3); ALTER TABLE llx_adherent_type ADD morphy VARCHAR(3);
ALTER TABLE llx_subscription ADD fk_type integer; ALTER TABLE llx_subscription ADD fk_type integer;
UPDATE llx_subscription as s SET fk_type = (SELECT fk_adherent_type FROM llx_adherent as a where a.rowid = s.fk_adherent) where fk_type IS NULL; UPDATE llx_subscription as s SET fk_type = (SELECT fk_adherent_type FROM llx_adherent as a where a.rowid = s.fk_adherent) where fk_type IS NULL;
-- Add url_id into unique index of bank_url -- Add url_id into unique index of bank_url
ALTER TABLE llx_bank_url DROP INDEX uk_bank_url; ALTER TABLE llx_bank_url DROP INDEX uk_bank_url;
@ -219,17 +219,17 @@ CREATE TABLE llx_bom_bom(
description text, description text,
note_public text, note_public text,
note_private text, note_private text,
fk_product integer, fk_product integer,
qty double(24,8), qty double(24,8),
efficiency double(8,4), efficiency double(8,4),
date_creation datetime NOT NULL, date_creation datetime NOT NULL,
tms timestamp, tms timestamp,
date_valid datetime, date_valid datetime,
fk_user_creat integer NOT NULL, fk_user_creat integer NOT NULL,
fk_user_modif integer, fk_user_modif integer,
fk_user_valid integer, fk_user_valid integer,
import_key varchar(14), import_key varchar(14),
status integer NOT NULL status integer NOT NULL
-- END MODULEBUILDER FIELDS -- END MODULEBUILDER FIELDS
) ENGINE=innodb; ) ENGINE=innodb;
@ -248,12 +248,12 @@ create table llx_bom_bom_extrafields
CREATE TABLE llx_bom_bomline( CREATE TABLE llx_bom_bomline(
-- BEGIN MODULEBUILDER FIELDS -- BEGIN MODULEBUILDER FIELDS
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
fk_bom integer NOT NULL, fk_bom integer NOT NULL,
fk_product integer NOT NULL, fk_product integer NOT NULL,
fk_bom_child integer NULL, fk_bom_child integer NULL,
description text, description text,
import_key varchar(14), import_key varchar(14),
qty double(24,8) NOT NULL, qty double(24,8) NOT NULL,
efficiency double(8,4) NOT NULL DEFAULT 1, efficiency double(8,4) NOT NULL DEFAULT 1,
position integer NOT NULL position integer NOT NULL
-- END MODULEBUILDER FIELDS -- END MODULEBUILDER FIELDS
@ -337,23 +337,23 @@ create table llx_reception
entity integer DEFAULT 1 NOT NULL, -- multi company id entity integer DEFAULT 1 NOT NULL, -- multi company id
fk_soc integer NOT NULL, fk_soc integer NOT NULL,
fk_projet integer DEFAULT NULL, fk_projet integer DEFAULT NULL,
ref_ext varchar(30), -- reference into an external system (not used by dolibarr) ref_ext varchar(30), -- reference into an external system (not used by dolibarr)
ref_int varchar(30), -- reference into an internal system (used by dolibarr to store extern id like paypal info) ref_int varchar(30), -- reference into an internal system (used by dolibarr to store extern id like paypal info)
ref_supplier varchar(30), -- customer number ref_supplier varchar(30), -- customer number
date_creation datetime, -- date de creation date_creation datetime, -- date de creation
fk_user_author integer, -- author of creation fk_user_author integer, -- author of creation
fk_user_modif integer, -- author of last change fk_user_modif integer, -- author of last change
date_valid datetime, -- date de validation date_valid datetime, -- date de validation
fk_user_valid integer, -- valideur fk_user_valid integer, -- valideur
date_delivery datetime DEFAULT NULL, -- date planned of delivery date_delivery datetime DEFAULT NULL, -- date planned of delivery
date_reception datetime, date_reception datetime,
fk_shipping_method integer, fk_shipping_method integer,
tracking_number varchar(50), tracking_number varchar(50),
fk_statut smallint DEFAULT 0, -- 0 = draft, 1 = validated, 2 = billed or closed depending on WORKFLOW_BILL_ON_SHIPMENT option fk_statut smallint DEFAULT 0, -- 0 = draft, 1 = validated, 2 = billed or closed depending on WORKFLOW_BILL_ON_SHIPMENT option
billed smallint DEFAULT 0, billed smallint DEFAULT 0,
height float, -- height height float, -- height
width float, -- with width float, -- with
size_units integer, -- unit of all sizes (height, width, depth) size_units integer, -- unit of all sizes (height, width, depth)
@ -365,7 +365,7 @@ create table llx_reception
model_pdf varchar(255), model_pdf varchar(255),
fk_incoterms integer, -- for incoterms fk_incoterms integer, -- for incoterms
location_incoterms varchar(255), -- for incoterms location_incoterms varchar(255), -- for incoterms
import_key varchar(14), import_key varchar(14),
extraparams varchar(255) -- for other parameters with json format extraparams varchar(255) -- for other parameters with json format
)ENGINE=innodb; )ENGINE=innodb;

View File

@ -34,6 +34,7 @@ BoxTitleLastFicheInter=Latest %s modified interventions
BoxTitleOldestUnpaidCustomerBills=Customer Invoices: oldest %s unpaid BoxTitleOldestUnpaidCustomerBills=Customer Invoices: oldest %s unpaid
BoxTitleOldestUnpaidSupplierBills=Vendor Invoices: oldest %s unpaid BoxTitleOldestUnpaidSupplierBills=Vendor Invoices: oldest %s unpaid
BoxTitleCurrentAccounts=Open Accounts: balances BoxTitleCurrentAccounts=Open Accounts: balances
BoxTitleSupplierOrdersAwaitingReception=Supplier orders awaiting reception
BoxTitleLastModifiedContacts=Contacts/Addresses: last %s modified BoxTitleLastModifiedContacts=Contacts/Addresses: last %s modified
BoxMyLastBookmarks=Bookmarks: latest %s BoxMyLastBookmarks=Bookmarks: latest %s
BoxOldestExpiredServices=Oldest active expired services BoxOldestExpiredServices=Oldest active expired services

View File

@ -25,6 +25,8 @@ OrdersToBill=Sales orders delivered
OrdersInProcess=Sales orders in process OrdersInProcess=Sales orders in process
OrdersToProcess=Sales orders to process OrdersToProcess=Sales orders to process
SuppliersOrdersToProcess=Purchase orders to process SuppliersOrdersToProcess=Purchase orders to process
SuppliersOrdersAwaitingReception=Purchase orders awaiting reception
AwaitingReception=Awaiting reception
StatusOrderCanceledShort=Canceled StatusOrderCanceledShort=Canceled
StatusOrderDraftShort=Draft StatusOrderDraftShort=Draft
StatusOrderValidatedShort=Validated StatusOrderValidatedShort=Validated

View File

@ -844,6 +844,12 @@ class Livraison extends CommonObject
elseif ($statut==0) return $langs->trans($this->statuts[$statut]); elseif ($statut==0) return $langs->trans($this->statuts[$statut]);
elseif ($statut==1) return $langs->trans($this->statuts[$statut]); elseif ($statut==1) return $langs->trans($this->statuts[$statut]);
} }
elseif ($mode == 3)
{
if ($statut==-1) return img_picto($langs->trans('StatusDeliveryCanceled'), 'statut5');
if ($statut==0) return img_picto($langs->trans('StatusDeliveryDraft'), 'statut0');
if ($statut==1) return img_picto($langs->trans('StatusDeliveryValidated'), 'statut4');
}
elseif ($mode == 4) elseif ($mode == 4)
{ {
if ($statut==-1) return img_picto($langs->trans('StatusDeliveryCanceled'), 'statut5').' '.$langs->trans('StatusDeliveryCanceled'); if ($statut==-1) return img_picto($langs->trans('StatusDeliveryCanceled'), 'statut5').' '.$langs->trans('StatusDeliveryCanceled');

View File

@ -750,7 +750,7 @@ if (! defined('NOLOGIN'))
$_SESSION['lastsearch_contextpage_'.$relativepathstring]=$_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]; $_SESSION['lastsearch_contextpage_'.$relativepathstring]=$_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring];
unset($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]); unset($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]);
} }
if (! empty($_SESSION['lastsearch_page_tmp_'.$relativepathstring]) && $_SESSION['lastsearch_page_tmp_'.$relativepathstring] > 1) if (! empty($_SESSION['lastsearch_page_tmp_'.$relativepathstring]) && $_SESSION['lastsearch_page_tmp_'.$relativepathstring] > 0)
{ {
$_SESSION['lastsearch_page_'.$relativepathstring]=$_SESSION['lastsearch_page_tmp_'.$relativepathstring]; $_SESSION['lastsearch_page_'.$relativepathstring]=$_SESSION['lastsearch_page_tmp_'.$relativepathstring];
unset($_SESSION['lastsearch_page_tmp_'.$relativepathstring]); unset($_SESSION['lastsearch_page_tmp_'.$relativepathstring]);
@ -2273,7 +2273,7 @@ if (! function_exists("llxFooter"))
unset($_SESSION['lastsearch_limit_tmp_'.$relativepathstring]); unset($_SESSION['lastsearch_limit_tmp_'.$relativepathstring]);
if (! empty($contextpage)) $_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]=$contextpage; if (! empty($contextpage)) $_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]=$contextpage;
if (! empty($page) && $page > 1) $_SESSION['lastsearch_page_tmp_'.$relativepathstring]=$page; if (! empty($page) && $page > 0) $_SESSION['lastsearch_page_tmp_'.$relativepathstring]=$page;
if (! empty($limit) && $limit != $conf->limit) $_SESSION['lastsearch_limit_tmp_'.$relativepathstring]=$limit; if (! empty($limit) && $limit != $conf->limit) $_SESSION['lastsearch_limit_tmp_'.$relativepathstring]=$limit;
unset($_SESSION['lastsearch_contextpage_'.$relativepathstring]); unset($_SESSION['lastsearch_contextpage_'.$relativepathstring]);

View File

@ -243,6 +243,7 @@ class FormProduct
$out=''; $out='';
if (empty($conf->global->ENTREPOT_EXTRA_STATUS)) $filterstatus = ''; if (empty($conf->global->ENTREPOT_EXTRA_STATUS)) $filterstatus = '';
if (!empty($fk_product)) $this->cache_warehouses = array();
$this->loadWarehouses($fk_product, '', $filterstatus, true, $exclude, $stockMin, $orderBy); $this->loadWarehouses($fk_product, '', $filterstatus, true, $exclude, $stockMin, $orderBy);
$nbofwarehouses=count($this->cache_warehouses); $nbofwarehouses=count($this->cache_warehouses);

View File

@ -491,6 +491,13 @@ if ($id > 0 || $ref)
{ {
print '<input class="flat" name="qty" size="5" value="'.$quantity.'">'; print '<input class="flat" name="qty" size="5" value="'.$quantity.'">';
} }
// Units
if ($conf->global->PRODUCT_USE_UNITS) {
$unit = $object->getLabelOfUnit();
if ($unit !== '') {
print '&nbsp;&nbsp;' . $langs->trans($unit);
}
}
print '</td></tr>'; print '</td></tr>';
// Vat rate // Vat rate
@ -778,11 +785,11 @@ SCRIPT;
$num = count($product_fourn_list); $num = count($product_fourn_list);
if (($num + ($offset * $limit)) < $nbtotalofrecords) $num++; if (($num + ($offset * $limit)) < $nbtotalofrecords) $num++;
print_barre_liste($langs->trans('SupplierPrices'), $page, $_SERVER ['PHP_SELF'], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy.png', 0, '', '', $limit, 1); print_barre_liste($langs->trans('SupplierPrices'), $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy.png', 0, '', '', $limit, 1);
// Suppliers list title // Suppliers list title
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="noborder" width="100%">'; print '<table class="liste" width="100%">';
$param="&id=".$object->id; $param="&id=".$object->id;
@ -851,6 +858,13 @@ SCRIPT;
// Quantity // Quantity
print '<td class="right">'; print '<td class="right">';
print $productfourn->fourn_qty; print $productfourn->fourn_qty;
// Units
if ($conf->global->PRODUCT_USE_UNITS) {
$unit = $object->getLabelOfUnit();
if ($unit !== '') {
print '&nbsp;&nbsp;' . $langs->trans($unit);
}
}
print '</td>'; print '</td>';
// VAT rate // VAT rate