* but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * */ require_once "Libs/autoload.php"; $config = new Config(); $webPage = new PJSWebPage($config->getTitle() . ' - Delete Contact'); $act = Tools::Param('act'); if ("Delete Contact" === $act) { $contactModel = new ContactModel(); $contactModel->populateFromForm(); if (!$contactModel->validateForDelete()) { $contactView = new ContactFormView('Delete Contact', $contactModel); $body = "<h2>Invalid data</h2>\n" . $contactView->getForm(); } else { $contactController = new ContactController(); $contactController->delete($contactModel); $body = "Deleted contact # " . $contactModel->getId() . "<br />\n"; } } else { $contactController = new ContactController(); $contactModel = $contactController->get(Tools::param('id')); $contactView = new ContactFormView('Delete Contact', $contactModel); $body = $contactView->getForm(); } $webPage->setBody($body);
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * */ require_once "Libs/autoload.php"; $config = new Config(); $webPage = new PJSWebPage($config->getTitle() . "Contacts - Add Contact"); $body = ''; $act = Tools::Param('act'); if ("Add Contact" === $act) { $model = new ContactModel(); $model->populateFromForm(); if (!$model->validateForAdd()) { $view = new ContactFormView('Add Contact', $model); $body = "<h2>Invalid data</h2>\n" . $view->getForm(); } else { $contactController = new ContactController(); $newId = $contactController->add($model); if ($newId > 0) { $body = "Added contact # " . $newId . "<br />\n"; } } } else { $body = ""; $contactModel = new ContactModel(); $companyId = '' === Tools::param('contactCompanyId') ? 0 : Tools::param('contactCompanyId'); $contactModel->setContactCompanyId($companyId);