forked from Wavyzz/dolibarr
Feature: Choix du destinataire (adresse tiers ou adresse contact facutration) sur les factures.
This commit is contained in:
@@ -152,6 +152,11 @@ if ($_POST["action"] == 'set_enable_editdelete')
|
||||
dolibarr_set_const($db, "FACTURE_ENABLE_EDITDELETE",$_POST["enable_editdelete"]);
|
||||
}
|
||||
|
||||
if ($_POST["action"] == 'set_use_bill_contact_as_recipient')
|
||||
{
|
||||
dolibarr_set_const($db, "FACTURE_USE_BILL_CONTACT_AS_RECIPIENT",$_POST["use_bill_contact_as_recipient"]);
|
||||
}
|
||||
|
||||
if ($_POST["action"] == 'update' || $_POST["action"] == 'add')
|
||||
{
|
||||
if (! dolibarr_set_const($db, $_POST["constname"],$_POST["constvalue"],$typeconst[$_POST["consttype"]],0,isset($_POST["constnote"])?$_POST["constnote"]:''));
|
||||
@@ -545,6 +550,19 @@ print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'
|
||||
print "</td></tr>\n";
|
||||
print '</form>';
|
||||
|
||||
// Active la possibilit<69> d'<27>diter/supprimer une facture valid<69>e sans paiement
|
||||
$var=! $var;
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="action" value="set_use_bill_contact_as_recipient">';
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print $langs->trans("UsBillingContactAsIncoiveRecipientIfExist");
|
||||
print '</td><td width="60" align="center">';
|
||||
print $html->selectyesno("use_bill_contact_as_recipient",$conf->global->FACTURE_USE_BILL_CONTACT_AS_RECIPIENT,1);
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print "</td></tr>\n";
|
||||
print '</form>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
|
||||
@@ -323,55 +323,65 @@ class CommonObject
|
||||
/**
|
||||
* \brief Charge le contact d'id $id dans this->contact
|
||||
* \param contactid Id du contact
|
||||
* \return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch_contact($contactid)
|
||||
{
|
||||
$contact = new Contact($this->db);
|
||||
$contact->fetch($contactid);
|
||||
$this->contact = $contact;
|
||||
}
|
||||
$contact = new Contact($this->db);
|
||||
$result=$contact->fetch($contactid);
|
||||
$this->contact = $contact;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Charge le tiers d'id $this->socid dans this->client
|
||||
* \return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch_client()
|
||||
{
|
||||
$client = new Societe($this->db);
|
||||
$client->fetch($this->socid);
|
||||
$result=$client->fetch($this->socid);
|
||||
$this->client = $client;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Charge le projet d'id $this->projet_id dans this->projet
|
||||
* \return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch_projet()
|
||||
{
|
||||
$projet = new Project($this->db);
|
||||
$projet->fetch($this->projet_id);
|
||||
$result=$projet->fetch($this->projet_id);
|
||||
$this->projet = $projet;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Charge le user d'id userid dans this->user
|
||||
* \param userid Id du contact
|
||||
* \return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch_user($userid)
|
||||
{
|
||||
$user = new User($this->db, $userid);
|
||||
$user->fetch();
|
||||
$this->user = $user;
|
||||
$user = new User($this->db, $userid);
|
||||
$result=$user->fetch();
|
||||
$this->user = $user;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Charge l'adresse de livraison d'id $this->adresse_livraison_id dans this->deliveryaddress
|
||||
* \param userid Id du contact
|
||||
*/
|
||||
/**
|
||||
* \brief Charge l'adresse de livraison d'id $this->adresse_livraison_id dans this->deliveryaddress
|
||||
* \param userid Id du contact
|
||||
* \return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch_adresse_livraison($deliveryaddressid)
|
||||
{
|
||||
$address = new Societe($this->db);
|
||||
$address->fetch_adresse_livraison($deliveryaddressid);
|
||||
$this->deliveryaddress = $address;
|
||||
}
|
||||
{
|
||||
$address = new Societe($this->db);
|
||||
$result=$address->fetch_adresse_livraison($deliveryaddressid);
|
||||
$this->deliveryaddress = $address;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Retourne la liste d<>roulante des soci<63>t<EFBFBD>s
|
||||
|
||||
@@ -978,12 +978,12 @@ class pdf_crabe extends ModelePDFFactures
|
||||
// Nom emetteur
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->SetFont('Arial','B',11);
|
||||
if (defined("FAC_PDF_SOCIETE_NOM") && FAC_PDF_SOCIETE_NOM) $pdf->MultiCell(80, 4, FAC_PDF_SOCIETE_NOM, 0, 'L');
|
||||
if (defined("FAC_PDF_SOCIETE_NOM") && FAC_PDF_SOCIETE_NOM) $pdf->MultiCell(80, 4, FAC_PDF_SOCIETE_NOM, 0, 'L'); // deprecated
|
||||
else $pdf->MultiCell(80, 4, $this->emetteur->nom, 0, 'L');
|
||||
|
||||
// Caract<63>ristiques emetteur
|
||||
$carac_emetteur = '';
|
||||
if (defined("FAC_PDF_ADRESSE") && FAC_PDF_ADRESSE) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).FAC_PDF_ADRESSE;
|
||||
if (defined("FAC_PDF_ADRESSE") && FAC_PDF_ADRESSE) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).FAC_PDF_ADRESSE; // deprecated
|
||||
else {
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$this->emetteur->adresse;
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$this->emetteur->cp.' '.$this->emetteur->ville;
|
||||
@@ -1017,22 +1017,37 @@ class pdf_crabe extends ModelePDFFactures
|
||||
// Cadre client destinataire
|
||||
$pdf->rect(100, $posy, 100, $hautcadre);
|
||||
|
||||
// Nom client
|
||||
$pdf->SetXY(102,$posy+3);
|
||||
$pdf->SetFont('Arial','B',11);
|
||||
$pdf->MultiCell(106,4, $object->client->nom, 0, 'L');
|
||||
// If invoice contact defined on invoice, we use it
|
||||
$receiver=0;
|
||||
if ($conf->global->FACTURE_USE_BILL_CONTACT_AS_RECIPIENT)
|
||||
{
|
||||
$arrayidcontact=$object->getIdContact('external','BILLING');
|
||||
if (sizeof($arrayidcontact) > 0)
|
||||
{
|
||||
$idcontact=$arrayidcontact[0];
|
||||
$result=$object->fetch_contact($idcontact);
|
||||
if ($result > 0) $receiver=$object->contact;
|
||||
$receiver=$object->contact;
|
||||
}
|
||||
}
|
||||
if (! $receiver) $receiver=$object->client;
|
||||
|
||||
// Caract<63>ristiques client
|
||||
$carac_client=$object->client->adresse;
|
||||
$carac_client.="\n".$object->client->cp . " " . $object->client->ville."\n";
|
||||
if ($this->emetteur->pays_code != $object->client->pays_code)
|
||||
{
|
||||
$carac_client.=$object->client->pays."\n";
|
||||
}
|
||||
if ($object->client->tva_intra) $carac_client.="\n".$outputlangs->transnoentities("VATIntraShort").': '.$object->client->tva_intra;
|
||||
$pdf->SetFont('Arial','',9);
|
||||
$pdf->SetXY(102,$posy+8);
|
||||
$pdf->MultiCell(86,4, $carac_client);
|
||||
// Nom client
|
||||
$pdf->SetXY(102,$posy+3);
|
||||
$pdf->SetFont('Arial','B',11);
|
||||
$pdf->MultiCell(106,4, $receiver->nom, 0, 'L');
|
||||
|
||||
// Caract<63>ristiques client
|
||||
$carac_client=$receiver->adresse;
|
||||
$carac_client.="\n".$receiver->cp . " " . $receiver->ville."\n";
|
||||
if ($this->emetteur->pays_code != $receiver->pays_code)
|
||||
{
|
||||
$carac_client.=$receiver->pays."\n";
|
||||
}
|
||||
if ($receiver->tva_intra) $carac_client.="\n".$outputlangs->transnoentities("VATIntraShort").': '.$receiver->tva_intra;
|
||||
$pdf->SetFont('Arial','',9);
|
||||
$pdf->SetXY(102,$posy+8);
|
||||
$pdf->MultiCell(86,4, $carac_client);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -288,6 +288,7 @@ ChequesArea=Cheques deposits area
|
||||
ChequeDeposits=Cheques deposits
|
||||
Cheques=Cheques
|
||||
CreditNoteConvertedIntoDiscount=This credit note has been converted into %s
|
||||
UsBillingContactAsIncoiveRecipientIfExist=Use customer billing contact address instead of third party address as recipient for invoices
|
||||
|
||||
# oursin PDF model
|
||||
Of=du
|
||||
|
||||
@@ -288,6 +288,7 @@ ChequesArea=Espace remises de ch
|
||||
ChequeDeposits=D<>pots de ch<63>ques
|
||||
Cheques=Ch<43>ques
|
||||
CreditNoteConvertedIntoDiscount=Cet avoir a <20>t<EFBFBD> converti en %s
|
||||
UsBillingContactAsIncoiveRecipientIfExist=Utiliser l'adresse du contact facturation client de la facture plutot que l'adresse du tiers comme destinataire des factures
|
||||
|
||||
# oursin PDF model
|
||||
Of=du
|
||||
|
||||
Reference in New Issue
Block a user