Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #53: Wysiwyg links #73

Closed
wants to merge 11 commits into from
38 changes: 30 additions & 8 deletions htdocs/admin/supplier_order.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,24 @@
$fourn->CreateCategory($user,$_POST["cat"]);
}

else if ($action == 'set_SUPPLIER_ORDER_FREE_TEXT')
else if ($action == 'set_SUPPLIER_ORDER_OTHER')
{
$freetext = GETPOST('SUPPLIER_ORDER_FREE_TEXT'); // No alpha here, we want exact string

$res = dolibarr_set_const($db, "SUPPLIER_ORDER_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);

if (! $res > 0) $error++;
$doubleapproval = GETPOST('SUPPLIER_ORDER_DOUBLE_APPROVAL');
$doubleapprovalgroup = GETPOST('SUPPLIER_ORDER_DOUBLE_APPROVAL_GROUP') > 0 ? GETPOST('SUPPLIER_ORDER_DOUBLE_APPROVAL_GROUP') : '';

$res1 = dolibarr_set_const($db, "SUPPLIER_ORDER_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
$res2 = dolibarr_set_const($db, "SUPPLIER_ORDER_DOUBLE_APPROVAL",$doubleapproval,'chaine',0,'',$conf->entity);
if (isset($_POST["SUPPLIER_ORDER_DOUBLE_APPROVAL_GROUP"]))
{
$res3 = dolibarr_set_const($db, "SUPPLIER_ORDER_DOUBLE_APPROVAL_GROUP",$doubleapprovalgroup,'chaine',0,'',$conf->entity);
}
else
{
$res3=1;
}

if (! $res1 > 0 || ! $res2 > 0 || ! $res3 > 0) $error++;

if (! $error)
{
Expand All @@ -188,12 +199,12 @@
* View
*/

$form=new Form($db);

$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);

llxHeader("","");

$form=new Form($db);

$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("SuppliersSetup"),$linkback,'setup');

Expand Down Expand Up @@ -447,7 +458,7 @@

print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_SUPPLIER_ORDER_FREE_TEXT">';
print '<input type="hidden" name="action" value="set_SUPPLIER_ORDER_OTHER">';

print_titre($langs->trans("OtherOptions"));
print '<table class="noborder" width="100%">';
Expand All @@ -457,6 +468,17 @@
print '<td width="80">&nbsp;</td>';
print "</tr>\n";

if ($conf->global->MAIN_FEATURES_LEVEL > 0)
{
print '<tr '.$bc[$var].'><td>';
print $langs->trans("UseDoubleApproval").'</td><td>';
print $form->selectyesno('SUPPLIER_ORDER_DOUBLE_APPROVAL', $conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL);
print '<br>'.$form->select_dolgroups($conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL_GROUP,'SUPPLIER_ORDER_DOUBLE_APPROVAL_GROUP', 1);
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
}

print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("FreeLegalTextOnOrders").' ('.$langs->trans("AddCRIfTooLong").')<br>';
print '<textarea name="SUPPLIER_ORDER_FREE_TEXT" class="flat" cols="120">'.$conf->global->SUPPLIER_ORDER_FREE_TEXT.'</textarea>';
Expand Down
1 change: 1 addition & 0 deletions htdocs/categories/admin/categorie_extrafields.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
/*
* Actions
*/

require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';


Expand Down
13 changes: 13 additions & 0 deletions htdocs/compta/bank/ligne.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
$langs->load("bills");
if (! empty($conf->adherent->enabled)) $langs->load("members");
if (! empty($conf->don->enabled)) $langs->load("donations");
if (! empty($conf->loan->enabled)) $langs->load("loan");


$id = (GETPOST('id','int') ? GETPOST('id','int') : GETPOST('account','int'));
Expand Down Expand Up @@ -347,6 +348,18 @@
print $langs->trans("SalaryPayment");
print '</a>';
}
else if ($links[$key]['type']=='payment_loan') {
print '<a href="'.DOL_URL_ROOT.'/loan/payment/card.php?id='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowLoanPayment'),'payment').' ';
print $langs->trans("PaymentLoan");
print '</a>';
}
else if ($links[$key]['type']=='loan') {
print '<a href="'.DOL_URL_ROOT.'/loan/card.php?id='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowLoan'),'bill').' ';
print $langs->trans("Loan");
print '</a>';
}
else if ($links[$key]['type']=='member') {
print '<a href="'.DOL_URL_ROOT.'/adherents/card.php?rowid='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowMember'),'user').' ';
Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/class/extrafields.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ class ExtraFields
'mail'=>'ExtrafieldMail',
'select' => 'ExtrafieldSelect',
'sellist' => 'ExtrafieldSelectList',
'separate' => 'ExtrafieldSeparator',
'checkbox' => 'ExtrafieldCheckBox',
'radio' => 'ExtrafieldRadio',
'checkbox' => 'ExtrafieldCheckBox',
'chkbxlst' => 'ExtrafieldCheckBoxFromList',
'link' => 'ExtrafieldLink',
'separate' => 'ExtrafieldSeparator',
);

/**
Expand Down
25 changes: 16 additions & 9 deletions htdocs/core/tpl/admin_extrafields_add.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

/**
* The following vars must be defined
* $type2label
* $form
* $conf, $lang,
*/

?>

<!-- BEGIN PHP TEMPLATE admin_extrafields_add.tpl.php -->
Expand Down Expand Up @@ -47,13 +55,13 @@ function init_typeoffields(type)
else if (type == 'varchar') { size.val('255').removeAttr('disabled'); unique.removeAttr('disabled','disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); }
else if (type == 'boolean') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();}
else if (type == 'price') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();}
else if (type == 'select') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();}
else if (type == 'link') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();}
else if (type == 'sellist') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").show();jQuery("#helpchkbxlst").hide();}
else if (type == 'checkbox') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();}
else if (type == 'radio') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();}
else if (type == 'separate') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); required.val('').attr('disabled','disabled'); default_value.val('').attr('disabled','disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();}
else if (type == 'chkbxlst') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").hide(); jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").show();}
else if (type == 'select') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();}
else if (type == 'link') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();;jQuery("#helpchkbxlst").hide();jQuery("#helplink").show();}
else if (type == 'sellist') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").show();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();}
else if (type == 'radio') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();}
else if (type == 'checkbox') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();}
else if (type == 'chkbxlst') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").show();jQuery("#helplink").hide();}
else if (type == 'separate') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); required.val('').attr('disabled','disabled'); default_value.val('').attr('disabled','disabled'); jQuery("#value_choice").hide();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();}
else size.val('').attr('disabled','disabled');
}
init_typeoffields('<?php echo GETPOST('type'); ?>');
Expand All @@ -66,7 +74,6 @@ function init_typeoffields(type)
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
<input type="hidden" name="action" value="add">
<input type="hidden" name="rowid" value="<?php echo $rowid ?>">

