Skip to content

Commit

Permalink
#95 [Tags] add: brand tags on products
Browse files Browse the repository at this point in the history
  • Loading branch information
Théo David committed Jan 16, 2023
1 parent ffacc56 commit 69f3c22
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 102 deletions.
72 changes: 72 additions & 0 deletions core/car_brands.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
Abarth
Alfa Romeo
Alpine
Aston Martin
Audi
Bentley
BMW
Bollore
BRP
Bugatti
Cadillac
Caterham
Chevrolet
Chrysler
Citroën
Cupra
Dacia
Daihatsu
DeVinci
Dodge
DS
Ferrari
Fiat
Fisker
Ford
GMC
Honda
Hummer
Hyundai
Infiniti
Isuzu
Jaguar
Jannarelly
Jeep
Kia
Koenigsegg
Lamborghini
Lancia
Land-Rover
Lexus
Lotus
Maserati
Maybach
Mazda
Mclaren
Mercedes
MG Motor
Mini
Mitsubishi
Nissan
Opel
Pagani
Peugeot
Pgo'
Polestar
Porsche
Renault
Rolls Royce
Saab
Seat
Shelby
Skoda
Smart
Ssangyong
Subaru
Suzuki
Tesla
Toyota
Venturi
Volkswagen
Volvo
Zenvo
36 changes: 33 additions & 3 deletions core/modules/modDoliCar.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -462,10 +462,10 @@ public function init($options = '')
}

//Categorie
if ($conf->global->DOLICAR_TAGS_SET == 0) {
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$tag = new Categorie($this->db);

$tag = new Categorie($this->db);
if ($conf->global->DOLICAR_TAGS_SET == 0) {

$tag->label = $langs->transnoentities('Vehicle');
$tag->type = 'product';
Expand Down Expand Up @@ -530,6 +530,36 @@ public function init($options = '')
}
dolibarr_set_const($this->db, 'DOLICAR_DEFAULT_VEHICLE_SET', 1, 'integer', 0, '', $conf->entity);
}

//Car brands tag
dolibarr_set_const($this->db, 'DOLICAR_CAR_BRANDS_TAG_SET', 0, 'integer', 0, '', $conf->entity);

if ($conf->global->DOLICAR_CAR_BRANDS_TAG_SET == 0) {

$tag->label = $langs->transnoentities('Brands');
$tag->type = 'product';
$result = $tag->create($user);


if ($result > 0) {

$filename = DOL_DOCUMENT_ROOT . '/custom/dolicar/core/car_brands.txt';
$file = fopen( $filename, "r" );
if ($file) {
while (($line = fgets($file)) !== false) {
$tag->label = $langs->transnoentities($line);
$tag->type = 'product';
$tag->fk_parent = $result;
$tag->create($user);

}
fclose($file);
}

dolibarr_set_const($this->db, 'DOLICAR_CAR_BRANDS_TAG', $result, 'integer', 0, '', $conf->entity);
dolibarr_set_const($this->db, 'DOLICAR_CAR_BRANDS_TAG_SET', 1, 'integer', 0, '', $conf->entity);
}
}
return $this->_init($sql, $options);
}

Expand Down
1 change: 1 addition & 0 deletions langs/fr_FR/dolicar.lang
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ LinkedProduct = Produit lié

