Skip to content

Commit

Permalink
Fix #30298 - billing contact in supplier proposal (#30404)
Browse files Browse the repository at this point in the history
* add external contact with billing code in supplier_proposal pdf

* update with pr returns

* Update pdf_other.php

* fix inversing condition

* Update pdf_other.php

---------

Co-authored-by: Laurent Destailleur <[email protected]>
  • Loading branch information
samifilali and eldy authored Jul 16, 2024
1 parent c9de307 commit 22def4f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
13 changes: 13 additions & 0 deletions htdocs/admin/pdf_other.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,19 @@
}
print '</td></tr>';

/* Keep this option hidden for the moment to avoid options inflation. We'll see later if it is used enough...
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("SUPPLIER_PROPOSAL_ADD_BILLING_CONTACT"), $langs->trans("SUPPLIER_PROPOSAL_ADD_BILLING_CONTACTMore"));
print '</td><td>';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('SUPPLIER_PROPOSAL_ADD_BILLING_CONTACT');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("SUPPLIER_PROPOSAL_ADD_BILLING_CONTACT", $arrval, $conf->global->SUPPLIER_PROPOSAL_ADD_BILLING_CONTACT);
}
print '</td></tr>';
*/

print '</table>';
print '</div>';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1353,7 +1353,11 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)

// If CUSTOMER contact defined, we use it
$usecontact = false;
$arrayidcontact = $object->getIdContact('external', 'CUSTOMER');
if (!getDolGlobalInt('SUPPLIER_PROPOSAL_ADD_BILLING_CONTACT')) {
$arrayidcontact = $object->getIdContact('external', 'CUSTOMER');
} else {
$arrayidcontact = array_merge($object->getIdContact('external', 'CUSTOMER'), $object->getIdContact('external', 'BILLING'));
}
if (count($arrayidcontact) > 0) {
$usecontact = true;
$result = $object->fetch_contact($arrayidcontact[0]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1375,7 +1375,11 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)

// If CUSTOMER contact defined on proposal, we use it. Note: Even if this is a supplier object, the code for external contat that follow order is 'CUSTOMER'
$usecontact = false;
$arrayidcontact = $object->getIdContact('external', 'CUSTOMER');
if (!getDolGlobalInt('SUPPLIER_PROPOSAL_ADD_BILLING_CONTACT')) {
$arrayidcontact = $object->getIdContact('external', 'CUSTOMER');
} else {
$arrayidcontact = array_merge($object->getIdContact('external', 'CUSTOMER'), $object->getIdContact('external', 'BILLING'));
}
if (count($arrayidcontact) > 0) {
$usecontact = true;
$result = $object->fetch_contact($arrayidcontact[0]);
Expand Down
2 changes: 2 additions & 0 deletions htdocs/langs/en_US/admin.lang
Original file line number Diff line number Diff line change
Expand Up @@ -2361,6 +2361,8 @@ INVOICE_ADD_SWISS_QR_CODE=Show the swiss QR-Bill code on invoices
INVOICE_ADD_SWISS_QR_CODEMore=Switzerland's standard for invoices; make sure ZIP & City are filled and that the accounts have valid Swiss/Liechtenstein IBANs.
INVOICE_SHOW_SHIPPING_ADDRESS=Show shipping address
INVOICE_SHOW_SHIPPING_ADDRESSMore=Compulsory indication in some countries (France, ...)
SUPPLIER_PROPOSAL_ADD_BILLING_CONTACT = Show billing contact on proposal
SUPPLIER_PROPOSAL_ADD_BILLING_CONTACMore = By default the contact only appears for billing
UrlSocialNetworksDesc=Url link of social network. Use {socialid} for the variable part that contains the social network ID.
IfThisCategoryIsChildOfAnother=If this category is a child of another one
DarkThemeMode=Dark theme mode
Expand Down

0 comments on commit 22def4f

Please sign in to comment.