<table summary="listofattributes" class="border centpercent">
<!-- Label -->
Expand All @@ -90,7 +97,7 @@ function init_typeoffields(type)
<td>
<table class="nobordernopadding">
<tr><td>
<textarea name="param" id="param" cols="80" rwos="<?php echo ROWS_4 ?>"><?php echo GETPOST('param'); ?></textarea>
<textarea name="param" id="param" cols="80" rows="<?php echo ROWS_4 ?>"><?php echo GETPOST('param'); ?></textarea>
</td><td id="helpselect"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpselect"),1,0)?></td>
<td><span id="helpsellist"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpsellist"),1,0)?></span>
<span id="helpchkbxlst"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpchkbxlst"),1,0)?></span></td></tr>
Expand Down
1 change: 1 addition & 0 deletions htdocs/langs/en_US/admin.lang
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ ExtrafieldSeparator=Separator
ExtrafieldCheckBox=Checkbox
ExtrafieldRadio=Radio button
ExtrafieldCheckBoxFromList= Checkbox from table
ExtrafieldLink=Link to an object
ExtrafieldParamHelpselect=Parameters list have to be like key,value<br><br> for example : <br>1,value1<br>2,value2<br>3,value3<br>...<br><br>In order to have the list depending on another :<br>1,value1|parent_list_code:parent_key<br>2,value2|parent_list_code:parent_key
ExtrafieldParamHelpcheckbox=Parameters list have to be like key,value<br><br> for example : <br>1,value1<br>2,value2<br>3,value3<br>...
ExtrafieldParamHelpradio=Parameters list have to be like key,value<br><br> for example : <br>1,value1<br>2,value2<br>3,value3<br>...
Expand Down
1 change: 1 addition & 0 deletions htdocs/langs/en_US/loan.lang
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Loans=Loans
NewLoan=New Loan
ShowLoan=Show Loan
PaymentLoan=Loan payment
ShowLoanPayment=Show Loan Payment
Capital=Capital
Insurance=Insurance
Interest=Interest
Expand Down
3 changes: 2 additions & 1 deletion htdocs/langs/en_US/suppliers.lang
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ SentToSuppliers=Sent to suppliers
ListOfSupplierOrders=List of supplier orders
MenuOrdersSupplierToBill=Supplier orders to invoice
NbDaysToDelivery=Delivery delay in days
DescNbDaysToDelivery=The biggest delay is display among order product list
DescNbDaysToDelivery=The biggest delay is display among order product list
UseDoubleApproval=Use double approval (the second approval will be any user of a defined user group)
4 changes: 2 additions & 2 deletions htdocs/loan/class/paymentloan.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ function delete($user, $notrigger=0)
* @param string $emetteur_banque Name of bank
* @return int <0 if KO, >0 if OK
*/
function addPaymentToBank($user,$mode,$label,$accountid,$emetteur_nom,$emetteur_banque)
function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque)
{
global $conf;

Expand Down Expand Up @@ -448,7 +448,7 @@ function addPaymentToBank($user,$mode,$label,$accountid,$emetteur_nom,$emetteur_
//$linkaddedforthirdparty=array();
if ($mode == 'payment_loan')
{
$result=$acc->add_url_line($bank_line_id, $this->id, DOL_URL_ROOT.'/loan/card.php?id=', $this->type_libelle.(($this->label && $this->label!=$this->type_libelle)?' ('.$this->label.')':''),'loan');
$result=$acc->add_url_line($bank_line_id, $this->id, DOL_URL_ROOT.'/loan/card.php?id=', ($this->label?$this->label:''),'loan');
if ($result <= 0) dol_print_error($this->db);
}
}
Expand Down
8 changes: 4 additions & 4 deletions htdocs/loan/payment/payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
$socid = $user->societe_id;
}

$loan = new Loan($db);
$loan->fetch($chid);

/*
* Actions
*/
Expand Down Expand Up @@ -92,6 +95,7 @@
$payment = new PaymentLoan($db);
$payment->chid = $chid;
$payment->datepaid = $datepaid;
$payment->label = $loan->label;
$payment->amount_capital = GETPOST('amount_capital');
$payment->amount_insurance = GETPOST('amount_insurance');
$payment->amount_interest = GETPOST('amount_interest');
Expand Down Expand Up @@ -150,10 +154,6 @@
// Form to create loan's payment
if ($_GET["action"] == 'create')
{

$loan = new Loan($db);
$loan->fetch($chid);

$total = $loan->capital;

print_fiche_titre($langs->trans("DoPayment"));
Expand Down