Skip to content

Commit

Permalink
Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into d…
Browse files Browse the repository at this point in the history
…evelop
  • Loading branch information
eldy committed Nov 29, 2018
2 parents 9e20d9e + ea3e58a commit bbfd134
Show file tree
Hide file tree
Showing 6 changed files with 154 additions and 8 deletions.
9 changes: 5 additions & 4 deletions htdocs/accountancy/admin/card.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -41,6 +41,7 @@
$ref = GETPOST('ref', 'alpha');
$rowid = GETPOST('rowid', 'int');
$cancel = GETPOST('cancel','alpha');
$accountingaccount = GETPOST('accountingaccount','alpha');

// Security check

Expand Down Expand Up @@ -229,7 +230,7 @@

// Account number
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">' . $langs->trans("AccountNumber") . '</span></td>';
print '<td><input name="account_number" size="30" value="' . $object->account_number . '"></td></tr>';
print '<td><input name="account_number" size="30" value="' . $accountingaccount . '"></td></tr>';

// Label
print '<tr><td><span class="fieldrequired">' . $langs->trans("Label") . '</span></td>';
Expand Down
2 changes: 1 addition & 1 deletion htdocs/accountancy/bookkeeping/balance.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@
$description = $object->get_compte_desc($line->numero_compte); // Search description of the account
$root_account_description = $object->get_compte_racine($line->numero_compte);
if (empty($description)) {
$link = '<a href="../admin/card.php?action=create&compte=' . length_accountg($line->numero_compte) . '">' . img_edit_add() . '</a>';
$link = '<a href="../admin/card.php?action=create&accountingaccount=' . length_accountg($line->numero_compte) . '">' . img_edit_add() . '</a>';
}
print '<tr class="oddeven">';

Expand Down
4 changes: 3 additions & 1 deletion htdocs/core/lib/company.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1344,7 +1344,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
elseif (is_object($filterobj) && get_class($filterobj) == 'Product') $sql.= ", ".MAIN_DB_PREFIX."product as o";

$sql.= " WHERE a.entity IN (".getEntity('agenda').")";
if (is_object($filterobj) && get_class($filterobj) == 'Societe' && $filterobj->id) $sql.= " AND a.fk_soc = ".$filterobj->id;
if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur')) && $filterobj->id) $sql.= " AND a.fk_soc = ".$filterobj->id;
elseif (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) $sql.= " AND a.fk_project = ".$filterobj->id;
elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent')
{
Expand Down Expand Up @@ -1386,6 +1386,8 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))";
elseif ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
if (is_array($filters) && $filters['search_agenda_label']) $sql.= natural_search('a.label', $filters['search_agenda_label']);

