31require
'../../main.inc.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/lib/donation.lib.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/lib/payments.lib.php';
45require_once DOL_DOCUMENT_ROOT.
'/don/class/don.class.php';
48$langs->loadLangs(array(
"admin",
"donations"));
50$action =
GETPOST(
'action',
'aZ09');
53$hookmanager->initHooks(array(
'newpayment'));
66if ($action ==
'setDONATION_ENABLE_PUBLIC') {
74if ($action ==
'update') {
75 $public =
GETPOST(
'DONATION_ENABLE_PUBLIC');
77 $minamount =
GETPOST(
'DONATION_MIN_AMOUNT');
78 $publiccounters =
GETPOST(
'DONATION_COUNTERS_ARE_PUBLIC');
79 $payonline =
GETPOST(
'DONATION_NEWFORM_PAYONLINE');
104$title = $langs->trans(
"DonationsSetup");
105$help_url =
'EN:Module_Donation|FR:Module_Don';
107llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-don page-admin_website');
110$linkback =
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/admin/modules.php', [
'restore_lastsearch_values' => 1]).
'">'.
img_picto($langs->trans(
"BackToModuleList"),
'back',
'class="pictofixedwidth"').
'<span class="hideonsmartphone">'.$langs->trans(
"BackToModuleList").
'</span></a>';
117print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
118print
'<input type="hidden" name="action" value="update">';
119print
'<input type="hidden" name="token" value="'.newToken().
'">';
123if (
$conf->use_javascript_ajax) {
124 print
"\n".
'<script type="text/javascript">';
125 print
'jQuery(document).ready(function () {
126 function initfields()
128 if (jQuery("#DONATION_ENABLE_PUBLIC").val()==\'0\') {
129 jQuery("#trforcetype, #tramount, #tredit, #trpayment").hide();
131 if (jQuery("#DONATION_ENABLE_PUBLIC").val()==\'1\') {
132 jQuery("#trforcetype, #tramount, #tredit, #trpayment").show();
136 jQuery("#DONATION_ENABLE_PUBLIC").change(function() { initfields(); });
138 print
'</script>'.
"\n";
142print
'<span class="opacitymedium">'.$langs->trans(
"BlankDonationFormDesc").
'</span><br><br>';
146$enabledisablehtml = $langs->trans(
"EnablePublicDonationForm").
' ';
149 $enabledisablehtml .=
'<a class="reposition valignmiddle" href="'.$_SERVER[
"PHP_SELF"].
'?action=setDONATION_ENABLE_PUBLIC&token='.newToken().
'&value=1'.$param.
'">';
150 $enabledisablehtml .=
img_picto($langs->trans(
"Disabled"),
'switch_off');
151 $enabledisablehtml .=
'</a>';
154 $enabledisablehtml .=
'<a class="reposition valignmiddle" href="'.$_SERVER[
"PHP_SELF"].
'?action=setDONATION_ENABLE_PUBLIC&token='.newToken().
'&value=0'.$param.
'">';
155 $enabledisablehtml .=
img_picto($langs->trans(
"Activated"),
'switch_on');
156 $enabledisablehtml .=
'</a>';
158print $enabledisablehtml;
159print
'<input type="hidden" id="DONATION_ENABLE_PUBLIC" name="DONATION_ENABLE_PUBLIC" value="'.(!
getDolGlobalString(
'DONATION_ENABLE_PUBLIC') ? 0 : 1).
'">';
166 print
img_picto(
'',
'globe').
' <span class="opacitymedium">'.$langs->trans(
'BlankDonationForm').
'</span><br>';
168 $entity_qr =
'?entity='.((int)
$conf->entity);
175 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
177 print
'<div class="urllink">';
178 print
'<input type="text" id="publicurldonation" class="quatrevingtpercentminusx" value="'.$urlwithroot.
'/public/donations/new.php'.$entity_qr.
'">';
179 print
'<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.
'/public/donations/new.php'.$entity_qr.
'">'.
img_picto(
'',
'globe',
'class="paddingleft"').
'</a>';
181 print ajax_autoselect(
'publicurldonation');
185 print
'<div class="div-table-responsive-no-min">';
186 print
'<table class="noborder centpercent">';
188 print
'<tr class="liste_titre">';
189 print
'<td>'.$langs->trans(
"Parameter").
'</td>';
190 print
'<td>'.$langs->trans(
"Value").
'</td>';
194 print
'<tr class="oddeven" id="tredit"><td>';
195 print $langs->trans(
"MinimumAmountDonation");
197 print
'<input type="text" class="right width50" id="DONATION_MIN_AMOUNT" name="DONATION_MIN_AMOUNT" value="'.getDolGlobalString(
'DONATION_MIN_AMOUNT').
'">';
198 print
"</td></tr>\n";
201 print
'<tr class="oddeven" id="tredit"><td>';
202 print $langs->trans(
"donationCountersArePublic");
204 print $form->selectyesno(
"DONATION_COUNTERS_ARE_PUBLIC",
getDolGlobalInt(
'DONATION_COUNTERS_ARE_PUBLIC'), 1,
false, 0, 1);
205 print
"</td></tr>\n";
208 print
'<tr class="oddeven" id="trpayment"><td>';
209 print $langs->trans(
"DONATION_NEWFORM_PAYONLINE");
214 $validpaymentmethod = getValidOnlinePaymentMethods(
'', 1);
217 $listofval = array();
218 $listofval[
'-1'] = array(
'label' => $langs->trans(
'No'));
219 $listofval[
'all'] = array(
'label' => $langs->trans(
'Yes').
' ('.$langs->trans(
"VisitorCanChooseItsPaymentMode").
')',
'data-html' => $langs->trans(
'Yes').
' <span class="opacitymedium">('.$langs->trans(
"VisitorCanChooseItsPaymentMode").
')</span>');
220 foreach ($validpaymentmethod as $key => $val) {
221 if (is_array($val)) {
222 $listofval[$key] = $val;
224 $listofval[$key] = array(
'label' => $key,
'status' =>
'valid');
228 print $form->selectarray(
"DONATION_NEWFORM_PAYONLINE", $listofval,
getDolGlobalString(
'DONATION_NEWFORM_PAYONLINE'), 0);
229 print
"</td></tr>\n";
234 print
'<div class="center">';
235 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
global $dolibarr_main_url_root
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
donation_admin_prepare_head()
Prepare array with list of admin tabs.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.