Merge pull request #130 from simnandez/develop
New: [ task #156 ] Create an invoice from a delivery receipt
This commit is contained in:
commit
314eba7065
@ -56,6 +56,7 @@ class Expedition extends CommonObject
|
|||||||
var $tracking_number;
|
var $tracking_number;
|
||||||
var $tracking_url;
|
var $tracking_url;
|
||||||
var $statut;
|
var $statut;
|
||||||
|
var $billed;
|
||||||
|
|
||||||
var $trueWeight;
|
var $trueWeight;
|
||||||
var $weight_units;
|
var $weight_units;
|
||||||
@ -95,6 +96,7 @@ class Expedition extends CommonObject
|
|||||||
$this->statuts[-1] = 'StatusSendingCanceled';
|
$this->statuts[-1] = 'StatusSendingCanceled';
|
||||||
$this->statuts[0] = 'StatusSendingDraft';
|
$this->statuts[0] = 'StatusSendingDraft';
|
||||||
$this->statuts[1] = 'StatusSendingValidated';
|
$this->statuts[1] = 'StatusSendingValidated';
|
||||||
|
$this->statuts[2] = 'StatusSendingProcessed';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -371,6 +373,7 @@ class Expedition extends CommonObject
|
|||||||
$this->tracking_number = $obj->tracking_number;
|
$this->tracking_number = $obj->tracking_number;
|
||||||
$this->origin = ($obj->origin?$obj->origin:'commande'); // For compatibility
|
$this->origin = ($obj->origin?$obj->origin:'commande'); // For compatibility
|
||||||
$this->origin_id = $obj->origin_id;
|
$this->origin_id = $obj->origin_id;
|
||||||
|
$this->billed = ($obj->fk_statut==2?1:0);
|
||||||
|
|
||||||
$this->trueWeight = $obj->weight;
|
$this->trueWeight = $obj->weight;
|
||||||
$this->weight_units = $obj->weight_units;
|
$this->weight_units = $obj->weight_units;
|
||||||
@ -988,27 +991,32 @@ class Expedition extends CommonObject
|
|||||||
if ($mode==0)
|
if ($mode==0)
|
||||||
{
|
{
|
||||||
if ($statut==0) return $langs->trans($this->statuts[$statut]);
|
if ($statut==0) return $langs->trans($this->statuts[$statut]);
|
||||||
if ($statut==1) return $langs->trans($this->statuts[$statut]);
|
if ($statut==1) return $langs->trans($this->statuts[$statut]);
|
||||||
|
if ($statut==2) return $langs->trans($this->statuts[$statut]);
|
||||||
}
|
}
|
||||||
if ($mode==1)
|
if ($mode==1)
|
||||||
{
|
{
|
||||||
if ($statut==0) return $langs->trans('StatusSendingDraftShort');
|
if ($statut==0) return $langs->trans('StatusSendingDraftShort');
|
||||||
if ($statut==1) return $langs->trans('StatusSendingValidatedShort');
|
if ($statut==1) return $langs->trans('StatusSendingValidatedShort');
|
||||||
|
if ($statut==2) return $langs->trans('StatusSendingProcessedShort');
|
||||||
}
|
}
|
||||||
if ($mode == 3)
|
if ($mode == 3)
|
||||||
{
|
{
|
||||||
if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut0');
|
if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut0');
|
||||||
if ($statut==1) return img_picto($langs->trans($this->statuts[$statut]),'statut4');
|
if ($statut==1) return img_picto($langs->trans($this->statuts[$statut]),'statut4');
|
||||||
|
if ($statut==2) return img_picto($langs->trans('StatusSendingProcessed'),'statut6');
|
||||||
}
|
}
|
||||||
if ($mode == 4)
|
if ($mode == 4)
|
||||||
{
|
{
|
||||||
if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]);
|
if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]);
|
||||||
if ($statut==1) return img_picto($langs->trans($this->statuts[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]);
|
if ($statut==1) return img_picto($langs->trans($this->statuts[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]);
|
||||||
|
if ($statut==2) return img_picto($langs->trans('StatusSendingProcessed'),'statut6').' '.$langs->trans('StatusSendingProcessed');
|
||||||
}
|
}
|
||||||
if ($mode == 5)
|
if ($mode == 5)
|
||||||
{
|
{
|
||||||
if ($statut==0) return $langs->trans('StatusSendingDraftShort').' '.img_picto($langs->trans($this->statuts[$statut]),'statut0');
|
if ($statut==0) return $langs->trans('StatusSendingDraftShort').' '.img_picto($langs->trans($this->statuts[$statut]),'statut0');
|
||||||
if ($statut==1) return $langs->trans('StatusSendingValidatedShort').' '.img_picto($langs->trans($this->statuts[$statut]),'statut4');
|
if ($statut==1) return $langs->trans('StatusSendingValidatedShort').' '.img_picto($langs->trans($this->statuts[$statut]),'statut4');
|
||||||
|
if ($statut==2) return $langs->trans('StatusSendingProcessedShort').' '.img_picto($langs->trans('StatusSendingProcessedShort'),'statut6');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1201,6 +1209,30 @@ class Expedition extends CommonObject
|
|||||||
$this->tracking_url = $value;
|
$this->tracking_url = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Classify the shipping as invoiced
|
||||||
|
*
|
||||||
|
* @return int <0 if ko, >0 if ok
|
||||||
|
*/
|
||||||
|
function set_billed()
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.'expedition SET fk_statut=2';
|
||||||
|
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > 0 ;';
|
||||||
|
if ($this->db->query($sql) )
|
||||||
|
{
|
||||||
|
//TODO: Option to set order billed if 100% of order is shipped
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($this->db);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -505,6 +505,11 @@ if ($action == 'send' && ! GETPOST('addfile','alpha') && ! GETPOST('removedfile'
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($action == 'classifybilled')
|
||||||
|
{
|
||||||
|
$object->fetch($id);
|
||||||
|
$object->set_billed();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
@ -1296,7 +1301,7 @@ else
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
// Send
|
// Send
|
||||||
if ($object->statut == 1)
|
if ($object->statut > 0)
|
||||||
{
|
{
|
||||||
$ref = dol_sanitizeFileName($object->ref);
|
$ref = dol_sanitizeFileName($object->ref);
|
||||||
$file = $conf->expedition->dir_output . '/sending/'.$ref.'/'.$ref.'.pdf';
|
$file = $conf->expedition->dir_output . '/sending/'.$ref.'/'.$ref.'.pdf';
|
||||||
@ -1321,7 +1326,7 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO add alternative status
|
// TODO add alternative status
|
||||||
if ($user->rights->expedition->creer && $object->statut > 2)
|
if ($user->rights->expedition->creer && $object->statut > 0)
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifybilled">'.$langs->trans("ClassifyBilled").'</a>';
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifybilled">'.$langs->trans("ClassifyBilled").'</a>';
|
||||||
}
|
}
|
||||||
@ -1360,6 +1365,12 @@ else
|
|||||||
//$delallowed=0;
|
//$delallowed=0;
|
||||||
|
|
||||||
$somethingshown=$formfile->show_documents('expedition',$objectref,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang);
|
$somethingshown=$formfile->show_documents('expedition',$objectref,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Linked object block
|
||||||
|
*/
|
||||||
|
$somethingshown=$object->showLinkedObjectBlock();
|
||||||
|
|
||||||
if ($genallowed && ! $somethingshown) $somethingshown=1;
|
if ($genallowed && ! $somethingshown) $somethingshown=1;
|
||||||
|
|
||||||
print '</td><td valign="top" width="50%">';
|
print '</td><td valign="top" width="50%">';
|
||||||
|
|||||||
@ -426,4 +426,3 @@ ALTER TABLE llx_propal ADD CONSTRAINT fk_propal_fk_currency FOREIGN KEY (fk_cur
|
|||||||
ALTER TABLE llx_commande ADD CONSTRAINT fk_commande_fk_currency FOREIGN KEY (fk_currency) REFERENCES llx_c_currencies (code_iso);
|
ALTER TABLE llx_commande ADD CONSTRAINT fk_commande_fk_currency FOREIGN KEY (fk_currency) REFERENCES llx_c_currencies (code_iso);
|
||||||
ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_fk_currency FOREIGN KEY (fk_currency) REFERENCES llx_c_currencies (code_iso);
|
ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_fk_currency FOREIGN KEY (fk_currency) REFERENCES llx_c_currencies (code_iso);
|
||||||
|
|
||||||
ALTER TABLE llx_expedition ADD COLUMN billed tinyint DEFAULT 0 AFTER fk_statut;
|
|
||||||
@ -41,7 +41,6 @@ create table llx_expedition
|
|||||||
fk_expedition_methode integer,
|
fk_expedition_methode integer,
|
||||||
tracking_number varchar(50),
|
tracking_number varchar(50),
|
||||||
fk_statut smallint DEFAULT 0,
|
fk_statut smallint DEFAULT 0,
|
||||||
billed tinyint DEFAULT 0,
|
|
||||||
|
|
||||||
height integer,
|
height integer,
|
||||||
width integer,
|
width integer,
|
||||||
|
|||||||
@ -31,9 +31,11 @@ SendingsToValidate=Enviaments a validar
|
|||||||
StatusSendingCanceled=Anul.lat
|
StatusSendingCanceled=Anul.lat
|
||||||
StatusSendingDraft=Esborrany
|
StatusSendingDraft=Esborrany
|
||||||
StatusSendingValidated=Validat (productes a enviar o enviats)
|
StatusSendingValidated=Validat (productes a enviar o enviats)
|
||||||
|
StatusSendingProcessed=Processat
|
||||||
StatusSendingCanceledShort=Anul.lat
|
StatusSendingCanceledShort=Anul.lat
|
||||||
StatusSendingDraftShort=Esborrany
|
StatusSendingDraftShort=Esborrany
|
||||||
StatusSendingValidatedShort=Validat
|
StatusSendingValidatedShort=Validat
|
||||||
|
StatusSendingProcessedShort=Processat
|
||||||
SendingSheet=Nota de lliurament
|
SendingSheet=Nota de lliurament
|
||||||
Carriers=Transportistes
|
Carriers=Transportistes
|
||||||
Carrier=Transportista
|
Carrier=Transportista
|
||||||
|
|||||||
@ -31,9 +31,11 @@ SendingsToValidate=Shipments to validate
|
|||||||
StatusSendingCanceled=Canceled
|
StatusSendingCanceled=Canceled
|
||||||
StatusSendingDraft=Draft
|
StatusSendingDraft=Draft
|
||||||
StatusSendingValidated=Validated (products to ship or already shipped)
|
StatusSendingValidated=Validated (products to ship or already shipped)
|
||||||
|
StatusSendingProcessed=Processed
|
||||||
StatusSendingCanceledShort=Canceled
|
StatusSendingCanceledShort=Canceled
|
||||||
StatusSendingDraftShort=Draft
|
StatusSendingDraftShort=Draft
|
||||||
StatusSendingValidatedShort=Validated
|
StatusSendingValidatedShort=Validated
|
||||||
|
StatusSendingProcessedShort=Processed
|
||||||
SendingSheet=Sending sheet
|
SendingSheet=Sending sheet
|
||||||
Carriers=Carriers
|
Carriers=Carriers
|
||||||
Carrier=Carrier
|
Carrier=Carrier
|
||||||
|
|||||||
@ -31,9 +31,11 @@ SendingsToValidate=Envíos a validar
|
|||||||
StatusSendingCanceled=Anulado
|
StatusSendingCanceled=Anulado
|
||||||
StatusSendingDraft=Borrador
|
StatusSendingDraft=Borrador
|
||||||
StatusSendingValidated=Validado (productos a enviar o enviados)
|
StatusSendingValidated=Validado (productos a enviar o enviados)
|
||||||
|
StatusSendingProcessed=Procesado
|
||||||
StatusSendingCanceledShort=Anulado
|
StatusSendingCanceledShort=Anulado
|
||||||
StatusSendingDraftShort=Borrador
|
StatusSendingDraftShort=Borrador
|
||||||
StatusSendingValidatedShort=Validado
|
StatusSendingValidatedShort=Validado
|
||||||
|
StatusSendingProcessedShort=Procesado
|
||||||
SendingSheet=Nota de entrega
|
SendingSheet=Nota de entrega
|
||||||
Carriers=Transportistas
|
Carriers=Transportistas
|
||||||
Carrier=Transportista
|
Carrier=Transportista
|
||||||
|
|||||||
@ -31,9 +31,11 @@ SendingsToValidate=Expéditions à valider
|
|||||||
StatusSendingCanceled=Annulée
|
StatusSendingCanceled=Annulée
|
||||||
StatusSendingDraft=Brouillon
|
StatusSendingDraft=Brouillon
|
||||||
StatusSendingValidated=Validée (produits à envoyer ou envoyés)
|
StatusSendingValidated=Validée (produits à envoyer ou envoyés)
|
||||||
|
StatusSendingProcessed=Traitée
|
||||||
StatusSendingCanceledShort=Annulée
|
StatusSendingCanceledShort=Annulée
|
||||||
StatusSendingDraftShort=Brouillon
|
StatusSendingDraftShort=Brouillon
|
||||||
StatusSendingValidatedShort=Validée
|
StatusSendingValidatedShort=Validée
|
||||||
|
StatusSendingProcessedShort=Traitée
|
||||||
SendingSheet=Bordereau d'expédition
|
SendingSheet=Bordereau d'expédition
|
||||||
Carriers=Transporteurs
|
Carriers=Transporteurs
|
||||||
Carrier=Transporteur
|
Carrier=Transporteur
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user