Merge pull request #5066 from atm-maxime/fix_thirdparty_instead_client
Fix order creation bug because of ->client
This commit is contained in:
commit
63d04f4f2d
@ -1380,7 +1380,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
$projectid = (! empty($objectsrc->fk_project) ? $objectsrc->fk_project : '');
|
||||
$ref_client = (! empty($objectsrc->ref_client) ? $objectsrc->ref_client : '');
|
||||
|
||||
$soc = $objectsrc->client;
|
||||
$soc = $objectsrc->thirdparty;
|
||||
$cond_reglement_id = (!empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(!empty($soc->cond_reglement_id)?$soc->cond_reglement_id:1));
|
||||
$mode_reglement_id = (!empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(!empty($soc->mode_reglement_id)?$soc->mode_reglement_id:0));
|
||||
$fk_account = (! empty($objectsrc->fk_account)?$objectsrc->fk_account:(! empty($soc->fk_account)?$soc->fk_account:0));
|
||||
|
||||
@ -1127,8 +1127,8 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// View third's localtaxes for now
|
||||
$localtax1_tx = get_localtax($lines[$i]->tva_tx, 1, $object->client);
|
||||
$localtax2_tx = get_localtax($lines[$i]->tva_tx, 2, $object->client);
|
||||
$localtax1_tx = get_localtax($lines[$i]->tva_tx, 1, $object->thirdparty);
|
||||
$localtax2_tx = get_localtax($lines[$i]->tva_tx, 2, $object->thirdparty);
|
||||
|
||||
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $localtax1_tx, $localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $date_start, $date_end, 0, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $object->origin, $lines[$i]->rowid, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options, $lines[$i]->situation_percent, $lines[$i]->fk_prev_id, $lines[$i]->fk_unit);
|
||||
|
||||
|
||||
@ -64,7 +64,7 @@ if ($action == 'builddoc' && $permissioncreate)
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($object->client->default_lang)) $newlang=$object->client->default_lang; // for proposal, order, invoice, ...
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($object->thirdparty->default_lang)) $newlang=$object->thirdparty->default_lang; // for proposal, order, invoice, ...
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($object->default_lang)) $newlang=$object->default_lang; // for thirdparty
|
||||
if (! empty($newlang))
|
||||
{
|
||||
|
||||
@ -233,7 +233,7 @@ function show_list_sending_receive($origin,$origin_id,$filter='')
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
|
||||
if (empty($newlang)) $newlang=$object->client->default_lang;
|
||||
if (empty($newlang)) $newlang=$object->thirdparty->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
|
||||
@ -1261,7 +1261,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
if ($showaddress)
|
||||
{
|
||||
// Sender properties
|
||||
$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client);
|
||||
$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty);
|
||||
|
||||
// Show sender
|
||||
$posy=42;
|
||||
@ -1306,12 +1306,12 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
|
||||
$thirdparty = $object->contact;
|
||||
} else {
|
||||
$thirdparty = $object->client;
|
||||
$thirdparty = $object->thirdparty;
|
||||
}
|
||||
|
||||
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
||||
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target', $object);
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->thirdparty,($usecontact?$object->contact:''),$usecontact,'target', $object);
|
||||
|
||||
// Show recipient
|
||||
$widthrecbox=100;
|
||||
|
||||
@ -542,20 +542,20 @@ class pdf_merou extends ModelePdfExpedition
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
|
||||
// Sender properties
|
||||
$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client);
|
||||
$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty);
|
||||
|
||||
$pdf->SetFont('','', $default_font_size - 3);
|
||||
$pdf->SetXY($blSocX,$blSocY+4);
|
||||
$pdf->MultiCell(80, 2, $carac_emetteur, 0, 'L');
|
||||
|
||||
|
||||
if ($object->client->code_client)
|
||||
if ($object->thirdparty->code_client)
|
||||
{
|
||||
$Yoff+=3;
|
||||
$posy=$Yoff;
|
||||
$pdf->SetXY(100,$posy);
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->client->code_client), '', 'R');
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
|
||||
}
|
||||
|
||||
// Date Expedition
|
||||
@ -628,12 +628,12 @@ class pdf_merou extends ModelePdfExpedition
|
||||
if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
|
||||
$thirdparty = $object->contact;
|
||||
} else {
|
||||
$thirdparty = $object->client;
|
||||
$thirdparty = $object->thirdparty;
|
||||
}
|
||||
|
||||
$carac_client_name=pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
||||
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,((!empty($object->contact))?$object->contact:null),$usecontact,'targetwithdetails',$object);
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->thirdparty,((!empty($object->contact))?$object->contact:null),$usecontact,'targetwithdetails',$object);
|
||||
|
||||
$blDestX=$blExpX+55;
|
||||
$blW=54;
|
||||
|
||||
@ -827,12 +827,12 @@ class pdf_rouget extends ModelePdfExpedition
|
||||
$pdf->MultiCell($w, 4, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_delivery,"day",false,$outputlangs,true), '', 'R');
|
||||
}
|
||||
|
||||
if (! empty($object->client->code_client))
|
||||
if (! empty($object->thirdparty->code_client))
|
||||
{
|
||||
$posy+=4;
|
||||
$pdf->SetXY($posx,$posy);
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->client->code_client), '', 'R');
|
||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
|
||||
}
|
||||
|
||||
|
||||
@ -881,7 +881,7 @@ class pdf_rouget extends ModelePdfExpedition
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
|
||||
}
|
||||
|
||||
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->client);
|
||||
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty);
|
||||
|
||||
// Show sender
|
||||
$posy=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42;
|
||||
@ -927,12 +927,12 @@ class pdf_rouget extends ModelePdfExpedition
|
||||
if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
|
||||
$thirdparty = $object->contact;
|
||||
} else {
|
||||
$thirdparty = $object->client;
|
||||
$thirdparty = $object->thirdparty;
|
||||
}
|
||||
|
||||
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
||||
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,(!empty($object->contact)?$object->contact:null),$usecontact,'targetwithdetails',$object);
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->thirdparty,(!empty($object->contact)?$object->contact:null),$usecontact,'targetwithdetails',$object);
|
||||
|
||||
// Show recipient
|
||||
$widthrecbox=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 100;
|
||||
|
||||
@ -1554,7 +1554,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
if ($showaddress)
|
||||
{
|
||||
// Sender properties
|
||||
$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client);
|
||||
$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty);
|
||||
|
||||
// Show sender
|
||||
$posy=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42;
|
||||
@ -1602,12 +1602,12 @@ class pdf_crabe extends ModelePDFFactures
|
||||
if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
|
||||
$thirdparty = $object->contact;
|
||||
} else {
|
||||
$thirdparty = $object->client;
|
||||
$thirdparty = $object->thirdparty;
|
||||
}
|
||||
|
||||
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
||||
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target',$object);
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->thirdparty,($usecontact?$object->contact:''),$usecontact,'target',$object);
|
||||
|
||||
// Show recipient
|
||||
$widthrecbox=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 100;
|
||||
|
||||
@ -552,12 +552,12 @@ class pdf_soleil extends ModelePDFFicheinter
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->datec,"day",false,$outputlangs,true), '', 'R');
|
||||
|
||||
if ($object->client->code_client)
|
||||
if ($object->thirdparty->code_client)
|
||||
{
|
||||
$posy+=4;
|
||||
$pdf->SetXY($posx,$posy);
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->client->code_client), '', 'R');
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
|
||||
}
|
||||
|
||||
if ($showaddress)
|
||||
@ -572,7 +572,7 @@ class pdf_soleil extends ModelePDFFicheinter
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
|
||||
}
|
||||
|
||||
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->client);
|
||||
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty);
|
||||
|
||||
// Show sender
|
||||
$posy=42;
|
||||
|
||||
@ -742,12 +742,12 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
}
|
||||
|
||||
if ($object->client->code_client)
|
||||
if ($object->thirdparty->code_client)
|
||||
{
|
||||
$posy+=5;
|
||||
$pdf->SetXY($posx,$posy);
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->client->code_client), '', 'R');
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
|
||||
}
|
||||
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
@ -849,12 +849,12 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
|
||||
$thirdparty = $object->contact;
|
||||
} else {
|
||||
$thirdparty = $object->client;
|
||||
$thirdparty = $object->thirdparty;
|
||||
}
|
||||
|
||||
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
||||
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target',$object);
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->thirdparty,($usecontact?$object->contact:''),$usecontact,'target',$object);
|
||||
|
||||
// Show recipient
|
||||
$widthrecbox=100;
|
||||
|
||||
@ -321,14 +321,14 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
||||
// On peut utiliser le nom de la societe du contact
|
||||
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
|
||||
else {
|
||||
$socobject = $object->client;
|
||||
$socobject = $object->thirdparty;
|
||||
// if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
|
||||
$contactobject = $object->contact;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$socobject=$object->client;
|
||||
$socobject=$object->thirdparty;
|
||||
}
|
||||
// Make substitution
|
||||
$substitutionarray=array(
|
||||
|
||||
@ -1442,12 +1442,12 @@ class pdf_azur extends ModelePDFPropales
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("DateEndPropal")." : " . dol_print_date($object->fin_validite,"day",false,$outputlangs,true), '', 'R');
|
||||
|
||||
if ($object->client->code_client)
|
||||
if ($object->thirdparty->code_client)
|
||||
{
|
||||
$posy+=4;
|
||||
$pdf->SetXY($posx,$posy);
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->client->code_client), '', 'R');
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
|
||||
}
|
||||
|
||||
$posy+=2;
|
||||
@ -1467,7 +1467,7 @@ class pdf_azur extends ModelePDFPropales
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
|
||||
}
|
||||
|
||||
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->client);
|
||||
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty);
|
||||
|
||||
// Show sender
|
||||
$posy=42;
|
||||
@ -1511,12 +1511,12 @@ class pdf_azur extends ModelePDFPropales
|
||||
if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
|
||||
$thirdparty = $object->contact;
|
||||
} else {
|
||||
$thirdparty = $object->client;
|
||||
$thirdparty = $object->thirdparty;
|
||||
}
|
||||
|
||||
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
||||
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target',$object);
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->thirdparty,($usecontact?$object->contact:''),$usecontact,'target',$object);
|
||||
|
||||
// Show recipient
|
||||
$widthrecbox=100;
|
||||
|
||||
@ -1271,12 +1271,12 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("SupplierProposalDate")." : " . dol_print_date($object->date_livraison,"day",false,$outputlangs,true), '', 'R');
|
||||
*/
|
||||
|
||||
if ($object->client->code_client)
|
||||
if ($object->thirdparty->code_client)
|
||||
{
|
||||
$posy+=4;
|
||||
$pdf->SetXY($posx,$posy);
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->client->code_client), '', 'R');
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
|
||||
}
|
||||
|
||||
$posy+=2;
|
||||
@ -1296,7 +1296,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
|
||||
}
|
||||
|
||||
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->client);
|
||||
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty);
|
||||
|
||||
// Show sender
|
||||
$posy=42;
|
||||
@ -1340,15 +1340,15 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
||||
{
|
||||
// On peut utiliser le nom de la societe du contact
|
||||
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname;
|
||||
else $socname = $object->client->name;
|
||||
else $socname = $object->thirdparty->name;
|
||||
$carac_client_name=$outputlangs->convToOutputCharset($socname);
|
||||
}
|
||||
else
|
||||
{
|
||||
$carac_client_name=$outputlangs->convToOutputCharset($object->client->name);
|
||||
$carac_client_name=$outputlangs->convToOutputCharset($object->thirdparty->name);
|
||||
}
|
||||
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target',$object);
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->thirdparty,($usecontact?$object->contact:''),$usecontact,'target',$object);
|
||||
|
||||
// Show recipient
|
||||
$widthrecbox=100;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user