diff --git a/app/classes/Framadate/Migration/AddColumn_ValueMax_In_poll_For_1_1.php b/app/classes/Framadate/Migration/AddColumn_ValueMax_In_poll_For_1_1.php index 6715f9b34afd256a64b327a05fa2479deb7f78aa..8b1caa22b9ac7b601e70855efc6278e7acdd2fdd 100644 --- a/app/classes/Framadate/Migration/AddColumn_ValueMax_In_poll_For_1_1.php +++ b/app/classes/Framadate/Migration/AddColumn_ValueMax_In_poll_For_1_1.php @@ -65,7 +65,6 @@ class AddColumn_ValueMax_In_poll_For_1_1 implements Migration { private function alterPollTable(\PDO $pdo) { $pdo->exec(' ALTER TABLE `' . Utils::table('poll') . '` - ADD `ValueMax` TINYINT, - ADD CHECK (ValueMax > 0)'); + ADD `ValueMax` TINYINT NULL;'); } } diff --git a/studs.php b/studs.php index 531bf1340a1d5570447b02ea58e27b96b388e2e1..f202c4a6350913dffed1885e7a89321d88350735 100644 --- a/studs.php +++ b/studs.php @@ -168,7 +168,7 @@ if ($accessGranted) { try { $result = $pollService->addVote($poll_id, $name, $choices, $slots_hash); if ($result) { - if ($poll->editable === Editable::EDITABLE_BY_OWN) { + if (intval($poll->editable) === Editable::EDITABLE_BY_OWN) { $editedVoteUniqueId = $result->uniqId; $message = getMessageForOwnVoteEditableVote($sessionService, $smarty, $editedVoteUniqueId, $config['use_smtp'], $poll_id, $name); } else { diff --git a/tpl/part/vote_table_classic.tpl b/tpl/part/vote_table_classic.tpl index 62d94e211ef469d5ac2213f01f4db4fabf713051..fd07e1d888e416cb714529f03fb66f76dba8ce15 100644 --- a/tpl/part/vote_table_classic.tpl +++ b/tpl/part/vote_table_classic.tpl @@ -101,7 +101,13 @@ <tr> <th class="bg-info">{$vote->name|html} - {if $slots gt 4} + {if $active && !$expired && $accessGranted && + ( + $poll->editable == constant('Framadate\Editable::EDITABLE_BY_ALL') + or $admin + or ($poll->editable == constant('Framadate\Editable::EDITABLE_BY_OWN') && $editedVoteUniqueId == $vote->uniqId) + ) && $slots gt 4 + } <span class="edit-username-left"> <a href="{if $admin}{poll_url id=$poll->admin_id vote_id=$vote->uniqId admin=true}{else}{poll_url id=$poll->id vote_id=$vote->uniqId}{/if}" class="btn btn-default btn-sm" title="{__f('Poll results', 'Edit the line: %s', $vote->name)|html}"> <i class="glyphicon glyphicon-pencil"></i><span class="sr-only">{__('Generic', 'Edit')}</span> @@ -168,7 +174,7 @@ {foreach $slots as $id=>$slot} <td class="bg-info" headers="C{$id}"> <ul class="list-unstyled choice"> - {if $best_choices['y'][$i] lt $poll->ValueMax || $poll->ValueMax eq NULL} + {if $poll->ValueMax eq NULL || $best_choices['y'][$i] lt $poll->ValueMax} <li class="yes"> <input type="radio" id="y-choice-{$id}" name="choices[{$id}]" value="2" /> <label class="btn btn-default btn-xs" for="y-choice-{$id}" title="{__('Poll results', 'Vote yes for')|html} {$slot->title|html}"> diff --git a/tpl/part/vote_table_date.tpl b/tpl/part/vote_table_date.tpl index 0c2a64bb5df1f619f140586372fbfa65d10b8362..0fa5804df44eb0005c052d7f6667862b6b393f89 100644 --- a/tpl/part/vote_table_date.tpl +++ b/tpl/part/vote_table_date.tpl @@ -153,9 +153,15 @@ <tr> {* Voted line *} - <th class="bg-info">{$vote->name|html} - {if $slots gt 4} + {if $active && !$expired && $accessGranted && + ( + $poll->editable == constant('Framadate\Editable::EDITABLE_BY_ALL') + or $admin + or ($poll->editable == constant('Framadate\Editable::EDITABLE_BY_OWN') && $editedVoteUniqueId == $vote->uniqId) + ) && + $slots|count gt 4 + } <span class="edit-username-left"> <a href="{if $admin}{poll_url id=$poll->admin_id vote_id=$vote->uniqId admin=true}{else}{poll_url id=$poll->id vote_id=$vote->uniqId}{/if}" class="btn btn-default btn-sm" title="{__f('Poll results', 'Edit the line: %s', $vote->name)|html}"> <i class="glyphicon glyphicon-pencil"></i><span class="sr-only">{__('Generic', 'Edit')}</span> @@ -232,7 +238,7 @@ <td class="bg-info" headers="M{$headersM[$i]} D{$headersD[$i]} H{$headersH[$i]}"> <ul class="list-unstyled choice"> - {if $best_choices['y'][$i] lt $poll->ValueMax || $poll->ValueMax eq NULL} + {if $poll->ValueMax eq NULL || $best_choices['y'][$i] lt $poll->ValueMax} <li class="yes"> <input type="radio" id="y-choice-{$i}" name="choices[{$i}]" value="2" /> <label class="btn btn-default btn-xs" for="y-choice-{$i}" title="{__('Poll results', 'Vote yes for')|html} {$slot->day|date_format:$date_format.txt_short|html} - {$moment|html}">