Comment: | Invoice module: duplication implemented |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | invoice_module |
Files: | files | file ages | folders |
SHA3-256: |
2495908d73114e5ad120fa271f9e6bab |
User & Date: | alinaar on 2023-03-14 18:34:43 |
Other Links: | branch diff | manifest | tags |
2023-03-14
| ||
19:06 | Invoice module: cancellation reason input added check-in: a749465e53 user: alinaar tags: invoice_module | |
18:34 | Invoice module: duplication implemented check-in: 2495908d73 user: alinaar tags: invoice_module | |
17:19 | Invoice module: listing buttons improved check-in: 9ad7416fec user: alinaar tags: invoice_module | |
Modified src/skel-dist/modules/invoice/action.html from [18e6c4e36e] to [7110ab84c3].
1 2 3 4 5 | {{#restrict section="accounting" level="write"}} {{* ==================== Header ==================== *}} {{:admin_header title="Devis et factures" current="acc"}} | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | {{#restrict section="accounting" level="write"}} {{* ==================== Header ==================== *}} {{:admin_header title="Devis et factures" current="acc"}} {{:include file='./include/constants.tpl' keep='DRAFT_STATUS, AWAITING_STATUS, VALIDATED_STATUS, REJECTED_STATUS, PAID_STATUS, DOCUMENT_TYPES, CANCELLED_LABEL, TYPE_LABELS, STATUS_LABELS, INVOICE_STATUS_LABELS, QUOTATION_TYPE, INVOICE_TYPE, VERSION'}} {{:include file='./include/style.tpl'}} {{if $_GET.action === 'sign' || $_POST.signing_submit || $_GET.action === 'delete' || $_POST.reject_submit || $_POST.validate_submit || $_POST.mark_as_paid_submit || $_POST.cancel_submit || $_POST.duplicate_submit || $_POST.status_update_button}} {{:include file='./include/modification.controller.tpl' keep='check_errors'}} {{elseif $_GET.id === null}} <p class="error block">Aucun document séléctionné.</p> {{/if}} {{#load id=$_GET.id|intval}} {{* ======================= Menu =========================== *}} {{:include file='./include/document_details_menu.html'}} {{* ======================= Title =========================== *}} {{:assign var="label" from="TYPE_LABELS.%s"|args:$type}} {{if $type === $INVOICE_TYPE}} {{:assign var="status_label" from="INVOICE_STATUS_LABELS.%s"|args:$status}} {{else}} {{:assign var="status_label" from="STATUS_LABELS.%s"|args:$status}} {{/if}} <h1>{{$label}} n° {{$key}} - {{if !$cancelled}}{{$status_label}}{{else}}{{$CANCELLED_LABEL}}{{/if}}</h1> {{* ======================= Errors =========================== *}} {{if $check_errors}} {{#foreach from=$check_errors item='error'}} <p class="error block">{{$error}}</p> {{/foreach}} |
︙ | ︙ | |||
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | <form method="POST" action=""> <fieldset> <legend><h2 class="irreversible">Annuler {{if $type === $INVOICE_TYPE}}la{{else}}le{{/if}} {{$label}} n° {{$key}} ?</h2></legend> {{:include file='./include/document_summary.html'}} {{:button type="submit" name="cancel_submit" label="Confirmer l'annulation" shape="check" class="main"}} </fieldset> </form> {{/if}} {{/load}} {{:admin_footer}} {{else}} {{:error message="Seuls les membres avec accès en écriture à la comptabilité peuvent visualiser cette page."}} {{/restrict}} | > > > > > > > > > | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | <form method="POST" action=""> <fieldset> <legend><h2 class="irreversible">Annuler {{if $type === $INVOICE_TYPE}}la{{else}}le{{/if}} {{$label}} n° {{$key}} ?</h2></legend> {{:include file='./include/document_summary.html'}} {{:button type="submit" name="cancel_submit" label="Confirmer l'annulation" shape="check" class="main"}} </fieldset> </form> {{elseif $_GET.action === 'ask_duplication'}} <form method="POST" action=""> <fieldset> <legend><h2>Dupliquer {{if $type === $INVOICE_TYPE}}la{{else}}le{{/if}} {{$label}} n° {{$key}} ?</h2></legend> {{:include file='./include/document_summary.html'}} {{:button type="submit" name="duplicate_submit" label="Dupliquer" shape="check" class="main"}} </fieldset> </form> {{/if}} {{/load}} {{:admin_footer}} {{else}} {{:error message="Seuls les membres avec accès en écriture à la comptabilité peuvent visualiser cette page."}} {{/restrict}} |
Modified src/skel-dist/modules/invoice/details.html from [236fcb430c] to [6e1ac529bf].
1 2 3 4 5 | {{#restrict section="accounting" level="read"}} {{* ==================== Header ==================== *}} {{:admin_header title="Devis et factures" current="acc"}} | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | {{#restrict section="accounting" level="read"}} {{* ==================== Header ==================== *}} {{:admin_header title="Devis et factures" current="acc"}} {{:include file='./include/constants.tpl' keep='DRAFT_STATUS, AWAITING_STATUS, VALIDATED_STATUS, REJECTED_STATUS, PAID_STATUS, DOCUMENT_TYPES, TYPE_LABELS, STATUS_LABELS, INVOICE_STATUS_LABELS, CANCELLED_LABEL, QUOTATION_TYPE, INVOICE_TYPE, VERSION'}} {{:include file='./include/style.tpl'}} {{if $_GET.id === null}} <p class="error block">Aucun document séléctionné.</p> {{else}} {{#load id=$_GET.id|intval}} |
︙ | ︙ | |||
104 105 106 107 108 109 110 111 112 113 114 115 116 117 | {{#users id=$author_id|intval}}{{:assign .='author'}}{{/users}} <p> {{if $type === $QUOTATION_TYPE}}Rédigé{{else}}Rédigée{{/if}} par : {{:link href="!users/details.php?id=%d"|args:$author.id label=$author.nom}}. </p> <p> Dernière modification : {{$last_modification_date}}. </p> </fieldset> <fieldset> <legend><h2>Destinataire</h2></legend> <p class="infos"> <strong class="business_name">{{$recipient_business_name}}</strong><br /> {{$recipient_address|escape|nl2br}} | > > > > > > > > > > > > > > > | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | {{#users id=$author_id|intval}}{{:assign .='author'}}{{/users}} <p> {{if $type === $QUOTATION_TYPE}}Rédigé{{else}}Rédigée{{/if}} par : {{:link href="!users/details.php?id=%d"|args:$author.id label=$author.nom}}. </p> <p> Dernière modification : {{$last_modification_date}}. </p> {{if $duplicated_from_id}} {{if $type === $INVOICE_TYPE}} {{:assign duplicate_label="facture n°%s"}} {{else}} {{:assign duplicate_label="devis n°%s"}} {{/if}} {{#load id=$duplicated_from_id}}{{:assign .='parent'}}{{/load}} {{if $parent}} {{* if the parent was a draft it may have been deleted since the duplication *}} <p> Dupliqué depuis {{if $type === $INVOICE_TYPE}}la{{else}}le{{/if}} {{:link href="details.html?id=%d&show=quotation"|args:$parent.id label=$duplicate_label|args:$parent.key}} ({{if $parent.cancelled}}{{$CANCELLED_LABEL}}{{else}}{{:assign var='parent_status_label' from="INVOICE_STATUS_LABELS.%s"|args:$parent.status}}{{$parent_status_label}}{{/if}}). </p> {{/if}} {{/if}} </fieldset> <fieldset> <legend><h2>Destinataire</h2></legend> <p class="infos"> <strong class="business_name">{{$recipient_business_name}}</strong><br /> {{$recipient_address|escape|nl2br}} |
︙ | ︙ |
Modified src/skel-dist/modules/invoice/edit.html from [7d7921a190] to [70ddfcc9ab].
︙ | ︙ | |||
134 135 136 137 138 139 140 | {{#foreach from=$check_errors item='error'}} <p class="error block">{{$error}}</p> {{/foreach}} {{else}} {{if $_POST.key}} {{:assign key=$_POST.key}} {{else}} | | < < < < | 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | {{#foreach from=$check_errors item='error'}} <p class="error block">{{$error}}</p> {{/foreach}} {{else}} {{if $_POST.key}} {{:assign key=$_POST.key}} {{else}} {{:include file='./include/generate_next_key.tpl' keep='key'}} {{/if}} {{if $document}} {{:assign id=$document.id|intval}} {{else}} {{:assign id=null}} {{/if}} |
︙ | ︙ |
Modified src/skel-dist/modules/invoice/include/document_list_buttons.html from [8bd18451bd] to [97016a6806].
︙ | ︙ | |||
44 45 46 47 48 49 50 51 52 53 54 55 56 57 | {{#transactions id=$transaction_id|intval}} <li>{{:linkbutton href='!acc/transactions/details.php?id=%d'|args:$id title="Écriture comptable" label='📖'}}</li> {{/transactions}} {{/if}} {{/if}} {{#restrict section="accounting" level="write"}} {{if !$cancelled}} {{if $type === $INVOICE_TYPE}} {{:assign button_target_label='la facture'}} {{else}} {{:assign button_target_label='le devis'}} {{/if}} <li> | > > > > > | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | {{#transactions id=$transaction_id|intval}} <li>{{:linkbutton href='!acc/transactions/details.php?id=%d'|args:$id title="Écriture comptable" label='📖'}}</li> {{/transactions}} {{/if}} {{/if}} {{#restrict section="accounting" level="write"}} <li> <form method="POST" action="{{"action.html?id=%d&show=%s&action=ask_duplication"|args:$id:$type}}"> {{:button type="submit" title="Dupliquer" shape="list-ol" name="duplicate_button"}} </form> </li> {{if !$cancelled}} {{if $type === $INVOICE_TYPE}} {{:assign button_target_label='la facture'}} {{else}} {{:assign button_target_label='le devis'}} {{/if}} <li> |
︙ | ︙ |
Modified src/skel-dist/modules/invoice/include/document_summary.html from [c1aa9e60f6] to [d382d4427d].
1 2 3 4 5 6 7 | <fieldset> <legend>Résumé</legend> <ul> <li>Destinataire : <strong class="business_name">{{$recipient_business_name}}</strong></li> <li>Intitulé : {{$subject}}</li> <li>Date : {{$date|date_short}}</li> <li>Total : {{$total|money_currency}}</li> | > | > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | <fieldset> <legend>Résumé</legend> <ul> <li>Destinataire : <strong class="business_name">{{$recipient_business_name}}</strong></li> <li>Intitulé : {{$subject}}</li> <li>Date : {{$date|date_short}}</li> <li>Total : {{$total|money_currency}}</li> <li> Statut en cours : {{if !$cancelled}} {{$status_label}} {{else}} <strong>{{$CANCELLED_LABEL}}</strong>. <br />(dernier statut avant annulation : {{$status_label}}) {{/if}} </li> </ul> </fieldset> |
Added src/skel-dist/modules/invoice/include/generate_next_key.tpl version [40c00bd744].
> > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | {{if $pattern === null && $type === $QUOTATION_TYPE}} {{:assign pattern="D%06d"}} {{elseif $pattern === null && $type === $INVOICE_TYPE}} {{:assign pattern="F%06d"}} {{/if}} {{if !$assign_to}} {{:assign assign_to='key'}} {{/if}} {{#load select="MAX(key) AS last" where="json_extract(document, '$.type') = :type" :type=$type}} {{:assign last_numeric=$last|regexp_replace:'~\D~':''}} {{:assign next_numeric='%d+1'|math:$last_numeric}} {{:assign var=$assign_to value=$pattern|args:$next_numeric}} {{/load}} {{:debug type=$type}} {{:debug to=$assign_to}} {{:debug key=$key}} {{:debug invoice_key=$invoice_key}} |
Modified src/skel-dist/modules/invoice/include/modification.controller.tpl from [aa2af83daf] to [b57d30ddef].
︙ | ︙ | |||
82 83 84 85 86 87 88 | {{elseif $_POST.validate_submit}} {{:assign new_status=$VALIDATED_STATUS}} {{:assign validation_date=$now|date:'Y-m-d'}} {{:assign redirection_code=5}} {{/if}} {{if !$check_errors}} {{if $_POST.validate_submit && $_POST.invoice}} | | < < < < < | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | {{elseif $_POST.validate_submit}} {{:assign new_status=$VALIDATED_STATUS}} {{:assign validation_date=$now|date:'Y-m-d'}} {{:assign redirection_code=5}} {{/if}} {{if !$check_errors}} {{if $_POST.validate_submit && $_POST.invoice}} {{:include file='./generate_next_key.tpl' type=$INVOICE_TYPE assign_to='invoice_key' keep='invoice_key'}} {{:save assign_new_id='invoice_id' validate_schema="./schema/invoice.json" key=$invoice_key type=$INVOICE_TYPE recipient_business_name=$recipient_business_name recipient_address=$recipient_address |
︙ | ︙ | |||
150 151 152 153 154 155 156 | signing_date=$signing_date validation_date=$validation_date payment_detail=$payment_detail extra_info=$extra_info parent_id=$_GET.id|intval module_version=$VERSION }} | < | 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | signing_date=$signing_date validation_date=$validation_date payment_detail=$payment_detail extra_info=$extra_info parent_id=$_GET.id|intval module_version=$VERSION }} {{:http redirect="details.html?id=%d&ok=%d"|args:$id:$redirection_code}} {{/if}} {{/load}} {{/if}} {{elseif $_POST.mark_as_paid_submit}} {{#load id=$_GET.id|intval}}{{:assign .='invoice'}}{{/load}} |
︙ | ︙ | |||
296 297 298 299 300 301 302 | validation_date=$validation_date payment_detail=$payment_detail extra_info=$extra_info parent_id=$parent_id module_version=$VERSION }} {{/if}} | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | validation_date=$validation_date payment_detail=$payment_detail extra_info=$extra_info parent_id=$parent_id module_version=$VERSION }} {{/if}} {{:http redirect="index.html?ok=5&show=%s"|args:$type}} {{/if}} {{/load}} {{/if}} {{elseif $_POST.duplicate_submit}} {{if !$_GET.id}} {{:assign var='check_errors.' value='Aucun document sélectionné.'}} {{else}} {{#load id=$_GET.id}} {{:include file='./generate_next_key.tpl' assign_to='new_key' keep='new_key'}} {{if $type === $INVOICE_TYPE}} {{:save validate_schema="./schema/invoice.json" key=$new_key type=$type recipient_business_name=$recipient_business_name recipient_address=$recipient_address recipient_member_id=$recipient_member_id recipient_member_numero=$recipient_member_numero introduction_text=$introduction_text subject=$subject date=$date deadline=$deadline status=$DRAFT_STATUS cancelled=false items=$items total=$total vat_exemption=$vat_exemption siret=$siret org_contact=$org_contact author_id=$author_id parent_id=$parent_id duplicated_from_id=$id|intval last_modification_date=$now|atom_date signing_place=$signing_place signing_date=$signing_date validation_date=null payment_date=null payment_comment=null transaction_id=null payment_detail=$payment_detail extra_info=$extra_info module_version=$VERSION }} {{else}} {{:save validate_schema="./schema/quotation.json" key=$new_key type=$type recipient_business_name=$recipient_business_name recipient_address=$recipient_address recipient_member_id=$recipient_member_id recipient_member_numero=$recipient_member_numero introduction_text=$introduction_text subject=$subject date=$date deadline=$deadline status=$DRAFT_STATUS cancelled=false items=$items total=$total vat_exemption=$vat_exemption siret=$siret org_contact=$org_contact author_id=$author_id child_id=null last_modification_date=$now|atom_date signing_place=$signing_place signing_date=$signing_date validation_date=null payment_detail=$payment_detail extra_info=$extra_info parent_id=null duplicated_from_id=$id|intval module_version=$VERSION }} {{/if}} {{:http redirect="index.html?ok=4"}} {{/load}} {{/if}} {{/if}} {{if $_POST.status_update_button}} {{* Only for developers *}} {{if !$_POST.id}} {{:error message='Aucun devis sélectionné.'}} |
︙ | ︙ |
Modified src/skel-dist/modules/invoice/include/schema/invoice.json from [f9785fbd86] to [af26d59dc9].
︙ | ︙ | |||
131 132 133 134 135 136 137 138 139 140 141 142 143 144 | "type": ["string", "null"], "maxLength": 1024 }, "parent_id": { "description": "ID du devis original", "type": ["integer", "null"], "maxLength": 19 }, "last_modification_date": { "description": "Date de la derniète modification", "type": "string", "maxLength": 25 }, "module_version": { | > > > > > | 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | "type": ["string", "null"], "maxLength": 1024 }, "parent_id": { "description": "ID du devis original", "type": ["integer", "null"], "maxLength": 19 }, "duplicated_from_id": { "description": "ID de la facture depuis laquelle celle-ci a été dupliquée", "type": ["integer", "null"], "maxLength": 19 }, "last_modification_date": { "description": "Date de la derniète modification", "type": "string", "maxLength": 25 }, "module_version": { |
︙ | ︙ |
Modified src/skel-dist/modules/invoice/include/schema/quotation.json from [1d749f37a9] to [aec06c36ae].
︙ | ︙ | |||
122 123 124 125 126 127 128 129 130 131 132 133 134 135 | "type": ["string", "null"], "maxLength": 1024 }, "parent_id": { "description": "Identique à ID si facture générée (hack pour grouper facture et devis)", "type": ["integer", "null"], "maxLength": 19 }, "last_modification_date": { "description": "Date de la derniète modification", "type": "string", "maxLength": 25 }, "module_version": { | > > > > > | 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | "type": ["string", "null"], "maxLength": 1024 }, "parent_id": { "description": "Identique à ID si facture générée (hack pour grouper facture et devis)", "type": ["integer", "null"], "maxLength": 19 }, "duplicated_from_id": { "description": "ID du devis duquel celui-ci a été dupliqué", "type": ["integer", "null"], "maxLength": 19 }, "last_modification_date": { "description": "Date de la derniète modification", "type": "string", "maxLength": 25 }, "module_version": { |
︙ | ︙ |
Modified src/skel-dist/modules/invoice/index.html from [5889494fbe] to [8ce64af9ef].
︙ | ︙ | |||
41 42 43 44 45 46 47 | {{:include file='./include/constants.tpl' keep='DRAFT_STATUS, AWAITING_STATUS, VALIDATED_STATUS, PAID_STATUS, TYPE_LABELS, STATUS_LABELS, CANCELLED_LABEL, QUOTATION_TYPE, INVOICE_TYPE, INVOICE_STATUS_LABELS'}} {{if $_GET.show == $QUOTATION_TYPE}} {{:assign filter="json_extract(document, '$.type') = '%s'"|args:$QUOTATION_TYPE}} {{elseif $_GET.show == 'paid'}} {{:assign filter="$$.type = :type AND $$.status = :status" type_filter=$INVOICE_TYPE status_filter=$PAID_STATUS}} {{elseif $_GET.show == 'unpaid'}} | | > > | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | {{:include file='./include/constants.tpl' keep='DRAFT_STATUS, AWAITING_STATUS, VALIDATED_STATUS, PAID_STATUS, TYPE_LABELS, STATUS_LABELS, CANCELLED_LABEL, QUOTATION_TYPE, INVOICE_TYPE, INVOICE_STATUS_LABELS'}} {{if $_GET.show == $QUOTATION_TYPE}} {{:assign filter="json_extract(document, '$.type') = '%s'"|args:$QUOTATION_TYPE}} {{elseif $_GET.show == 'paid'}} {{:assign filter="$$.type = :type AND $$.status = :status" type_filter=$INVOICE_TYPE status_filter=$PAID_STATUS}} {{elseif $_GET.show == 'unpaid'}} {{:assign filter="$$.type = :type AND $$.status = :status AND $$.cancelled = false" type_filter=$INVOICE_TYPE status_filter=$AWAITING_STATUS}} {{else}} {{:assign filter="1"}} {{/if}} {{if $_GET.ok}} <p class="block confirm"> {{if $_GET.ok === '1'}} Devis enregistré. {{elseif $_GET.ok === '2'}} Devis modifié avec succès. {{elseif $_GET.ok === '3'}} Brouillon supprimé avec succès. {{elseif $_GET.ok === '4'}} Document dupliqué avec succès. {{elseif $_GET.ok === '5'}} Document annulé avec succès. {{/if}} </p> {{/if}} {{:assign list_select="key; id AS 'Numéro'; datetime($$.date) AS 'Émission'; $$.deadline AS 'Échéance'; $$.recipient_business_name AS 'Tiers'; $$.subject AS 'Intitulé'; $$.total AS 'Montant'; $$.status AS 'Statut'"}} |
︙ | ︙ |