Merge branch 'develop' of github.com:Dolibarr/dolibarr into dev_new_conf_defaulteventstatus

This commit is contained in:
Florian HENRY 2021-03-02 11:05:20 +01:00
commit 0f7144a391
17 changed files with 181 additions and 217 deletions

34
DCO Normal file
View File

@ -0,0 +1,34 @@
Developer Certificate of Origin
Version 1.1
Copyright (C) 2002 - Today, The Dolibarr team and its contributors.
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.

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

@ -341,8 +341,7 @@ foreach ($bankcateg->fetchAll() as $bankcategory) {
/* ************************************************************************** */
if ($action == 'create') {
// Update fields properties in realtime
if (!empty($conf->use_javascript_ajax))
{
if (!empty($conf->use_javascript_ajax)) {
print "\n".'<script type="text/javascript" language="javascript">';
print '$(document).ready(function () {
setPaymentType();

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

@ -356,8 +356,7 @@ if ($action == 'create') {
// Company
if (!empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES)) {
// Thirdparty
if ($soc->id > 0)
{
if ($soc->id > 0) {
print '<td class="fieldrequired">'.$langs->trans('ThirdParty').'</td>';
print '<td>';
print $soc->getNomUrl(1);

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

@ -914,13 +914,9 @@ if ($source == 'order') {
if ($action != 'dopayment') { // Do not change amount if we just click on first dopayment
$amount = $order->total_ttc;
<<<<<<< HEAD
if (GETPOST("amount", 'int')) {
$amount = GETPOST("amount", 'int');
if (GETPOST("amount", 'alpha')) {
$amount = GETPOST("amount", 'alpha');
}
=======
if (GETPOST("amount", 'alpha')) $amount = GETPOST("amount", 'alpha');
>>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git
$amount = price2num($amount);
}
@ -969,14 +965,8 @@ if ($source == 'order') {
print ' ('.$langs->trans("ToComplete").')';
}
print '</td><td class="CTableRow'.($var ? '1' : '2').'">';
<<<<<<< HEAD
if (empty($amount) || !is_numeric($amount)) {
print '<input type="hidden" name="amount" value="'.GETPOST("amount", 'int').'">';
=======
if (empty($amount) || !is_numeric($amount))
{
print '<input type="hidden" name="amount" value="'.price2num(GETPOST("amount", 'alpha'), 'MT').'">';
>>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount", "alpha"), 'MT').'">';
} else {
print '<b>'.price($amount).'</b>';
@ -1048,13 +1038,9 @@ if ($source == 'invoice') {
if ($action != 'dopayment') { // Do not change amount if we just click on first dopayment
$amount = price2num($invoice->total_ttc - ($invoice->getSommePaiement() + $invoice->getSumCreditNotesUsed() + $invoice->getSumDepositsUsed()));
<<<<<<< HEAD
if (GETPOST("amount", 'int')) {
$amount = GETPOST("amount", 'int');
if (GETPOST("amount", 'alpha')) {
$amount = GETPOST("amount", 'alpha');
}
=======
if (GETPOST("amount", 'int')) $amount = GETPOST("amount", 'alpha');
>>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git
$amount = price2num($amount);
}
@ -1106,14 +1092,8 @@ if ($source == 'invoice') {
if ($object->type == $object::TYPE_CREDIT_NOTE) {
print '<b>'.$langs->trans("CreditNote").'</b>';
} elseif (empty($object->paye)) {
<<<<<<< HEAD
if (empty($amount) || !is_numeric($amount)) {
print '<input type="hidden" name="amount" value="'.GETPOST("amount", 'int').'">';
=======
if (empty($amount) || !is_numeric($amount))
{
print '<input type="hidden" name="amount" value="'.price2num(GETPOST("amount", 'alpha'), 'MT').'">';
>>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount", "alpha"), 'MT').'">';
} else {
print '<b>'.price($amount).'</b>';
@ -1224,13 +1204,9 @@ if ($source == 'contractline') {
}
}
<<<<<<< HEAD
if (GETPOST("amount", 'int')) {
$amount = GETPOST("amount", 'int');
if (GETPOST("amount", 'alpha')) {
$amount = GETPOST("amount", 'alpha');
}
=======
if (GETPOST("amount", 'alpha')) $amount = GETPOST("amount", 'alpha');
>>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git
$amount = price2num($amount);
}
@ -1320,14 +1296,8 @@ if ($source == 'contractline') {
print ' ('.$langs->trans("ToComplete").')';
}
print '</td><td class="CTableRow'.($var ? '1' : '2').'">';
<<<<<<< HEAD
if (empty($amount) || !is_numeric($amount)) {
print '<input type="hidden" name="amount" value="'.GETPOST("amount", 'int').'">';
=======
if (empty($amount) || !is_numeric($amount))
{
print '<input type="hidden" name="amount" value="'.price2num(GETPOST("amount", 'alpha'), 'MT').'">';
>>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount", "alpha"), 'MT').'">';
} else {
print '<b>'.price($amount).'</b>';
@ -1400,15 +1370,10 @@ if ($source == 'membersubscription') {
if ($action != 'dopayment') { // Do not change amount if we just click on first dopayment
$amount = $subscription->total_ttc;
<<<<<<< HEAD
if (GETPOST("amount", 'int')) {
$amount = GETPOST("amount", 'int');
if (GETPOST("amount", 'alpha')) {
$amount = GETPOST("amount", 'alpha');
}
$amount = price2num($amount);
=======
if (GETPOST("amount", 'alpha')) $amount = GETPOST("amount", 'alpha');
$amount = price2num($amount, 'MT');
>>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git
}
if (GETPOST('fulltag', 'alpha')) {
@ -1505,14 +1470,9 @@ if ($source == 'membersubscription') {
}
if (empty($amount) || !is_numeric($amount)) {
//$valtoshow=price2num(GETPOST("newamount",'alpha'),'MT');
<<<<<<< HEAD
if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) {
$valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow);
}
print '<input type="hidden" name="amount" value="'.GETPOST("amount", 'int').'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.$valtoshow.'">';
=======
if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow);
print '<input type="hidden" name="amount" value="'.price2num(GETPOST("amount", 'alpha'), 'MT').'">';
if (empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) {
print '<input class="flat maxwidth75" type="text" name="newamountbis" value="'.$valtoshow.'" disabled>';
@ -1520,15 +1480,11 @@ if ($source == 'membersubscription') {
} else {
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.$valtoshow.'">';
}
>>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git
} else {
$valtoshow = $amount;
if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) {
$valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow);
<<<<<<< HEAD
=======
$amount = $valtoshow;
>>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git
}
print '<b>'.price($valtoshow).'</b>';
print '<input type="hidden" name="amount" value="'.$valtoshow.'">';
@ -1598,13 +1554,9 @@ if ($source == 'donation') {
if ($action != 'dopayment') { // Do not change amount if we just click on first dopayment
$amount = $subscription->total_ttc;
<<<<<<< HEAD
if (GETPOST("amount", 'int')) {
$amount = GETPOST("amount", 'int');
if (GETPOST("amount", 'alpha')) {
$amount = GETPOST("amount", 'alpha');
}
=======
if (GETPOST("amount", 'alpha')) $amount = GETPOST("amount", 'alpha');
>>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git
$amount = price2num($amount);
}
@ -1678,24 +1630,16 @@ if ($source == 'donation') {
}
if (empty($amount) || !is_numeric($amount)) {
//$valtoshow=price2num(GETPOST("newamount",'alpha'),'MT');
<<<<<<< HEAD
if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) {
$valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow);
}
print '<input type="hidden" name="amount" value="'.GETPOST("amount", 'int').'">';
=======
if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow);
print '<input type="hidden" name="amount" value="'.price2num(GETPOST("amount", 'alpha'), 'MT').'">';
>>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.$valtoshow.'">';
} else {
$valtoshow = $amount;
if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) {
$valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow);
<<<<<<< HEAD
=======
$amount = $valtoshow;
>>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git
}
print '<b>'.price($valtoshow).'</b>';
print '<input type="hidden" name="amount" value="'.$valtoshow.'">';
@ -2181,7 +2125,6 @@ if (preg_match('/^dopayment/', $action)) { // If we choosed/click on the payme
console.log("We click on buttontopay");
event.preventDefault();
<<<<<<< HEAD
if (cardholderName.value == '')
{
console.log("Field Card holder is empty");
@ -2190,7 +2133,11 @@ if (preg_match('/^dopayment/', $action)) { // If we choosed/click on the payme
}
else
{
stripe.handleCardPayment(
/* Disable button to pay and show hourglass cursor */
jQuery('#hourglasstopay').show();
jQuery('#buttontopay').hide();
stripe.handleCardPayment(
clientSecret, cardElement, {
payment_method_data: {
billing_details: {
@ -2212,87 +2159,34 @@ if (preg_match('/^dopayment/', $action)) { // If we choosed/click on the payme
}
<?php } ?>
}
},
save_payment_method: <?php if ($stripecu) {
print 'true';
} else {
},
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 */
} ?> /* 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();
}
});
}
});
=======
if (cardholderName.value == '')
{
console.log("Field Card holder is empty");
var displayError = document.getElementById('card-errors');
displayError.textContent = '<?php print dol_escape_js($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CardOwner"))); ?>';
}
else
{
/* Disable button to pay and show hourglass cursor */
jQuery('#hourglasstopay').show();
jQuery('#buttontopay').hide();
stripe.handleCardPayment(
clientSecret, cardElement, {
payment_method_data: {
billing_details: {
name: cardholderName.value
<?php if (GETPOST('email', 'alpha') || (is_object($object) && is_object($object->thirdparty) && !empty($object->thirdparty->email))) { ?>, email: '<?php echo dol_escape_js(GETPOST('email', 'alpha') ? GETPOST('email', 'alpha') : $object->thirdparty->email); ?>'<?php } ?>
<?php if (is_object($object) && is_object($object->thirdparty) && !empty($object->thirdparty->phone)) { ?>, phone: '<?php echo dol_escape_js($object->thirdparty->phone); ?>'<?php } ?>
<?php if (is_object($object) && is_object($object->thirdparty)) { ?>, address: {
city: '<?php echo dol_escape_js($object->thirdparty->town); ?>',
<?php if ($object->thirdparty->country_code) { ?>country: '<?php echo dol_escape_js($object->thirdparty->country_code); ?>',<?php } ?>
line1: '<?php echo dol_escape_js(preg_replace('/\s\s+/', ' ', $object->thirdparty->address)); ?>',
postal_code: '<?php echo dol_escape_js($object->thirdparty->zip); ?>'
}
<?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 */
}
).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 {
// 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();
}
});
}
});
>>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git
<?php
} else // Old method (not SCA ready)

View File

@ -86,14 +86,14 @@ if (empty($conf) || !is_object($conf)) {
<tr>
<td><span class="fieldrequired"><?php echo $langs->trans('Supplier'); ?></span></td>
<td><?php echo $this->control->tpl['yn_supplier']; ?></td>
<td><?php echo $langs->trans('SupplierCode'); ?></td>
<td>
<table class="nobordernopadding">
<tr>
<td><input type="text" name="code_fournisseur" size="16" value="<?php echo $this->control->tpl['suppliercode']; ?>" maxlength="24"></td>
<td><?php echo $this->control->tpl['help_suppliercode']; ?></td>
</tr>
</table>
<td><?php echo $langs->trans('SupplierCode'); ?></td>
<td>
<table class="nobordernopadding">
<tr>
<td><input type="text" name="code_fournisseur" size="16" value="<?php echo $this->control->tpl['suppliercode']; ?>" maxlength="24"></td>
<td><?php echo $this->control->tpl['help_suppliercode']; ?></td>
</tr>
</table>
</td>
</tr>

View File

@ -94,14 +94,14 @@ if (empty($conf) || !is_object($conf)) {
<tr>
<td><span class="fieldrequired"><?php echo $langs->trans('Supplier'); ?></span></td>
<td><?php echo $this->control->tpl['yn_supplier']; ?></td>
<td><?php echo $langs->trans('SupplierCode'); ?></td>
<td>
<table class="nobordernopadding">
<tr>
<td><input type="text" name="code_fournisseur" size="16" value="<?php echo $this->control->tpl['suppliercode']; ?>" maxlength="24"></td>
<td><?php echo $this->control->tpl['help_suppliercode']; ?></td>
</tr>
</table>
<td><?php echo $langs->trans('SupplierCode'); ?></td>
<td>
<table class="nobordernopadding">
<tr>
<td><input type="text" name="code_fournisseur" size="16" value="<?php echo $this->control->tpl['suppliercode']; ?>" maxlength="24"></td>
<td><?php echo $this->control->tpl['help_suppliercode']; ?></td>
</tr>
</table>
</td>
</tr>

View File

@ -82,9 +82,9 @@ class DateLibTzFranceTest extends PHPUnit\Framework\TestCase
{
global $conf,$user,$langs,$db;
if (getServerTimeZoneString() != 'Europe/Paris' && getServerTimeZoneString() != 'Europe/Berlin') {
print "\n".__METHOD__." This PHPUnit test can be launched manually only onto a server with PHP timezone set to TZ=Europe/Paris, not a TZ=".getServerTimeZoneString().".\n"; die();
}
if (getServerTimeZoneString() != 'Europe/Paris' && getServerTimeZoneString() != 'Europe/Berlin') {
print "\n".__METHOD__." This PHPUnit test can be launched manually only onto a server with PHP timezone set to TZ=Europe/Paris, not a TZ=".getServerTimeZoneString().".\n"; die();
}
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.