Skip to content

Commit

Permalink
Merge pull request #3083 from ehuelsmann/master-mc
Browse files Browse the repository at this point in the history
Master mc
  • Loading branch information
ehuelsmann committed Aug 10, 2017
2 parents 057729f + d3075d0 commit da1e174
Show file tree
Hide file tree
Showing 30 changed files with 803 additions and 439 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ env:
- secure: q9IckmvMBEEQ6EeM4U8K4y96Lx6tEaxs/A5GYUJxNJVhUkx3YqJKeERArZc4fpoV3CtUCFPDs/tktiFJn1LDeh3s9vJitUAGMU2AQxiUNARXK4EkEdPhvbX+CtusIIKDXYwEqXLiymv6mmpcc9/19CvHUzr9CiKZbb/LpS8lWqc=
- secure: cZKPTfU0h4rH2IIRr1Ds1XRPDrloe/K+menYm+VK54hE4MM2zTtNDmWn0fyPdeHeJDRrTF0pyobje8RG9E2Ld5YPHXve1/lVkieoPeqzm9V8hlvZlkgTQJiMAvKzjhSlUJx8AKPjX+jQZfhgAS1hnuWwOIB1cAA7fMpPJ7rPVWo=

notifications:
webhooks: https://ledgersmb.org/webhook/travis_ci_notifications

matrix:
include:
- perl: '5.26'
Expand Down
7 changes: 7 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ Released 2016-12-24
Changelog for 1.5.10
* Fix loading image URL taken from Dojo 1.12 (instead of 1.10) (Erik H)
* Fix mails being sent with non-unique Message-IDs (Erik H, #3041)
* Round-trip fewer values over web requests during migration (Erik H)
* Migrate accounting <-> invoice relationship from LSMB 1.2/SL (Erik H/Yves L)

Erik H is Erik Huelsmann
Yves L is Yves Lavoie


Changelog for 1.5.9
Expand Down Expand Up @@ -249,6 +252,10 @@ Released 2014-09-15
Changelog for 1.4.42
* Fix goods/services search with AR/AP invoices (Chris T, #2938)
* Fix ar/ap not searchable by part number (Chris T, #2926)
* Round-trip fewer values over web requests during migration (Erik H)

Chris T is Chris Travers
Erik H is Erik Huelsmann


Changelog for 1.4.41
Expand Down
21 changes: 0 additions & 21 deletions UI/js-src/lsmb/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,24 +56,3 @@ require(["dojo/parser", "dojo/query", "dojo/on", "dijit/registry",
});
});
});


require([
"dojo/on", "dojo/query", "dojo/dom-class", "dojo/_base/event",
"dojo/domReady!"],
function (on, query, domclass, event) {
query("a.t-submenu").forEach(function(node){
on(node, "click", function(e) {
if ( !e.ctrlKey && !e.shiftKey && !e.button != 0 ) {
event.stop(e);
var parent = node.parentNode;
if (domclass.contains(parent, "menu_closed")) {
domclass.replace(parent, "menu_open", "menu_closed");
}
else {
domclass.replace(parent, "menu_closed", "menu_open");
}
}
});
});
});
93 changes: 93 additions & 0 deletions UI/js-src/lsmb/menus/Tree.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
define(["dojo/_base/declare",
"dojo/on",
"dojo/_base/lang",
"dojo/_base/event",
"dojo/mouse",
"dojo/_base/array",
"dojo/store/JsonRest", "dojo/store/Observable",
"dojo/store/Memory", "dojo/store/Cache",
"dijit/Tree", "dijit/tree/ObjectStoreModel"
], function(declare, on, lang, event, mouse, array,
JsonRest, Observable, Memory, Cache, Tree, ObjectStoreModel
){
// set up the store to get the tree data, plus define the method
// to query the children of a node
var restStore = new JsonRest({
target: "menu.pl?action=menuitems_json&",
idProperty: "id"
});
var memoryStore = new Memory({idProperty: "id"});
var store = new Cache(restStore, memoryStore);

// initialize the store with the full menu
var results = store.query({});

// give store Observable interface so Tree can track updates
store = new Observable(store);

// create model to interface Tree to store
var model = new ObjectStoreModel({
store: store,
labelAttr: 'label',
mayHaveChildren: function(item){ return item.menu; },
getChildren: function(object, onComplete, onError){
onComplete(memoryStore.query({parent: object.id}));
},
getRoot: function(onItem, onError){
store.get(0).then(onItem, onError);
}
});

return declare("lsmb/menus/Tree", [Tree], {
model: model,
showRoot: false,
openOnClick: true,
postCreate: function() {
this.inherited(arguments);

this.own(
on(this.containerNode, "mousedown",
lang.hitch(this, this.__onClick)));
},
onClick: function(item, node, event){
// regular handling of non-leafs
if (item.menu) return;

// for leafs, either open in the current application,
// or open a new window, depending on the trigger.
var url = '',
newWindow = ((mouse.isLeft(event)
&& (event.ctrlKey || event.metaKey))
|| (mouse.isMiddle(event))
|| array.some( item.args,
function (q) {
return ("new=1" == q)
}));
if ( item.module ) {
url += item.module + "?";
url += item.args.join("&");
}
if ( newWindow ) {
// Simulate a target="_blank" attribute on an A tag
window.open(location.origin + location.pathname
+ location.search + '#' + url, "_blank");
}
else {
location.hash = url;
}
},
__onClick: function(e) {
// simulate "click opening in background tab"
// (Ctrl+LeftMouse or MiddleMouse)
if (mouse.isLeft(e) && !(e.ctrlKey || e.metaKey)) return;

event.stop(e);
e.preventDefault();

var node = dijit.getEnclosingWidget(e.target);
var item = node.item;
this.onClick(item, node, e);
}
});
});

