From da431170991889af5756e960b408d4eaeef366ff Mon Sep 17 00:00:00 2001 From: Florent Bruneau Date: Sun, 14 Mar 2010 18:45:08 +0100 Subject: [PATCH] Rename tips to reminder_tips. Also fix a few naming issues in the table (titre -> title, priorite -> priority) and some SQL syntax error in 20_naming_convention.sql. Signed-off-by: Florent Bruneau --- modules/events.php | 6 +++--- templates/include/tips.tpl | 2 +- upgrade/account/20_naming_convention.sql | 10 +++++++--- upgrade/account/copy_tables.sh | 2 +- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/modules/events.php b/modules/events.php index d333d0c..eebfa82 100644 --- a/modules/events.php +++ b/modules/events.php @@ -64,11 +64,11 @@ class EventsModule extends PLModule do { $priority = (int)($priority/2); $res = XDB::query("SELECT * - FROM tips + FROM reminder_tips WHERE (expiration = '0000-00-00' OR expiration > CURDATE()) AND (promo_min = 0 OR promo_min <= {?}) AND (promo_max = 0 OR promo_max >= {?}) - AND (priorite >= {?}) + AND (priority >= {?}) AND (state = 'active') $exclude ORDER BY RAND() @@ -307,7 +307,7 @@ class EventsModule extends PLModule { $page->setTitle('Administration - Astuces'); $page->assign('title', 'Gestion des Astuces'); - $table_editor = new PLTableEditor('admin/tips', 'tips', 'id'); + $table_editor = new PLTableEditor('admin/tips', 'reminder_tips', 'id'); $table_editor->describe('expiration', 'date de péremption', true); $table_editor->describe('promo_min', 'promo. min (0 aucune)', false); $table_editor->describe('promo_max', 'promo. max (0 aucune)', false); diff --git a/templates/include/tips.tpl b/templates/include/tips.tpl index f7bbd8e..2d4f5f3 100644 --- a/templates/include/tips.tpl +++ b/templates/include/tips.tpl @@ -25,7 +25,7 @@
{/if} {icon name=lightbulb} {if !$tips.special} - Astuce : {$tips.titre} + Astuce : {$tips.title} {if hasPerm('admin') && !$tips.special && !$nochange} {icon name="page_edit" title="Editer"} {/if} diff --git a/upgrade/account/20_naming_convention.sql b/upgrade/account/20_naming_convention.sql index b245877..c5cf76c 100644 --- a/upgrade/account/20_naming_convention.sql +++ b/upgrade/account/20_naming_convention.sql @@ -30,12 +30,16 @@ CHANGE COLUMN user_id uid INT(11) not null; # announces ALTER TABLE announces -CHANGE COLUMN user_id uid INT(11) not null; +CHANGE COLUMN user_id uid INT(11) not null, CHANGE COLUMN peremption expiration DATE NOT NULL; + ALTER TABLE announce_read CHANGE COLUMN user_id uid INT(11) not null; - ALTER TABLE tips -CHANGE COLUMN peremption expiration DATE NOT NULL; + + ALTER TABLE reminder_tips +CHANGE COLUMN peremption expiration DATE NOT NULL, +CHANGE COLUMN titre title VARCHAR(64) NOT NULL, +CHANGE COLUMN priorite priority TINYINT(2) UNSIGNED NOT NULL DEFAULT 127; # profile ALTER TABLE profile_photos diff --git a/upgrade/account/copy_tables.sh b/upgrade/account/copy_tables.sh index 7df0a20..8c5abf5 100755 --- a/upgrade/account/copy_tables.sh +++ b/upgrade/account/copy_tables.sh @@ -93,7 +93,7 @@ copyTable '#x4dat#.search_autocomplete' 'search_autocomplete' copyTable '#x4dat#.search_name' 'search_name' copyTable '#x4dat#.skins' 'skins' -copyTable '#x4dat#.tips' 'tips' +copyTable '#x4dat#.tips' 'reminder_tips' copyTable '#x4dat#.survey_surveys' 'surveys' copyTable '#x4dat#.survey_answers' 'survey_answers' -- 2.1.4