[open-ils-commits] r11619 - trunk/Open-ILS/web/conify/global/actor
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Dec 18 16:17:29 EST 2008
Author: miker
Date: 2008-12-18 16:17:25 -0500 (Thu, 18 Dec 2008)
New Revision: 11619
Modified:
trunk/Open-ILS/web/conify/global/actor/org_unit.html
trunk/Open-ILS/web/conify/global/actor/org_unit.js
Log:
use pcrud (C) instead of permacrud (Perl)
Modified: trunk/Open-ILS/web/conify/global/actor/org_unit.html
===================================================================
--- trunk/Open-ILS/web/conify/global/actor/org_unit.html 2008-12-18 14:26:59 UTC (rev 11618)
+++ trunk/Open-ILS/web/conify/global/actor/org_unit.html 2008-12-18 21:17:25 UTC (rev 11619)
@@ -73,7 +73,7 @@
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; },
@@ -113,7 +113,7 @@
}).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) },
@@ -356,7 +356,7 @@
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) {
@@ -421,7 +421,7 @@
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) {
@@ -494,8 +494,8 @@
<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,
@@ -573,8 +573,8 @@
</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,
@@ -642,8 +642,8 @@
</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,
@@ -710,8 +710,8 @@
</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,
@@ -778,8 +778,8 @@
</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,
Modified: trunk/Open-ILS/web/conify/global/actor/org_unit.js
===================================================================
--- trunk/Open-ILS/web/conify/global/actor/org_unit.js 2008-12-18 14:26:59 UTC (rev 11618)
+++ trunk/Open-ILS/web/conify/global/actor/org_unit.js 2008-12-18 21:17:25 UTC (rev 11619)
@@ -38,7 +38,7 @@
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;
@@ -61,26 +61,80 @@
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) {
+ 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() ) {
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 () {
@@ -89,7 +143,7 @@
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' )]);
@@ -136,7 +190,7 @@
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' )]);
@@ -166,7 +220,7 @@
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' )]);
@@ -196,7 +250,7 @@
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' )]);
@@ -226,7 +280,7 @@
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' )]);
More information about the open-ils-commits
mailing list