From: konrad Date: Mon, 7 Feb 2011 21:14:58 +0000 (+0000) Subject: move change mail into its own transaction X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=a0264b2c82d848e0f01cc3fb8779c108c22b2a9c;p=web%2Fkonrad%2Fsmoke.git move change mail into its own transaction git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@722 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- diff --git a/src/dialogs/customerdlg.cpp b/src/dialogs/customerdlg.cpp index 2c1f843..b3839ab 100644 --- a/src/dialogs/customerdlg.cpp +++ b/src/dialogs/customerdlg.cpp @@ -366,6 +366,11 @@ void MCustomerDialog::changeMail() { QString mail=QInputDialog::getText(this, tr("Change Mail Address"), tr("Please enter the mail address for this customer to log into the web portal:"),QLineEdit::Normal, m_mail->text()); if(mail!=""){ + MTChangeCustomerMail ccm=req->queryChangeCustomerMail(m_cust.customerid(),mail); + if(ccm.hasError()){ + QMessageBox::warning(this,tr("Warning"),tr("Unable to set new email: %1").arg(ccm.errorString())); + return; + } m_mail->setText(mail); m_cust.setemail(mail); } diff --git a/wob/transact/customer.wolf b/wob/transact/customer.wolf index e438fca..2710452 100644 --- a/wob/transact/customer.wolf +++ b/wob/transact/customer.wolf @@ -59,7 +59,7 @@ - changes customer data + changes customer data (except online data) @@ -68,6 +68,18 @@ + + + changes customer login data + + + + + + + + + deletes a customer - usually by merging info into another customer diff --git a/www/inc/wext/customer.php b/www/inc/wext/customer.php index 48e7cda..4dba57a 100644 --- a/www/inc/wext/customer.php +++ b/www/inc/wext/customer.php @@ -65,6 +65,7 @@ class WOCustomer extends WOCustomerAbstract //create customer $cc->toTablecustomer($ct); $ct->revert("passwd"); + $ct->revert("email"); $ct->revert("rstcode"); $ct->revert("rsttill"); if($ct->isChanged())$ct->update(); @@ -245,6 +246,26 @@ class WOCustomer extends WOCustomerAbstract $trans->setcontacttype(WOContactType::fromTablecontacttype($tab)); } + /**called from ChangeCustomerMail transaction*/ + public static function changeCustomerMail($trans) + { + global $db; + $cc=$trans->getcustomerid(); + $ct=WTcustomer::getFromDB($cc); + if(!is_a($ct,"WTcustomer")){ + $trans->abortWithError(tr("Customer does not exist in the database.")); + return; + } + //try to set new mail + $ct->email=$trans->getemail(); + if(!$ct->update()){ + $trans->abortWithError(tr("This email already exists in the database.")); + return; + } + //set return value + $trans->setcustomer(WOCustomer::fromTablecustomer($ct)); + } + ///the ResetCustomerPassword transaction public static function resetPassword($trans) {