Commit c2d07257 authored by Cédric Houbart's avatar Cédric Houbart
Browse files

Merged base_product and base_user, fix ModelService::get

parent 346a9495
......@@ -128,7 +128,7 @@ class ModelService {
// Fields
$sql .= ModelService::selectFields($def, $fields);
// Tables
$sql .= "FROM " . $def->getName();
$sql .= " FROM " . $def->getName();
foreach ($def->getExtTables() as $table) {
$sql .= "LEFT JOIN " . $table . " ON " . $table . ".rel_id = "
. $def->getName() . ".id ";
......
<?php
// Pastèque Web back office, Users module
// Pastèque Web back office, Products module
//
// Copyright (C) 2013 Scil (http://scil.coop)
//
......@@ -20,7 +20,7 @@
// category_edit action
namespace BaseUsers;
namespace BaseProducts;
if (isset($_POST['name'])) {
$def = \Pasteque\ModelFactory::get("user");
......@@ -37,7 +37,6 @@ $user = NULL;
if (isset($_GET['id'])) {
$user = \Pasteque\ModelService::get("user", $_GET['id']);
}
$permissions = \Pasteque\ModelService::search("permission");
?>
<h1><?php \pi18n("Edit an user", PLUGIN_NAME); ?></h1>
......
<?php
// Pastèque Web back office, Users module
// Pastèque Web back office, Products module
//
// Copyright (C) 2013 Scil (http://scil.coop)
//
......@@ -18,7 +18,7 @@
// You should have received a copy of the GNU General Public License
// along with Pastèque. If not, see <http://www.gnu.org/licenses/>.
namespace BaseUsers;
namespace BaseProducts;
if (isset($_POST['delete-user'])) {
\Pasteque\ModelService::delete("user", $_POST['delete-user']);
......
......@@ -44,6 +44,12 @@ function init() {
$categoryDef->addAttribute("parent_id", \Pasteque\ATTRDEF_SINGLEREL,
array("model" => "category"));
$userDef = \Pasteque\ModelFactory::register("user");
$userDef->addAttribute("permission_ids", \Pasteque\ATTRDEF_MULTREL,
array("model" => "permission"));
$permissionDef = \Pasteque\ModelFactory::register("permission");
$cashDef = \Pasteque\ModelFactory::register("cashsession");
$cashDef->addAttribute("sequence", \Pasteque\ATTRDEF_INT);
$cashDef->addAttribute("start", \Pasteque\ATTRDEF_DATE);
......@@ -78,6 +84,9 @@ function init() {
$MENU->registerModuleEntry("catalog", PLUGIN_NAME, "Taxes", "taxes");
$MENU->registerModuleEntry("catalog", PLUGIN_NAME, "Categories", "categories");
$MENU->registerModuleEntry("catalog", PLUGIN_NAME, "Products", "products");
$MENU->addSection("admin", "Administration", PLUGIN_NAME);
$MENU->registerModuleEntry("admin", PLUGIN_NAME, "Users", "users");
\Pasteque\register_i18n(PLUGIN_NAME);
}
\Pasteque\hook("module_load", __NAMESPACE__ . "\init");
......
......@@ -17,5 +17,12 @@
"Add a tax": "Add a tax",
"Edit tax": "Edit tax",
"Rates": "Rates",
"New tax rate": "New rate"
"New tax rate": "New rate",
"Administration": "Administration",
"Users": "Users",
"Add an user": "Add an user",
"Edit an user": "Edit an user",
"%d users": "%d users"
}
......@@ -17,5 +17,12 @@
"Add a tax": "Ajouter une taxe",
"Edit tax": "Édition de la taxe",
"Rates": "Taux",
"New tax rate": "Nouveau taux"
"New tax rate": "Nouveau taux",
"Administration": "Administration",
"Users": "Utilisateurs",
"Add an user": "Ajouter un utilisateur",
"Edit an user": "Édition d'un utilisateur",
"%d users": "%d utilisateurs"
}
<?php
// Pastèque Web back office, Users module
//
// Copyright (C) 2013 Scil (http://scil.coop)
//
// This file is part of Pastèque.
//
// Pastèque is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Pastèque is distributed in the hope that it will be useful,
// 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 Pastèque. If not, see <http://www.gnu.org/licenses/>.
namespace BaseUsers;
function init() {
// Register models
$user = \Pasteque\ModelFactory::register("user");
$user->addAttribute("permission_ids", \Pasteque\ATTRDEF_MULTREL,
array("model" => "permission"));
$permissions = \Pasteque\ModelFactory::register("permission");
// Register menu
global $MENU;
$MENU->addSection("admin", "Administration", PLUGIN_NAME);
$MENU->registerModuleEntry("admin", PLUGIN_NAME, "Users", "users");
\Pasteque\register_i18n(PLUGIN_NAME);
}
\Pasteque\hook("module_load", __NAMESPACE__ . "\init");
?>
{
"Administration": "Administration",
"Products": "Products",
"Add a product": "Add a product",
"No product found": "No product found",
"Edit a product": "Edit a product",
"Sell price + taxes": "Sell price + taxes",
"Categories": "Categories",
"Edit categories": "Edit categories",
"Add a category": "Add a category",
"%d categories": "%d categories",
"No category found": "No category found",
"Taxes": "Taxes",
"Add a tax": "Add a tax",
"Edit tax": "Edit tax",
"Rates": "Rates",
"New tax rate": "New rate",
"Users": "Users",
"Add an user": "Add an user",
"Edit an user": "Edit an user",
"%d users": "%d users"
}
{
"Administration": "Administration",
"Products": "Produits",
"Add a product": "Ajouter un produit",
"No product found": "Aucun produit trouvé",
"Edit a product": "Édition d'un produit",
"Sell price + taxes": "Prix de vente + taxes",
"Categories": "Categories",
"Edit a category": "Édition d'une categorie",
"Add a category": "Ajouter une catégorie",
"%d categories": "%d categories",
"No category found": "Pas de categorie trouvée",
"Taxes": "Taxes",
"Add a tax": "Ajouter une taxe",
"Edit tax": "Édition de la taxe",
"Rates": "Taux",
"New tax rate": "Nouveau taux",
"Users": "Utilisateurs",
"Add an user": "Ajouter un utilisateur",
"Edit an user": "Édition d'un utilisateur",
"%d users": "%d utilisateurs"
}
<?php
// Pastèque Web back office, Users module
//
// Copyright (C) 2013 Scil (http://scil.coop)
//
// This file is part of Pastèque.
//
// Pastèque is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Pastèque is distributed in the hope that it will be useful,
// 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 Pastèque. If not, see <http://www.gnu.org/licenses/>.
namespace BaseUsers;
const PLUGIN_NAME = "base_users";
require_once(dirname(__FILE__) . "/base_users.php");
?>
Supports Markdown
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