Skip to content

Commit

Permalink
NEW allow to modify validated doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexis Algoud committed Mar 24, 2017
1 parent ac871fb commit 7057b77
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
6 changes: 3 additions & 3 deletions admin/quickcustomerprice_setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@
// Example with a yes / no select
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("ParamLabel").'</td>';
print '<td>'.$langs->trans("QCP_ALLOW_CHANGE_ON_VALIDATE").'</td>';
print '<td align="center" width="20">&nbsp;</td>';
print '<td align="right" width="300">';
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_CONSTNAME">';
print $form->selectyesno("CONSTNAME",$conf->global->CONSTNAME,1);
print '<input type="hidden" name="action" value="set_QCP_ALLOW_CHANGE_ON_VALIDATE">';
print $form->selectyesno("QCP_ALLOW_CHANGE_ON_VALIDATE",$conf->global->QCP_ALLOW_CHANGE_ON_VALIDATE,1);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</form>';
print '</td></tr>';
Expand Down
6 changes: 3 additions & 3 deletions class/actions_quickcustomerprice.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ function formObjectOptions($parameters, &$object, &$action, $hookmanager)
//var_dump($parameters['currentcontext']);
if ($parameters['currentcontext'] == 'propalcard' || $parameters['currentcontext'] == 'ordercard' || $parameters['currentcontext'] == 'invoicecard')
{
global $langs, $conf;

if($object->statut > 0 && empty($conf->global->QCP_ALLOW_CHANGE_ON_VALIDATE)) return 0;

if($object->statut > 0) return 0;

global $langs;
?>
<script type="text/javascript">
$(document).ready(function() {
Expand Down
2 changes: 1 addition & 1 deletion core/modules/modquickcustomerprice.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function __construct($db)
$this->dirs = array();

// Config pages. Put here list of php page, stored into quickcustomerprice/admin directory, to use to setup module.
$this->config_page_url = false;
$this->config_page_url = array('quickcustomerprice_setup.php@quickcustomerprice');

// Dependencies
$this->hidden = false; // A condition to hide module
Expand Down
4 changes: 3 additions & 1 deletion langs/fr_FR/quickcustomerprice.lang
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ Module104874Desc = Permet la modification rapide des prix, quantité et remise d
ATMAbout = Ce module a été développé par <a href="http://www.atm-consulting.fr" target="_blank">ATM Consulting</a><br>Vous pouvez retrouver la documentation sur notre <a href="http://wiki.atm-consulting.fr/index.php/Accueil" target="_blank">wiki</a><br><br>Pour toute question technique ou retour, contactez-nous sur <a href="mailto:support@atm-consulting.fr">support@atm-consulting.fr</a><br><br>Pour toute question commerciale, contactez-nous sur <a href="mailto:contact@atm-consulting.fr">contact@atm-consulting.fr</a> ou au +33 9 77 19 50 70<br><br>Retrouvez nos autres modules sur <a href="http://www.dolistore.com/search.php?orderby=position&orderway=desc&search_query=atm&submit_search=Rechercher" target="_blank">Dolistore</a>

quickcustomerpriceSetup = Configuration du module quickcustomerprice
quickcustomerpriceAbout = A propos du module quickcustomerprice
quickcustomerpriceAbout = A propos du module quickcustomerprice

QCP_ALLOW_CHANGE_ON_VALIDATE=Autoriser la modification d'élément validé
4 changes: 4 additions & 0 deletions script/interface.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ function _updateLine($objectid, $objectelement,$lineid,$column, $value) {
$o=new $objectelement($db);
$o->fetch($objectid);

if(!empty($conf->global->QCP_ALLOW_CHANGE_ON_VALIDATE)) {
$o->brouillon=1;
}

$find=false;
foreach($o->lines as &$line) {
if($line->id == $lineid || $line->rowid == $lineid) {
Expand Down

0 comments on commit 7057b77

Please sign in to comment.