mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
New: [ task #156 ] Create an invoice from a delivery receipt
This commit is contained in:
parent
5b6d6fc731
commit
7e02e3faf6
|
|
@ -56,6 +56,7 @@ class Expedition extends CommonObject
|
|||
var $tracking_number;
|
||||
var $tracking_url;
|
||||
var $statut;
|
||||
var $billed;
|
||||
|
||||
var $trueWeight;
|
||||
var $weight_units;
|
||||
|
|
@ -95,6 +96,7 @@ class Expedition extends CommonObject
|
|||
$this->statuts[-1] = 'StatusSendingCanceled';
|
||||
$this->statuts[0] = 'StatusSendingDraft';
|
||||
$this->statuts[1] = 'StatusSendingValidated';
|
||||
$this->statuts[2] = 'StatusSendingProcessed';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -371,6 +373,7 @@ class Expedition extends CommonObject
|
|||
$this->tracking_number = $obj->tracking_number;
|
||||
$this->origin = ($obj->origin?$obj->origin:'commande'); // For compatibility
|
||||
$this->origin_id = $obj->origin_id;
|
||||
$this->billed = ($obj->fk_statut==2?1:0);
|
||||
|
||||
$this->trueWeight = $obj->weight;
|
||||
$this->weight_units = $obj->weight_units;
|
||||
|
|
@ -988,27 +991,32 @@ class Expedition extends CommonObject
|
|||
if ($mode==0)
|
||||
{
|
||||
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 ($statut==0) return $langs->trans('StatusSendingDraftShort');
|
||||
if ($statut==1) return $langs->trans('StatusSendingValidatedShort');
|
||||
if ($statut==2) return $langs->trans('StatusSendingProcessedShort');
|
||||
}
|
||||
if ($mode == 3)
|
||||
{
|
||||
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==2) return img_picto($langs->trans('StatusSendingProcessed'),'statut6');
|
||||
}
|
||||
if ($mode == 4)
|
||||
{
|
||||
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==2) return img_picto($langs->trans('StatusSendingProcessed'),'statut6').' '.$langs->trans('StatusSendingProcessed');
|
||||
}
|
||||
if ($mode == 5)
|
||||
{
|
||||
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==2) return $langs->trans('StatusSendingProcessedShort').' '.img_picto($langs->trans('StatusSendingProcessedShort'),'statut6');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1201,6 +1209,30 @@ class Expedition extends CommonObject
|
|||
$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
|
||||
|
|
@ -1296,7 +1301,7 @@ else
|
|||
}*/
|
||||
|
||||
// Send
|
||||
if ($object->statut == 1)
|
||||
if ($object->statut > 0)
|
||||
{
|
||||
$ref = dol_sanitizeFileName($object->ref);
|
||||
$file = $conf->expedition->dir_output . '/sending/'.$ref.'/'.$ref.'.pdf';
|
||||
|
|
@ -1321,7 +1326,7 @@ else
|
|||
}
|
||||
|
||||
// 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>';
|
||||
}
|
||||
|
|
@ -1360,6 +1365,12 @@ else
|
|||
//$delallowed=0;
|
||||
|
||||
$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;
|
||||
|
||||
print '</td><td valign="top" width="50%">';
|
||||
|
|
|
|||
|
|
@ -425,5 +425,4 @@ INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MXP'
|
|||
ALTER TABLE llx_propal ADD CONSTRAINT fk_propal_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_expedition ADD COLUMN billed tinyint DEFAULT 0 AFTER fk_statut;
|
||||
|
||||
|
|
@ -41,7 +41,6 @@ create table llx_expedition
|
|||
fk_expedition_methode integer,
|
||||
tracking_number varchar(50),
|
||||
fk_statut smallint DEFAULT 0,
|
||||
billed tinyint DEFAULT 0,
|
||||
|
||||
height integer,
|
||||
width integer,
|
||||
|
|
|
|||
|
|
@ -31,9 +31,11 @@ SendingsToValidate=Enviaments a validar
|
|||
StatusSendingCanceled=Anul.lat
|
||||
StatusSendingDraft=Esborrany
|
||||
StatusSendingValidated=Validat (productes a enviar o enviats)
|
||||
StatusSendingProcessed=Processat
|
||||
StatusSendingCanceledShort=Anul.lat
|
||||
StatusSendingDraftShort=Esborrany
|
||||
StatusSendingValidatedShort=Validat
|
||||
StatusSendingProcessedShort=Processat
|
||||
SendingSheet=Nota de lliurament
|
||||
Carriers=Transportistes
|
||||
Carrier=Transportista
|
||||
|
|
|
|||
|
|
@ -31,9 +31,11 @@ SendingsToValidate=Shipments to validate
|
|||
StatusSendingCanceled=Canceled
|
||||
StatusSendingDraft=Draft
|
||||
StatusSendingValidated=Validated (products to ship or already shipped)
|
||||
StatusSendingProcessed=Processed
|
||||
StatusSendingCanceledShort=Canceled
|
||||
StatusSendingDraftShort=Draft
|
||||
StatusSendingValidatedShort=Validated
|
||||
StatusSendingProcessedShort=Processed
|
||||
SendingSheet=Sending sheet
|
||||
Carriers=Carriers
|
||||
Carrier=Carrier
|
||||
|
|
|
|||
|
|
@ -31,9 +31,11 @@ SendingsToValidate=Envíos a validar
|
|||
StatusSendingCanceled=Anulado
|
||||
StatusSendingDraft=Borrador
|
||||
StatusSendingValidated=Validado (productos a enviar o enviados)
|
||||
StatusSendingProcessed=Procesado
|
||||
StatusSendingCanceledShort=Anulado
|
||||
StatusSendingDraftShort=Borrador
|
||||
StatusSendingValidatedShort=Validado
|
||||
StatusSendingProcessedShort=Procesado
|
||||
SendingSheet=Nota de entrega
|
||||
Carriers=Transportistas
|
||||
Carrier=Transportista
|
||||
|
|
|
|||
|
|
@ -31,9 +31,11 @@ SendingsToValidate=Expéditions à valider
|
|||
StatusSendingCanceled=Annulée
|
||||
StatusSendingDraft=Brouillon
|
||||
StatusSendingValidated=Validée (produits à envoyer ou envoyés)
|
||||
StatusSendingProcessed=Traitée
|
||||
StatusSendingCanceledShort=Annulée
|
||||
StatusSendingDraftShort=Brouillon
|
||||
StatusSendingValidatedShort=Validée
|
||||
StatusSendingProcessedShort=Traitée
|
||||
SendingSheet=Bordereau d'expédition
|
||||
Carriers=Transporteurs
|
||||
Carrier=Transporteur
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user