/** * @param Piece $piece * @param Devis $devis * @return string */ function element_is_on_off(Piece $piece, Devis $devis) { if ($devis->hasElement($piece)) { return 'on'; } return 'off'; }
public static function install() { self::init(); global $wpdb; require_once ABSPATH . 'wp-admin/includes/upgrade.php'; /* Create Devis Table */ $sql_create_table = 'CREATE TABLE ' . Devis::getTableName() . ' ( id int(10) unsigned NOT NULL AUTO_INCREMENT, utilisateur_id int(11) NOT NULL, vehicule_id int(11) NOT NULL, state tinyint(3) unsigned NOT NULL, creationDate datetime NOT NULL, updateDate datetime DEFAULT NULL, mailSent tinyint DEFAULT 0 NOT NULL, proposition_id int(11) NULL, PRIMARY KEY (id), KEY state (state) )' . $charset_collate . ';'; if (dbDelta($sql_create_table)) { } else { } /* Create Dommage Table */ $sql_create_table = 'CREATE TABLE ' . Dommage::getTableName() . ' ( id int(11) NOT NULL AUTO_INCREMENT, devis_id int(11) NOT NULL, piece int(11) NOT NULL, type varchar(30) DEFAULT NULL, taille varchar(30) DEFAULT NULL, peinture char(3) DEFAULT NULL, commentaire text, demi float NULL, complet float NULL, simple float NULL, complexe float NULL, t_mo float NULL, qt float NULL, tarif float NULL, PRIMARY KEY (id), KEY devis_id (devis_id) )' . $charset_collate . ';'; if (dbDelta($sql_create_table)) { } else { } /* Create Photo table */ $sql_create_table = 'CREATE TABLE ' . Photo::getTableName() . ' ( id int(11) NOT NULL AUTO_INCREMENT, dommage_id int(11) NOT NULL, name varchar(50) NOT NULL, PRIMARY KEY (id), KEY dommage_id (dommage_id) )' . $charset_collate . ';'; if (dbDelta($sql_create_table)) { } else { } /* Create Utilisateur Table */ $sql_create_table = 'CREATE TABLE ' . Utilisateur::getTableName() . ' ( id int(11) NOT NULL AUTO_INCREMENT, civilite varchar(5) NOT NULL, nom varchar(100) NOT NULL, prenom varchar(100) NOT NULL, societe varchar(100) DEFAULT NULL, code_client varchar(20) DEFAULT NULL, adresse varchar(255) NOT NULL, cmplt_adresse varchar(255) DEFAULT NULL, cp varchar(10) NOT NULL, ville varchar(100) NOT NULL, pays varchar(50) DEFAULT NULL, tel varchar(20) NOT NULL, mobile varchar(20) DEFAULT NULL, email varchar(100) NOT NULL, comment_connu tinyint(4) NOT NULL, PRIMARY KEY (id) )' . $charset_collate . ';'; if (dbDelta($sql_create_table)) { } else { } /* Create Vehicule Table */ $sql_create_table = 'CREATE TABLE ' . Vehicule::getTableName() . ' ( id int(11) NOT NULL AUTO_INCREMENT, immatriculation varchar(30) NOT NULL, marque varchar(50) NOT NULL, modele varchar(50) NOT NULL, kms int(11) DEFAULT NULL, numero_chassis varchar(100) DEFAULT NULL, PRIMARY KEY (id) )' . $charset_collate . ';'; if (dbDelta($sql_create_table)) { } else { } /* Create Devis Table */ $sql_create_table = 'CREATE TABLE ' . Proposition::getTableName() . ' ( id int(10) unsigned NOT NULL AUTO_INCREMENT, main_oeuvre float NOT NULL, F_prise_charge int NOT NULL, remise int NOT NULL, ht float NOT NULL, ht_r float NOT NULL, tva float NOT NULL, tot float NOT NULL, comment text NULL, acompte int NOT NULL, date1 datetime NOT NULL, date2 datetime NOT NULL, date3 datetime NOT NULL, matin_midi1 tinyint NOT NULL, matin_midi2 tinyint NOT NULL, matin_midi3 tinyint NOT NULL, PRIMARY KEY (id) )' . $charset_collate . ';'; if (dbDelta($sql_create_table)) { } else { } add_option('dw_devis_db_version', self::DB_VERSION); /* TODO : [création | modification] du répertoire upload avec les bons droits */ return true; }