[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[4801] trunk



Revision: 4801
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4801&view=rev
Author:   einhverfr
Date:     2012-05-29 10:49:29 +0000 (Tue, 29 May 2012)
Log Message:
-----------
Notes functionality now works on new framework.  All we have left are pricelists

Modified Paths:
--------------
    trunk/LedgerSMB/DBObject/Entity/Note.pm
    trunk/LedgerSMB/Scripts/contact.pm
    trunk/UI/Contact/divs/notes.html

Modified: trunk/LedgerSMB/DBObject/Entity/Note.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Entity/Note.pm	2012-05-29 10:08:25 UTC (rev 4800)
+++ trunk/LedgerSMB/DBObject/Entity/Note.pm	2012-05-29 10:49:29 UTC (rev 4801)
@@ -98,7 +98,7 @@
              'eca__list_notes', args => [$credit_id]);
     } else {
         @results = $self->call_procedure(procname =>
-             'entity__list_notes', args => [$credit_id]);
+             'entity__list_notes', args => [$entity_id]);
     }
     for my $row(@results){
         $self->prepare_dbhash($row); 
@@ -116,7 +116,12 @@
 
 sub save {
     my ($self) = @_;
-    my ($ref) = $self->exec_method({funcname => 'entity__save_notes'});
+    my $ref;
+    if ($self->credit_id){
+        ($ref) = $self->exec_method({funcname => 'eca__save_notes'});
+    } else {
+        ($ref) = $self->exec_method({funcname => 'entity__save_notes'});
+    }
     $self->prepare_dbhash($ref);
     $self = $self->new(%$ref);
 }

Modified: trunk/LedgerSMB/Scripts/contact.pm
===================================================================
--- trunk/LedgerSMB/Scripts/contact.pm	2012-05-29 10:08:25 UTC (rev 4800)
+++ trunk/LedgerSMB/Scripts/contact.pm	2012-05-29 10:49:29 UTC (rev 4801)
@@ -591,4 +591,31 @@
     get($request);
 }
 
+=item save_notes($request)
+
+Saves notes.  entity_id or credit_id must be set, as must note_class, note, and 
+subject.
+
+=cut
+
+sub save_notes {
+    my ($request) = @_;
+    my $note = LedgerSMB::DBObject::Entity::Note->new(%$request);
+    if ($request->{note_class} == 1){
+       $note->credit_id(undef);
+    }
+    $note->save;
+    get($request);
+}
+
+=back
+
+=head1 COPYRIGHT
+
+Copyright (c) 2012, the LedgerSMB Core Team.  This is licensed under the GNU 
+General Public License, version 2, or at your option any later version.  Please 
+see the accompanying License.txt for more information.
+
+=cut
+
 1;

Modified: trunk/UI/Contact/divs/notes.html
===================================================================
--- trunk/UI/Contact/divs/notes.html	2012-05-29 10:08:25 UTC (rev 4800)
+++ trunk/UI/Contact/divs/notes.html	2012-05-29 10:49:29 UTC (rev 4801)
@@ -19,7 +19,7 @@
 	<?lsmb PROCESS input element_data = {
 		type="hidden" 
 		name="credit_id" 
-		value=credit_id
+		value=credit_act.id
 	} ?>
 <div class="input">
    <?lsmb PROCESS input element_data = {
@@ -30,17 +30,20 @@
       size = "20"
 	} ?>
 </div>
-<?lsmb IF credit_id -?>
-<div class="input"><?lsmb PROCESS select element_data = {
+<div class="input">
+<?lsmb 
+IF credit_act.id;
+    PROCESS select element_data = {
 			name = "note_class"
 			default_values = [note_class]
-			options = note_class_options
+			options = attach_level_options
 			label = text("Note Class") #"
-			text_attr = "label"
 			value_attr = "value"
-	} ?>
+	};
+ELSE ?>
+<label><?lsmb text('Note Class') ?></label><?lsmb text('Entity');
+END; ?>
 </div>
-<?lsmb END # IF credit_id -?>
 <div class="input"><?lsmb PROCESS textarea element_data = {
 	label = text('Notes')
 	name = 'note'
@@ -55,7 +58,7 @@
 
 </form>
 <?lsmb FOREACH n = notes ?>
-<div class="note">
+<div class="note<?lsmb IF n.note_class == 3; ' eca_note'; END ?>">
     <div class="note_subject"><?lsmb text('Subject: [_1]', n.subject)?></div>
     <div class="timestamp"><?lsmb text('Entered at: [_1]', n.created) ?></div>
     <div class="author"><?lsmb text("Author: [_1]", n.created_by) ?></div>

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.