window.dirtyStore = [];
pCRUD.request({
- method : 'open-ils.permacrud.search.aou.atomic',
+ method : 'open-ils.pcrud.search.aou.atomic',
timeout : 15,
params : [ ses, { id : { "!=" : null } }, { order_by : { aou : 'shortname' } } ],
onerror : function (r) { throw aou_strings.ERROR_FETCHING_ORGS; },
}).send();
pCRUD.request({
- method : 'open-ils.permacrud.search.aout.atomic',
+ method : 'open-ils.pcrud.search.aout.atomic',
timeout : 10,
params : [ ses, { id : { "!=" : null } }, { order_by : { aout : 'depth' } } ],
onerror : function (r) { status_update(aou_strings.ERROR_FETCHING_TYPES_AOUT) },
modified_ou.isdeleted( 1 );
pCRUD.request({
- method : 'open-ils.permacrud.delete.aou',
+ method : 'open-ils.pcrud.delete.aou',
timeout : 10,
params : [ ses, modified_ou ],
onerror : function (r) {
var new_obj;
pCRUD.request({
- method : 'open-ils.permacrud.create.aou',
+ method : 'open-ils.pcrud.create.aou',
timeout : 10,
params : [ ses, new_fm_obj ],
onerror : function (r) {
<button jsId="save_hoo_button" dojoType="dijit.form.Button" label="&conify.save_button.label;">
<script type="dojo/connect" event="onClick">
<![CDATA[
- var method_name = 'open-ils.permacrud.update.aouhoo';
- if (current_ou_hoo.isnew() == 1) method_name = 'open-ils.permacrud.create.aouhoo';
+ var method_name = 'open-ils.pcrud.update.aouhoo';
+ if (current_ou_hoo.isnew() == 1) method_name = 'open-ils.pcrud.create.aouhoo';
pCRUD.request({
method : method_name,
</script>
<script type="dojo/connect" event="onClick">
<![CDATA[
- var method_name = 'open-ils.permacrud.update.aoa';
- if (current_billing_address.isnew() == 1) method_name = 'open-ils.permacrud.create.aoa';
+ var method_name = 'open-ils.pcrud.update.aoa';
+ if (current_billing_address.isnew() == 1) method_name = 'open-ils.pcrud.create.aoa';
pCRUD.request({
method : method_name,
</script>
<script type="dojo/connect" event="onClick">
<![CDATA[
- var method_name = 'open-ils.permacrud.update.aoa';
- if (current_holds_address.isnew() == 1) method_name = 'open-ils.permacrud.create.aoa';
+ var method_name = 'open-ils.pcrud.update.aoa';
+ if (current_holds_address.isnew() == 1) method_name = 'open-ils.pcrud.create.aoa';
pCRUD.request({
method : method_name,
</script>
<script type="dojo/connect" event="onClick">
<![CDATA[
- var method_name = 'open-ils.permacrud.update.aoa';
- if (current_mailing_address.isnew() == 1) method_name = 'open-ils.permacrud.create.aoa';
+ var method_name = 'open-ils.pcrud.update.aoa';
+ if (current_mailing_address.isnew() == 1) method_name = 'open-ils.pcrud.create.aoa';
pCRUD.request({
method : method_name,
</script>
<script type="dojo/connect" event="onClick">
<![CDATA[
- var method_name = 'open-ils.permacrud.update.aoa';
- if (current_ill_address.isnew() == 1) method_name = 'open-ils.permacrud.create.aoa';
+ var method_name = 'open-ils.pcrud.update.aoa';
+ if (current_ill_address.isnew() == 1) method_name = 'open-ils.pcrud.create.aoa';
pCRUD.request({
method : method_name,
var cgi = new CGI();
var cookieManager = new HTTP.Cookies();
var ses = cookieManager.read('ses') || cgi.param('ses');
-var pCRUD = new OpenSRF.ClientSession('open-ils.permacrud');
+var pCRUD = new OpenSRF.ClientSession('open-ils.pcrud');
var current_ou, current_ou_hoo;
var virgin_ou_id = -1;
save_ou_button.disabled = false;
delete_ou_button.disabled = false;
- pCRUD.request({
- method : 'open-ils.permacrud.update.aou',
+ if (!pCRUD.connect()) {
+ highlighter.editor_pane.red.play();
+ status_update( dojo.string.substitute( aou_strings.ERROR_SAVING_DATA, [ou_list_store.getValue( current_ou, 'name' )] ) );
+ return null;
+ }
+
+ var commit = pCRUD.request({
+ method : 'open-ils.pcrud.transaction.commit',
+ timeout : 10,
+ params : [ ses, modified_ou ],
+ onerror : function (r) {
+ highlighter.editor_pane.red.play();
+ status_update( dojo.string.substitute( aou_strings.ERROR_SAVING_DATA, [ou_list_store.getValue( current_ou, 'name' )] ) );
+ pCRUD.disconnect();
+ throw 'commit error';
+ },
+ oncomplete : function (r) {
+ var res = r.recv();
+ if ( res ) {
+ ou_list_store.setValue( current_ou, 'ischanged', 0 );
+ highlighter.editor_pane.green.play();
+ status_update( dojo.string.substitute( aou_strings.SUCCESS_SAVE, [ou_list_store.getValue( current_ou, 'name' )] ) );
+ } else {
+ highlighter.editor_pane.red.play();
+ status_update( dojo.string.substitute( aou_strings.ERROR_SAVING_DATA, [ou_list_store.getValue( current_ou, 'name' )] ) );
+ }
+ pCRUD.disconnect();
+ },
+ });
+
+ var update = pCRUD.request({
+ method : 'open-ils.pcrud.update.aou',
timeout : 10,
params : [ ses, modified_ou ],
onerror : function (r) {
ou_list_store.setValue( current_ou, 'ischanged', 0 );
highlighter.editor_pane.green.play();
status_update( dojo.string.substitute( aou_strings.SUCCESS_SAVE, [ou_list_store.getValue( current_ou, 'name' )] ) );
+ commit.send();
} else {
highlighter.editor_pane.red.play();
status_update( dojo.string.substitute( aou_strings.ERROR_SAVING_DATA, [ou_list_store.getValue( current_ou, 'name' )] ) );
+ pCRUD.disconnect();
}
},
- }).send();
+ });
+
+ var begin = pCRUD.request({
+ method : 'open-ils.pcrud.transaction.begin',
+ timeout : 10,
+ params : [ ses, modified_ou ],
+ onerror : function (r) {
+ highlighter.editor_pane.red.play();
+ status_update( dojo.string.substitute( aou_strings.ERROR_SAVING_DATA, [ou_list_store.getValue( current_ou, 'name' )] ) );
+ },
+ oncomplete : function (r) {
+ var res = r.recv();
+ if ( res && res.content() ) {
+ update.send();
+ } else {
+ highlighter.editor_pane.red.play();
+ status_update( dojo.string.substitute( aou_strings.ERROR_SAVING_DATA, [ou_list_store.getValue( current_ou, 'name' )] ) );
+ pCRUD.disconnect();
+ }
+ },
+ });
+
+ begin.send();
}
function hoo_load () {
current_ou_hoo.isnew(1);
pCRUD.request({
- method : 'open-ils.permacrud.retrieve.aouhoo',
+ method : 'open-ils.pcrud.retrieve.aouhoo',
params : [ ses, ou_list_store.getValue( current_ou, 'id' ) ],
onerror : function (r) {
throw dojo.string.substitute(aou_strings.ERROR_FETCHING_HOURS, [ou_list_store.getValue( current_ou, 'name' )]);
if (ou_list_store.getValue( current_ou, 'billing_address' )) {
pCRUD.request({
- method : 'open-ils.permacrud.retrieve.aoa',
+ method : 'open-ils.pcrud.retrieve.aoa',
params : [ ses, ou_list_store.getValue( current_ou, 'billing_address' ) ],
onerror : function (r) {
throw dojo.string.substitute(aou_strings.ERROR_FETCHING_PHYSICAL, [ou_list_store.getValue( current_ou, 'name' )]);
if (ou_list_store.getValue( current_ou, 'mailing_address' )) {
pCRUD.request({
- method : 'open-ils.permacrud.retrieve.aoa',
+ method : 'open-ils.pcrud.retrieve.aoa',
params : [ ses, ou_list_store.getValue( current_ou, 'mailing_address' ) ],
onerror : function (r) {
throw dojo.string.substitute(aou_strings.ERROR_FETCHING_MAILING, [ou_list_store.getValue( current_ou, 'name' )]);
if (ou_list_store.getValue( current_ou, 'holds_address' )) {
pCRUD.request({
- method : 'open-ils.permacrud.retrieve.aoa',
+ method : 'open-ils.pcrud.retrieve.aoa',
params : [ ses, ou_list_store.getValue( current_ou, 'holds_address' ) ],
onerror : function (r) {
throw dojo.string.substitute(aou_strings.ERROR_FETCHING_HOLDS, [ou_list_store.getValue( current_ou, 'name' )]);
if (ou_list_store.getValue( current_ou, 'ill_address' )) {
pCRUD.request({
- method : 'open-ils.permacrud.retrieve.aoa',
+ method : 'open-ils.pcrud.retrieve.aoa',
params : [ ses, ou_list_store.getValue( current_ou, 'ill_address' ) ],
onerror : function (r) {
throw dojo.string.substitute(aou_strings.ERROR_FETCHING_ILL, [ou_list_store.getValue( current_ou, 'name' )]);