Merge branch '23.0' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
f6241de8a0
13 changed files with 237 additions and 64 deletions
|
|
@ -1464,6 +1464,7 @@ function pricejs(amount, mode = 'MT', currency_code = '', force_locale = '') {
|
|||
*/
|
||||
function price2numjs(amount) {
|
||||
if (amount == '') return '';
|
||||
if (amount == null) return ''; /* null or undefined */
|
||||
|
||||
var dec = <?php echo json_encode($dec) ?>;
|
||||
var thousand = <?php echo json_encode($thousand) ?>;
|
||||
|
|
|
|||
|
|
@ -269,7 +269,7 @@ print $formadmin->selectTypeOfFields('type', GETPOST('type', 'alpha'));
|
|||
<tr class="extra_emptyonclone"><td><?php echo $form->textwithpicto($langs->trans("EmptyOnClone"), $langs->trans("EmptyOnCloneDesc")); ?></td><td class="valeur"><input id="emptyonclone" type="checkbox" name="emptyonclone"<?php echo((GETPOST('emptyonclone', 'alpha')) ? ' checked' : ''); ?>></td></tr>
|
||||
<!-- Visibility -->
|
||||
<tr><td class="extra_list"><?php echo $form->textwithpicto($langs->trans("Visibility"), $langs->trans("VisibleDesc").'<br><br>'.$langs->trans("ItCanBeAnExpression")); ?>
|
||||
</td><td class="valeur"><input id="list" class="width50" type="text" name="list" value="<?php echo GETPOSTISSET('list') ? GETPOSTINT('list') : '1'; ?>"></td></tr>
|
||||
</td><td class="valeur"><input id="list" class="minwidth200" type="text" name="list" value="<?php echo GETPOSTISSET('list') ? GETPOST('list') : '1'; ?>"></td></tr>
|
||||
<!-- Visibility for PDF-->
|
||||
<tr><td class="extra_pdf"><?php echo $form->textwithpicto($langs->trans("DisplayOnPdf"), $langs->trans("DisplayOnPdfDesc")); ?>
|
||||
</td><td class="valeur"><input id="printable" class="width50" type="text" name="printable" value="<?php echo dolPrintHTMLForAttribute(GETPOSTISSET('printable') ? GETPOST('printable') : '0'); ?>"></td></tr>
|
||||
|
|
|
|||
|
|
@ -346,7 +346,7 @@ if (in_array($type, array_keys($typewecanchangeinto))) {
|
|||
|
||||
<!-- Visibility -->
|
||||
<tr><td class="extra_list"><?php echo $form->textwithpicto($langs->trans("Visibility"), $langs->trans("VisibleDesc").'<br><br>'.$langs->trans("ItCanBeAnExpression")); ?>
|
||||
</td><td class="valeur"><input id="list" class="width50" type="text" name="list" value="<?php echo($list != '' ? $list : '1'); ?>"></td></tr>
|
||||
</td><td class="valeur"><input id="list" class="minwidth200" type="text" name="list" value="<?php echo($list != '' ? $list : '1'); ?>"></td></tr>
|
||||
|
||||
<!-- Visibility for PDF-->
|
||||
<tr><td class="extra_pdf"><?php echo $form->textwithpicto($langs->trans("DisplayOnPdf"), $langs->trans("DisplayOnPdfDesc")); ?>
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ IfIntegrityAuthenticityIsOkYouCanGetdetailByOpeningTheFile=If integrity and auth
|
|||
IfIntegrityAuthenticityIsOkYouCanGetdetailByOpeningTheFile2=So you can use any filter of your choice and see detail of references, amounts, cumulative and/or pertetual amounts of each events.
|
||||
DetectionOfSystemRestoration=Detection of database system restoration or deletion of the last line
|
||||
FeatureOnlyWhenArchiveAnalyzedFrom=This feature is for the moment available only when archive is controled from %s
|
||||
DiscountInPercent=Discount (in %)
|
||||
DiscountInPercent=Discount (in %%)
|
||||
|
||||
## logTypes
|
||||
logBILL_DELETE=Customer invoice logically deleted
|
||||
|
|
|
|||
|
|
@ -378,6 +378,7 @@ ErrorBadParameterWhenCallingCreateOfBlockedLog=Bad parameter when calling create
|
|||
ErrorMaxDecimalsShownTooLowComparedToUnitOrTotal=Value for 'Max. decimals for prices shown on screen' (%s) must be equal to or greater than both 'Max. decimals for unit prices' (%s) and 'Max. decimals for total prices' (%s). This is required to prevent rounding inconsistencies on documents.
|
||||
ErrorOnlyDraftStatusCanBeDeletedInMassAction=Only elements in draft status can be deleted in mass action
|
||||
ErrorLDAPFunctionsAreDisabledOnThisPHP=LDAP functions are disabled on this PHP.
|
||||
ErrorFailedToGetTokenFromClientIdAndSecret=Failed to get a %s token from client ID and client secret
|
||||
|
||||
# Warnings
|
||||
WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup.
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ IfIntegrityAuthenticityIsOkYouCanGetdetailByOpeningTheFile=If integrity and auth
|
|||
IfIntegrityAuthenticityIsOkYouCanGetdetailByOpeningTheFile2=So you can use any filter of your choice and see detail of references, amounts, cumulative and/or pertetual amounts of each events.
|
||||
DetectionOfSystemRestoration=Detection of database system restoration or deletion of the last line
|
||||
FeatureOnlyWhenArchiveAnalyzedFrom=This feature is for the moment available only when archive is controled from %s
|
||||
DiscountInPercent=Discount (in %)
|
||||
DiscountInPercent=Discount (in %%)
|
||||
|
||||
## logTypes
|
||||
logBILL_DELETE=Az ügyfél számla logikailag törölve
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ IfIntegrityAuthenticityIsOkYouCanGetdetailByOpeningTheFile=ファイル の整
|
|||
IfIntegrityAuthenticityIsOkYouCanGetdetailByOpeningTheFile2=したがって、任意のフィルターを使用して、各イベントの参照、金額、累積金額、および/または永続金額の詳細を表示できます。
|
||||
DetectionOfSystemRestoration=データベースシステムの復元または最終行の削除の検出
|
||||
FeatureOnlyWhenArchiveAnalyzedFrom=この機能は現時点では、アーカイブが %s から制御されている場合にのみ利用可能です。
|
||||
DiscountInPercent=割引率(%)
|
||||
DiscountInPercent=割引率(%s)
|
||||
|
||||
## logTypes
|
||||
logBILL_DELETE=顧客請求書は論理削除済
|
||||
|
|
|
|||
|
|
@ -26,12 +26,6 @@
|
|||
|
||||
// Load Dolibarr environment
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/partnership/lib/partnership.lib.php';
|
||||
|
||||
/**
|
||||
* @var Conf $conf
|
||||
* @var DoliDB $db
|
||||
|
|
@ -40,6 +34,11 @@ require_once DOL_DOCUMENT_ROOT.'/partnership/lib/partnership.lib.php';
|
|||
* @var Translate $langs
|
||||
* @var User $user
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/partnership/lib/partnership.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("partnership", "other"));
|
||||
|
|
|
|||
|
|
@ -26,7 +26,13 @@
|
|||
|
||||
// Load Dolibarr environment
|
||||
require '../main.inc.php';
|
||||
|
||||
/**
|
||||
* @var Conf $conf
|
||||
* @var DoliDB $db
|
||||
* @var HookManager $hookmanager
|
||||
* @var Translate $langs
|
||||
* @var User $user
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
|
|
@ -36,14 +42,6 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
|||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php';
|
||||
|
||||
/**
|
||||
* @var Conf $conf
|
||||
* @var DoliDB $db
|
||||
* @var HookManager $hookmanager
|
||||
* @var Translate $langs
|
||||
* @var User $user
|
||||
*/
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("partnership", "members", "other"));
|
||||
|
||||
|
|
@ -629,6 +627,9 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
|||
if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||
$param .= '&limit='.((int) $limit);
|
||||
}
|
||||
if ($optioncss != '') {
|
||||
$param .= '&optioncss='.urlencode($optioncss);
|
||||
}
|
||||
if ($socid) {
|
||||
$param .= '&socid='.urlencode((string) ($socid));
|
||||
}
|
||||
|
|
@ -650,9 +651,6 @@ foreach ($search as $key => $val) {
|
|||
$param .= '&search_'.$key.'='.urlencode($search[$key]);
|
||||
}
|
||||
}
|
||||
if ($optioncss != '') {
|
||||
$param .= '&optioncss='.urlencode($optioncss);
|
||||
}
|
||||
if ($search_filter && $search_filter != '-1') {
|
||||
$param .= "&search_filter=".urlencode($search_filter);
|
||||
}
|
||||
|
|
@ -704,7 +702,7 @@ $newcardbutton = '';
|
|||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitleSeparator();
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/partnership/partnership_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF'].($socid > 0 ? '?socid='.$socid : '')), '', $permissiontoadd);
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/partnership/partnership_card.php', 1).'?action=create'.($socid > 0 ? '&fk_soc='.$socid : '').'&backtopage='.urlencode($_SERVER['PHP_SELF'].($socid > 0 ? '?socid='.$socid : '')), '', $permissiontoadd);
|
||||
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||
|
|
|
|||
|
|
@ -299,8 +299,24 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he
|
|||
|
||||
$db->begin();
|
||||
|
||||
$morphy = GETPOST("morphy", 'alphanohtml');
|
||||
$lastname = GETPOST("lastname", 'alphanohtml');
|
||||
$firstname = GETPOST("firstname", 'alphanohtml');
|
||||
$societe = GETPOST("societe", 'alphanohtml');
|
||||
$email = preg_replace('/\s+/', '', GETPOST("member_email", 'aZ09arobase'));
|
||||
$country_id = getDolGlobalInt("MEMBER_NEWFORM_FORCECOUNTRYCODE", GETPOSTINT('country_id'));
|
||||
|
||||
if (!in_array($morphy, array('mor', 'phy'))) {
|
||||
$error++;
|
||||
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('MemberNature'))."<br>\n";
|
||||
}
|
||||
|
||||
// test if login already exists
|
||||
if (!getDolGlobalString('ADHERENT_LOGIN_NOT_REQUIRED')) {
|
||||
if (!GETPOST('member_email')) {
|
||||
$error++;
|
||||
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("EMail"))."<br>\n";
|
||||
}
|
||||
if (!GETPOST('login')) {
|
||||
$error++;
|
||||
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login"))."<br>\n";
|
||||
|
|
@ -320,51 +336,36 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he
|
|||
$langs->load("errors");
|
||||
$errmsg .= $langs->trans("ErrorPasswordsMustMatch")."<br>\n";
|
||||
}
|
||||
if (!GETPOST('member_email')) {
|
||||
$error++;
|
||||
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("EMail"))."<br>\n";
|
||||
}
|
||||
}
|
||||
if (GETPOST('typeid') <= 0) {
|
||||
$error++;
|
||||
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type"))."<br>\n";
|
||||
}
|
||||
if (!in_array(GETPOST('morphy'), array('mor', 'phy'))) {
|
||||
$error++;
|
||||
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('Nature'))."<br>\n";
|
||||
}
|
||||
|
||||
$lastname = GETPOST("lastname", 'alphanohtml');
|
||||
$firstname = GETPOST("firstname", 'alphanohtml');
|
||||
$societe = GETPOST("societe", 'alphanohtml');
|
||||
$morphy = GETPOST("morphy", 'alphanohtml');
|
||||
$email = preg_replace('/\s+/', '', GETPOST("member_email", 'aZ09arobase'));
|
||||
$country_id = getDolGlobalInt("MEMBER_NEWFORM_FORCECOUNTRYCODE", GETPOSTINT('country_id'));
|
||||
|
||||
if ($morphy != 'mor' && empty($lastname)) {
|
||||
if ($morphy && $morphy != 'mor' && empty($lastname)) {
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Lastname")), null, 'errors');
|
||||
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentities("Lastname"));
|
||||
}
|
||||
if ($morphy != 'mor' && (!isset($firstname) || $firstname == '')) {
|
||||
if ($morphy && $morphy != 'mor' && (!isset($firstname) || $firstname == '')) {
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Firstname")), null, 'errors');
|
||||
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentities("Firstname"));
|
||||
}
|
||||
if ($morphy == 'mor' && empty($societe)) {
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Company")), null, 'errors');
|
||||
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentities("Company"));
|
||||
}
|
||||
if (empty($country_id)) {
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Country")), null, 'errors');
|
||||
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentities("Country"));
|
||||
}
|
||||
if (getDolGlobalString('ADHERENT_MAIL_REQUIRED') && !isValidEmail($email)) {
|
||||
if (getDolGlobalString('ADHERENT_MAIL_REQUIRED') && $email && !isValidEmail($email)) {
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorBadEMail", $email), null, 'errors');
|
||||
$errmsg .= $langs->trans("ErrorBadEMail", $email);
|
||||
}
|
||||
$birthday = dol_mktime(GETPOSTINT("birthhour"), GETPOSTINT("birthmin"), GETPOSTINT("birthsec"), GETPOSTINT("birthmonth"), GETPOSTINT("birthday"), GETPOSTINT("birthyear"));
|
||||
if (GETPOST("birthmonth") && empty($birthday)) {
|
||||
|
|
@ -850,7 +851,7 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR
|
|||
}
|
||||
|
||||
// Company // TODO : optional hide
|
||||
print '<tr id="trcompany" class="trcompany"><td id="tdcompany" class="titlefieldmiddle'.($checkednature == "mor" ? ' fieldrequired"' : '').'">'.$langs->trans("Company").'</td><td>';
|
||||
print '<tr id="trcompany" class="trcompany"><td id="tdcompany" class="titlefieldmiddle paddingrightonly'.($checkednature == "mor" ? ' fieldrequired"' : '').'">'.$langs->trans("Company").'</td><td>';
|
||||
print img_picto('', 'company', 'class="pictofixedwidth paddingright"');
|
||||
print '<input type="text" name="societe" class="minwidth150 widthcentpercentminusx" value="'.dol_escape_htmltag(GETPOST('societe')).'"></td></tr>'."\n";
|
||||
|
||||
|
|
@ -1001,7 +1002,7 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR
|
|||
|
||||
|
||||
// Add hook to complete the form
|
||||
$parameters = array('country_id' => $country_id);
|
||||
$parameters = array('country_id' => $country_id, 'mode' => 'new');
|
||||
$reshook = $hookmanager->executeHooks('membershipNewSubscriptionPublicForm', $parameters, $object, $action);
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
|
@ -1012,15 +1013,15 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR
|
|||
// Do not set a default amount MEMBER_NEWFORM_AMOUNT if you use MEMBER_NEWFORM_DOLIBARRTURNOVER
|
||||
$s = $langs->trans("AreYouAPreferredPartner", '<a href="https://partners.dolibarr.org" target="_blank">{s1}</a>');
|
||||
$s = str_replace('{s1}', 'Peferred Partner', $s);
|
||||
print '<tr id="trbudget" class="trcompany"><td><label for="pp">'.$s.'</label></td><td>';
|
||||
print '<tr id="trbudget" class="trcompany"><td class="paddingrightonly"><label for="pp" class="small">'.$s.'</label></td><td>';
|
||||
print '<input type="checkbox" name="pp" id="pp" value="1"'.(GETPOST('pp') ? ' checked="checked"' : '').' class="reposition">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr id="trbudget" class="trcompany"><td class="fieldrequired">'.$langs->trans("TurnoverOrBudget").'</td><td>';
|
||||
print '<tr id="trbudget" class="trcompany"><td class="fieldrequired paddingrightonly"><span class="small">'.$langs->trans("TurnoverOrBudget").'</span></td><td>';
|
||||
|
||||
$country_code = dol_getIdFromCode($db, $country_id, 'c_country', 'rowid', 'code');
|
||||
if ($country_code === 'FR' && $checkednature === 'mor' && GETPOST('pp')) {
|
||||
print '<input type="text" name="budget" id="budget" class="flat turnover right width100" value="'.GETPOST('budget').'">';
|
||||
print '<input type="text" name="budget" id="budget" class="flat turnover right width100" value="'.GETPOST('budget').'" required>';
|
||||
} else {
|
||||
$arraybudget = array('50' => '<= 100 000', '100' => '<= 200 000', '200' => '<= 500 000', '300' => '<= 1 500 000', '600' => '<= 3 000 000', '1000' => '<= 5 000 000', '2000' => '5 000 000+');
|
||||
print $form->selectarray('budget', $arraybudget, GETPOSTINT('budget'), 1, 0, 0, '', 0, 0, 0, '');
|
||||
|
|
@ -1058,14 +1059,16 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR
|
|||
jQuery("#newmember").submit();
|
||||
});
|
||||
jQuery("#budget").change(function() {
|
||||
console.log("Turnover amount has been modified");
|
||||
console.log("Turnover amount has been modified on change");
|
||||
newamount = initturnover();
|
||||
jQuery("#amount").val(newamount);
|
||||
jQuery("#amounthidden").val(newamount);
|
||||
});
|
||||
jQuery("#budget").keyup(function() {
|
||||
console.log("Turnover amount has been modified");
|
||||
console.log("Turnover amount has been modified on keyup");
|
||||
newamount = initturnover();
|
||||
jQuery("#amount").val(newamount);
|
||||
jQuery("#amounthidden").val(newamount);
|
||||
});
|
||||
|
||||
function initturnover() {
|
||||
|
|
@ -1074,7 +1077,7 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR
|
|||
morphy = jQuery("#moralinput").is(\':checked\') ? \'mor\' : \'phy\';
|
||||
selectcountry_id = jQuery("#selectcountry_id").val();
|
||||
pp = jQuery("#pp").is(\':checked\') ? true : false;
|
||||
console.log("Set fields according to nature other properties");
|
||||
console.log("Set fields according to nature and other properties");
|
||||
console.log("morphy="+morphy);
|
||||
console.log("selectcountry_id="+selectcountry_id);
|
||||
console.log("pp="+pp);
|
||||
|
|
@ -1098,7 +1101,7 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR
|
|||
if (selectcountry_id == 1) {
|
||||
if (pp) {
|
||||
console.log("value selected in input text field is "+jQuery("#budget").val());
|
||||
newamount = Math.max(Math.round(jQuery("#budget").val() * 0.005), 50);
|
||||
newamount = Math.max(Math.round(price2numjs(jQuery("#budget").val()) * 0.005), 50);
|
||||
console.log("newamount = "+newamount);
|
||||
} else {
|
||||
console.log("not a pp");
|
||||
|
|
@ -1117,6 +1120,7 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR
|
|||
jQuery("#budget").val(\'\');
|
||||
newamount = \'\';
|
||||
}
|
||||
console.log("newamount="+newamount);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1001,6 +1001,7 @@ print '<input type="hidden" name="e" value="'.$entity.'" />';
|
|||
//print '<input type="hidden" name="forcesandbox" value="'.GETPOSTINT('forcesandbox').'" />';
|
||||
print '<input type="hidden" name="lang" value="'.$getpostlang.'">';
|
||||
print '<input type="hidden" name="ws" value="'.$ws.'">';
|
||||
print '<input type="hidden" name="reload" id="reload" value="0">';
|
||||
print "\n";
|
||||
|
||||
|
||||
|
|
@ -1807,19 +1808,170 @@ if ($source == 'member' || $source == 'membersubscription') {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// Add hook to complete the form
|
||||
$parameters = array('mode' => 'renewal');
|
||||
$reshook = $hookmanager->executeHooks('membershipNewSubscriptionPublicForm', $parameters, $object, $action);
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
// TODO Move this into previous hook
|
||||
if (getDolGlobalString('MEMBER_NEWFORM_DOLIBARRTURNOVER')) {
|
||||
$country_id = 0;
|
||||
if ($member->thirdparty instanceOf Societe) {
|
||||
$country_id = $member->thirdparty->country_id;
|
||||
}
|
||||
$checkednature = $member->morphy;
|
||||
print '<input type="hidden" name="moralinput" id="moralinput" value="'.$checkednature.'">';
|
||||
|
||||
// Is it a Preferred Partner
|
||||
$pp = 0;
|
||||
include_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php';
|
||||
$partnership = new Partnership($db);
|
||||
$result = $partnership->fetch(0, null, null, $member->thirdparty->id);
|
||||
if ($result > 0) {
|
||||
$pp = 1;
|
||||
}
|
||||
|
||||
// Do not set a default amount MEMBER_NEWFORM_AMOUNT if you use MEMBER_NEWFORM_DOLIBARRTURNOVER
|
||||
$s = $langs->trans("AreYouAPreferredPartner", '<a href="https://partners.dolibarr.org" target="_blank">{s1}</a>');
|
||||
$s = str_replace('{s1}', 'Peferred Partner', $s);
|
||||
print '<tr id="trbudget" class="trcompany"><td><label for="pp" class="small">'.$s.'</label></td><td>';
|
||||
print '<input type="checkbox" name="pp" id="pp" value="1"'.((GETPOST('reload') ? GETPOST('pp') : $pp) ? ' checked="checked"' : '').' class="reposition">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr id="trbudget" class="trcompany"><td class=""><span class="small">'.$langs->trans("TurnoverOrBudget").'</span></td><td>';
|
||||
|
||||
$country_code = dol_getIdFromCode($db, $country_id, 'c_country', 'rowid', 'code');
|
||||
if ($country_code === 'FR' && $checkednature === 'mor' && (GETPOST('reload') ? GETPOST('pp') : $pp)) {
|
||||
print '<input type="text" name="budget" id="budget" class="flat turnover right width100" value="'.GETPOST('budget').'" required autofocus>';
|
||||
} else {
|
||||
$arraybudget = array('50' => '<= 100 000', '100' => '<= 200 000', '200' => '<= 500 000', '300' => '<= 1 500 000', '600' => '<= 3 000 000', '1000' => '<= 5 000 000', '2000' => '5 000 000+');
|
||||
print $form->selectarray('budget', $arraybudget, GETPOSTINT('budget'), 1, 0, 0, ($checkednature === 'mor' ? 'required' :''), 0, 0, 0, '');
|
||||
}
|
||||
print ' € or $';
|
||||
|
||||
print '<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
firstload = true;
|
||||
|
||||
newamount = initturnover();
|
||||
jQuery("#amount").val(newamount);
|
||||
jQuery("#newamount").val(newamount);
|
||||
|
||||
firstload = false;
|
||||
|
||||
jQuery("#selectcountry_id").change(function() {
|
||||
console.log("We change country (code added for association, replace common code), so we reload page");
|
||||
jQuery("#budget").val(\'\');
|
||||
jQuery("#amount").val(\'\');
|
||||
jQuery("#newamount").val(\'\');
|
||||
jQuery("#amounthidden").val(\'\');
|
||||
});
|
||||
jQuery("#pp").change(function() {
|
||||
console.log("We change the preferred partner status");
|
||||
selectcountry_id = jQuery("#selectcountry_id").val();
|
||||
morphy = jQuery("#moralinput").is(\':checked\') ? \'mor\' : \'phy\';
|
||||
jQuery("#budget").val(\'\');
|
||||
jQuery("#amount").val(\'\');
|
||||
jQuery("#amounthidden").val(\'\');
|
||||
jQuery("#newamount").val(\'\');
|
||||
jQuery("#reload").val(\'1\');
|
||||
document.paymentform.action.value="";
|
||||
jQuery("#dolpaymentform").submit();
|
||||
});
|
||||
jQuery("#budget").change(function() {
|
||||
console.log("Turnover amount has been modified on change");
|
||||
newamount = initturnover();
|
||||
jQuery("#amount").val(newamount);
|
||||
jQuery("#amounthidden").val(newamount);
|
||||
jQuery("#newamount").val(newamount);
|
||||
});
|
||||
jQuery("#budget").keyup(function() {
|
||||
console.log("Turnover amount has been modified on keyup");
|
||||
newamount = initturnover();
|
||||
jQuery("#amount").val(newamount);
|
||||
jQuery("#amounthidden").val(newamount);
|
||||
jQuery("#newamount").val(newamount);
|
||||
});
|
||||
|
||||
function initturnover() {
|
||||
newamount = 0;
|
||||
|
||||
//morphy = jQuery("#moralinput").is(\':checked\') ? \'mor\' : \'phy\';
|
||||
morphy = jQuery("#moralinput").val();
|
||||
selectcountry_id = '.((int) $country_id).';
|
||||
pp = jQuery("#pp").is(\':checked\') ? true : false;
|
||||
console.log("Set fields according to nature and other properties");
|
||||
console.log("morphy="+morphy);
|
||||
console.log("selectcountry_id="+selectcountry_id);
|
||||
console.log("pp="+pp);
|
||||
|
||||
if (morphy == \'phy\') {
|
||||
jQuery(".amount").val('.((float) $amount).');
|
||||
jQuery("#trbirth").show();
|
||||
jQuery(".trcompany").hide();
|
||||
jQuery(".trbudget").hide();
|
||||
newamount = '.((float) $amount).';
|
||||
} else {
|
||||
jQuery(".amount").val(\'\');
|
||||
jQuery("#trbirth").hide();
|
||||
jQuery(".trcompany").show();
|
||||
jQuery(".trbudget").show();
|
||||
jQuery(".hideifautoturnover").hide();
|
||||
if (firstload) {
|
||||
jQuery("#budget").val(\'\');
|
||||
}
|
||||
|
||||
if (selectcountry_id == 1) {
|
||||
if (pp) {
|
||||
console.log("value selected in input text field is "+jQuery("#budget").val());
|
||||
newamount = Math.max(Math.round(price2numjs(jQuery("#budget").val()) * 0.005), 50);
|
||||
console.log("newamount = "+newamount);
|
||||
} else {
|
||||
console.log("not a pp");
|
||||
if (jQuery("#budget").val() > 0) {
|
||||
console.log("value found in budget is "+jQuery("#budget").val());
|
||||
newamount = jQuery("#budget").val();
|
||||
} else {
|
||||
jQuery("#budget").val(\'\');
|
||||
newamount = \'\';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (jQuery("#budget").val() > 0) {
|
||||
newamount = jQuery("#budget").val();
|
||||
} else {
|
||||
jQuery("#budget").val(\'\');
|
||||
newamount = \'\';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return newamount;
|
||||
}
|
||||
});
|
||||
</script>';
|
||||
print '</td></tr>'."\n";
|
||||
}
|
||||
|
||||
|
||||
// Set amount for the subscription from the the type and options:
|
||||
// - First check the amount of the member type if not previous payment.
|
||||
// - First check the amount of the member type if there is no previous payment.
|
||||
$amount = ($member->last_subscription_amount ? $member->last_subscription_amount : (empty($amountbytype[$typeid]) ? 0 : $amountbytype[$typeid]));
|
||||
// - If not found, take the default amount
|
||||
if (empty($amount) && getDolGlobalString('MEMBER_NEWFORM_AMOUNT')) {
|
||||
$amount = getDolGlobalString('MEMBER_NEWFORM_AMOUNT');
|
||||
}
|
||||
|
||||
// - If an amount was posted from the form (for example from page with types of membership)
|
||||
if ($caneditamount && GETPOSTISSET('amount') && GETPOSTFLOAT('amount', 'MT') > 0) {
|
||||
if ($caneditamount && !GETPOST('reload') && GETPOSTISSET('amount') && GETPOSTFLOAT('amount', 'MT') > 0) {
|
||||
$amount = GETPOSTFLOAT('amount', 'MT');
|
||||
}
|
||||
// - If a new amount was posted from the form
|
||||
if ($caneditamount && GETPOSTISSET('newamount') && GETPOSTFLOAT('newamount', 'MT') > 0) {
|
||||
if ($caneditamount && !GETPOST('reload') && GETPOSTISSET('newamount') && GETPOSTFLOAT('newamount', 'MT') > 0) {
|
||||
$amount = GETPOSTFLOAT('newamount', 'MT');
|
||||
}
|
||||
// - If a min is set or an amount from the posted form, we take them into account
|
||||
|
|
@ -1829,18 +1981,18 @@ if ($source == 'member' || $source == 'membersubscription') {
|
|||
print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Amount");
|
||||
// This place no longer allows amount edition
|
||||
if (getDolGlobalString('MEMBER_EXT_URL_SUBSCRIPTION_INFO')) {
|
||||
print ' - <a href="' . getDolGlobalString('MEMBER_EXT_URL_SUBSCRIPTION_INFO').'" rel="external" target="_blank" rel="noopener noreferrer">'.$langs->trans("SeeHere").'</a>';
|
||||
print ' - <a href="' . getDolGlobalString('MEMBER_EXT_URL_SUBSCRIPTION_INFO').'" rel="external" target="_blank" rel="noopener noreferrer">'.img_picto('', 'url', 'class="pictofixedwidth"').$langs->trans("SeeHere").'</a>';
|
||||
}
|
||||
print '</td><td class="CTableRow2">';
|
||||
|
||||
$caneditamount = $adht->caneditamount;
|
||||
$minimumamount = !getDolGlobalString('MEMBER_MIN_AMOUNT') ? $adht->amount : max(getDolGlobalString('MEMBER_MIN_AMOUNT'), $adht->amount, $amount);
|
||||
|
||||
if ($caneditamount && $action != 'dopayment') {
|
||||
if ($caneditamount && ($action != 'dopayment' || GETPOST('reload'))) {
|
||||
if (GETPOSTISSET('newamount')) {
|
||||
print '<input type="text" class="width75" name="newamount" value="'.price(price2num(GETPOST('newamount'), '', 2), 1, $langs, 1, -1, -1).'">';
|
||||
print '<input type="text" class="width75 amount" name="newamount" id="newamount" value="'.price(price2num(GETPOST('newamount'), '', 2), 1, $langs, 1, -1, -1).'">';
|
||||
} else {
|
||||
print '<input type="text" class="width75" name="newamount" value="'.price($amount, 1, $langs, 1, -1, -1).'">';
|
||||
print '<input type="text" class="width75 amount" name="newamount" id="newamount" value="'.price($amount, 1, $langs, 1, -1, -1).'">';
|
||||
}
|
||||
} else {
|
||||
print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency
|
||||
|
|
@ -2580,7 +2732,7 @@ if (preg_match('/^dopayment/', $action)) { // If we choose/clicked on the paym
|
|||
// JS Code for Stripe
|
||||
if (empty($stripearrayofkeys['publishable_key'])) {
|
||||
$langs->load("errors");
|
||||
print info_admin($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Stripe")), 0, 0, 'error');
|
||||
print info_admin($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Stripe")), 0, 0, 'error marginleftonly marginrightonly');
|
||||
} else {
|
||||
print '<!-- JS Code for Stripe components -->';
|
||||
print '<script src="https://js.stripe.com/v3/"></script>'."\n";
|
||||
|
|
|
|||
|
|
@ -5781,6 +5781,15 @@ div.boximport {
|
|||
.product_line_stock_too_low { color: var(--productlinestocktoolow); }
|
||||
|
||||
.fieldrequired { font-weight: bold; color: var(--fieldrequiredcolor) !important; }
|
||||
#tablesubscribe .fieldrequired {
|
||||
font-weight: inherit !important;
|
||||
color: inherit !important;
|
||||
}
|
||||
#tablesubscribe .fieldrequired:after {
|
||||
content: " *";
|
||||
color: #660000;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
td.widthpictotitle, .table-fiche-title img.widthpictotitle { width: 34px; text-align: <?php echo $left; ?>; }
|
||||
span.widthpictotitle { font-size: 1.5em; }
|
||||
|
|
|
|||
|
|
@ -5713,6 +5713,15 @@ div.boximport {
|
|||
.product_line_stock_too_low { color: #884400; }
|
||||
|
||||
.fieldrequired { font-weight: bold; color: #000055; }
|
||||
#tablesubscribe .fieldrequired {
|
||||
font-weight: inherit !important;
|
||||
color: inherit !important;
|
||||
}
|
||||
#tablesubscribe .fieldrequired:after {
|
||||
content: " *";
|
||||
color: #660000;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
td.widthpictotitle, .table-fiche-title img.widthpictotitle { width: 32px; font-size: 1.4em; text-align: <?php echo $left; ?>; }
|
||||
table.titlemodulehelp tr td img.widthpictotitle { width: 80px; }
|
||||
|
|
|
|||
Loading…
Reference in a new issue