10 changes: 8 additions & 2 deletions UI/lib/elements.html
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,12 @@
?>
<?lsmb PROCESS auto_label # Process element label. ?>
<button<?lsmb all_attributes ?><?lsmb all_custom_attributes ?>><?lsmb element_data.text ?></button>
<?lsmb IF element_data.tooltip.msg;
INCLUDE tooltip element_data = {
id => element_data.tooltip.id,
position => element_data.tooltip.position,
msg => element_data.tooltip.msg };
END ?>
<?lsmb END ?>
<?lsmb END ?>

Expand Down Expand Up @@ -420,7 +426,7 @@

<?lsmb BLOCK tooltip;
IF element_data && element_data.id.defined() && element_data.msg.defined();
props="connectId:" _ element_data.id;
props="connectId:'" _ element_data.id _ "'";
IF element_data.position.defined();
positions = [];
FOREACH position IN element_data.position
Expand All @@ -430,7 +436,7 @@
props = props _ ',position:[' _ positions.join(',') _ ']';
END; ?>
<div data-dojo-type="dijit/Tooltip" data-dojo-props=<?lsmb props ?> >
<?lsmb element_data.msg; ?>
<?lsmb UNESCAPE(element_data.msg) ?>
</div>
<?lsmb END;
END ?>
12 changes: 3 additions & 9 deletions UI/menu/expanding.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
li.menu_closed {
}

li.menu_closed > ul {
display: none;
}

li.menu_open > ul {
display: block;
#top_menu .dijitTreeIcon {
background-image: none;
width: 0
}

#version_info {
Expand Down
48 changes: 3 additions & 45 deletions UI/menu/expanding.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,48 +13,6 @@
</tr>
</table>
<hr>
<ul id="top_menu" class="menu_open">
<?lsmb old_level = 0 ?>
<?lsmb FOREACH item = menu_items ?>
<?lsmb href = "" ?>
<!-- <?lsmb item.level ?> :: <?lsmb old_level ?> -->
<?lsmb WHILE item.level < old_level ?>
</li></ul><?lsmb old_level = old_level - 1 ?>
<?lsmb END ?>
<?lsmb IF old_level > 0 && item.level <= old_level ?></li><?lsmb END ?>
<?lsmb old_level = item.level ?>
<li id="menu_<?lsmb item.id ?>"
class = "<?lsmb IF (item.menu && item.open)
?>menu_open<?lsmb ELSIF item.menu
?>menu_closed<?lsmb
ELSE ?>menu_item<?lsmb END ?>">
<a href="<?lsmb IF item.module ?><?lsmb item.module
?>?login=<?lsmb login
?>&amp;<?lsmb FOREACH arg IN item.args
?><?lsmb arg
?>&amp;<?lsmb END
?><?lsmb IF item.menu
?>id=<?lsmb item.id
?>&amp;open=<?lsmb open
?><?lsmb END; END ?>"
<?lsmb IF item.module && (item.module != 'menu.pl') &&
('login.pl' != item.module) ?>
<?lsmb ELSIF ('New Window' == item.label) ?>
target = 'new'
<?lsmb ELSIF ('login.pl' == item.module) ?>
target = '_top'
<?lsmb END ?>
id="a_<?lsmb- item.id -?>"
class="<?lsmb IF item.label == 'New Window';
'menu-new-window';
ELSIF item.module;
'menu-terminus';
ELSE; 't-submenu'; END ?>"
><?lsmb text(item.label) ?></a>
<?lsmb IF item.menu && (item.label != 'New Window') ?>
<ul id="sub_<?lsmb item.id ?>" class="submenu">
<?lsmb END ?>
<?lsmb END ?>
<?lsmb WHILE 0 < old_level ?>
</li></ul><?lsmb old_level = old_level - 1 ?>
<?lsmb END ?>