# Data - Donnée
Settings = Réglages
Brands = Marques
Vehicle = Véhicule
Mileage = Kilométrage
ProductLotMileageModifyTrigger = Modification du kilométrage
Expand Down
76 changes: 0 additions & 76 deletions sql/data.sql
Original file line number Diff line number Diff line change
@@ -1,76 +0,0 @@
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(1, 0, 'Abarth', 'Abarth', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(2, 0, 'Alfa Romeo', 'Alfa Romeo', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(3, 0, 'Alpine', 'Alpine', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(4, 0, 'Aston Martin', 'Aston Martin', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(5, 0, 'Audi', 'Audi', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(6, 0, 'Bentley', 'Bentley', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(7, 0, 'BMW', 'BMW', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(8, 0, 'Bollore', 'Bollore', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(9, 0, 'BRP', 'BRP', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(10 0, 'Bugatti', 'Bugatti', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(11, 0, 'Cadillac', 'Cadillac', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(12, 0, 'Caterham', 'Caterham', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(13, 0, 'Chevrolet', 'Chevrolet', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(14, 0, 'Chrysler', 'Chrysler', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(15, 0, 'Citroën', 'Citroën', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(16, 0, 'Cupra', 'Cupra', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(17, 0, 'Dacia', 'Dacia', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(18, 0, 'Daihatsu', 'Daihatsu', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(19, 0, 'DeVinci', 'DeVinci', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(20, 0, 'Dodge', 'Dodge', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(21, 0, 'DS', 'DS', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(22, 0, 'Ferrari', 'Ferrari', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(23, 0, 'Fiat', 'Fiat', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(24, 0, 'Fisker', 'Fisker', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(25, 0, 'Ford', 'Ford', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(26, 0, 'GMC', 'GMC', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(27, 0, 'Gordon Murray Automotive', 'Gordon Murray Automotive', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(28, 0, 'Honda', 'Honda', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(29, 0, 'Hummer', 'Hummer', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(30 0, 'Hyundai', 'Hyundai', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(31, 0, 'Infiniti', 'Infiniti', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(32 0, 'Isuzu', 'Isuzu', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(33, 0, 'Jaguar', 'Jaguar', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(34, 0, 'Jannarelly', 'Jannarelly', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(35, 0, 'Jeep', 'Jeep', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(36, 0, 'Kia', 'Kia', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(37, 0, 'Koenigsegg', 'Koenigsegg', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(38, 0, 'Lamborghini', 'Lamborghini', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(39, 0, 'Lancia', 'Lancia', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(40, 0, 'Land-Rover', 'Land-Rover', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(41, 0, 'Lexus', 'Lexus', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(42, 0, 'Lotus', 'Lotus', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(43, 0, 'Maserati', 'Maserati', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(44, 0, 'Maybach', 'Maybach', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(45, 0, 'Mazda', 'Mazda', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(46, 0, 'Mclaren', 'Mclaren', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(47, 0, 'Mercedes', 'Mercedes', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(48, 0, 'MG Motor', 'MG Motor', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(49, 0, 'Mini', 'Mini', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(50, 0, 'Mitsubishi', 'Mitsubishi', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(51, 0, 'Nissan', 'Nissan', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(52, 0, 'Opel', 'Opel', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(53, 0, 'Pagani', 'Pagani', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(54, 0, 'Peugeot', 'Peugeot', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(55, 0, 'Pgo', 'Pgo', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(56, 0, 'Polestar', 'Polestar', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(57, 0, 'Porsche', 'Porsche', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(58, 0, 'Renault', 'Renault', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(59, 0, 'Rolls Royce', 'Rolls Royce', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(60, 0, 'Saab', 'Saab', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(61, 0, 'Seat', 'Seat', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(62, 0, 'Shelby', 'Shelby', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(63, 0, 'Skoda', 'Skoda', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(64, 0, 'Smart', 'Smart', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(65, 0, 'Ssangyong', 'Ssangyong', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(66, 0, 'Subaru', 'Subaru', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(67, 0, 'Suzuki', 'Suzuki', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(68, 0, 'Tesla', 'Tesla', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(69, 0, 'Toyota', 'Toyota', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(70, 0, 'Venturi', 'Venturi', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(71, 0, 'Volkswagen', 'Volkswagen', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(72, 0, 'Volvo', 'Volvo', '', 1);
INSERT INTO `llx_c_car_brands` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(73, 0, 'Zenvo', 'Zenvo', '', 1);



23 changes: 0 additions & 23 deletions sql/llx_c_car_brands.sql

This file was deleted.

0 comments on commit 69f3c22

Please sign in to comment.