Task #10577: Works with shipments
This commit is contained in:
parent
560ada001b
commit
08114f30d9
@ -3,6 +3,7 @@
|
|||||||
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
|
||||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
||||||
* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2011 Juanjo Menent <jmenent@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
|
||||||
@ -84,7 +85,56 @@ class Expedition extends CommonObject
|
|||||||
$this->statuts[0] = 'StatusSendingDraft';
|
$this->statuts[0] = 'StatusSendingDraft';
|
||||||
$this->statuts[1] = 'StatusSendingValidated';
|
$this->statuts[1] = 'StatusSendingValidated';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return next contract ref
|
||||||
|
* @param soc objet society
|
||||||
|
* @return string free reference for contract
|
||||||
|
*/
|
||||||
|
function getNextNumRef($soc)
|
||||||
|
{
|
||||||
|
global $db, $langs, $conf;
|
||||||
|
$langs->load("sendings");
|
||||||
|
|
||||||
|
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/expedition";
|
||||||
|
|
||||||
|
if (! empty($conf->global->EXPEDITION_ADDON_NUMBER))
|
||||||
|
{
|
||||||
|
$file = $conf->global->EXPEDITION_ADDON_NUMBER.".php";
|
||||||
|
|
||||||
|
// Chargement de la classe de numerotation
|
||||||
|
$classname = $conf->global->EXPEDITION_ADDON_NUMBER;
|
||||||
|
|
||||||
|
$result=include_once($dir.'/'.$file);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
$obj = new $classname();
|
||||||
|
$numref = "";
|
||||||
|
$numref = $obj->getNextValue($soc,$this);
|
||||||
|
|
||||||
|
if ( $numref != "")
|
||||||
|
{
|
||||||
|
return $numref;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($db,"Expedition::getNextNumRef ".$obj->error);
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $langs->trans("Error")." ".$langs->trans("Error_EXPEDITION_ADDON_NUMBER_NotDefined");
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $langs->trans("Error")." ".$langs->trans("Error_EXPEDITION_ADDON_NUMBER_NotDefined");
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Cree expedition en base
|
* \brief Cree expedition en base
|
||||||
* \param user Objet du user qui cree
|
* \param user Objet du user qui cree
|
||||||
@ -364,8 +414,22 @@ class Expedition extends CommonObject
|
|||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
// Define new ref
|
// Define new ref
|
||||||
$num = "EXP".$this->id;
|
$soc = new Societe($this->db);
|
||||||
|
$soc->fetch($this->socid);
|
||||||
|
|
||||||
|
// Class of company linked to order
|
||||||
|
$result=$soc->set_as_client();
|
||||||
|
|
||||||
|
// Define new ref
|
||||||
|
if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref)))
|
||||||
|
{
|
||||||
|
$num = $this->getNextNumRef($soc);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$num = "EXP".$this->id;
|
||||||
|
}
|
||||||
|
|
||||||
$now=dol_now();
|
$now=dol_now();
|
||||||
|
|
||||||
// Validate
|
// Validate
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
||||||
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
|
||||||
|
* Copyright (C) 2011 Juanjo Menent <jmenent@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
|
||||||
@ -701,7 +702,16 @@ else
|
|||||||
*/
|
*/
|
||||||
if ($_GET["action"] == 'valid')
|
if ($_GET["action"] == 'valid')
|
||||||
{
|
{
|
||||||
$ret=$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$expedition->id,$langs->trans('ValidateSending'),$langs->trans("ConfirmValidateSending",$expedition->ref),'confirm_valid','',0,1);
|
$objectref = substr($expedition->ref, 1, 4);
|
||||||
|
if ($objectref == 'PROV')
|
||||||
|
{
|
||||||
|
$numref = $expedition->getNextNumRef($soc);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$numref = $expedition->ref;
|
||||||
|
}
|
||||||
|
$ret=$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$expedition->id,$langs->trans('ValidateSending'),$langs->trans("ConfirmValidateSending",$numref),'confirm_valid','',0,1);
|
||||||
if ($ret == 'html') print '<br>';
|
if ($ret == 'html') print '<br>';
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -34,7 +34,7 @@ StatusSendingValidated=Validat (productes a enviar o enviats)
|
|||||||
StatusSendingCanceledShort=Anul.lat
|
StatusSendingCanceledShort=Anul.lat
|
||||||
StatusSendingDraftShort=Esborrany
|
StatusSendingDraftShort=Esborrany
|
||||||
StatusSendingValidatedShort=Validat
|
StatusSendingValidatedShort=Validat
|
||||||
SendingSheet=Fitxa d'enviament
|
SendingSheet=Nota de lliurament
|
||||||
Carriers=Transportistes
|
Carriers=Transportistes
|
||||||
Carrier=Transportista
|
Carrier=Transportista
|
||||||
CarriersArea=Àrea transportistes
|
CarriersArea=Àrea transportistes
|
||||||
@ -57,3 +57,4 @@ SendingMethodCOLSUI=Colissimo
|
|||||||
# ModelDocument
|
# ModelDocument
|
||||||
DocumentModelSirocco=Model simple nota de lliurament
|
DocumentModelSirocco=Model simple nota de lliurament
|
||||||
DocumentModelTyphon=Model complet de nota de lliurament (logo...)
|
DocumentModelTyphon=Model complet de nota de lliurament (logo...)
|
||||||
|
Error_EXPEDITION_ADDON_NUMBER_NotDefined=Constant EXPEDITION_ADDON_NUMBER no definida
|
||||||
@ -40,7 +40,7 @@ Carrier=Carrier
|
|||||||
CarriersArea=Carriers area
|
CarriersArea=Carriers area
|
||||||
NewCarrier=New carrier
|
NewCarrier=New carrier
|
||||||
ConfirmDeleteSending=Are you sure you want to delete this shipment ?
|
ConfirmDeleteSending=Are you sure you want to delete this shipment ?
|
||||||
ConfirmValidateSending=Are you sure you want to validate this shipment ?
|
ConfirmValidateSending=Are you sure you want to validate this shipment with reference <b>%s</b> ?
|
||||||
ConfirmCancelSending=Are you sure you want to cancel this shipment ?
|
ConfirmCancelSending=Are you sure you want to cancel this shipment ?
|
||||||
GenericTransport=Generic transport
|
GenericTransport=Generic transport
|
||||||
Enlevement=Gotten by customer
|
Enlevement=Gotten by customer
|
||||||
@ -59,3 +59,5 @@ SendingMethodCOLSUI=Colissimo
|
|||||||
# ModelDocument
|
# ModelDocument
|
||||||
DocumentModelSirocco=Simple document model for delivery receipts
|
DocumentModelSirocco=Simple document model for delivery receipts
|
||||||
DocumentModelTyphon=More complete document model for delivery receipts (logo...)
|
DocumentModelTyphon=More complete document model for delivery receipts (logo...)
|
||||||
|
|
||||||
|
Error_EXPEDITION_ADDON_NUMBER_NotDefined=Constant EXPEDITION_ADDON_NUMBER not defined
|
||||||
|
|||||||
@ -35,13 +35,13 @@ StatusSendingValidated=Validado (productos a enviar o enviados)
|
|||||||
StatusSendingCanceledShort=Anulado
|
StatusSendingCanceledShort=Anulado
|
||||||
StatusSendingDraftShort=Borrador
|
StatusSendingDraftShort=Borrador
|
||||||
StatusSendingValidatedShort=Validado
|
StatusSendingValidatedShort=Validado
|
||||||
SendingSheet=Ficha de envío
|
SendingSheet=Nota de entrega
|
||||||
Carriers=Transportistas
|
Carriers=Transportistas
|
||||||
Carrier=Transportista
|
Carrier=Transportista
|
||||||
CarriersArea=Área transportistas
|
CarriersArea=Área transportistas
|
||||||
NewCarrier=Nuevo transportista
|
NewCarrier=Nuevo transportista
|
||||||
ConfirmDeleteSending=¿Está seguro de querer eliminar esta expedición?
|
ConfirmDeleteSending=¿Está seguro de querer eliminar esta expedición?
|
||||||
ConfirmValidateSending=¿Está seguro de querer validar esta expedición?
|
ConfirmValidateSending=¿Está seguro de querer validar esta expedición con la referencia <b>%s</b>?
|
||||||
ConfirmCancelSending=¿Está seguro de querer anular esta expedición?
|
ConfirmCancelSending=¿Está seguro de querer anular esta expedición?
|
||||||
GenericTransport=Transporte genérico
|
GenericTransport=Transporte genérico
|
||||||
Enlevement=Pick-up por el cliente
|
Enlevement=Pick-up por el cliente
|
||||||
@ -57,4 +57,5 @@ SendingMethodTRANS=Transportista
|
|||||||
SendingMethodCOLSUI=Colissimo
|
SendingMethodCOLSUI=Colissimo
|
||||||
# ModelDocument
|
# ModelDocument
|
||||||
DocumentModelSirocco=Modelo simple de nota de entrega / recepción
|
DocumentModelSirocco=Modelo simple de nota de entrega / recepción
|
||||||
DocumentModelTyphon=Modelo completo de nota de entrega / recepción (logo...)
|
DocumentModelTyphon=Modelo completo de nota de entrega / recepción (logo...)
|
||||||
|
Error_EXPEDITION_ADDON_NUMBER_NotDefined=Constante EXPEDITION_ADDON_NUMBER no definida
|
||||||
@ -34,13 +34,13 @@ StatusSendingValidated=Validado (productos a enviar o enviados)
|
|||||||
StatusSendingCanceledShort=Anulado
|
StatusSendingCanceledShort=Anulado
|
||||||
StatusSendingDraftShort=Borrador
|
StatusSendingDraftShort=Borrador
|
||||||
StatusSendingValidatedShort=Validado
|
StatusSendingValidatedShort=Validado
|
||||||
SendingSheet=Ficha de envío
|
SendingSheet=Nota de entrega
|
||||||
Carriers=Transportistas
|
Carriers=Transportistas
|
||||||
Carrier=Transportista
|
Carrier=Transportista
|
||||||
CarriersArea=Área transportistas
|
CarriersArea=Área transportistas
|
||||||
NewCarrier=Nuevo transportista
|
NewCarrier=Nuevo transportista
|
||||||
ConfirmDeleteSending=¿Está seguro de querer eliminar esta expedición?
|
ConfirmDeleteSending=¿Está seguro de querer eliminar esta expedición?
|
||||||
ConfirmValidateSending=¿Está seguro de querer validar esta expedición?
|
ConfirmValidateSending=¿Está seguro de querer validar esta expedición con la referencia <b>%s</b>?
|
||||||
ConfirmCancelSending=¿Está seguro de querer anular esta expedición?
|
ConfirmCancelSending=¿Está seguro de querer anular esta expedición?
|
||||||
GenericTransport=Transporte genérico
|
GenericTransport=Transporte genérico
|
||||||
Enlevement=Pick-up por el cliente
|
Enlevement=Pick-up por el cliente
|
||||||
@ -57,3 +57,4 @@ SendingMethodCOLSUI=Colissimo
|
|||||||
# ModelDocument
|
# ModelDocument
|
||||||
DocumentModelSirocco=Modelo simple de nota de entrega / recepción
|
DocumentModelSirocco=Modelo simple de nota de entrega / recepción
|
||||||
DocumentModelTyphon=Modelo completo de nota de entrega / recepción (logo...)
|
DocumentModelTyphon=Modelo completo de nota de entrega / recepción (logo...)
|
||||||
|
Error_EXPEDITION_ADDON_NUMBER_NotDefined=Constante EXPEDITION_ADDON_NUMBER no definida
|
||||||
@ -40,7 +40,7 @@ Carrier=Transporteur
|
|||||||
CarriersArea=Espace transporteurs
|
CarriersArea=Espace transporteurs
|
||||||
NewCarrier=Nouveau transporteur
|
NewCarrier=Nouveau transporteur
|
||||||
ConfirmDeleteSending=Êtes-vous sûr de vouloir supprimer cette expédition ?
|
ConfirmDeleteSending=Êtes-vous sûr de vouloir supprimer cette expédition ?
|
||||||
ConfirmValidateSending=Êtes-vous sûr de vouloir valider cette expédition ?
|
ConfirmValidateSending=Êtes-vous sûr de vouloir valider cette expédition sous la référence <b>%s</b>?
|
||||||
ConfirmCancelSending=Êtes-vous sûr de vouloir annuler cette expédition ?
|
ConfirmCancelSending=Êtes-vous sûr de vouloir annuler cette expédition ?
|
||||||
GenericTransport=Transporteur générique
|
GenericTransport=Transporteur générique
|
||||||
Enlevement=Enlèvement sur place par le client
|
Enlevement=Enlèvement sur place par le client
|
||||||
@ -59,3 +59,5 @@ SendingMethodCOLSUI=Colissimo Suivi
|
|||||||
# ModelDocument
|
# ModelDocument
|
||||||
DocumentModelSirocco=Modèle de bon de réception/livraison simple
|
DocumentModelSirocco=Modèle de bon de réception/livraison simple
|
||||||
DocumentModelTyphon=Modèle de bon de réception/livraison complet (logo...)
|
DocumentModelTyphon=Modèle de bon de réception/livraison complet (logo...)
|
||||||
|
|
||||||
|
Error_EXPEDITION_ADDON_NUMBER_NotDefined=Constante EXPEDITION_ADDON_NUMBER non définie
|
||||||
Loading…
Reference in New Issue
Block a user