<div id="top_menu" data-dojo-type="lsmb/menus/Tree">
</div>
4 changes: 2 additions & 2 deletions UI/reconciliation/report.html
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
id = id
msg = text('Clear date is [*,_1,day] in the future of after posting',0-row.days)
};
ELSIF row.days > 60;
ELSIF row.days > 150;
class='cleared-past';
element_data = {
id = id
Expand All @@ -193,7 +193,7 @@
END;
END;
?>
<td id='<?lsmb id ?>' class='<?lsmb class ?>'>
<td id='<?lsmb id ?>' class='date <?lsmb class ?>'>
<?lsmb INCLUDE tooltip element_data; ?>
<?lsmb row.clear_time ?></td>
<td><?lsmb row.scn ?> </td>
Expand Down
2 changes: 1 addition & 1 deletion UI/setup/complete.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<body id="setup-operation-complete" class="lsmb <?lsmb dojo_theme ?>">
<div class="setupconsole">
<h2><?lsmb text('Database Management Console') ?></h2>
<?lsmb INCLUDE 'ui-db-credentials.html' ?>
<?lsmb INCLUDE 'setup/ui-db-credentials.html' ?>
<div class="listtop"><?lsmb text('Database Operation Complete') ?></div>
<p><?lsmb text('This database operation has completed successfully. LedgerSMB may now be used.'); ?></p>
<p><a href="setup.pl?action=login&amp;s_user=<?lsmb login ?>&amp;database="><?lsmb text('Return to setup') ?></a></p>
Expand Down
2 changes: 1 addition & 1 deletion UI/setup/confirm_operation.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<div class="setupconsole">
<h2><?lsmb text('Database Management Console') ?></h2>
<?lsmb # notice, message, and operation are all localized. ?>
<?lsmb INCLUDE 'ui-db-credentials.html' ?>
<?lsmb INCLUDE 'setup/ui-db-credentials.html' ?>
<div class="listtop"><?lsmb text('Confirm Operation') ?></div>
<div id="notice"><?lsmb notice ?></div>
<div id="message"><?lsmb message ?></div>
Expand Down
2 changes: 1 addition & 1 deletion UI/setup/list_databases.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
PROCESS "dynatable.html"; ?>
<body id="setup-list-databases" class="lsmb <?lsmb dojo_theme ?>">
<div class="setupconsole">
<?lsmb INCLUDE 'ui-db-credentials.html' ?>
<?lsmb INCLUDE 'setup/ui-db-credentials.html' ?>
<div class="listtop"><?lsmb text('Available Databases') ?></div>
<?lsmb
INCLUDE dynatable
Expand Down
14 changes: 14 additions & 0 deletions UI/setup/stylesheet.css
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,17 @@ img.logo {
button {
margin-top: 10px;
}

.listtop {
font-size: larger;
}

tr.listheading {
background-color: lightgrey;
}
tr.listrow:nth-child(even) {background: #FFF}
tr.listrow:nth-child(odd) {background: #EEE}

td.dijitStretch {
min-width: 125px;
}
3 changes: 2 additions & 1 deletion lib/LedgerSMB/Database.pm
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ sub get_info {
# different means
$logger->debug("DBI->connect dbh=$dbh");

$retval->{status} = 'exists';

my $sth;
$sth = $dbh->prepare("SELECT SESSION_USER");
$sth->execute;
Expand Down Expand Up @@ -280,7 +282,6 @@ sub get_info {
$retval->{version} =~ s/(\d+\.\d+).*/$1/g;
} else {
$retval->{appname} = 'unknown';
$retval->{exists} = 'exists';
}
$dbh->rollback;
}
Expand Down
15 changes: 14 additions & 1 deletion lib/LedgerSMB/Locale.pm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ Locale support module for LedgerSMB. Uses Locale::Maketext::Lexicon as a base.
Returns a locale handle for accessing the other methods. Inherited from
Locale::Maketext.
=item marktext ($string)
Identity function. Allows text to me marked for translation so that it
will be picked by the PO scanner. The actual translation has to be done
in the calling module when the page is prepared.
Note: This isn't a method but a utility function.
=item text ($string, @params)
Returns the translation for the given string. Use this method with a litteral
Expand Down Expand Up @@ -86,7 +93,9 @@ package LedgerSMB::Locale;
use strict;
use warnings;

use base 'Locale::Maketext';
use base qw( Locale::Maketext Exporter );
our @EXPORT_OK = qw(marktext);

use LedgerSMB::Sysconfig;
use Locale::Maketext::Lexicon;
use Encode;
Expand All @@ -99,6 +108,10 @@ Locale::Maketext::Lexicon->import(
}
);

sub marktext {
return shift;
}

sub text {
my ( $self, $text, @params ) = @_;
return $self->maketext( $text, @params );
Expand Down
9 changes: 3 additions & 6 deletions lib/LedgerSMB/Scripts/account.pm
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,8 @@ sub yearend_info {
$eoy->{closed_date} = $eoy->latest_closing;
$eoy->{user} = $request->{_user};
my $template = LedgerSMB::Template->new_UI(
user => $request->{_user},
locale => $request->{_locale},
template => 'accounts/yearend'
);
$request,
template => 'accounts/yearend');
return $template->render_to_psgi({ request => $request,
eoy => $eoy});
}
Expand All @@ -244,8 +242,7 @@ sub post_yearend {
my $eoy = LedgerSMB::DBObject::EOY->new({base => $request});
$eoy->close_books;
my $template = LedgerSMB::Template->new_UI(
user => $request->{_user},
locale => $request->{_locale},
$request,
template => 'accounts/yearend_complete'
);
return $template->render_to_psgi($eoy);
Expand Down

0 comments on commit da1e174

Please sign in to comment.