UPDATE `civicrm_option_value`
SET is_reserved = 1
-WHERE is_reserved = 0 AND option_group_id = @option_group_id_activity_type AND component_id = @caseCompId;
\ No newline at end of file
+WHERE is_reserved = 0 AND option_group_id = @option_group_id_activity_type AND component_id = @caseCompId;
+
+-- CRM-13964
+SELECT @option_group_id_cs := max(id) from civicrm_option_group where name = 'contribution_status';
+SELECT @option_val_id_cs_wt := MAX(weight) FROM civicrm_option_value WHERE option_group_id = @option_group_id_cs;
+SELECT @option_val_id_cs_val := MAX(value) FROM civicrm_option_value WHERE option_group_id = @option_group_id_cs;
+
+INSERT INTO
+ `civicrm_option_value` (`option_group_id`, {localize field='label'}label{/localize}, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`)
+VALUES
+ (@option_group_id_cs, '{ts escape="sql"}Partially paid{/ts}', @option_val_id_cs_val+1, 'Partially paid', NULL, 0, NULL, @option_val_id_cs_wt+1, 0, 1, 1, NULL, NULL);
+
+-- participant status adding
+SELECT @participant_status_wt := max(id) from civicrm_participant_status_type;
+
+INSERT INTO civicrm_participant_status_type (id, name, {localize field='label'}label{/localize}, class, is_reserved, is_active, is_counted, weight, visibility_id)
+VALUES
+ (1, 'Partially paid', '{ts escape="sql"}Partially paid{/ts}', 'Positive', 1, 1, 1, @participant_status_wt+1, 2);
\ No newline at end of file
}
}
}
+
+ // change the status to default 'partially paid' for partial payments
+ var feeAmount;
+ var userModifiedAmount;
+ var partiallyPaidStatusId = {/literal}{$partiallyPaidStatusId}{literal};
+
+ cj('#total_amount')
+ .focus(
+ function() {
+ feeAmount = cj(this).val();
+ feeAmount = parseInt(feeAmount);
+ }
+ )
+ .change(
+ function() {
+ userModifiedAmount = cj(this).val();
+ userModifiedAmount = parseInt(userModifiedAmount);
+ if (userModifiedAmount < feeAmount) {
+ cj('#status_id').val(partiallyPaidStatusId);
+ }
+ }
+ );
+
+ cj('#Participant').submit(
+ function(e) {
+ var userSubmittedStatus = cj('#status_id').val();
+ var statusLabel = cj('#status_id option:selected').text();
+ if (userModifiedAmount < feeAmount && userSubmittedStatus != partiallyPaidStatusId) {
+ var result = confirm('Payment amount is less than the amount owed. Expected participant status is \'Partially paid\'. Are you sure you want to set the participant status to ' + statusLabel + '? Click OK to continue, Cancel to change your entries.');
+ if (result == false) {
+ e.preventDefault();
+ }
+ }
+ }
+ );
</script>
{/literal}
{/if}
(@option_group_id_cs, '{ts escape="sql"}In Progress{/ts}', 5, 'In Progress', NULL, 0, NULL, 5, NULL, 0, 1, 1, NULL, NULL),
(@option_group_id_cs, '{ts escape="sql"}Overdue{/ts}' , 6, 'Overdue' , NULL, 0, NULL, 6, NULL, 0, 1, 1, NULL, NULL),
(@option_group_id_cs, '{ts escape="sql"}Refunded{/ts}' , 7, 'Refunded' , NULL, 0, NULL, 7, NULL, 0, 1, 1, NULL, NULL),
+ (@option_group_id_cs, '{ts escape="sql"}Partially paid{/ts}', 8, 'Partially paid', NULL, 0, NULL, 8, NULL, 0, 1, 1, NULL, NULL),
(@option_group_id_pcp, '{ts escape="sql"}Waiting Review{/ts}', 1, 'Waiting Review', NULL, 0, NULL, 1, NULL, 0, 1, 1, NULL, NULL),
(@option_group_id_pcp, '{ts escape="sql"}Approved{/ts}' , 2, 'Approved' , NULL, 0, NULL, 2, NULL, 0, 1, 1, NULL, NULL),
(10, 'Pending from approval', '{ts escape="sql"}Pending from approval{/ts}', 'Pending', 1, 0, 1, 10, 2 ),
(11, 'Rejected', '{ts escape="sql"}Rejected{/ts}', 'Negative', 1, 0, 0, 11, 2 ),
(12, 'Expired', '{ts escape="sql"}Expired{/ts}', 'Negative', 1, 1, 0, 12, 2 ),
- (13, 'Pending in cart', '{ts escape="sql"}Pending in cart{/ts}', 'Pending', 1, 1, 0, 13, 2 );
+ (13, 'Pending in cart', '{ts escape="sql"}Pending in cart{/ts}', 'Pending', 1, 1, 0, 13, 2 ),
+ (14, 'Partially paid', '{ts escape="sql"}Partially paid{/ts}', 'Positive', 1, 1, 1, 14, 2 );
+
-- CRM-8150