@@ -305,7 +305,7 @@ public function create_zip( $files = array(), $destination = '', $overwrite = fa
305305
306306 public function get_zip_paths ( $ entry , $ type = false ) {
307307
308- $ filename = $ this ->get_zip_filename ( $ entry[ ' id ' ] );
308+ $ filename = $ this ->get_zip_filename ( $ entry );
309309 $ paths = GFFormsModel::get_file_upload_path ( $ entry ['form_id ' ], $ filename );
310310
311311 foreach ( $ paths as &$ path ) {
@@ -315,8 +315,12 @@ public function get_zip_paths( $entry, $type = false ) {
315315 return $ type ? rgar ( $ paths , $ type ) : $ paths ;
316316 }
317317
318- public function get_zip_filename ( $ entry_id ) {
319- return $ this ->get_slug ( $ this ->_args ['zip_name ' ], $ entry_id , $ this ->_args ['field_ids ' ] ) . '.zip ' ;
318+ public function get_zip_filename ( $ entry ) {
319+ $ form_id = $ entry ['form_id ' ];
320+ $ form = GFAPI ::get_form ( $ form_id );
321+ // replace merge tags in the zip file name
322+ $ zip_name = GFCommon::replace_variables ( $ this ->_args ['zip_name ' ], $ form , $ entry , false , false , false );
323+ return $ this ->get_slug ( $ zip_name , $ entry ['id ' ], $ this ->_args ['field_ids ' ] ) . '.zip ' ;
320324 }
321325
322326 public function get_meta_key ( $ entry_id = false ) {
@@ -475,7 +479,7 @@ public function add_zip_as_attachment( $notification, $form, $entry ) {
475479new GW_Zip_Files (
476480 array (
477481 'form_id ' => 123 ,
478- 'zip_name ' => 'my-sweet-archive ' ,
482+ 'zip_name ' => 'my-sweet-archive ' , // supports merge tags
479483 'notifications ' => array ( '5f4668ec2afbb ' ),
480484 )
481485);
0 commit comments