From f20dd8019426c164af8d210692445c830aca28c4 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 18 Jan 2019 11:20:36 +0100 Subject: [PATCH] FIX: better thirparty support --- htdocs/don/card.php | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/htdocs/don/card.php b/htdocs/don/card.php index 6a63074166c..d2a43b41813 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Florian Henry * Copyright (C) 2015-2016 Alexandre Spangaro - * Copyright (C) 2018 Thibault FOUCART + * Copyright (C) 2018-2019 Thibault FOUCART * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -107,8 +107,8 @@ if ($action == 'update') $object->amount = price2num(GETPOST("amount",'alpha')); $object->town = GETPOST("town",'alpha'); $object->zip = GETPOST("zipcode",'alpha'); - $object->country_id = GETPOST('country_id', 'int'); - $object->email = GETPOST("email",'alpha'); + $object->country_id = GETPOST('country_id', 'int'); + $object->email = GETPOST("email",'alpha'); $object->date = $donation_date; $object->public = GETPOST("public",'alpha'); $object->fk_project = GETPOST("fk_project",'alpha'); @@ -154,6 +154,7 @@ if ($action == 'add') if (! $error) { + $object->fk_soc = GETPOST("fk_soc",'int'); $object->firstname = GETPOST("firstname",'alpha'); $object->lastname = GETPOST("lastname",'alpha'); $object->societe = GETPOST("societe",'alpha'); @@ -161,8 +162,8 @@ if ($action == 'add') $object->amount = price2num(GETPOST("amount",'alpha')); $object->zip = GETPOST("zipcode",'alpha'); $object->town = GETPOST("town",'alpha'); - $object->country_id = GETPOST('country_id', 'int'); - $object->email = GETPOST("email",'alpha'); + $object->country_id = GETPOST('country_id', 'int'); + $object->email = GETPOST("email",'alpha'); $object->date = $donation_date; $object->note_private= GETPOST("note_private",'none'); $object->note_public = GETPOST("note_public",'none'); @@ -516,7 +517,7 @@ if (! empty($id) && $action == 'edit') // Amount if ($object->statut == 0) { - print "".''.$langs->trans("Amount").' '.$langs->trans("Currency".$conf->currency).''; + print "".''.$langs->trans("Amount").' '.$langs->trans("Currency".$conf->currency).''; } else { @@ -530,6 +531,14 @@ if (! empty($id) && $action == 'edit') print ""; print "\n"; +if ( $object->fk_soc && ! empty($conf->societe->enabled) && ! empty($conf->global->DONATION_USE_THIRDPARTIES) ) { + + $company=new Societe($db); + $result=$company->fetch($object->fk_soc); + + print ''.$langs->trans("LinkedToDolibarrThirdParty").''.$company->getNomUrl(1).''; + +} else { $langs->load("companies"); print ''.$langs->trans("Company").''; print ''.$langs->trans("Lastname").''; @@ -537,10 +546,10 @@ if (! empty($id) && $action == 'edit') print ''.$langs->trans("Address").''; print ''; - // Zip / Town - print ''.$langs->trans("Zip").' / '.$langs->trans("Town").''; + // Zip / Town + print ''.$langs->trans("Zip").' / '.$langs->trans("Town").''; print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','state_id'),6); - print ' '; + print ' '; print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','state_id')); print ''; @@ -551,7 +560,7 @@ if (! empty($id) && $action == 'edit') print ''; print "".''.$langs->trans("EMail").''; - +} // Payment mode print "".$langs->trans("PaymentMode")."\n"; if ($object->modepaymentid) $selected = $object->modepaymentid; @@ -683,11 +692,22 @@ if (! empty($id) && $action != 'edit') print ''.$langs->trans("PublicDonation").''; print yn($object->public); print ''; + +if ($object->fk_soc) { + + $company=new Societe($db); + $result=$company->fetch($object->fk_soc); + + print ''.$langs->trans("LinkedToDolibarrThirdParty").''.$company->getNomUrl(1).''; + +} else { print ''.$langs->trans("Company").''.$object->societe.''; print ''.$langs->trans("Lastname").''.$object->lastname.''; print ''.$langs->trans("Firstname").''.$object->firstname.''; +} + // Payment mode print "".$langs->trans("PaymentMode").""; $form->form_modes_reglement(null, $object->modepaymentid,'none');