Merge remote-tracking branch 'upstream/develop' into fixmerge

This commit is contained in:
Frédéric FRANCE 2021-03-02 08:13:33 +01:00
commit 883faf6f43
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
11 changed files with 116 additions and 78 deletions

View File

@ -402,13 +402,13 @@ foreach ($dirmodels as $reldir) {
// Active
if (in_array($name, $def)) {
print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;token='.newToken().'&amp;value='.$name.'">';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&amp;token='.newToken().'&amp;value='.$name.'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
} else {
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
@ -417,7 +417,7 @@ foreach ($dirmodels as $reldir) {
if ($conf->global->PROPALE_ADDON_PDF == "$name") {
print img_picto($langs->trans("Default"), 'on');
} else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
print '</td>';

View File

@ -720,17 +720,17 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
/*
* Last actions
*/
if ($user->rights->agenda->myactions->read) {
/*if ($user->rights->agenda->myactions->read) {
show_array_last_actions_done($max);
}
}*/
/*
* Actions to do
*/
if ($user->rights->agenda->myactions->read) {
/*if ($user->rights->agenda->myactions->read) {
show_array_actions_to_do($max);
}
}*/
/*

View File

@ -2113,6 +2113,24 @@ if ($action == 'create') {
print '</td>';
print '</tr>';
// Payment mode
print '<tr>';
print '<td class="valuefield">';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentMode');
print '</td>';
if ($action != 'editmode' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'), 1).'</a></td>';
}
print '</tr></table>';
print '</td><td class="valuefieldcreate">';
if ($object->statut == Propal::STATUS_DRAFT && $action == 'editmode' && $usercancreate) {
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1);
} else {
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none');
}
print '</td></tr>';
// Delivery date
$langs->load('deliveries');
print '<tr><td>';
@ -2200,24 +2218,6 @@ if ($action == 'create') {
print '</td>';
print '</tr>';
// Payment mode
print '<tr>';
print '<td class="valuefield">';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentMode');
print '</td>';
if ($action != 'editmode' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'), 1).'</a></td>';
}
print '</tr></table>';
print '</td><td class="valuefieldcreate">';
if ($object->statut == Propal::STATUS_DRAFT && $action == 'editmode' && $usercancreate) {
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1);
} else {
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none');
}
print '</td></tr>';
// Multicurrency
if (!empty($conf->multicurrency->enabled)) {
// Multicurrency code
@ -2350,7 +2350,7 @@ if ($action == 'create') {
print '<table class="border tableforfield centpercent">';
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) {
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
// Multicurrency Amount HT
print '<tr><td class="titlefieldmiddle">'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).'</td>';
print '<td class="nowrap">'.price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';

View File

@ -95,6 +95,7 @@ $search_availability = GETPOST('search_availability', 'int');
$search_categ_cus = GETPOST("search_categ_cus", 'int');
$search_fk_cond_reglement = GETPOST("search_fk_cond_reglement", 'int');
$search_fk_shipping_method = GETPOST("search_fk_shipping_method", 'int');
$search_fk_input_reason = GETPOST("search_fk_input_reason", 'int');
$search_fk_mode_reglement = GETPOST("search_fk_mode_reglement", 'int');
$search_btn = GETPOST('button_search', 'alpha');
$search_remove_btn = GETPOST('button_removefilter', 'alpha');
@ -189,6 +190,7 @@ $arrayfields = array(
'p.date_livraison'=>array('label'=>"DeliveryDate", 'checked'=>0),
'ava.rowid'=>array('label'=>"AvailabilityPeriod", 'checked'=>0),
'p.fk_shipping_method'=>array('label'=>"SendingMethod", 'checked'=>0, 'enabled'=>!empty($conf->expedition->enabled)),
'p.fk_input_reason'=>array('label'=>"Origin", 'checked'=>0, 'enabled'=>1),
'p.fk_cond_reglement'=>array('label'=>"PaymentConditionsShort", 'checked'=>0),
'p.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>0),
'p.total_ht'=>array('label'=>"AmountHT", 'checked'=>1),
@ -277,6 +279,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_categ_cus = 0;
$search_fk_cond_reglement = '';
$search_fk_shipping_method = '';
$search_fk_input_reason = '';
$search_fk_mode_reglement = '';
}
if ($object_statut != '') {
@ -414,7 +417,7 @@ $sql .= ' p.rowid, p.entity, p.note_private, p.total_ht, p.total_tva, p.total_tt
$sql .= ' p.fk_multicurrency, p.multicurrency_code, p.multicurrency_tx, p.multicurrency_total_ht, p.multicurrency_total_tva, p.multicurrency_total_ttc,';
$sql .= ' p.datec as date_creation, p.tms as date_update, p.date_cloture as date_cloture,';
$sql .= ' p.note_public, p.note_private,';
$sql .= ' p.fk_cond_reglement,p.fk_mode_reglement,p.fk_shipping_method,';
$sql .= ' p.fk_cond_reglement,p.fk_mode_reglement,p.fk_shipping_method,p.fk_input_reason,';
$sql .= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,";
$sql .= ' u.login';
if (!$user->rights->societe->client->voir && !$socid) {
@ -547,6 +550,9 @@ if ($search_fk_cond_reglement > 0) {
if ($search_fk_shipping_method > 0) {
$sql .= " AND p.fk_shipping_method = ".$db->escape($search_fk_shipping_method);
}
if ($search_fk_input_reason > 0) {
$sql .= " AND p.fk_input_reason = ".$db->escape($search_fk_input_reason);
}
if ($search_fk_mode_reglement > 0) {
$sql .= " AND p.fk_mode_reglement = ".$db->escape($search_fk_mode_reglement);
}
@ -735,6 +741,9 @@ if ($resql) {
if ($search_fk_shipping_method > 0) {
$param .= '&search_fk_shipping_method='.$search_fk_shipping_method;
}
if ($search_fk_input_reason > 0) {
$param .= '&search_fk_input_reason='.$search_fk_input_reason;
}
if ($search_fk_mode_reglement > 0) {
$param .= '&search_fk_mode_reglement='.$search_fk_mode_reglement;
}
@ -983,6 +992,12 @@ if ($resql) {
$form->selectShippingMethod($search_fk_shipping_method, 'search_fk_shipping_method', '', 1, '', 1);
print '</td>';
}
// Source - Input reason
if (!empty($arrayfields['p.fk_input_reason']['checked'])) {
print '<td class="liste_titre">';
$form->selectInputReason($search_fk_input_reason, 'search_fk_input_reason', '', 1, 'maxwidth125', 1);
print '</td>';
}
// Payment term
if (!empty($arrayfields['p.fk_cond_reglement']['checked'])) {
print '<td class="liste_titre">';
@ -1169,6 +1184,9 @@ if ($resql) {
if (!empty($arrayfields['p.fk_shipping_method']['checked'])) {
print_liste_field_titre($arrayfields['p.fk_shipping_method']['label'], $_SERVER["PHP_SELF"], "p.fk_shipping_method", "", $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['p.fk_input_reason']['checked'])) {
print_liste_field_titre($arrayfields['p.fk_input_reason']['label'], $_SERVER["PHP_SELF"], "p.fk_input_reason", "", $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['p.fk_cond_reglement']['checked'])) {
print_liste_field_titre($arrayfields['p.fk_cond_reglement']['label'], $_SERVER["PHP_SELF"], "p.fk_cond_reglement", "", $param, '', $sortfield, $sortorder);
}
@ -1473,7 +1491,7 @@ if ($resql) {
$totalarray['nbfield']++;
}
}
//Shipping Method
// Shipping Method
if (!empty($arrayfields['p.fk_shipping_method']['checked'])) {
print '<td>';
$form->formSelectShippingMethod('', $obj->fk_shipping_method, 'none', 1);
@ -1482,6 +1500,17 @@ if ($resql) {
$totalarray['nbfield']++;
}
}
// Source - input reason
if (!empty($arrayfields['p.fk_input_reason']['checked'])) {
print '<td class="tdoverflowmax125" title="'.dol_escape_htmltag($form->cache_demand_reason[$obj->fk_input_reason]['label']).'">';
if ($obj->fk_input_reason > 0) {
print $form->cache_demand_reason[$obj->fk_input_reason]['label'];
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Payment terms
if (!empty($arrayfields['p.fk_cond_reglement']['checked'])) {
print '<td>';

View File

@ -490,7 +490,7 @@ if (empty($reshook)) {
setEventMessages($object->error, $object->errors, 'errors');
}
} elseif ($action == 'classifyunbilled' && $usercancreate) {
$ret = $object->classifyUnBilled();
$ret = $object->classifyUnBilled($user);
if ($ret < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}

View File

@ -2962,11 +2962,12 @@ class Commande extends CommonOrder
/**
* Classify the order as not invoiced
*
* @return int <0 if ko, >0 if ok
* @param User $user Object user making the change
* @param int $notrigger 1=Does not execute triggers, 0=execute triggers
* @return int <0 if ko, >0 if ok
*/
public function classifyUnBilled()
public function classifyUnBilled(User $user, $notrigger = 0)
{
global $conf, $user, $langs;
$error = 0;
$this->db->begin();
@ -2981,12 +2982,14 @@ class Commande extends CommonOrder
$this->billed = 1;
}
// Call trigger
$result = $this->call_trigger('ORDER_CLASSIFY_UNBILLED', $user);
if ($result < 0) {
$error++;
if (!$notrigger && empty($error)) {
// Call trigger
$result = $this->call_trigger('ORDER_CLASSIFY_UNBILLED', $user);
if ($result < 0) {
$error++;
}
// End call triggers
}
// End call triggers
if (!$error) {
$this->billed = 0;

View File

@ -129,7 +129,7 @@ class DolGeoIP
}
} else {
if (!function_exists('geoip_country_code_by_addr')) {
return strtolower(geoip_country_code_by_name($this->gi, $ip));
return strtolower(geoip_country_code_by_name($ip));
}
return strtolower(geoip_country_code_by_addr($this->gi, $ip));
}

View File

@ -3729,15 +3729,17 @@ class Form
* @param string $htmlname Nom de la zone select
* @param string $exclude To exclude a code value (Example: SRC_PROP)
* @param int $addempty Add an empty entry
* @param string $morecss Add more css to the HTML select component
* @param int $notooltip Do not show the tooltip for admin
* @return void
*/
public function selectInputReason($selected = '', $htmlname = 'demandreasonid', $exclude = '', $addempty = 0)
public function selectInputReason($selected = '', $htmlname = 'demandreasonid', $exclude = '', $addempty = 0, $morecss = '', $notooltip = 0)
{
global $langs, $user;
$this->loadCacheInputReason();
print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';
print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">';
if ($addempty) {
print '<option value="0"'.(empty($selected) ? ' selected' : '').'>&nbsp;</option>';
}
@ -3756,7 +3758,7 @@ class Form
print '</option>';
}
print '</select>';
if ($user->admin) {
if ($user->admin && empty($notooltip)) {
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
}
print ajax_combobox('select_'.$htmlname);

View File

@ -913,16 +913,20 @@ IMG;
{
dol_syslog(get_class($this).'::exportAsAttachedPDF $ret_val='.$retval, LOG_DEBUG);
$filename=''; $linenum=0;
if (headers_sent($filename, $linenum)) {
throw new OdfException("headers already sent ($filename at $linenum)");
if (php_sapi_name() != 'cli') { // If we are in a web context (not into CLI context)
if (headers_sent($filename, $linenum)) {
throw new OdfException("headers already sent ($filename at $linenum)");
}
if (!empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
$name=preg_replace('/\.od(x|t)/i', '', $name);
header('Content-type: application/pdf');
header('Content-Disposition: attachment; filename="'.$name.'.pdf"');
readfile($name.".pdf");
}
}
if (!empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
$name=preg_replace('/\.od(x|t)/i', '', $name);
header('Content-type: application/pdf');
header('Content-Disposition: attachment; filename="'.$name.'.pdf"');
readfile($name.".pdf");
}
if (!empty($conf->global->MAIN_ODT_AS_PDF_DEL_SOURCE))
{
unlink($name);
@ -931,7 +935,7 @@ IMG;
dol_syslog(get_class($this).'::exportAsAttachedPDF $ret_val='.$retval, LOG_DEBUG);
dol_syslog(get_class($this).'::exportAsAttachedPDF $output_arr='.var_export($output_arr, true), LOG_DEBUG);
if ($retval==126) {
if ($retval == 126) {
throw new OdfException('Permission execute convert script : ' . $command);
}
else {

View File

@ -4169,7 +4169,7 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo
$mod = new modBlockedLog($db);
// For this module we only reload menus.
$mod->delete_menus();
$mod->insert_menus($reloadmode);
$mod->insert_menus();
}
} elseif ($moduletoreload == 'MAIN_MODULE_CRON') {
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Cron module");

View File

@ -2133,11 +2133,11 @@ if (preg_match('/^dopayment/', $action)) { // If we choosed/click on the payme
}
else
{
/* Disable button to pay and show hourglass cursor */
jQuery('#hourglasstopay').show();
jQuery('#buttontopay').hide();
/* Disable button to pay and show hourglass cursor */
jQuery('#hourglasstopay').show();
jQuery('#buttontopay').hide();
stripe.handleCardPayment(
stripe.handleCardPayment(
clientSecret, cardElement, {
payment_method_data: {
billing_details: {
@ -2159,32 +2159,32 @@ if (preg_match('/^dopayment/', $action)) { // If we choosed/click on the payme
}
<?php } ?>
}
},
save_payment_method: <?php if ($stripecu) {
print 'true';
} else {
print 'false';
} ?> /* true when a customer was provided when creating payment intent. true ask to save the card */
},
save_payment_method:<?php if ($stripecu) {
print 'true';
} else {
print 'false';
} ?> /* true when a customer was provided when creating payment intent. true ask to save the card */
}
).then(function(result) {
).then(function(result) {
console.log(result);
if (result.error) {
console.log("Error on result of handleCardPayment");
jQuery('#buttontopay').show();
jQuery('#hourglasstopay').hide();
// Inform the user if there was an error
var errorElement = document.getElementById('card-errors');
errorElement.textContent = result.error.message;
} else {
if (result.error) {
console.log("Error on result of handleCardPayment");
jQuery('#buttontopay').show();
jQuery('#hourglasstopay').hide();
// Inform the user if there was an error
var errorElement = document.getElementById('card-errors');
errorElement.textContent = result.error.message;
} else {
// The payment has succeeded. Display a success message.
console.log("No error on result of handleCardPayment, so we submit the form");
// Submit the form
jQuery('#buttontopay').hide();
jQuery('#hourglasstopay').show();
// Send form (action=charge that will do nothing)
jQuery('#payment-form').submit();
}
});
console.log("No error on result of handleCardPayment, so we submit the form");
// Submit the form
jQuery('#buttontopay').hide();
jQuery('#hourglasstopay').show();
// Send form (action=charge that will do nothing)
jQuery('#payment-form').submit();
}
});
}
});