+sub quotation_new {
+ my $p = shift;
+
+ my($context, $session, $custnum) = _custoragent_session_custnum($p);
+ return { 'error' => $session } if $context eq 'error';
+
+ my $quotation = FS::quotation->new({
+ 'custnum' => $session->{'custnum'},
+ 'usernum' => $FS::CurrentUser::CurrentUser->usernum,
+ '_date' => time,
+ });
+ my $error = $quotation->insert;
+ if ( $error ) {
+ warn "failed to create selfservice quotation for custnum #" .
+ $session->{custnum} . "\n";
+ return { 'error' => $error };
+ } else {
+ warn "started new selfservice quotation #". $quotation->quotationnum."\n"
+ if $DEBUG;
+ return { 'error' => $error, 'quotationnum' => $quotation->quotationnum };
+ }
+}
+
+=item quotation_delete { session, quotationnum }
+
+Disables (doesn't actually delete) the specified quotationnum.
+
+=cut
+
+sub quotation_delete {
+ my $p = shift;
+
+ my($context, $session, $custnum) = _custoragent_session_custnum($p);
+ return { 'error' => $session } if $context eq 'error';
+
+ my $quotation = _quotation($session, $p->{quotationnum})
+ or return { 'error' => "Quotation not found" };
+ warn "quotation_delete #".$quotation->quotationnum
+ if $DEBUG;
+
+ $quotation->set('disabled' => 'Y');
+ my $error = $quotation->replace;
+ return { 'error' => $error };
+}
+
+=item quotation_info { session, quotationnum }
+
+Returns a hashref describing the specified quotation, containing: