Fix teacher remove

parent e4872f50
...@@ -224,7 +224,8 @@ INSERT INTO `itemcategory` (`id`,`name`,`groupflag`,`sort`) VALUES ...@@ -224,7 +224,8 @@ INSERT INTO `itemcategory` (`id`,`name`,`groupflag`,`sort`) VALUES
(120,'ΣΕΤ ΡΟΜΠΟΤΙΚΗΣ ΔΗΜΟΤΙΚΟΥ', 1,20), (120,'ΣΕΤ ΡΟΜΠΟΤΙΚΗΣ ΔΗΜΟΤΙΚΟΥ', 1,20),
(121,'ΣΕΤ ΡΟΜΠΟΤΙΚΗΣ ΓΥΜΝΑΣΙΟΥ', 1,21), (121,'ΣΕΤ ΡΟΜΠΟΤΙΚΗΣ ΓΥΜΝΑΣΙΟΥ', 1,21),
(122,'ΣΕΤ ΡΟΜΠΟΤΙΚΗΣ ΛΥΚΕΙΟΥ', 1,22), (122,'ΣΕΤ ΡΟΜΠΟΤΙΚΗΣ ΛΥΚΕΙΟΥ', 1,22),
(123,'ΔΙΑΔΡΑΣΤΙΚΟ ΣΥΣΤΗΜΑ (INTERACTIVE SET)', 1,23); (123,'ΔΙΑΔΡΑΣΤΙΚΟ ΣΥΣΤΗΜΑ (INTERACTIVE SET)', 1,23),
(124,'ΜΟΝΑΔΑ ΑΔΙΑΛΕΙΠΤΗΣ ΠΑΡΟΧΗΣ ΡΕΥΜΑΤΟΣ (UPS)', 1, 24);
/*!40000 ALTER TABLE `itemcategory` ENABLE KEYS */; /*!40000 ALTER TABLE `itemcategory` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
...@@ -401,9 +402,6 @@ UNLOCK TABLES; ...@@ -401,9 +402,6 @@ UNLOCK TABLES;
-- Table structure for table `school` -- Table structure for table `school`
-- --
DROP TABLE IF EXISTS `school`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
DROP TABLE IF EXISTS `school`; DROP TABLE IF EXISTS `school`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */; /*!40101 SET character_set_client = utf8 */;
...@@ -588,7 +586,7 @@ CREATE TABLE `softwarecategory` ( ...@@ -588,7 +586,7 @@ CREATE TABLE `softwarecategory` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT, `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; ) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --
...@@ -643,7 +641,7 @@ DROP TABLE IF EXISTS `tpesurvey`; ...@@ -643,7 +641,7 @@ DROP TABLE IF EXISTS `tpesurvey`;
/*!40101 SET character_set_client = utf8 */; /*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tpesurvey` ( CREATE TABLE `tpesurvey` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT, `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`teacher_id` int(11) unsigned NOT NULL, `teacher_id` int(11) unsigned DEFAULT NULL,
`already_using_tpe` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `already_using_tpe` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`knowledge_level` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `knowledge_level` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`assets_in_use` text COLLATE utf8mb4_unicode_ci, `assets_in_use` text COLLATE utf8mb4_unicode_ci,
...@@ -663,7 +661,7 @@ CREATE TABLE `tpesurvey` ( ...@@ -663,7 +661,7 @@ CREATE TABLE `tpesurvey` (
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `teacher_id_UNIQUE` (`teacher_id`), UNIQUE KEY `teacher_id_UNIQUE` (`teacher_id`),
KEY `index_foreignkey_tpesurvey_teacher` (`teacher_id`), KEY `index_foreignkey_tpesurvey_teacher` (`teacher_id`),
CONSTRAINT `c_fk_tpesurvey_teacher_id` FOREIGN KEY (`teacher_id`) REFERENCES `teacher` (`id`) ON UPDATE CASCADE CONSTRAINT `c_fk_tpesurvey_teacher_id` FOREIGN KEY (`teacher_id`) REFERENCES `teacher` (`id`) ON UPDATE CASCADE ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
......
...@@ -77,6 +77,7 @@ ...@@ -77,6 +77,7 @@
<li>ΚΩΔΙΚΟΣ 21 - ΣΕΤ ΡΟΜΠΟΤΙΚΗΣ ΓΥΜΝΑΣΙΟΥ</li> <li>ΚΩΔΙΚΟΣ 21 - ΣΕΤ ΡΟΜΠΟΤΙΚΗΣ ΓΥΜΝΑΣΙΟΥ</li>
<li>ΚΩΔΙΚΟΣ 22 - ΣΕΤ ΡΟΜΠΟΤΙΚΗΣ ΛΥΚΕΙΟΥ</li> <li>ΚΩΔΙΚΟΣ 22 - ΣΕΤ ΡΟΜΠΟΤΙΚΗΣ ΛΥΚΕΙΟΥ</li>
<li>ΚΩΔΙΚΟΣ 23 - ΔΙΑΔΡΑΣΤΙΚΟ ΣΥΣΤΗΜΑ (INTERACTIVE SET)</li> <li>ΚΩΔΙΚΟΣ 23 - ΔΙΑΔΡΑΣΤΙΚΟ ΣΥΣΤΗΜΑ (INTERACTIVE SET)</li>
<li>ΚΩΔΙΚΟΣ 24 - ΜΟΝΑΔΑ ΑΔΙΑΛΕΙΠΤΗΣ ΠΑΡΟΧΗΣ ΡΕΥΜΑΤΟΣ (UPS)</li>
</ul> </ul>
<p class="text-center"> <p class="text-center">
<a class="btn btn-primary" href="{{ base_url() }}/files/prodiagrafes_edulabs.pdf">ΑΝΑΛΥΤΙΚΕΣ ΠΡΟΔΙΑΓΡΑΦΕΣ ΕΞΟΠΛΙΣΜΟΥ</a> <a class="btn btn-primary" href="{{ base_url() }}/files/prodiagrafes_edulabs.pdf">ΑΝΑΛΥΤΙΚΕΣ ΠΡΟΔΙΑΓΡΑΦΕΣ ΕΞΟΠΛΙΣΜΟΥ</a>
......
LOCK TABLES `itemcategory` WRITE;
/*!40000 ALTER TABLE `itemcategory` DISABLE KEYS */;
INSERT INTO `itemcategory` (`id`,`name`,`groupflag`,`sort`) VALUES
(124,'ΜΟΝΑΔΑ ΑΔΙΑΛΕΙΠΤΗΣ ΠΑΡΟΧΗΣ ΡΕΥΜΑΤΟΣ (UPS)', 1, 24);
/*!40000 ALTER TABLE `itemcategory` ENABLE KEYS */;
UNLOCK TABLES;
ALTER TABLE `itemcategory` AUTO_INCREMENT = 200;
alter table `applicationform` modify `received_by` varchar(255);
lock tables `tpesurvey` write;
alter table `tpesurvey` modify `teacher_id` int(11) unsigned null;
alter table `tpesurvey` drop foreign key `c_fk_tpesurvey_teacher_id`;
alter table `tpesurvey` add constraint `c_fk_tpesurvey_teacher_id`
foreign key (`teacher_id`)
references `teacher` (`id`) on update cascade on delete set null;
unlock tables;
...@@ -50,7 +50,8 @@ return function (Slim\App $app) { ...@@ -50,7 +50,8 @@ return function (Slim\App $app) {
$container[Action\Staff\DeleteTeacher::class] = function ($c) { $container[Action\Staff\DeleteTeacher::class] = function ($c) {
return new Action\Staff\DeleteTeacher( return new Action\Staff\DeleteTeacher(
$c->get(Service\StaffServiceInterface::class) $c->get(Service\StaffServiceInterface::class),
$c->get('logger')
); );
}; };
......
This diff is collapsed.
...@@ -7,25 +7,32 @@ ...@@ -7,25 +7,32 @@
* @copyright Copyright (c) 2008-2015 Greek Free/Open Source Software Society (https://gfoss.ellak.gr/) * @copyright Copyright (c) 2008-2015 Greek Free/Open Source Software Society (https://gfoss.ellak.gr/)
* @license GNU GPLv3 http://www.gnu.org/licenses/gpl-3.0-standalone.html * @license GNU GPLv3 http://www.gnu.org/licenses/gpl-3.0-standalone.html
*/ */
namespace GrEduLabs\Schools\Action\Staff; namespace GrEduLabs\Schools\Action\Staff;
use Exception; use Exception;
use GrEduLabs\Schools\Service\StaffServiceInterface; use GrEduLabs\Schools\Service\StaffServiceInterface;
use Slim\Http\Request; use Slim\Http\Request;
use Slim\Http\Response; use Slim\Http\Response;
use Monolog\Logger;
class DeleteTeacher class DeleteTeacher
{ {
/** /**
* *
* @var StaffServiceInterface * @var StaffServiceInterface
*/ */
private $staffService; private $staffService;
public function __construct(StaffServiceInterface $staffService) /**
* @var Monolog\Logger
*/
private $logger;
public function __construct(StaffServiceInterface $staffService, Logger $logger)
{ {
$this->staffService = $staffService; $this->staffService = $staffService;
$this->logger = $logger;
} }
public function __invoke(Request $req, Response $res) public function __invoke(Request $req, Response $res)
...@@ -50,6 +57,10 @@ class DeleteTeacher ...@@ -50,6 +57,10 @@ class DeleteTeacher
} }
try { try {
$teacher_data = $this->staffService->getTeacherById($id);
unset($teacher_data['telephone']);
unset($teacher_data['email']);
$this->logger->info(sprintf('Call staffService->removeTeacher(%d) = %s', $id, var_export($teacher_data, true)));
$this->staffService->removeTeacher($id); $this->staffService->removeTeacher($id);
$res = $res->withStatus(204); $res = $res->withStatus(204);
} catch (Exception $ex) { } catch (Exception $ex) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment