Skip to content

Commit

Permalink
Merge pull request #177 from phili67/phili67-FindDepositSlip-bug
Browse files Browse the repository at this point in the history
All the changes to make the deposit working with foreign languages
  • Loading branch information
phili67 authored Jan 31, 2018
2 parents 8d1b052 + d63ae84 commit 1577966
Show file tree
Hide file tree
Showing 11 changed files with 116 additions and 77 deletions.
36 changes: 23 additions & 13 deletions src/DepositSlipEditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use EcclesiaCRM\DepositQuery;
use EcclesiaCRM\dto\SystemURLs;
use EcclesiaCRM\Utils\InputUtils;
use EcclesiaCRM\dto\SystemConfig;

$iDepositSlipID = 0;
$thisDeposit = 0;
Expand Down Expand Up @@ -45,6 +46,9 @@
Redirect('Menu.php');
}


$funds = $thisDeposit->getFundTotals();

//Set the page title
$sPageTitle = $thisDeposit->getType().' '.gettext('Deposit Slip Number: ').$iDepositSlipID;

Expand Down Expand Up @@ -75,7 +79,7 @@
<div class="row">
<div class="col-lg-4">
<label for="Date"><?= gettext('Date'); ?>:</label>
<input type="text" class="form-control date-picker" name="Date" value="<?php echo $thisDeposit->getDate('Y-m-d'); ?>" id="DepositDate" >
<input type="text" class="form-control date-picker" name="Date" value="<?= $thisDeposit->getDate(SystemConfig::getValue('sDatePickerFormat')); ?>" id="DepositDate" >
</div>
<div class="col-lg-4">
<label for="Comment"><?php echo gettext('Comment:'); ?></label>
Expand All @@ -90,10 +94,16 @@
</div>
<div class="row p-2">
<div class="col-lg-5 m-2" style="text-align:center">
<input type="submit" class="btn" value="<?php echo gettext('Save'); ?>" name="DepositSlipSubmit">
<input type="submit" class="btn btn-primary" value="<?php echo gettext('Save'); ?>" name="DepositSlipSubmit">
</div>
<div class="col-lg-5 m-2" style="text-align:center">
<input type="button" class="btn" value="<?php echo gettext('Deposit Slip Report'); ?>" name="DepositSlipGeneratePDF" onclick="window.CRM.VerifyThenLoadAPIContent(window.CRM.root + '/api/deposits/<?php echo $thisDeposit->getId() ?>/pdf');">
<?php
if (count($funds)) {
?>
<input type="button" class="btn btn-default" value="<?php echo gettext('Deposit Slip Report'); ?>" name="DepositSlipGeneratePDF" onclick="window.CRM.VerifyThenLoadAPIContent(window.CRM.root + '/api/deposits/<?php echo $thisDeposit->getId() ?>/pdf');">
<?php
}
?>
</div>
</div>
<?php
Expand All @@ -115,12 +125,12 @@
<ul style="margin:0px; border:0px; padding:0px;">
<?php
// Get deposit totals
echo '<li><b>TOTAL ('.$thisDeposit->getPledges()->count().'):</b> $'.$thisDeposit->getVirtualColumn('totalAmount').'</li>';
echo '<li><b>TOTAL ('.$thisDeposit->getPledges()->count().'):</b> '.SystemConfig::getValue('sCurrency').$thisDeposit->getVirtualColumn('totalAmount').'</li>';
if ($thisDeposit->getCountCash()) {
echo '<li><b>CASH ('.$thisDeposit->getCountCash().'):</b> $'.$thisDeposit->getTotalCash().'</li>';
echo '<li><b>CASH ('.$thisDeposit->getCountCash().'):</b> '.SystemConfig::getValue('sCurrency').$thisDeposit->getTotalCash().'</li>';
}
if ($thisDeposit->getCountChecks()) {
echo '<li><b>CHECKS ('.$thisDeposit->getCountChecks().'):</b> $'.$thisDeposit->getTotalChecks().' </li>';
echo '<li><b>CHECKS ('.$thisDeposit->getCountChecks().'):</b> '.SystemConfig::getValue('sCurrency').$thisDeposit->getTotalChecks().' </li>';
}
?>
</ul>
Expand All @@ -130,7 +140,7 @@
<ul style="margin:0px; border:0px; padding:0px;">
<?php
foreach ($thisDeposit->getFundTotals() as $fund) {
echo '<li><b>'.$fund['Name'].'</b>: $'.$fund['Total'].'</li>';
echo '<li><b>'.$fund['Name'].'</b>: '.SystemConfig::getValue('sCurrency').$fund['Total'].'</li>';
}
?>
</div>
Expand All @@ -145,7 +155,7 @@
<?php
if ($iDepositSlipID and $thisDeposit->getType() and !$thisDeposit->getClosed()) {
if ($thisDeposit->getType() == 'eGive') {
echo '<input type=button class=btn value="'.gettext('Import eGive')."\" name=ImporteGive onclick=\"javascript:document.location='eGive.php?DepositSlipID=$iDepositSlipID&linkBack=DepositSlipEditor.php?DepositSlipID=$iDepositSlipID&PledgeOrPayment=Payment&CurrentDeposit=$iDepositSlipID';\">";
echo '<input type=button class="btn btn-default" value="'.gettext('Import eGive')."\" name=ImporteGive onclick=\"javascript:document.location='eGive.php?DepositSlipID=$iDepositSlipID&linkBack=DepositSlipEditor.php?DepositSlipID=$iDepositSlipID&PledgeOrPayment=Payment&CurrentDeposit=$iDepositSlipID';\">";
} else {
echo '<input type=button class="btn btn-success" value="'.gettext('Add Payment')."\" name=AddPayment onclick=\"javascript:document.location='PledgeEditor.php?CurrentDeposit=$iDepositSlipID&PledgeOrPayment=Payment&linkBack=DepositSlipEditor.php?DepositSlipID=$iDepositSlipID&PledgeOrPayment=Payment&CurrentDeposit=$iDepositSlipID';\">";
}
Expand All @@ -165,7 +175,7 @@
if ($iDepositSlipID and $thisDeposit->getType() and !$thisDeposit->getClosed()) {
if ($thisDeposit->getType() == 'Bank') {
?>
<button type="button" id="deleteSelectedRows" class="btn btn-danger" disabled>Delete Selected Rows</button>
<button type="button" id="deleteSelectedRows" class="btn btn-danger" disabled><?= gettext("Delete Selected Rows") ?></button>
<?php
}
}
Expand All @@ -177,7 +187,7 @@
<script src="<?= SystemURLs::getRootPath() ?>/skin/js/DepositSlipEditor.js"></script>
<?php
$fundData = [];
foreach ($thisDeposit->getFundTotals() as $tmpfund) {
foreach ($funds as $tmpfund) {
$fund = new StdClass();
$fund->color = '#'.random_color();
$fund->highlight = '#'.random_color();
Expand Down Expand Up @@ -216,9 +226,9 @@
var deletedRows = dataT.rows('.selected').data();
bootbox.confirm({
title:'<?= gettext("Confirm Delete")?>',
message: '<p><?= gettext("Are you sure you want to delete the selected")?> ' + deletedRows.length + ' <?= gettext("payments(s)?") ?></p>' +
'<p><?= gettext("This action CANNOT be undone, and may have legal implications!") ?></p>'+
'<p><?= gettext("Please ensure this what you want to do.</p>") ?>',
message: "<p><?= gettext("Are you sure you want to delete the selected")?> " + deletedRows.length + " <?= gettext("payments(s)?") ?></p>" +
"<p><?= gettext("This action CANNOT be undone, and may have legal implications!") ?></p>"+
"<p><?= gettext("Please ensure this what you want to do.</p>") ?>",
buttons: {
cancel : {
label: '<?= gettext("Close"); ?>'
Expand Down
5 changes: 3 additions & 2 deletions src/EcclesiaCRM/dto/SystemConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ private static function buildConfigs()
"iDasbhoardServiceIntervalTime" => new ConfigItem(2047, "iDasbhoardServiceIntervalTime", "number", "60", gettext("Dashboard Service dynamic asynchronous refresh interval, default 60 second")),
"bCheckedAttendees" => new ConfigItem(2048, "bCheckedAttendees", "boolean", "1", gettext("When you make the attendance all the kids are checked by default")),
"bCheckedAttendeesCurrentUser" => new ConfigItem(2049, "bCheckedAttendeesCurrentUser", "boolean", "0", gettext("When you make the attendance the current user isn't choosed by default")),
"sStateUnuseful" => new ConfigItem(2050, "sStateUnuseful", "boolean", "0", gettext("Hide dropdown states when they are unusefull"))
"sStateUnuseful" => new ConfigItem(2050, "sStateUnuseful", "boolean", "0", gettext("Hide dropdown states when they are unusefull")),
"sCurrency" => new ConfigItem(2051, "sCurrency", "text", "$", gettext("The currency symbol you want to use in the deposit in $ per default"))
);
}

Expand All @@ -255,7 +256,7 @@ private static function buildCategories()
gettext('System Settings') => ["sLogLevel", "bRegistered","sGZIPname","sZIPname","sPGPname","bCSVAdminOnly","sHeader","bEnableIntegrityCheck","iIntegrityCheckInterval","sLastIntegrityCheckTimeStamp", "iPhotoClientCacheDuration","bHSTSEnable"],
gettext('Quick Search') => ["bSearchIncludePersons","bSearchIncludePersonsMax","bSearchIncludeAddresses", "bSearchIncludeAddressesMax", "bSearchIncludeFamilies","bSearchIncludeFamiliesMax","bSearchIncludeFamilyHOH","bSearchIncludeFamilyHOHMax","bSearchIncludeGroups","bSearchIncludeGroupsMax","bSearchIncludeDeposits", "bSearchIncludeDepositsMax", "bSearchIncludePayments", "bSearchIncludePaymentsMax"],
gettext('Backup') => ["sLastBackupTimeStamp","bEnableExternalBackupTarget","sExternalBackupType","sExternalBackupAutoInterval","sExternalBackupEndpoint","sExternalBackupUsername","sExternalBackupPassword"],
gettext('Localization') => ["sLanguage","sStateUnuseful","sDistanceUnit","sPhoneFormat","sPhoneFormatWithExt","sPhoneFormatCell","sDateFormatLong","sTimeEnglish","sTimeFormat","sDatePickerPlaceHolder","sDateFormatNoYear","sDateFormatShort","sDateTimeFormat","sDateFilenameFormat","sCSVExportDelemiter","sCSVExportCharset","sDatePickerFormat"],
gettext('Localization') => ["sLanguage","sCurrency","sStateUnuseful","sDistanceUnit","sPhoneFormat","sPhoneFormatWithExt","sPhoneFormatCell","sDateFormatLong","sTimeEnglish","sTimeFormat","sDatePickerPlaceHolder","sDateFormatNoYear","sDateFormatShort","sDateTimeFormat","sDateFilenameFormat","sCSVExportDelemiter","sCSVExportCharset","sDatePickerFormat"],
gettext('Integration') => ["sMailChimpApiKey","sGoogleTrackingID","bEnableGravatarPhotos","bEnableGooglePhotos","iRemotePhotoCacheDuration","sNexmoAPIKey","sNexmoAPISecret","sNexmoFromNumber","sOLPURL","sOLPUserName","sOLPPassword","bEnableExternalCalendarAPI"],
gettext('Church Services') => ["iPersonConfessionFatherCustomField","iPersonConfessionDateCustomField"],
gettext('Users Specific Schedule Tasks') => ["bEventsOnDashboardPresence","iEventsOnDashboardPresenceTimeOut","iDasbhoardServiceIntervalTime"],
Expand Down
12 changes: 6 additions & 6 deletions src/FamilyView.php
Original file line number Diff line number Diff line change
Expand Up @@ -864,16 +864,16 @@ class="fa fa-trash"></i></button>

<tr>
<td>
<?= $plg_PledgeOrPayment ?>&nbsp;
<?= gettext($plg_PledgeOrPayment) ?>&nbsp;
</td>
<td>
<?= $fundName ?>&nbsp;
<?= gettext($fundName) ?>&nbsp;
</td>
<td>
<?= MakeFYString($plg_FYID) ?>&nbsp;
</td>
<td>
<?= $plg_date ?>&nbsp;
<?= OutputUtils::change_date_for_place_holder($plg_date) ?>&nbsp;
</td>
<td align=center>
<?= $plg_amount ?>&nbsp;
Expand All @@ -882,10 +882,10 @@ class="fa fa-trash"></i></button>
<?= $plg_NonDeductible ?>&nbsp;
</td>
<td>
<?= $plg_schedule ?>&nbsp;
<?= gettext($plg_schedule) ?>&nbsp;
</td>
<td>
<?= $plg_method ?>&nbsp;
<?= gettext($plg_method) ?>&nbsp;
</td>
<td>
<?= $plg_comment ?>&nbsp;
Expand All @@ -899,7 +899,7 @@ class="fa fa-trash"></i></button>
href="PledgeDelete.php?GroupKey=<?= $plg_GroupKey ?>&amp;linkBack=FamilyView.php?FamilyID=<?= $iFamilyID ?>"><?= gettext("Delete") ?></a>
</td>
<td>
<?= $plg_DateLastEdited ?>&nbsp;
<?= OutputUtils::change_date_for_place_holder($plg_DateLastEdited) ?>&nbsp;
</td>
<td>
<?= $EnteredFirstName . " " . $EnteredLastName ?>&nbsp;
Expand Down
14 changes: 8 additions & 6 deletions src/FindDepositSlip.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,13 @@
</div>
</div>
</div>
<p>
<br>
<div class="row">
<div class="col-xs-3">
<div class="container-fluid">
<div class="col-lg-3">
<button type="button" class="btn btn-primary" id="addNewDeposit"><?= gettext('Add New Deposit') ?></button>
</div>
</div>
</div>
</form>
</div>
Expand Down Expand Up @@ -91,10 +93,10 @@
var deletedRows = dataT.rows('.selected').data()
bootbox.confirm({
title:'<?= gettext("Confirm Delete") ?>',
message: '<p><?= gettext("Are you sure you want to delete the selected"); ?> '+ deletedRows.length + ' <?= gettext("Deposit(s)"); ?>?' +
'</p><p><?= gettext("This will also delete all payments associated with this deposit"); ?></p>'+
'<p><?= gettext("This action CANNOT be undone, and may have legal implications!") ?></p>'+
'<p><?= gettext("Please ensure this what you want to do.") ?></p>',
message: "<p><?= gettext("Are you sure you want to delete the selected"); ?> "+ deletedRows.length + ' <?= gettext("Deposit(s)"); ?>?' +
"</p><p><?= gettext("This will also delete all payments associated with this deposit"); ?></p>"+
"<p><?= gettext("This action CANNOT be undone, and may have legal implications!") ?></p>"+
"<p><?= gettext("Please ensure this what you want to do.") ?></p>",
buttons: {
cancel : {
label: '<?= gettext("Close"); ?>'
Expand Down
Binary file modified src/Images/church_letterhead.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ class="users-list-date"><?= date_format($person->getDateLastEdited(), SystemConf

$( document ).ready(function() {
$.each(lineDataRaw.Deposits, function(i, val) {
lineData.labels.push(moment(val.Date).format("MM-DD-YY"));
lineData.labels.push(moment(val.Date).format(window.CRM.datePickerformat.toUpperCase()));
lineData.datasets[0].data.push(val.totalAmount);
});
options = {
Expand Down
6 changes: 4 additions & 2 deletions src/PledgeEditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -682,11 +682,12 @@
</div>

<div class="col-lg-12">
<br>
<?php if (!$dep_Closed) {
?>
<input type="submit" class="btn " value="<?= gettext('Save') ?>" name="PledgeSubmit">
<input type="submit" class="btn btn-primary" value="<?= gettext('Save') ?>" name="PledgeSubmit">
<?php if ($_SESSION['bAddRecords']) {
echo '<input type="submit" class="btn btn-primary value="'.gettext('Save and Add').'" name="PledgeSubmitAndAdd">';
echo '<input type="submit" class="btn btn-info value="'.gettext('Save and Add').'" name="PledgeSubmitAndAdd">';
} ?>
<?php
} ?>
Expand Down Expand Up @@ -763,6 +764,7 @@

$("#FamilyName").select2({
minimumInputLength: 2,
language: window.CRM.shortLocale,
ajax: {
url: function (params){
var a = window.CRM.root + '/api/families/search/'+ params.term;
Expand Down
Binary file modified src/locale/textdomain/fr_FR/LC_MESSAGES/messages.mo
Binary file not shown.
Loading

0 comments on commit 1577966

Please sign in to comment.