@@ -28,119 +28,26 @@ public function indexAction()
2828 $ this ->renderLayout ();
2929 }
3030
31- public function newAction ()
32- {
33- $ this ->_forward ('edit ' );
34- }
35-
36- /**
37- * Action for /admin/action/edit/
38- * Edit action details
39- *
40- * @return void
41- */
42- public function editAction ()
43- {
44- $ this ->loadLayout ()
45- ->_addContent ($ this ->getLayout ()->createBlock ('sfp_banking/action_edit ' ))
46- ->renderLayout ();
47- }
48-
4931 /**
5032 * Action for saving an action
5133 *
5234 * @return void
5335 */
5436 public function saveAction ()
5537 {
56- $ actionId = $ this ->getRequest ()->getParam ('id ' , false );
57-
58- if ($ data = $ this ->getRequest ()->getPost ()) {
59-
60- /** @var $action Sfp_Banking_Model_Action */
61- $ action = Mage::getModel ('sfp_banking/action ' );
62-
63- if ($ actionId ) {
64-
65- $ action ->load ($ actionId );
66- }
67-
68- if (is_array ($ data ['custom_prices ' ])) {
69- $ data ['custom_prices ' ] = serialize ($ data ['custom_prices ' ]);
70- }
71-
72- $ action ->addData ($ data );
73-
74- try {
75- $ this ->_checkForExistingCode ($ action );
76- $ action ->save ();
77-
78- Mage::getSingleton ('adminhtml/session ' )
79- ->addSuccess (Mage::helper ('sfp_banking ' )->__ ('Action was saved successfully ' ));
80- $ this ->getResponse ()->setRedirect ($ this ->getUrl ('*/*/ ' ));
81- return ;
82- } catch (Exception $ e ) {
83- Mage::getSingleton ('adminhtml/session ' )
84- ->addError ($ e ->getMessage ());
85- }
86- }
87- $ this ->_redirectReferer ();
88- }
89-
90- /**
91- * Check if the given code already exists in any institute or action (different from the current one)
92- *
93- * @param Sfp_Banking_Model_Action $action
94- */
95- protected function _checkForExistingCode ($ action )
96- {
97- if (!$ action ->getCode ()) return ;
98-
99- $ instituteCollection = Mage::getModel ('sfp_banking/institute ' )
100- ->getCollection ()
101- ->addFieldToFilter ('code ' , $ action ->getCode ());
102-
103- if ($ instituteCollection ->getSize () > 0 ) {
104-
105- Mage::throwException (Mage::helper ('sfp_banking ' )->__ ('Code already exists. ' ));
106- }
107-
108- $ actionCollection = Mage::getModel ('sfp_banking/action ' )
109- ->getCollection ()
110- ->addFieldToFilter ('code ' , $ action ->getCode ());
111-
112- if ($ actionId = $ action ->getId ()) {
113- $ actionCollection ->addFieldToFilter ('action_id ' , array ('neq ' => $ actionId ));
114- }
115-
116- if ($ actionCollection ->getSize () > 0 ) {
117-
118- Mage::throwException (Mage::helper ('sfp_banking ' )->__ ('Code already exists. ' ));
119- }
120- }
121-
122- /**
123- * Action for deleting an action
124- *
125- * @return void
126- */
127- public function deleteAction ()
128- {
129- $ actionId = $ this ->getRequest ()->getParam ('id ' , false );
130-
13138 try {
132- Mage::getModel ('sfp_banking/action ' )->setId ($ actionId )->delete ();
133- Mage::getSingleton ('adminhtml/session ' )
134- ->addSuccess (Mage::helper ('sfp_banking ' )
135- ->__ ('Action successfully deleted ' ));
136- $ this ->getResponse ()->setRedirect ($ this ->getUrl ('*/*/ ' ));
137-
138- return ;
39+ /** @var $anonymizer IntegerNet_Anonymizer_Model_Anonymizer */
40+ $ anonymizer = Mage::getModel ('anonymizer/anonymizer ' );
41+ $ anonymizer ->anonymizeAll ();
42+ foreach ($ anonymizer ->getResults () as $ resultLabel => $ resultCount ) {
43+ Mage::getSingleton ('adminhtml/session ' )->addSuccess (
44+ Mage::helper ('anonymizer ' )->__ ('Anonymized %s %s. ' , $ resultCount , $ resultLabel )
45+ );
46+ }
13947 } catch (Exception $ e ) {
14048 Mage::getSingleton ('adminhtml/session ' )->addError ($ e ->getMessage ());
14149 }
14250
14351 $ this ->_redirectReferer ();
14452 }
145-
14653}
0 commit comments