//TODO Add limit for thirdparty in contexte very all result
$sql.= $db->order($sortfield, $sortorder);
dol_syslog("company.lib::show_actions_done", LOG_DEBUG);
$resql=$db->query($sql);
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/modAccounting.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function __construct($db)
"MAIN_COMPANY_CODE_ALWAYS_REQUIRED",
"chaine",
"1",
"With this constants on, third party code is always required whatever is numbering module behaviour", 0, 'current', 0
"With this constants on, third party code is always required whatever is numbering module behaviour", 0, 'current', 1
);
$this->const[2] = array(
"MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED",
Expand Down
2 changes: 1 addition & 1 deletion htdocs/expensereport/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -1925,7 +1925,7 @@
print $paymentexpensereportstatic->getNomUrl(1);
print '</td>';
print '<td>'.dol_print_date($db->jdate($objp->dp),'day')."</td>\n";
$labeltype=$langs->trans("PaymentType".$objp->p_code)!=("PaymentType".$objp->p_code)?$langs->trans("PaymentType".$objp->p_code):$objp->fk_typepayment;
$labeltype=$langs->trans("PaymentType".$objp->p_code)!=("PaymentType".$objp->p_code)?$langs->trans("PaymentType".$objp->p_code):$objp->payment_type;
print "<td>".$labeltype.' '.$objp->num_payment."</td>\n";
if (! empty($conf->banque->enabled))
{
Expand Down
143 changes: 143 additions & 0 deletions htdocs/public/payment/newpayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -1423,7 +1423,150 @@
print '<input type="hidden" name="desc" value="'.dol_escape_htmltag($labeldesc).'">'."\n";
}

// Payment on donation
if ($source == 'donation')
{
$found=true;
$langs->load("don");

require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';

$don=new Don($db);
$result=$don->fetch($ref);
if ($result <= 0)
{
$mesg=$don->error;
$error++;
}
else
{
$don->fetch_thirdparty();
$object = $don;
}

if ($action != 'dopayment') // Do not change amount if we just click on first dopayment
{
$amount=$subscription->total_ttc;
if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int');
$amount=price2num($amount);
}

$fulltag='DON='.$don->ref.'.DAT='.dol_print_date(dol_now(),'%Y%m%d%H%M');
if (! empty($TAG)) { $tag=$TAG; $fulltag.='.TAG='.$TAG; }
$fulltag=dol_string_unaccent($fulltag);

// Creditor

print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Creditor");
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$creditor.'</b>';
print '<input type="hidden" name="creditor" value="'.$creditor.'">';
print '</td></tr>'."\n";

// Debitor

print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Member");
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>';
if ($don->morphy == 'mor' && ! empty($don->societe)) print $don->societe;
else print $don->getFullName($langs);
print '</b>';

// Object

$text='<b>'.$langs->trans("PaymentDonation").'</b>';
if (GETPOST('desc','alpha')) $text='<b>'.$langs->trans(GETPOST('desc','alpha')).'</b>';
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Designation");
print '</td><td class="CTableRow'.($var?'1':'2').'">'.$text;
print '<input type="hidden" name="source" value="'.dol_escape_htmltag($source).'">';
print '<input type="hidden" name="ref" value="'.dol_escape_htmltag($don->ref).'">';
print '</td></tr>'."\n";

// Amount

print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Amount");
if (empty($amount))
{
if (empty($conf->global->MEMBER_NEWFORM_AMOUNT)) print ' ('.$langs->trans("ToComplete");
if (! empty($conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO)) print ' - <a href="'.$conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO.'" rel="external" target="_blank">'.$langs->trans("SeeHere").'</a>';
if (empty($conf->global->MEMBER_NEWFORM_AMOUNT)) print ')';
}
print '</td><td class="CTableRow'.($var?'1':'2').'">';
$valtoshow='';
if (empty($amount) || ! is_numeric($amount))
{
$valtoshow=price2num(GETPOST("newamount",'alpha'),'MT');
// force default subscription amount to value defined into constant...
if (empty($valtoshow))
{
if (! empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) {
if (! empty($conf->global->MEMBER_NEWFORM_AMOUNT)) {
$valtoshow = $conf->global->MEMBER_NEWFORM_AMOUNT;
}
}
else {
if (! empty($conf->global->MEMBER_NEWFORM_AMOUNT)) {
$amount = $conf->global->MEMBER_NEWFORM_AMOUNT;
}
}
}
}
if (empty($amount) || ! is_numeric($amount))
{
//$valtoshow=price2num(GETPOST("newamount",'alpha'),'MT');
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.'">';
}
else {
$valtoshow=$amount;
if (! empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow=max($conf->global->MEMBER_MIN_AMOUNT,$valtoshow);
print '<b>'.price($valtoshow).'</b>';
print '<input type="hidden" name="amount" value="'.$valtoshow.'">';
print '<input type="hidden" name="newamount" value="'.$valtoshow.'">';
}
// Currency
print ' <b>'.$langs->trans("Currency".$currency).'</b>';
print '<input type="hidden" name="currency" value="'.$currency.'">';
print '</td></tr>'."\n";

// Tag

print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("PaymentCode");
print '</td><td class="CTableRow'.($var?'1':'2').'"><b style="word-break: break-all;">'.$fulltag.'</b>';
print '<input type="hidden" name="tag" value="'.$tag.'">';
print '<input type="hidden" name="fulltag" value="'.$fulltag.'">';
print '</td></tr>'."\n";

// Shipping address
$shipToName=$don->getFullName($langs);
$shipToStreet=$don->address;
$shipToCity=$don->town;
$shipToState=$don->state_code;
$shipToCountryCode=$don->country_code;
$shipToZip=$don->zip;
$shipToStreet2='';
$phoneNum=$don->phone;
if ($shipToName && $shipToStreet && $shipToCity && $shipToCountryCode && $shipToZip)
{
print '<!-- Shipping address information -->';
print '<input type="hidden" name="shipToName" value="'.$shipToName.'">'."\n";
print '<input type="hidden" name="shipToStreet" value="'.$shipToStreet.'">'."\n";
print '<input type="hidden" name="shipToCity" value="'.$shipToCity.'">'."\n";
print '<input type="hidden" name="shipToState" value="'.$shipToState.'">'."\n";
print '<input type="hidden" name="shipToCountryCode" value="'.$shipToCountryCode.'">'."\n";
print '<input type="hidden" name="shipToZip" value="'.$shipToZip.'">'."\n";
print '<input type="hidden" name="shipToStreet2" value="'.$shipToStreet2.'">'."\n";
print '<input type="hidden" name="phoneNum" value="'.$phoneNum.'">'."\n";
}
else
{
print '<!-- Shipping address not complete, so we don t use it -->'."\n";
}
if (is_object($don->thirdparty)) print '<input type="hidden" name="thirdparty_id" value="'.$don->thirdparty->id.'">'."\n";
print '<input type="hidden" name="email" value="'.$don->email.'">'."\n";
$labeldesc = $langs->trans("PaymentSubscription");
if (GETPOST('desc','alpha')) $labeldesc=GETPOST('desc','alpha');
print '<input type="hidden" name="desc" value="'.dol_escape_htmltag($labeldesc).'">'."\n";
}


if (! $found && ! $mesg) $mesg=$langs->trans("ErrorBadParameters");
Expand Down

0 comments on commit bbfd134

Please sign in to comment.