Fix: Pb with autocompletefor records with no country and state
This commit is contained in:
parent
1b9b787622
commit
c96915b3ce
@ -174,7 +174,7 @@ class FormCompany
|
||||
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
||||
print '</tr></table></form>';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Retourne la liste deroulante des departements/province/cantons tout pays confondu ou pour un pays donne.
|
||||
* \remarks Dans le cas d'une liste tout pays confondus, l'affichage fait une rupture sur le pays.
|
||||
@ -207,7 +207,7 @@ class FormCompany
|
||||
dol_syslog("FormCompany::select_departement selected=$selected, pays_code=$pays_code",LOG_DEBUG);
|
||||
|
||||
$langs->load("dict");
|
||||
|
||||
|
||||
$out='';
|
||||
|
||||
// On recherche les departements/cantons/province active d'une region et pays actif
|
||||
@ -272,7 +272,7 @@ class FormCompany
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
@ -337,7 +337,7 @@ class FormCompany
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Retourne la liste deroulante des civilite actives
|
||||
* \param selected civilite pre-selectionnee
|
||||
@ -357,7 +357,7 @@ class FormCompany
|
||||
{
|
||||
global $conf,$langs,$user;
|
||||
$langs->load("dict");
|
||||
|
||||
|
||||
$out='';
|
||||
|
||||
$sql = "SELECT rowid, code, civilite, active FROM ".MAIN_DB_PREFIX."c_civilite";
|
||||
@ -397,10 +397,10 @@ class FormCompany
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Retourne la liste deroulante des formes juridiques tous pays confondus ou pour un pays donne.
|
||||
* \remarks Dans le cas d'une liste tous pays confondu, on affiche une rupture sur le pays
|
||||
@ -422,7 +422,7 @@ class FormCompany
|
||||
{
|
||||
global $conf,$langs,$user;
|
||||
$langs->load("dict");
|
||||
|
||||
|
||||
$out='';
|
||||
|
||||
// On recherche les formes juridiques actives des pays actifs
|
||||
@ -484,7 +484,7 @@ class FormCompany
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
@ -523,7 +523,7 @@ class FormCompany
|
||||
if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT)
|
||||
{
|
||||
$minLength = (is_numeric($conf->global->COMPANY_USE_SEARCH_TO_SELECT)?$conf->global->COMPANY_USE_SEARCH_TO_SELECT:2);
|
||||
|
||||
|
||||
$socid=0;
|
||||
if ($selected)
|
||||
{
|
||||
@ -609,22 +609,22 @@ class FormCompany
|
||||
}
|
||||
print "</select>\n";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retourne la liste deroulante des codes postaux et des villes associées
|
||||
*/
|
||||
function select_ziptown($selected='',$htmlname='zipcode',$fields='',$fieldsize=0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
||||
$out='';
|
||||
|
||||
|
||||
$size='';
|
||||
if (!empty($fieldsize)) $size='size="'.$fieldsize.'"';
|
||||
|
||||
|
||||
if ($conf->use_javascript_ajax) $out.= ajax_multiautocompleter($htmlname,$fields,DOL_URL_ROOT.'/core/ajaxziptown.php')."\n";
|
||||
$out.= '<input id="'.$htmlname.'" type="text" name="'.$htmlname.'" '.$size.' value="'.$selected.'">'."\n";
|
||||
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
||||
@ -88,6 +88,7 @@ function ajax_multiautocompleter($htmlname,$fields,$url,$option='')
|
||||
|
||||
$fields = php2js($fields);
|
||||
|
||||
$script.= '<!-- Autocomplete -->'."\n";
|
||||
$script.= '<script type="text/javascript">';
|
||||
$script.= 'jQuery(document).ready(function() {
|
||||
var fields = '.$fields.';
|
||||
@ -107,8 +108,9 @@ function ajax_multiautocompleter($htmlname,$fields,$url,$option='')
|
||||
jQuery("#departement_id").html(item.states);
|
||||
}
|
||||
for (i=0;i<length;i++) {
|
||||
if (item[fields[i]]) {
|
||||
jQuery("#" + fields[i]).val(item[fields[i]]);
|
||||
if (item[fields[i]]) { // If defined
|
||||
//alert(item[fields[i]]);
|
||||
jQuery("#" + fields[i]).val(item[fields[i]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -117,14 +119,31 @@ function ajax_multiautocompleter($htmlname,$fields,$url,$option='')
|
||||
});
|
||||
},
|
||||
select: function( event, ui ) {
|
||||
// TODO move this to specific request
|
||||
if (ui.item.states) {
|
||||
jQuery("#departement_id").html(ui.item.states);
|
||||
}
|
||||
|
||||
for (i=0;i<length;i++) {
|
||||
//alert(fields[i] + " = " + ui.item[fields[i]]);
|
||||
if (ui.item[fields[i]]) {
|
||||
jQuery("#" + fields[i]).val(ui.item[fields[i]]);
|
||||
if (fields[i]=="selectpays_id")
|
||||
{
|
||||
if (ui.item[fields[i]] > 0) // Do not erase country if unknown
|
||||
{
|
||||
jQuery("#" + fields[i]).val(ui.item[fields[i]]);
|
||||
// If we set new country and new state, we need to set a new list of state to allow change
|
||||
if (ui.item.states && ui.item["departement_id"] != jQuery("#departement_id").value) {
|
||||
jQuery("#departement_id").html(ui.item.states);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (fields[i]=="departement_id")
|
||||
{
|
||||
if (ui.item[fields[i]] > 0) // Do not erase state if unknown
|
||||
{
|
||||
jQuery("#" + fields[i]).val(ui.item[fields[i]]); // This may fails if not correct country
|
||||
}
|
||||
}
|
||||
else if (ui.item[fields[i]]) { // If defined
|
||||
//alert(fields[i]);
|
||||
//alert(ui.item[fields[i]]);
|
||||
jQuery("#" + fields[i]).val(ui.item[fields[i]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,6 +61,8 @@ $langs->load("paypal");
|
||||
llxHeaderPayBox($langs->trans("PaymentForm"));
|
||||
|
||||
|
||||
print '<span id="dolpaymentspan"></span>'."\n";
|
||||
|
||||
print $langs->trans("YourPaymentHasNotBeenRecorded");
|
||||
|
||||
|
||||
|
||||
@ -60,6 +60,8 @@ $langs->load("paypal");
|
||||
llxHeaderPayBox($langs->trans("PaymentForm"));
|
||||
|
||||
|
||||
print '<span id="dolpaymentspan"></span>'."\n";
|
||||
|
||||
print $langs->trans("YourPaymentHasBeenRecorded");
|
||||
|
||||
|
||||
|
||||
@ -78,9 +78,9 @@ if ($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY == 'paypalonly')
|
||||
if ($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY == 'integral')
|
||||
{
|
||||
dol_syslog("expresscheckout redirect with CallMarkExpressCheckout $paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL, $shipToName, $shipToStreet, $shipToCity, $shipToState, $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum");
|
||||
$resArray = CallMarkExpressCheckout ($paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL);
|
||||
//$resArray = CallMarkExpressCheckout ($paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL,
|
||||
//$shipToName, $shipToStreet, $shipToCity, $shipToState, $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum);
|
||||
//$resArray = CallMarkExpressCheckout ($paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL);
|
||||
$resArray = CallMarkExpressCheckout ($paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL,
|
||||
$shipToName, $shipToStreet, $shipToCity, $shipToState, $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum);
|
||||
}
|
||||
// For direct payment with credit card
|
||||
if ($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY == 'cconly')
|
||||
|
||||
@ -411,6 +411,14 @@ if ($_REQUEST["source"] == 'order')
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="EMAIL" size="48" value="'.$email.'"></td></tr>'."\n";
|
||||
|
||||
// Shipping address
|
||||
$shipToName=$order->client->nom;
|
||||
$shipToStreet=$order->client->address;
|
||||
$shipToCity=$order->client->ville;
|
||||
$shipToState=$order->client->departement_code;
|
||||
$shipToCountryCode=$order->client->pays_code;
|
||||
$shipToZip=$order->client->cp;
|
||||
$shipToStreet2='';
|
||||
$phoneNum=$order->client->tel;
|
||||
print '<input type="hidden" name="shipToName" value="'.$shipToName.'">'."\n";
|
||||
print '<input type="hidden" name="shipToStreet" value="'.$shipToStreet.'">'."\n";
|
||||
print '<input type="hidden" name="shipToCity" value="'.$shipToCity.'">'."\n";
|
||||
|
||||
@ -60,6 +60,8 @@ $langs->load("paypal");
|
||||
llxHeaderPaypal($langs->trans("PaymentForm"));
|
||||
|
||||
|
||||
print '<span id="dolpaymentspan"></span>'."\n";
|
||||
|
||||
print $langs->trans("YourPaymentHasNotBeenRecorded");
|
||||
|
||||
//require_once(DOL_DOCUMENT_ROOT."/paypal/lib/paypalfunctions.php");
|
||||
|
||||
@ -62,6 +62,8 @@ $langs->load("paypal");
|
||||
llxHeaderPaypal($langs->trans("PaymentForm"));
|
||||
|
||||
|
||||
print '<span id="dolpaymentspan"></span>'."\n";
|
||||
|
||||
print $langs->trans("YourPaymentHasBeenRecorded");
|
||||
|
||||
//require_once(DOL_DOCUMENT_ROOT."/paypal/lib/paypalfunctions.php");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user